/* ─── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

:root {
  --bg:         #060d18;
  --s1:         rgba(255,255,255,0.035);
  --s2:         rgba(255,255,255,0.065);
  --border:     rgba(255,255,255,0.07);
  --border-lg:  rgba(255,255,255,0.13);
  --text:       #f0f4f8;
  --muted:      #64748b;
  --accent:     #34d399;
  --accent-dim: rgba(52,211,153,0.10);
  --accent-bdr: rgba(52,211,153,0.18);
  --warn:       #f59e0b;
  --warn-dim:   rgba(245,158,11,0.12);
  --warn-bdr:   rgba(245,158,11,0.22);
  --r:          14px;
  --r-sm:       10px;
}

body {
  background:
    radial-gradient(ellipse 70% 45% at 0% 0%,   rgba(52,211,153,0.06) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 95%, rgba(56,189,248,0.05) 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  font-size: 15px;
}

a { text-decoration: none; color: inherit; }
.text-sm { font-size: .82rem; }
.text-muted { color: var(--muted) !important; }
.fw-semibold { font-weight: 600; }
.fw-bold { font-weight: 700; }

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 999px; }

/* ─── Topbar ────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 200;
  background: rgba(6,13,24,0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  padding: .7rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: .65rem; }
.brand-dot {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent-dim); border: 1px solid var(--accent-bdr);
  display: grid; place-items: center;
  color: var(--accent); font-size: 1rem; flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 1rem; color: #fff; }

.nav-icon-btn {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--s1); border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--muted); font-size: 1rem;
  transition: color .15s, background .15s, border-color .15s;
}
.nav-icon-btn:hover { color: var(--text); background: var(--s2); border-color: var(--border-lg); }
.nav-icon-btn.danger:hover { color: #f87171; border-color: rgba(248,113,113,.3); background: rgba(248,113,113,.08); }

/* ─── Balance hero ──────────────────────────────────────────── */
.balance-hero {
  background: var(--s1); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.4rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.greeting { font-size: 1.2rem; font-weight: 700; }
.uid-pill {
  display: inline-block; margin-top: .35rem;
  padding: .2rem .65rem; border-radius: 999px;
  background: var(--s2); border: 1px solid var(--border-lg);
  font-size: .75rem; color: var(--muted); font-family: monospace;
}
.bal-label  { font-size: .78rem; color: var(--muted); text-align: right; }
.bal-amount {
  font-size: 2.1rem; font-weight: 800; color: var(--accent);
  text-align: right; font-variant-numeric: tabular-nums; letter-spacing: -.5px;
}

/* ─── Generic card ──────────────────────────────────────────── */
.ui-card {
  background: var(--s1); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.25rem;
}
.ui-card-title {
  font-weight: 700; font-size: .95rem; margin-bottom: 1rem;
  display: flex; align-items: center; gap: .5rem;
}

/* ─── Bonus card ────────────────────────────────────────────── */
.bonus-card {
  background: linear-gradient(135deg, rgba(52,211,153,0.07), rgba(52,211,153,0.02));
  border: 1px solid var(--accent-bdr); border-radius: var(--r);
  padding: 1.2rem 1.4rem; margin-bottom: 1.25rem;
}
.bonus-icon-wrap {
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--accent-dim); border: 1px solid var(--accent-bdr);
  display: grid; place-items: center; color: var(--accent); font-size: 1.2rem;
}
.bonus-count { font-weight: 700; color: var(--accent); font-size: 1rem; white-space: nowrap; }
.bonus-dots  { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .25rem; }
.bonus-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  transition: background .2s, border-color .2s;
}
.bonus-dot.filled { background: var(--accent); border-color: var(--accent); }
.bonus-hint { font-size: .8rem; color: rgba(134,239,172,.75); margin-top: .5rem; }

/* ─── Category tabs ─────────────────────────────────────────── */
.cat-tabs {
  display: flex; gap: .45rem; overflow-x: auto; scrollbar-width: none;
  padding: .85rem 0;
  position: sticky; top: 57px; z-index: 100;
  background: rgba(6,13,24,0.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); margin-bottom: 2rem;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  display: flex; align-items: center; gap: .4rem; white-space: nowrap;
  padding: .4rem .9rem; border-radius: 999px;
  background: var(--s1); border: 1px solid var(--border);
  color: var(--muted); font-size: .83rem; font-weight: 500;
  transition: color .12s, background .12s, border-color .12s;
}
.cat-tab:hover, .cat-tab.active {
  color: var(--accent); background: var(--accent-dim); border-color: var(--accent-bdr);
}
.cat-count {
  background: var(--s2); border-radius: 999px;
  padding: .05rem .45rem; font-size: .72rem; color: var(--muted);
}

/* ─── Section headers ───────────────────────────────────────── */
.prod-section { margin-bottom: 2.5rem; }
.section-head { display: flex; align-items: center; gap: .7rem; margin-bottom: 1rem; }
.section-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--s2); display: grid; place-items: center;
  color: var(--accent); font-size: .95rem; flex-shrink: 0;
}
.section-title { font-weight: 700; font-size: 1rem; }
.section-sub   { font-size: .78rem; color: var(--muted); }

/* ─── Product card ──────────────────────────────────────────── */
.product-card {
  background: var(--s1); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.1rem;
  display: flex; flex-direction: column; height: 100%;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.product-card:hover {
  border-color: var(--border-lg);
  box-shadow: 0 8px 28px rgba(0,0,0,.35);
  transform: translateY(-2px);
}
.product-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--s2); border: 1px solid var(--border);
  display: grid; place-items: center;
  font-size: 1.4rem; color: var(--accent); margin-bottom: .85rem;
}
.product-name  { font-weight: 600; font-size: .9rem; line-height: 1.3; margin-bottom: .2rem; }
.product-price { color: var(--muted); font-size: .85rem; margin-bottom: .9rem; }

/* ─── Quantity stepper ──────────────────────────────────────── */
.stepper {
  display: flex; align-items: center; height: 36px;
  background: var(--s2); border: 1px solid var(--border);
  border-radius: var(--r-sm); overflow: hidden; margin-bottom: .55rem;
}
.stepper-btn {
  width: 36px; height: 36px; flex-shrink: 0;
  background: none; border: none; color: var(--muted);
  font-size: 1.1rem; cursor: pointer;
  display: grid; place-items: center;
  transition: color .1s, background .1s;
}
.stepper-btn:hover { color: var(--accent); background: var(--accent-dim); }
.stepper-val { flex: 1; text-align: center; font-weight: 600; font-size: .9rem; }

/* ─── Buy button ────────────────────────────────────────────── */
.btn-buy {
  width: 100%; border: none; border-radius: var(--r-sm);
  background: linear-gradient(135deg, #059669 0%, #34d399 100%);
  color: #fff; font-weight: 600; font-size: .875rem;
  padding: .55rem 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  transition: opacity .12s, transform .1s, box-shadow .15s;
}
.btn-buy:hover { opacity: .88; transform: translateY(-1px); box-shadow: 0 4px 18px rgba(52,211,153,.2); }
.btn-buy:active { transform: scale(.97); opacity: .8; }
.btn-buy:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }

/* ─── Game card ─────────────────────────────────────────────── */
.game-card {
  background: linear-gradient(135deg, rgba(245,158,11,0.07), rgba(245,158,11,0.02));
  border: 1px solid var(--warn-bdr); border-radius: var(--r); padding: 1.1rem;
}
.game-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--warn-dim); border: 1px solid var(--warn-bdr);
  display: grid; place-items: center;
  font-size: 1.4rem; color: var(--warn); margin-bottom: .85rem;
}
.btn-play {
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  border: none; border-radius: var(--r-sm); cursor: pointer;
  width: 100%; padding: .55rem 1rem;
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  color: #000; font-weight: 700; font-size: .875rem;
  transition: opacity .12s, transform .1s, box-shadow .15s;
}
.btn-play:hover { opacity: .88; transform: translateY(-1px); box-shadow: 0 4px 18px rgba(245,158,11,.3); color: #000; }
.btn-play:active { transform: scale(.97); }

/* ─── Leaderboard ───────────────────────────────────────────── */
.leaderboard-card {
  background: var(--s1); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.1rem;
}
.lb-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .9rem; font-weight: 600; font-size: .9rem;
}
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table tr { border-bottom: 1px solid var(--border); }
.lb-table tr:last-child { border-bottom: none; }
.lb-table td { padding: .5rem .3rem; font-size: .875rem; vertical-align: middle; }
.lb-rank { width: 48px; }
.lb-score { text-align: right; font-weight: 600; }
.lb-empty { color: var(--muted); font-size: .875rem; }
.rank-1 { display:inline-block; background:#f59e0b; color:#000; font-weight:700; border-radius:6px; padding:.1rem .45rem; font-size:.78rem; }
.rank-2 { display:inline-block; background:#94a3b8; color:#000; font-weight:700; border-radius:6px; padding:.1rem .45rem; font-size:.78rem; }
.rank-3 { display:inline-block; background:#b87333; color:#fff; font-weight:700; border-radius:6px; padding:.1rem .45rem; font-size:.78rem; }
.rank-n { color: var(--muted); font-size: .875rem; padding-left: .3rem; }

/* ─── Data table (bookings) ─────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: .78rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  padding: .6rem .75rem; border-bottom: 1px solid var(--border-lg);
  text-align: left;
}
.data-table td { padding: .7rem .75rem; border-bottom: 1px solid var(--border); font-size: .875rem; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--s2); }
.badge-free {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  background: var(--accent-dim); border: 1px solid var(--accent-bdr);
  color: var(--accent); font-size: .72rem; font-weight: 600;
}
.price-negative { color: #f87171; font-weight: 600; }
.price-free     { color: var(--accent); }

/* ─── Stat card ─────────────────────────────────────────────── */
.stat-card {
  background: var(--s1); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.2rem 1.3rem; height: 100%;
}
.stat-label { font-size: .78rem; color: var(--muted); margin-bottom: .4rem; display: flex; align-items: center; gap: .35rem; }
.stat-value { font-size: 1.75rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }

/* ─── Top 5 list ────────────────────────────────────────────── */
.top5-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .55rem 0; border-bottom: 1px solid var(--border);
}
.top5-row:last-child { border-bottom: none; }
.top5-left  { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.top5-rank  { width: 1.4rem; text-align: center; color: var(--muted); font-size: .85rem; }
.badge-count {
  display: inline-block; padding: .15rem .55rem; border-radius: 999px;
  background: var(--s2); color: var(--muted); font-size: .78rem; font-weight: 600;
}

/* ─── Bar chart ─────────────────────────────────────────────── */
.bar-chart { display: flex; align-items: flex-end; gap: .5rem; height: 130px; }
.bar-col { display: flex; flex-direction: column; align-items: center; flex: 1; gap: .3rem; min-width: 0; }
.bar-val { font-size: .68rem; color: var(--muted); white-space: nowrap; }
.bar-fill { width: 100%; border-radius: 6px; background: linear-gradient(180deg, var(--accent), #059669); opacity: .75; transition: opacity .15s; }
.bar-fill:hover { opacity: 1; }
.bar-label { font-size: .72rem; color: var(--muted); }

/* ─── Scan prompt ───────────────────────────────────────────── */
.scan-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 70vh; text-align: center;
}
.scan-ring {
  width: 130px; height: 130px; border-radius: 50%;
  background: var(--accent-dim); border: 2px solid var(--accent-bdr);
  display: grid; place-items: center;
  font-size: 3.2rem; color: var(--accent); margin-bottom: 1.5rem;
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0    rgba(52,211,153,.25); }
  50%      { box-shadow: 0 0 0 22px rgba(52,211,153,0);   }
}
.scan-title { font-size: 1.6rem; font-weight: 700; margin-bottom: .5rem; }
.scan-sub   { color: var(--muted); font-size: .95rem; }

/* ─── Alert card ────────────────────────────────────────────── */
.alert-card {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.1rem 1.3rem; border-radius: var(--r); margin-top: 3rem;
}
.alert-warn { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.2); }
.alert-warn i { font-size: 1.5rem; color: var(--warn); }

/* ─── Bottom actions ────────────────────────────────────────── */
.bottom-actions { display: flex; gap: .65rem; flex-wrap: wrap; padding: 1.5rem 0 2rem; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem 1.1rem; border-radius: 999px;
  background: var(--s1); border: 1px solid var(--border);
  color: var(--muted); font-size: .85rem; font-weight: 500;
  transition: color .12s, background .12s, border-color .12s;
}
.btn-ghost:hover { color: var(--text); background: var(--s2); border-color: var(--border-lg); }
.btn-ghost.danger:hover { color: #f87171; background: rgba(248,113,113,.07); border-color: rgba(248,113,113,.25); }
