/* Visual language carried over from the legacy salary-bot WebApp (dark slate + glassmorphism cards +
   a fixed bottom nav), minus everything that went with the retired gamification. Self-hosted, no CDN
   fonts or icon packs — a Telegram WebApp should paint instantly on a phone. */

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

:root {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f8fafc;
  --text-sub: #94a3b8;
  --accent: #3b82f6;
  --good: #86efac;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 12px;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
}

/* Ambient glow, same trick as the legacy app: two fixed radial blobs behind everything. */
body::before, body::after {
  content: ''; position: fixed; width: 300px; height: 300px; z-index: -1; pointer-events: none;
}
body::before { top: -10%; left: -10%; background: radial-gradient(circle, rgba(59,130,246,.15) 0%, transparent 70%); }
body::after { bottom: -10%; right: -10%; background: radial-gradient(circle, rgba(168,85,247,.15) 0%, transparent 70%); }

@keyframes gradientBG { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.hidden { display: none !important; }
.state { text-align: center; color: var(--text-sub); padding: 60px 20px; }

.card {
  background: rgba(30, 41, 59, .45);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-radius: 18px; padding: 16px; margin-bottom: 12px;
  border: 1px solid rgba(255,255,255,.08); border-top: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.card-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-sub); margin-bottom: 12px; font-weight: 700; }

/* ── header ─────────────────────────────────────────────────────────────── */
.profile-header { display: flex; flex-direction: column; align-items: center; margin: 8px 0 16px; }
.avatar {
  width: 76px; height: 76px; border-radius: 20px; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; background: rgba(30,41,59,.7); border: 2px solid rgba(255,255,255,.15);
  background-size: cover; background-position: center; margin-bottom: 10px;
}
.user-name { font-size: 19px; font-weight: 800; margin-bottom: 6px; text-align: center; }
.user-role {
  color: var(--text-sub); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  background: rgba(255,255,255,.08); padding: 4px 12px; border-radius: 20px; border: 1px solid rgba(255,255,255,.05);
}

.controls { display: flex; gap: 8px; margin-bottom: 12px; }
.pill {
  flex: 1; background: rgba(255,255,255,.06); color: var(--text); border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px; padding: 9px 12px; font-size: 13px; font-weight: 600; appearance: none; outline: none;
}
.pill-ghost { flex: 0 0 auto; background: rgba(0,0,0,.25); }
.wide { width: 100%; margin-bottom: 10px; }

/* ── pay ────────────────────────────────────────────────────────────────── */
.balance-card {
  text-align: center; padding: 24px 20px; border-radius: 24px;
  background: linear-gradient(-45deg, rgba(15,23,42,.6), rgba(30,58,138,.6), rgba(23,37,84,.6), rgba(30,41,59,.6));
  background-size: 400% 400%; animation: gradientBG 15s ease infinite;
  border: 1px solid rgba(255,255,255,.15); box-shadow: 0 15px 40px -10px rgba(30,58,138,.5);
}
.balance-label { color: rgba(255,255,255,.7); font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; }
.balance-amount { font-size: 40px; font-weight: 800; margin: 8px 0 2px; letter-spacing: -1px; line-height: 1.1; }
.balance-converted { color: #93c5fd; font-size: 15px; font-weight: 500; min-height: 20px; }
.currency-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; }
.pay-note { font-size: 10px; color: rgba(255,255,255,.55); margin-top: 10px; line-height: 1.4; }
.rate { font-size: 11px; color: var(--text-sub); }

.quick-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qs {
  background: rgba(255,255,255,.03); border-radius: 14px; padding: 12px; text-align: center;
  border: 1px solid rgba(255,255,255,.05);
}
.qs-val { font-size: 18px; font-weight: 700; }
.qs-label { font-size: 10px; color: var(--text-sub); margin-top: 2px; }

.note { font-size: 12px; color: var(--text-sub); text-align: center; margin: 14px 4px; line-height: 1.5; }

/* ── leaderboard ────────────────────────────────────────────────────────── */
.scope-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.scope {
  flex: 1; padding: 9px 6px; border-radius: 12px; font-size: 12px; font-weight: 600; cursor: pointer;
  background: rgba(255,255,255,.05); color: var(--text-sub); border: 1px solid rgba(255,255,255,.08);
}
.scope.active { background: var(--accent); color: #fff; border-color: transparent; }

.rating-list { display: flex; flex-direction: column; gap: 8px; }
.r-item {
  display: flex; align-items: center; padding: 12px 14px; border-radius: 14px;
  background: rgba(255,255,255,.02); border: 1px solid rgba(255,255,255,.05);
}
.r-item.me { border-color: rgba(59,130,246,.6); background: rgba(59,130,246,.12); }
.r-item.rank-1 { background: linear-gradient(90deg, rgba(255,215,0,.15), rgba(255,215,0,.02)); border-color: rgba(255,215,0,.3); }
.r-item.rank-2 { background: linear-gradient(90deg, rgba(192,192,192,.15), rgba(192,192,192,.02)); border-color: rgba(192,192,192,.3); }
.r-item.rank-3 { background: linear-gradient(90deg, rgba(205,127,50,.15), rgba(205,127,50,.02)); border-color: rgba(205,127,50,.3); }
.r-rank { width: 30px; text-align: center; font-size: 15px; font-weight: 700; color: var(--text-sub); }
.r-avatar {
  width: 38px; height: 38px; border-radius: 11px; margin: 0 10px; flex-shrink: 0;
  background: rgba(30,41,59,.8); background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.r-name { flex: 1; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-val { font-size: 14px; font-weight: 700; color: var(--accent); margin-left: 10px; }

/* ── blocked state ──────────────────────────────────────────────────────── */
.blocked-card { max-width: 340px; margin: 40px auto; text-align: center; padding: 28px 20px; }
.blocked-icon { font-size: 34px; margin-bottom: 12px; }
.blocked-card h2 { font-size: 18px; margin: 0 0 10px; }
.blocked-card p { font-size: 13px; color: var(--text-sub); line-height: 1.6; margin: 0; }
.blocked-card a { color: #93c5fd; }

/* ── chrome ─────────────────────────────────────────────────────────────── */
.attribution { text-align: center; font-size: 10px; color: rgba(148,163,184,.6); margin: 18px 0 4px; }

.screen { display: none; animation: fadeIn .3s; }
.screen.active { display: block; }

.nav {
  position: fixed; bottom: 0; left: 0; width: 100%; display: flex; justify-content: space-around;
  background: rgba(15,23,42,.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  padding-top: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255,255,255,.1); box-shadow: 0 -5px 25px rgba(0,0,0,.5); z-index: 100;
}
.nav-item { flex: 1; text-align: center; color: var(--text-sub); font-size: 10px; font-weight: 600; cursor: pointer; transition: .25s; }
.nav-item .ico { display: block; font-size: 20px; margin-bottom: 3px; }
.nav-item.active { color: #60a5fa; }
