/* ═══════════════════════════════════════════════
   TEST BOT — MINI APP STYLES
   Dark Glassmorphism • Telegram Mini App
   ═══════════════════════════════════════════════ */

/* ─── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #060a14;
  --surface:    #0a0e1a;
  --card:       rgba(255,255,255,0.055);
  --card-hover: rgba(255,255,255,0.09);
  --border:     rgba(255,255,255,0.09);
  --border-md:  rgba(255,255,255,0.14);

  --blue:       #3878ff;
  --blue-light: #90b8ff;
  --blue-dim:   rgba(56,120,255,0.18);
  --teal:       #00bed2;
  --teal-light: #5de8f0;
  --teal-dim:   rgba(0,190,200,0.18);
  --amber:      #ffa032;
  --amber-light:#ffbe6a;
  --amber-dim:  rgba(255,160,50,0.18);
  --purple:     #8c50ff;
  --purple-light:#c090ff;
  --purple-dim: rgba(140,80,255,0.18);
  --green:      #00d26e;
  --green-light:#4eeaa0;
  --green-dim:  rgba(0,210,110,0.15);
  --red:        #ff4f4f;
  --red-dim:    rgba(255,79,79,0.18);

  --text:       rgba(255,255,255,0.92);
  --text-2:     rgba(255,255,255,0.55);
  --text-3:     rgba(255,255,255,0.32);
  --text-4:     rgba(255,255,255,0.18);

  --radius-sm:  10px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --blur:       blur(16px);
  --blur-md:    blur(24px);

  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
}

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── App wrapper ──────────────────────────────── */
.app { position: relative; min-height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.app.hidden { display: none !important; }

/* ─── Background blobs ─────────────────────────── */
.blob {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  animation: blobFloat 8s ease-in-out infinite;
}
.blob1 {
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(56,120,255,0.28) 0%, transparent 68%);
  top: -80px; right: -60px;
  animation-delay: 0s;
}
.blob2 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(0,190,210,0.16) 0%, transparent 68%);
  top: 220px; left: -70px;
  animation-delay: -3s;
}
.blob3 {
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(120,60,255,0.16) 0%, transparent 68%);
  bottom: 140px; right: -30px;
  animation-delay: -5s;
}
@keyframes blobFloat {
  0%,100% { transform: translateY(0px) scale(1); }
  50%      { transform: translateY(-20px) scale(1.05); }
}

/* ─── Pages ────────────────────────────────────── */
.page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateX(24px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 1;
}
.page.active {
  opacity: 1;
  pointer-events: all;
  transform: translateX(0);
  position: relative;
}

/* ─── Scroll ───────────────────────────────────── */
.scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.scroll::-webkit-scrollbar { display: none; }

/* ─── Loader ───────────────────────────────────── */
.loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 999;
  transition: opacity 0.4s ease;
}
.loader.hidden { opacity: 0; pointer-events: none; }
.loader-icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  background: var(--blue-dim);
  border: 1px solid rgba(90,150,255,0.3);
  display: flex; align-items: center; justify-content: center;
  color: var(--blue-light);
  animation: loaderPulse 1.6s ease-in-out infinite;
}
@keyframes loaderPulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(0.94); }
}
.loader-text {
  font-size: 13px;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

/* ─── Topbar ───────────────────────────────────── */
.topbar {
  padding: 18px 16px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  z-index: 2;
}
.topbar-left { display: flex; align-items: center; gap: 11px; }

.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--blue-dim);
  border: 1.5px solid rgba(90,150,255,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  color: var(--blue-light);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.label { font-size: 12px; color: var(--text-3); line-height: 1.2; }
.title { font-size: 15px; font-weight: 500; color: var(--text); line-height: 1.3; }

.page-title { font-size: 16px; font-weight: 600; color: var(--text); }
.page-sub   { font-size: 12px; color: var(--text-3); margin-top: 1px; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  background: rgba(255,255,255,0.06);
  border: 0.5px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); }
.icon-btn:active { transform: scale(0.93); }

.icon-btn-primary {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: var(--blue);
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.icon-btn-primary:active { opacity: 0.8; }

.timer-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255,160,50,0.15);
  border: 0.5px solid rgba(255,160,50,0.3);
  color: var(--amber-light);
  font-weight: 500;
  white-space: nowrap;
}

/* ─── Hero ─────────────────────────────────────── */
.hero {
  margin: 0 14px;
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,0.07);
  border: 0.5px solid var(--border-md);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
}
.hero::after {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56,120,255,0.35) 0%, transparent 70%);
  pointer-events: none;
}
.hero.hidden { display: none; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(56,120,255,0.2);
  border: 0.5px solid rgba(90,150,255,0.3);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--blue-light);
  margin-bottom: 8px;
}
.hero-title {
  font-size: 18px; font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}
.hero-sub {
  font-size: 12px; color: var(--text-3);
  margin-bottom: 14px;
}
.hero-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(56,120,255,0.9);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.1px;
  transition: opacity 0.15s, transform 0.1s;
}
.hero-btn:hover  { opacity: 0.9; }
.hero-btn:active { transform: scale(0.96); }

.hero-icon {
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px;
  border-radius: 14px;
  background: rgba(255,255,255,0.07);
  border: 0.5px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  color: rgba(120,170,255,0.7);
  z-index: 1;
}

/* ─── Section title ────────────────────────────── */
.section-title {
  font-size: 11px; font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 16px;
  margin: 18px 0 9px;
}

/* ─── Grid 2 ───────────────────────────────────── */
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 0 14px;
}

.card {
  border-radius: var(--radius-md);
  padding: 14px 13px;
  display: flex; flex-direction: column; gap: 11px;
  cursor: pointer;
  background: var(--card);
  border: 0.5px solid var(--border);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.card:hover  { background: var(--card-hover); border-color: rgba(255,255,255,0.16); }
.card:active { transform: scale(0.97); }
.active-card { border-color: rgba(90,150,255,0.4) !important; background: rgba(56,120,255,0.12) !important; }

.card-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.card-label { font-size: 13px; font-weight: 500; color: var(--text); }
.card-sub   { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ─── Icon colors ──────────────────────────────── */
.ic-blue   { background: var(--blue-dim);   color: var(--blue-light); }
.ic-teal   { background: var(--teal-dim);   color: var(--teal-light); }
.ic-amber  { background: var(--amber-dim);  color: var(--amber-light); }
.ic-purple { background: var(--purple-dim); color: var(--purple-light); }
.ic-green  { background: var(--green-dim);  color: var(--green-light); }
.ic-red    { background: var(--red-dim);    color: #ff8080; }

/* ─── List box ─────────────────────────────────── */
.list-box {
  margin: 0 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(255,255,255,0.045);
  border: 0.5px solid var(--border);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.list-row {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 13px;
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: background 0.12s;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: rgba(255,255,255,0.04); }

.list-icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.list-name { font-size: 13px; color: var(--text); font-weight: 500; }
.list-sub  { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.list-chev { font-size: 20px; color: var(--text-4); line-height: 1; }

.empty-text {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

/* ─── Badges ───────────────────────────────────── */
.badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-green  { background: var(--green-dim); color: var(--green-light); border: 0.5px solid rgba(0,210,110,0.25); }
.badge-amber  { background: var(--amber-dim); color: var(--amber-light); border: 0.5px solid rgba(255,160,50,0.25); }
.badge-red    { background: var(--red-dim);   color: #ff8080;            border: 0.5px solid rgba(255,79,79,0.25); }
.badge-blue   { background: var(--blue-dim);  color: var(--blue-light);  border: 0.5px solid rgba(56,120,255,0.3); }
.badge-purple { background: var(--purple-dim);color: var(--purple-light);border: 0.5px solid rgba(140,80,255,0.3); }

/* ─── Inputs ───────────────────────────────────── */
.input-group { margin-bottom: 12px; }
.input-label {
  display: block;
  font-size: 12px; font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  -webkit-appearance: none;
}
.input::placeholder { color: var(--text-4); }
.input:focus {
  border-color: rgba(90,150,255,0.5);
  background: rgba(255,255,255,0.09);
}
.input-hint { font-size: 11px; color: var(--text-3); margin-top: 5px; }

textarea.input {
  resize: none;
  min-height: 120px;
  line-height: 1.5;
}

/* ─── Buttons ──────────────────────────────────── */
.full-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.1px;
  transition: opacity 0.15s, transform 0.1s;
  margin-top: 4px;
}
.full-btn:hover  { opacity: 0.9; }
.full-btn:active { transform: scale(0.98); }
.full-btn:disabled { opacity: 0.4; pointer-events: none; }

.outline-btn {
  background: transparent;
  border: 0.5px solid var(--border-md);
  color: var(--text-2);
}
.outline-btn:hover { background: rgba(255,255,255,0.06); }

.admin-btn {
  background: var(--purple-dim);
  border: 0.5px solid rgba(140,80,255,0.4);
  color: var(--purple-light);
}
.admin-btn:hover { background: rgba(140,80,255,0.22); }

/* ─── Error text ───────────────────────────────── */
.error-text {
  font-size: 12px;
  color: #ff8080;
  background: rgba(255,79,79,0.1);
  border: 0.5px solid rgba(255,79,79,0.2);
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 10px;
}
.error-text.hidden { display: none; }

/* ─── Profile ──────────────────────────────────── */
.profile-hero {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 16px 18px;
  text-align: center;
}
.profile-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--blue-dim);
  border: 2px solid rgba(90,150,255,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 600;
  color: var(--blue-light);
  margin-bottom: 12px;
}
.profile-name { font-size: 17px; font-weight: 600; color: var(--text); }
.profile-date { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* ─── Stats grids ──────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 14px;
  margin-bottom: 4px;
}
.stat-card {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 10px;
  text-align: center;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.stat-val   { font-size: 18px; font-weight: 600; color: var(--text); }
.stat-label { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.stat-val.teal   { color: var(--teal-light); }
.stat-val.amber  { color: var(--amber-light); }
.stat-val.purple { color: var(--purple-light); }

.stats-grid4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 0 14px;
  margin-bottom: 4px;
}
.stat-card4 {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 12px;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.stat-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ─── Result page ──────────────────────────────── */
.result-grade   { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.result-percent { font-size: 42px; font-weight: 800; letter-spacing: -1px; color: var(--blue-light); margin-bottom: 6px; }
.result-detail  { font-size: 13px; color: var(--text-3); }

/* ─── Navbar ───────────────────────────────────── */
.navbar {
  display: flex; align-items: center;
  margin: 12px 14px 14px;
  background: rgba(255,255,255,0.07);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 0.5px solid rgba(255,255,255,0.11);
  border-radius: var(--radius-xl);
  padding: 5px;
  gap: 3px;
  position: sticky;
  bottom: 0;
  z-index: 10;
}
.nb {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  cursor: pointer;
  color: var(--text-3);
  font-size: 10px;
  border-radius: 22px;
  border: 0.5px solid transparent;
  transition: all 0.2s cubic-bezier(.4,0,.2,1);
  user-select: none;
}
.nb svg { transition: transform 0.2s; }
.nb:hover { color: var(--text-2); }
.nb.active {
  background: rgba(56,120,255,0.18);
  border-color: rgba(90,150,255,0.35);
  color: var(--blue-light);
}
.nb.active svg { transform: scale(1.08); }

/* ─── Tahlil answers grid ──────────────────────── */
.answers-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 12px;
}
.ans-cell {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  position: relative;
}
.ans-correct { background: var(--green-dim);  color: var(--green-light); border: 0.5px solid rgba(0,210,110,0.3); }
.ans-wrong   { background: var(--red-dim);    color: #ff8080;            border: 0.5px solid rgba(255,79,79,0.3); }
.ans-unknown { background: var(--card);       color: var(--text-3);      border: 0.5px solid var(--border); }

/* ─── Toast ────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%; transform: translateX(-50%) translateY(10px);
  background: rgba(20,28,50,0.95);
  border: 0.5px solid var(--border-md);
  border-radius: 14px;
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  z-index: 999;
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.hidden { display: none; }

/* ─── Rating ranks ─────────────────────────────── */
.rank-medal { font-size: 16px; }
.rank-me    { background: rgba(56,120,255,0.1) !important; border-color: rgba(90,150,255,0.3) !important; }

/* ─── Misc helpers ─────────────────────────────── */
.hidden  { display: none !important; }
.mt-8    { margin-top: 8px; }
.mt-12   { margin-top: 12px; }
.mt-16   { margin-top: 16px; }
.gap-8   { display: flex; gap: 8px; }
.flex-1  { flex: 1; }
.text-center { text-align: center; }

/* ─── Scrollbar for desktop ────────────────────── */
@media (min-width: 600px) {
  body { display: flex; justify-content: center; align-items: flex-start; }
  .app {
    width: 390px;
    min-height: 100vh;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.07), 0 40px 80px rgba(0,0,0,0.5);
    border-radius: 0;
  }
}

/* ─── Animations ───────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease forwards; }

@keyframes spin {
  to { transform: rotate(360deg); }
}
.spin { animation: spin 0.8s linear infinite; }
