*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  font-family: 'Barlow', system-ui, sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  background: #001a33;
  position: relative;
}

/* ANIMATED GRADIENT BACKGROUND */
#bg {
  position: fixed; inset: 0; z-index: 0;
  background: linear-gradient(135deg, #002147 0%, #2d1b69 25%, #005bb5 50%, #4a1a8a 75%, #001a33 100%);
  background-size: 400% 400%;
  animation: nebula 18s ease-in-out infinite;
}
@keyframes nebula {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
#bg-glass {
  position: fixed; inset: 0; z-index: 1;
  background: radial-gradient(circle at 30% 20%, rgba(120,80,255,.15), transparent 60%),
              radial-gradient(circle at 70% 80%, rgba(0,120,255,.15), transparent 60%);
  backdrop-filter: blur(2px);
}

/* APP CONTAINER */
.app {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
}

/* TOPBAR */
.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(env(safe-area-inset-top, 0), 12px) 16px 10px;
  background: rgba(0, 10, 30, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-hex {
  width: 36px; height: 36px; border-radius: 9px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.1);
}
.logo-hex img { width: 100%; height: 100%; object-fit: cover; }
.logo-top { font-family: 'Bebas Neue', sans-serif; font-size: 15px; letter-spacing: 1.5px; line-height: 1; }
.logo-sub { font-family: 'Bebas Neue', sans-serif; font-size: 9px; letter-spacing: 3px; color: rgba(255,255,255,.55); margin-top: 2px; }

.avatar-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(10px);
  cursor: pointer;
  font-weight: 700;
}

/* SCROLL AREA */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 80px;
  scrollbar-width: none; /* Firefox */
}
.scroll-area::-webkit-scrollbar { display: none; } /* Chrome, Safari, Edge */
body { overflow: hidden; }
html { overflow: hidden; scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }

/* PANELS */
.panel { display: none; padding: 0 0 1rem; }
.panel.active { display: block; }

/* GREETING */
.greeting { padding: 1.1rem 1.1rem .85rem; }
.greeting-date {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: rgba(255,255,255,.55);
  margin-bottom: .35rem;
}
.greeting-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px; letter-spacing: .5px; line-height: 1.05;
  font-weight: 400;
}
.greeting-title em { font-style: normal; color: #ffd966; }

/* GLASS CARDS — translucent frosted */
.glass-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  margin: 0 1rem .75rem;
  position: relative;
  overflow: hidden;
}

/* DAILY CHALLENGE CARD */
.daily-card {
  cursor: pointer;
  padding: 1.25rem 1.15rem;
  background: rgba(255, 217, 102, 0.08);
  border: 1px solid rgba(255, 217, 102, 0.25);
}
.daily-glow {
  position: absolute; top: -50px; right: -50px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,217,102,.3), transparent 70%);
  pointer-events: none;
}
.daily-tag {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: #ffd966;
  margin-bottom: .55rem;
  display: flex; align-items: center; gap: 6px;
}
.live-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #4ade80; box-shadow: 0 0 8px rgba(74,222,128,.6);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .55; } }
.daily-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px; letter-spacing: .5px; line-height: 1.05;
  margin-bottom: .85rem; font-weight: 400;
}
.daily-bottom {
  display: flex; align-items: center; justify-content: space-between;
}
.daily-stats { display: flex; gap: 18px; }
.ds-val { font-family: 'Bebas Neue', sans-serif; font-size: 22px; color: #ffd966; line-height: 1; }
.ds-lbl { font-size: 9px; font-weight: 700; color: rgba(255,255,255,.55); margin-top: 3px; letter-spacing: .5px; }

/* PLAY BUTTON */
.play-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px; letter-spacing: 1.5px;
  padding: 12px 22px; border-radius: 10px; border: none;
  background: #ffd966; color: #000;
  cursor: pointer; font-weight: 400;
  box-shadow: 0 4px 14px rgba(255, 217, 102, 0.3);
  transition: transform .15s, box-shadow .15s;
}
.play-btn:active { transform: scale(.96); }
.play-btn i { font-size: 14px; }

/* GLASS BUTTON (Challenge, Categories) */
.glass-btn {
  display: flex; align-items: center; gap: 12px;
  margin: 0 1rem .55rem;
  padding: .9rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  transition: all .15s;
}
.glass-btn:active { transform: scale(.98); background: rgba(255,255,255,.12); }
.challenge-btn {
  background: rgba(64, 144, 240, 0.15);
  border-color: rgba(124, 181, 255, 0.35);
}
.gb-icon {
  width: 42px; height: 42px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.gb-body { flex: 1; min-width: 0; }
.gb-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 17px; letter-spacing: .5px; line-height: 1;
  margin-bottom: 3px;
}
.gb-sub { font-size: 11px; color: rgba(255,255,255,.65); }
.gb-badge {
  font-size: 9px; font-weight: 800; letter-spacing: .5px;
  padding: 3px 8px; border-radius: 5px; flex-shrink: 0;
}
.gb-badge.free { background: #4ade80; color: #042; }
.gb-badge.pro  { background: #ffd966; color: #000; }
.gb-chev { color: rgba(255,255,255,.4); font-size: 16px; }

/* SECTION HEADER */
.section-header {
  padding: 1.1rem 1.1rem .55rem;
}
.section-header h3 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px; letter-spacing: 1px; font-weight: 400;
  color: rgba(255,255,255,.92);
}

/* CATEGORY LIST — full-width rows like STT */
#catList { display: flex; flex-direction: column; }

/* BOTTOM NAV */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto;
  display: flex; justify-content: space-around;
  background: rgba(0, 10, 30, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 8px 0 max(env(safe-area-inset-bottom, 0), 10px);
  z-index: 50;
}
.nav-btn {
  flex: 1;
  background: none; border: none;
  color: rgba(255,255,255,.55);
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 6px;
  cursor: pointer;
  text-transform: uppercase;
}
.nav-btn i { font-size: 22px; }
.nav-btn.active { color: #ffd966; }

/* VAULT PRO FEATURES */
.vp-feat {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; color: rgba(255,255,255,.85);
  padding: 7px 0;
}
.vp-feat::before {
  content: '✓'; color: #4ade80; font-weight: 800;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(74,222,128,.2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; flex-shrink: 0;
}

/* PROFILE */
.profile-av {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #ffd966, #ff9966);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', sans-serif; font-size: 28px;
  color: #000;
}
.profile-stats {
  display: flex; margin: 0 1rem .75rem;
}
.ps-cell { flex: 1; text-align: center; }
.ps-val { font-family: 'Bebas Neue', sans-serif; font-size: 26px; color: #ffd966; }
.ps-lbl { font-size: 10px; color: rgba(255,255,255,.6); margin-top: 3px; font-weight: 600; }

.setting {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; cursor: pointer;
  border-radius: 10px;
  transition: background .15s;
}
.setting:hover { background: rgba(255,255,255,.05); }
.setting i:first-child { font-size: 18px; width: 22px; text-align: center; color: rgba(255,255,255,.7); }
.setting span { flex: 1; font-size: 14px; font-weight: 500; }
.setting .chev { font-size: 16px; color: rgba(255,255,255,.4); }

/* LEADERBOARD */
.lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.lb-row:last-child { border-bottom: none; }
.lb-rank {
  width: 28px; text-align: center;
  font-family: 'Bebas Neue', sans-serif; font-size: 18px;
  color: rgba(255,255,255,.6);
}
.lb-rank.top1 { color: #ffd966; }
.lb-rank.top2 { color: #c0c0c0; }
.lb-rank.top3 { color: #cd7f32; }
.lb-name { flex: 1; font-size: 13px; font-weight: 600; }
.lb-pts { font-family: 'Bebas Neue', sans-serif; font-size: 16px; color: #ffd966; }

/* QUIZ + RESULTS OVERLAY */
.screen-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 10, 30, 0.95);
  backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
}
.screen-overlay.active { display: flex; }

.quiz-bar {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: max(env(safe-area-inset-top, 0), 12px) 14px 10px;
  background: rgba(0, 10, 30, 0.7);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.back-btn {
  width: 34px; height: 34px; border-radius: 9px;
  background: rgba(255,255,255,.1); border: none;
  color: #fff; font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.quiz-progress { flex: 1; }
.quiz-cat { font-size: 10px; color: rgba(255,255,255,.6); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }
.quiz-track { height: 4px; background: rgba(255,255,255,.12); border-radius: 2px; overflow: hidden; }
.quiz-fill { height: 100%; background: #ffd966; transition: width .3s ease; }
.quiz-num { font-family: 'Bebas Neue', sans-serif; font-size: 16px; color: #ffd966; }

.timer-track { height: 3px; background: rgba(255,255,255,.1); }
.timer-fill { height: 100%; background: #4ade80; transition: width .1s linear; }

.q-body {
  flex: 1; overflow-y: auto;
  padding: 1.25rem 1.1rem 1.5rem;
  scrollbar-width: none;
}
.q-body::-webkit-scrollbar { display: none; }

.q-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: .85rem;
  color: rgba(255,255,255,.7);
}
.q-diff { padding: 2px 7px; border-radius: 4px; font-size: 9px; }

.q-text {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px; letter-spacing: .3px; line-height: 1.15;
  margin-bottom: 1.25rem; font-weight: 400;
}

.ans {
  display: flex; align-items: center; gap: 11px;
  width: 100%; margin-bottom: 9px;
  padding: 13px 14px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  color: #fff; font-size: 14px; font-weight: 500; text-align: left;
  cursor: pointer; transition: all .15s;
  backdrop-filter: blur(8px);
}
.ans:active { background: rgba(255,255,255,.12); }
.ans.correct { background: rgba(74,222,128,.2); border-color: #4ade80; }
.ans.wrong   { background: rgba(255,107,138,.2); border-color: #ff6b8a; }
.ans.dim     { opacity: .4; }
.ans-letter {
  width: 28px; height: 28px; border-radius: 7px;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', sans-serif; font-size: 14px;
  flex-shrink: 0;
}
.ans-text { flex: 1; line-height: 1.3; }

.exp-card {
  margin-top: 1rem; padding: .85rem 1rem;
  background: rgba(255,217,102,.1);
  border: 1px solid rgba(255,217,102,.25);
  border-radius: 11px;
  font-size: 13px; line-height: 1.5;
  color: rgba(255,255,255,.9);
  display: none;
}
.exp-card.show { display: block; }
.next-btn {
  display: none; width: 100%;
  margin-top: 1rem;
  padding: 13px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px; letter-spacing: 1.5px;
  background: #ffd966; color: #000;
  border: none; border-radius: 11px; cursor: pointer;
}
.next-btn.show { display: block; }

/* MODAL OVERLAYS */
.overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(6px);
  display: none;
  align-items: flex-end; justify-content: center;
}
.overlay.show { display: flex; }
.sheet {
  width: 100%; max-width: 480px;
  margin: 0 !important;
  padding: 1.25rem 1.15rem 1.75rem;
  border-radius: 20px 20px 0 0;
  background: rgba(20, 20, 50, 0.85);
  border-top: 1px solid rgba(255,255,255,.15);
  animation: sheetUp .25s ease;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,.3);
  margin: 0 auto 1rem;
}

.auth-tabs {
  display: flex; gap: 4px;
  background: rgba(0,0,0,.3); padding: 4px;
  border-radius: 10px; margin-bottom: 1rem;
}
.auth-tab {
  flex: 1; padding: 9px;
  background: none; border: none;
  color: rgba(255,255,255,.6);
  font-size: 13px; font-weight: 700;
  border-radius: 7px; cursor: pointer;
}
.auth-tab.active { background: rgba(255,255,255,.15); color: #fff; }
.auth-panel { display: none; }
.auth-panel.active { display: block; }

.field-input {
  width: 100%; padding: 12px 14px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  color: #fff; font-size: 14px;
  margin-bottom: 9px;
  font-family: inherit;
}
.field-input::placeholder { color: rgba(255,255,255,.4); }
.field-input:focus { outline: none; border-color: #ffd966; }

/* TOAST */
.toast {
  position: fixed; bottom: 100px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(0,10,30,.9);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
  padding: 11px 18px;
  border-radius: 24px;
  font-size: 13px; font-weight: 500;
  opacity: 0;
  transition: all .3s;
  z-index: 999;
  white-space: nowrap;
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
