:root {
  --bg: #080a10;
  --bg2: #0e1119;
  --surface: rgba(22, 26, 38, 0.88);
  --surface2: #1c2130;
  --glass: rgba(255, 255, 255, 0.04);
  --gold: #f5c518;
  --gold2: #e6a800;
  --red: #e63946;
  --blue: #5b8def;
  --purple: #9b7bff;
  --mint: #3dd6b5;
  --text: #f4f6fb;
  --muted: #8d95ab;
  --radius: 18px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --glow-gold: 0 0 24px rgba(245, 197, 24, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(91, 141, 239, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(245, 197, 24, 0.08), transparent),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 88px;
}

/* ── Header ── */
.header {
  position: relative;
  padding: 24px 20px 28px;
  overflow: hidden;
}

.header-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(155deg, #10131c 0%, #1a1228 45%, #121a2e 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header-glow {
  position: absolute;
  top: -40px;
  right: -20px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(245, 197, 24, 0.15), transparent 70%);
  pointer-events: none;
}

.header-content { position: relative; z-index: 1; }

.logo-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.logo-badge svg { width: 28px; height: 28px; border-radius: 4px; }

.logo-text {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff 30%, var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}

.greeting {
  margin-top: 14px;
  font-size: 0.92rem;
  color: var(--muted);
}

.greeting strong { color: var(--text); font-weight: 700; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  background: rgba(245, 197, 24, 0.08);
  border: 1px solid rgba(245, 197, 24, 0.22);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.76rem;
  backdrop-filter: blur(8px);
}

.chip-label { color: var(--muted); }

.user-level {
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: #111;
  font-weight: 800;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  box-shadow: 0 2px 8px rgba(245, 197, 24, 0.3);
}

/* ── Stats ── */
.main { padding: 0 16px 20px; }

.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.07);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.04), transparent 60%);
  pointer-events: none;
}

.stat-card-gold { box-shadow: var(--glow-gold); }
.stat-card-blue { box-shadow: 0 0 24px rgba(91, 141, 239, 0.12); }

.stat-icon-wrap {
  width: 42px;
  height: 42px;
  margin: 0 auto 10px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ── Section ── */
.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.section-head.sm { margin-top: 20px; }

.section-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* ── Premium icons ── */
.p-icon,
.stat-icon-wrap,
.card-icon,
.nav-ic,
.back-ic,
.title-ic,
.file-dl-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.p-icon svg,
.stat-icon-wrap svg,
.card-icon svg,
.nav-ic svg,
.back-ic svg,
.title-ic svg,
.file-dl-icon svg {
  width: 22px;
  height: 22px;
}

.card-icon svg { width: 24px; height: 24px; }
.logo-badge svg { width: 28px; height: 28px; }
.back-ic svg { width: 16px; height: 16px; transform: rotate(180deg); }

.p-icon--test,
.card-icon.p-icon--test { background: linear-gradient(135deg, #7c5cbf, #5a3d9e); color: #fff; }
.p-icon--bonus,
.card-icon.p-icon--bonus { background: linear-gradient(135deg, #f5c518, #d4920a); color: #1a1200; }
.p-icon--video,
.card-icon.p-icon--video { background: linear-gradient(135deg, #3b9eff, #1a6fd4); color: #fff; }
.p-icon--library,
.card-icon.p-icon--library { background: linear-gradient(135deg, #3dd6b5, #1fa88a); color: #042a22; }
.p-icon--course,
.card-icon.p-icon--course { background: linear-gradient(135deg, #f5c518, #c98b00); color: #1a1200; }
.p-icon--feedback,
.card-icon.p-icon--feedback { background: linear-gradient(135deg, #9b7bff, #6b4fd4); color: #fff; }
.p-icon--daily,
.card-icon.p-icon--daily { background: linear-gradient(135deg, #ff7eb3, #c44d8a); color: #fff; }
.p-icon--consult,
.card-icon.p-icon--consult { background: linear-gradient(135deg, #e63946, #a81e2a); color: #fff; }
.p-icon--faq,
.card-icon.p-icon--faq { background: linear-gradient(135deg, #5c6b8a, #3a4558); color: #e8ecf4; }
.p-icon--referral,
.card-icon.p-icon--referral { background: linear-gradient(135deg, #3dd6b5, #229e82); color: #042a22; }
.p-icon--coin,
.stat-icon-wrap.p-icon--coin { background: linear-gradient(135deg, #f5c518, #b8860b); color: #1a1200; }
.p-icon--users,
.stat-icon-wrap.p-icon--users { background: linear-gradient(135deg, #5b8def, #2d5fbf); color: #fff; }
.p-icon--document,
.file-dl-icon.p-icon--document { background: linear-gradient(135deg, #f5c518, #d4920a); color: #1a1200; }
.p-icon--download,
.file-dl-icon.p-icon--download { background: linear-gradient(135deg, #3dd6b5, #1fa88a); color: #042a22; }
.p-icon--admin,
.title-ic.p-icon--admin { background: linear-gradient(135deg, #5c6b8a, #3a4558); color: #e8ecf4; }
.p-icon--muted,
.back-ic.p-icon--muted { background: transparent; color: var(--muted); }
.p-icon--nav,
.nav-ic.p-icon--nav { background: transparent; color: currentColor; }
.p-icon--flag,
.logo-badge.p-icon--flag { background: rgba(255,255,255,0.06); }

.stat-icon-wrap,
.card-icon,
.file-dl-icon {
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255,255,255,0.15);
}

/* ── Menu grid ── */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card {
  position: relative;
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
  padding: 16px 14px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s, box-shadow 0.18s;
  color: inherit;
  font: inherit;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255,255,255,0.03), transparent 50%);
  pointer-events: none;
}

.card:active { transform: scale(0.97); }

.card-featured {
  border-color: rgba(245, 197, 24, 0.35);
  box-shadow: var(--glow-gold), 0 4px 20px rgba(0,0,0,0.25);
}

.card-featured::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(245,197,24,0.2), transparent 70%);
  pointer-events: none;
}

.card-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  display: block;
  letter-spacing: -0.01em;
}

.card-desc {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 4px;
  display: block;
  font-weight: 500;
}

.card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: #111;
}

/* ── Pages ── */
.page { padding: 16px; }
.hidden { display: none !important; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  font-family: inherit;
}

.content-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  line-height: 1.65;
  font-size: 0.9rem;
  white-space: pre-wrap;
  border: 1px solid rgba(255,255,255,0.06);
}

.content-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.content-title .p-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
}

.content-title .p-icon svg { width: 18px; height: 18px; }

.content-title span { flex: 1; }

/* ── File list / bonus ── */
.file-list { margin: 12px 0; }

.file-dl {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 10px;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.file-dl:active {
  transform: scale(0.98);
  border-color: rgba(245, 197, 24, 0.4);
  box-shadow: var(--glow-gold);
}

.file-dl-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
}

.file-dl-body { flex: 1; min-width: 0; }

.file-dl-name {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-dl-type {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 3px;
}

.file-dl-action {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}

.file-dl-action svg { width: 18px; height: 18px; }

.bonus-price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--gold);
  font-weight: 700;
}

.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(245, 197, 24, 0.1);
  border: 1px solid rgba(245, 197, 24, 0.2);
  font-size: 0.82rem;
  margin-bottom: 14px;
}

.coin-pill .p-icon { width: 28px; height: 28px; border-radius: 8px; }
.coin-pill .p-icon svg { width: 16px; height: 16px; }

/* ── Buttons ── */
.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: #111;
  border: none;
  border-radius: 14px;
  padding: 15px 24px;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  box-shadow: 0 4px 16px rgba(245, 197, 24, 0.25);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 13px 20px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  width: 100%;
  margin-top: 8px;
  font-family: inherit;
}

.btn-row { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* ── Level grid ── */
.level-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.level-btn {
  background: var(--surface2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 16px 8px;
  color: var(--text);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: transform 0.15s, border-color 0.15s;
}

.level-btn:active { transform: scale(0.97); border-color: rgba(245,197,24,0.35); }
.level-btn span { display: block; font-size: 0.65rem; color: var(--muted); font-weight: 500; margin-top: 4px; }

/* ── FAQ / Referral ── */
.faq-cat { margin-bottom: 12px; }

.faq-cat-title {
  background: var(--surface2);
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.faq-item {
  background: var(--surface);
  border-radius: 12px;
  margin-bottom: 6px;
  border: 1px solid rgba(255,255,255,0.05);
}

.faq-q { padding: 13px 14px; font-size: 0.84rem; font-weight: 600; cursor: pointer; }
.faq-a { padding: 0 14px 12px; font-size: 0.8rem; color: var(--muted); line-height: 1.55; display: none; }
.faq-item.open .faq-a { display: block; }

.ref-box {
  background: var(--surface);
  border: 1px solid rgba(245, 197, 24, 0.2);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  box-shadow: var(--glow-gold);
}

.ref-hint { color: var(--muted); font-size: 0.85rem; margin: 12px 0; }
.ref-count { margin-top: 14px; font-size: 0.82rem; color: var(--muted); }
.ref-count b { color: var(--gold); }

.ref-link {
  background: var(--bg2);
  border-radius: 12px;
  padding: 14px;
  font-size: 0.78rem;
  word-break: break-all;
  margin: 14px 0;
  color: var(--gold);
  border: 1px solid rgba(245, 197, 24, 0.15);
}

.word-de { font-size: 1.2rem; font-weight: 800; margin: 12px 0 6px; }
.word-uz { color: var(--muted); margin-bottom: 12px; font-size: 0.88rem; }
.word-ex { font-style: italic; color: #b8c0d8; font-size: 0.85rem; }

.progress-wrap {
  background: var(--bg2);
  border-radius: 10px;
  height: 8px;
  margin: 14px 0;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold2));
  border-radius: 10px;
  transition: width 0.3s;
}

/* ── Bottom nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  background: rgba(14, 17, 25, 0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
  gap: 6px;
}

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  padding: 8px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.64rem;
  font-weight: 600;
  border-radius: 12px;
  transition: all 0.18s;
  font-family: inherit;
}

.nav-btn.active {
  color: var(--gold);
  background: rgba(245, 197, 24, 0.1);
}

.nav-ic { width: 24px; height: 24px; }
.nav-btn.active .nav-ic svg { filter: drop-shadow(0 0 6px rgba(245,197,24,0.5)); }

/* ── Admin ── */
.admin-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  margin-bottom: 16px;
  font-weight: 800;
}

.title-ic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.admin-stat {
  background: var(--surface);
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.05);
}

.admin-stat b {
  display: block;
  font-size: 1.3rem;
  color: var(--gold);
  margin-bottom: 4px;
  font-weight: 800;
}

.user-list { display: flex; flex-direction: column; gap: 8px; }

.user-row {
  background: var(--surface);
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 0.82rem;
  border: 1px solid rgba(255,255,255,0.05);
}

.user-row .name { font-weight: 700; }
.user-row .meta { color: var(--muted); font-size: 0.74rem; margin-top: 4px; }

.file-row {
  background: var(--surface);
  border-radius: 12px;
  padding: 11px 13px;
  margin-bottom: 6px;
  font-size: 0.82rem;
  border: 1px solid rgba(255,255,255,0.04);
}

.file-row .type { color: var(--muted); font-size: 0.72rem; }

.ref-stats { font-size: 0.82rem; color: var(--muted); margin-top: 8px; }
.ref-stats b { color: var(--gold); }
