@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #6C63FF;
  --primary-dark: #5548e8;
  --secondary: #FF6584;
  --accent: #43E97B;
  --bg: #0D0D1A;
  --bg2: #13132A;
  --bg3: #1a1a35;
  --card: #1E1E3A;
  --card2: #252548;
  --border: rgba(108,99,255,0.2);
  --text: #ffffff;
  --text-muted: #8888b0;
  --text-dim: #5555aa;
  --gold: #FFD700;
  --silver: #C0C0C0;
  --bronze: #CD7F32;
  --success: #43E97B;
  --danger: #FF6584;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(108,99,255,0.15);
  --shadow-hover: 0 16px 48px rgba(108,99,255,0.3);
  --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  --font-head:   'Bungee', cursive;
  --font-body:  'Poppins', sans-serif;;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 20% 20%, rgba(108,99,255,0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 80%, rgba(255,101,132,0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* =========== SCROLLBAR =========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* =========== NAVBAR =========== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(13,13,26,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 22px;
  color: var(--text);
}

.nav-brand .logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.nav-brand .logo-img {
  width: 60%; 
  border-radius: 10px;
  object-fit: contain;
  display: block;
}

.nav-brand span { background: linear-gradient(90deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.nav-actions { 
  display: flex; 
  align-items: center; 
  gap: 12px;
  position: relative;
}

.nav-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  border: none;
  min-height: 40px;
  white-space: nowrap;
}

.nav-btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.nav-btn-ghost:hover { border-color: var(--primary); color: var(--text); }
.nav-btn-ghost:active { transform: scale(0.98); }

.nav-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}
.nav-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(108,99,255,0.5); }
.nav-btn-primary:active { transform: scale(0.98); }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
}
.user-avatar:hover { transform: scale(1.1); }

.user-menu {
  position: relative;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  display: none;
  box-shadow: var(--shadow-hover);
  z-index: 100;
}
.user-dropdown.show { display: block; animation: fadeIn 0.2s ease; }

.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  transition: var(--transition);
  text-decoration: none;
}
.dropdown-item:hover { background: var(--bg3); color: var(--text); }
.dropdown-item.danger:hover { color: var(--danger); }

.dropdown-divider { height: 1px; background: var(--border); margin: 6px 8px; }

/* =========== MAIN WRAPPER =========== */
.main-wrapper {
  padding-top: 64px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* =========== HERO =========== */
.hero {
  padding: 80px 24px 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(108,99,255,0.15);
  border: 1px solid rgba(108,99,255,0.3);
  border-radius: 50px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 24px;
  animation: pulse-border 2s ease infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(108,99,255,0.3); }
  50% { border-color: rgba(108,99,255,0.7); }
}

.hero h1 {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 20px;
}

.hero h1 .highlight {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}

.hero p {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 36px;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-top: 48px;
  flex-wrap: wrap;
}

.hero-stat { text-align: center; }
.hero-stat .num {
  font-family: 'Poppins', sans-serif;
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-stat .lbl { font-size: 13px; color: var(--text-muted); margin-top: 4px; font-weight: 600; }

/* =========== BUTTONS =========== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
  min-height: 44px;
  -webkit-user-select: none;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 20px rgba(108,99,255,0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(108,99,255,0.6); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { border-color: var(--primary); transform: translateY(-2px); }
.btn-secondary:active { transform: scale(0.98); }

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #e85577);
  color: #fff;
}
.btn-danger:active { transform: scale(0.98); }

.btn-lg { padding: 16px 36px; font-size: 15px; min-height: 48px; }
.btn-sm { padding: 8px 18px; font-size: 13px; min-height: 36px; }
.btn-block { width: 100%; justify-content: center; }

/* =========== SEARCH & FILTER =========== */
.search-section {
  padding: 0 24px 32px;
  max-width: 800px;
  margin: 0 auto;
}

.search-box {
  position: relative;
  margin-bottom: 20px;
}

.search-box input {
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 14px 20px 14px 52px;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: var(--transition);
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,0.15); }

.search-icon {
  position: absolute;
  left: 18px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
  pointer-events: none;
}

.category-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.category-filters::-webkit-scrollbar { display: none; }

.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px;
  border-radius: 50px;
  background: var(--card);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
.filter-chip:hover { border-color: var(--primary); color: var(--text); }
.filter-chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(108,99,255,0.4);
}

/* =========== SECTION =========== */
.section { padding: 0 24px 60px; max-width: 1200px; margin: 0 auto; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-title {
  font-family: 'Poppins', sans-serif;
  font-size: 22px;
  font-weight: 800;
}

.section-link {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}
.section-link:hover { color: var(--secondary); }

/* =========== QUIZ GRID =========== */
.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.quiz-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.quiz-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-hover);
}

.quiz-card.locked { opacity: 0.7; }
.quiz-card.locked:hover { transform: none; box-shadow: none; border-color: var(--border); }

.quiz-card-thumb {
  height: 140px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-card-emoji { font-size: 52px; }

.lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13,13,26,0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  backdrop-filter: blur(2px);
}
.lock-overlay .lock-icon { font-size: 28px; }
.lock-overlay span { font-size: 12px; font-weight: 700; color: var(--text-muted); }

.quiz-card-body { padding: 16px; }

.quiz-cat-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 50px;
  margin-bottom: 8px;
}

.quiz-card h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}

.quiz-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  flex-wrap: wrap;
}

.quiz-meta span { display: flex; align-items: center; gap: 4px; }

.difficulty-badge {
  padding: 3px 8px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.diff-easy { background: rgba(67,233,123,0.15); color: var(--accent); }
.diff-medium { background: rgba(247,151,30,0.15); color: #F7971E; }
.diff-hard { background: rgba(255,101,132,0.15); color: var(--danger); }

/* =========== CATEGORY CARDS =========== */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.cat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.cat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.cat-icon { font-size: 36px; margin-bottom: 10px; }
.cat-name { font-weight: 800; font-size: 14px; margin-bottom: 4px; }
.cat-count { font-size: 12px; color: var(--text-muted); font-weight: 600; }

/* =========== MODAL =========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}
.modal-overlay.show { opacity: 1; pointer-events: all; }

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  width: 100%;
  max-width: 480px;
  padding: 40px;
  position: relative;
  transform: scale(0.9) translateY(20px);
  transition: var(--transition);
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
}
.modal-overlay.show .modal { transform: scale(1) translateY(0); }

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  background: var(--bg3);
  border: none;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--danger); color: #fff; }

.modal-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin: 0 auto 24px;
}

.modal h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
}

.modal p {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 15px;
  line-height: 1.6;
}

/* =========== FORM =========== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-input {
  width: 100%;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: var(--transition);
}
.form-input::placeholder { color: var(--text-dim); }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,0.15); }
.form-error { font-size: 13px; color: var(--danger); margin-top: 6px; display: none; font-weight: 600; }
.form-error.show { display: block; }

/* =========== QUIZ PLAY =========== */
#quiz-play-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1500;
  display: none;
  flex-direction: column;
  overflow-y: auto;
}
#quiz-play-screen.show { display: flex; }

.quiz-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.quiz-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.quiz-timer {
  display: flex; align-items: center; gap: 6px;
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: var(--accent);
  min-width: 60px;
  justify-content: center;
}
.quiz-timer.danger { color: var(--danger); animation: blink 0.5s ease infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.quiz-q-counter {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.quiz-body {
  flex: 1;
  padding: 40px 24px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.question-text {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 700;
  margin-bottom: 32px;
  line-height: 1.4;
  text-align: center;
}

.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 500px) { .answers-grid { grid-template-columns: 1fr; } }

.answer-btn {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: left;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
}
.answer-btn:hover:not(:disabled) { border-color: var(--primary); background: var(--card2); transform: translateY(-2px); }
.answer-btn .answer-letter {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  transition: var(--transition);
}

.answer-btn.correct {
  border-color: var(--success) !important;
  background: rgba(67,233,123,0.1) !important;
}
.answer-btn.correct .answer-letter { background: var(--success); color: #000; }

.answer-btn.wrong {
  border-color: var(--danger) !important;
  background: rgba(255,101,132,0.1) !important;
}
.answer-btn.wrong .answer-letter { background: var(--danger); color: #fff; }

.answer-btn:disabled { cursor: not-allowed; }

/* =========== RESULTS =========== */
.results-screen {
  text-align: center;
  padding: 40px 24px;
  max-width: 600px;
  margin: 0 auto;
}

.result-circle {
  width: 140px; height: 140px;
  border-radius: 50%;
  background: var(--card);
  border: 4px solid var(--primary);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  margin: 0 auto 24px;
  position: relative;
}

.result-percentage {
  font-family: 'Poppins', sans-serif;
  font-size: 36px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.result-label { font-size: 12px; color: var(--text-muted); font-weight: 700; }

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 28px 0;
}

.result-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.result-stat .val {
  font-family: 'Poppins', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}
.result-stat .lbl { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-top: 4px; }

/* =========== LEADERBOARD =========== */
.leaderboard-table {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: var(--card2); }
.lb-row.current-user { background: rgba(108,99,255,0.1); border-left: 3px solid var(--primary); }

.lb-rank {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 16px;
  min-width: 36px;
  text-align: center;
}
.rank-1 { color: var(--gold); }
.rank-2 { color: var(--silver); }
.rank-3 { color: var(--bronze); }

.lb-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}

.lb-info { flex: 1; min-width: 0; }
.lb-name { font-weight: 800; font-size: 15px; }
.lb-sub { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-top: 2px; }

.lb-score {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: var(--primary);
}

/* =========== TABS =========== */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--card);
  padding: 4px;
  border-radius: 50px;
  border: 1px solid var(--border);
  margin-bottom: 32px;
}

.tab-btn {
  flex: 1;
  padding: 10px 20px;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: transparent;
  color: var(--text-muted);
  text-align: center;
}
.tab-btn.active {
  background: linear-gradient(135deg, #6c63ff30, #5548e8c9);
  color: #fff;
  box-shadow: 0 4px 16px rgba(108,99,255,0.4);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.3s ease; }

/* =========== PROFILE =========== */
.profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  margin-bottom: 24px;
}

.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  font-weight: 900;
  color: #fff;
  margin: 0 auto 16px;
  border: 4px solid var(--primary);
}

.profile-name { font-family: 'Poppins', sans-serif; font-size: 24px; font-weight: 800; }
.profile-joined { font-size: 13px; color: var(--text-muted); font-weight: 600; margin-top: 4px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.stat-card {
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}
.stat-card .val {
  font-family: 'Poppins', sans-serif;
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-card .lbl { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-top: 4px; }

/* =========== TOASTS =========== */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 14px;
  min-width: 260px;
  max-width: 340px;
  box-shadow: var(--shadow-hover);
  animation: slideInRight 0.3s ease;
  transition: var(--transition);
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========== LOADING =========== */
.loading-spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(13, 13, 26, 0.95);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease-in-out;
}

.loading-panel.show {
  display: flex;
}

.loading-panel-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loading-panel-content p {
  font-size: 16px;
  color: var(--text-muted);
  margin: 0;
  font-weight: 500;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--card2) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* =========== EMPTY STATE =========== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; }
.empty-state h3 { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 15px; }

/* =========== RESPONSIVE =========== */
@media (max-width: 768px) {
  .hero { padding: 48px 20px 40px; }
  .section { padding: 0 16px 40px; }
  .quiz-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 28px; }
  .result-stats { grid-template-columns: 1fr; }
  .modal { padding: 28px 20px; }
  .quiz-body { padding: 24px 16px; }
  .answers-grid { grid-template-columns: 1fr; }
  
  /* Navbar tablet adjustments */
  .navbar { padding: 0 16px; }
  .nav-brand { font-size: 18px; }
  
  /* User menu dropdown tablet adjustments */
  .user-menu-dropdown {
    position: absolute;
    width: auto;
    border-radius: 8px;
    top: calc(100% + 4px);
    min-width: 180px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  /* Tablet optimizations */
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .quiz-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .navbar { padding: 0 12px; height: 56px; }
  .nav-brand { gap: 6px; font-size: 16px; }
  .nav-brand .logo-img { width: 45%;  }
  .nav-actions { gap: 6px; }
  
  .main-wrapper { padding-top: 56px; }
  
  /* Mobile menu dropdown - full width drawer style */
  .user-menu-dropdown {
    position: fixed;
    bottom: auto;
    top: 56px;
    right: 0;
    
    width: 100%;
    max-width: none;
    border-radius: 0;
    border: none;
    border-top: 1px solid var(--border);
    box-shadow: none;
    background: var(--card);
    z-index: 1000;
  }
  
  .user-menu-dropdown a {
    padding: 14px 16px;
    font-size: 13px;
    min-height: 44px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
  }
  
  .user-menu-dropdown a:last-child {
    border-bottom: none;
  }
  
  .user-menu-dropdown a:active {
    background: var(--bg3);
  }
  
  body { font-size: 14px; }
  
  /* Button sizing for mobile touch */
  .btn { min-height: 44px; padding: 10px 20px; font-size: 13px; }
  .btn-lg { min-height: 48px; padding: 14px 28px; font-size: 14px; }
  
  /* Modal adjustments */
  .modal { 
    padding: 24px 16px;
    border-radius: 16px;
    margin: 16px;
    max-width: 100%;
  }
  
  /* Quiz play screen adjustments */
  #quiz-body { padding: 20px 12px; }
  .question-text { font-size: 16px; margin-bottom: 24px; }
  .answer-btn { 
    padding: 14px 12px;
    font-size: 13px;
    min-height: 50px;
    gap: 10px;
  }
  
  .answer-letter {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }
  
  /* Result stats mobile */
  .result-stats { grid-template-columns: 1fr; gap: 8px; }
  .result-stat { padding: 12px 10px; }
  .result-stat .val { font-size: 18px; }
  
  /* Result circle sizing */
  .result-circle { 
    width: 120px;
    height: 120px;
    margin: 20px auto;
  }
  
  .result-percentage { font-size: 40px; }
  
  /* Form improvements for mobile */
  .form-group { margin-bottom: 18px; }
  .form-control { 
    padding: 12px 14px;
    font-size: 16px;
    min-height: 44px;
  }
  .form-label { font-size: 12px; }
  
  /* Disable zoom on input focus for iOS */
  input, textarea, select {
    font-size: 16px;
  }
}

/* =========== FEATURED QUIZ =========== */
.featured-banner {
  background: linear-gradient(135deg, #6c63ff38, #5548e840);
  border-radius: var(--radius);
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}
.featured-banner::before {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}
.featured-banner h2 { font-family: 'Poppins', sans-serif; font-size: 24px; font-weight: 800; }
.featured-banner p { color: rgba(255,255,255,0.75); font-size: 14px; margin-top: 6px; }
.featured-emoji { font-size: 56px; flex-shrink: 0; }

/* =========== QUIZ DETAIL MODAL =========== */
.quiz-detail-thumb {
  height: 160px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  margin-bottom: 20px;
}

.quiz-info-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.info-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg3);
  border-radius: 50px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

/* =========== FOOTER =========== */
.footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 60px;
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 12px;
}

.footer-links a {
  font-size: 14px;
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--secondary);
  text-decoration: underline;
}

.footer-content p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

/* =========== FORM STYLES =========== */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.1);
}

.form-control::placeholder {
  color: var(--text-dim);
}

.form-error {
  display: none;
  margin-top: 6px;
  font-size: 12px;
  color: var(--danger);
  font-weight: 600;
}

.form-error.show {
  display: block;
}

/* =========== LOADING PANEL =========== */
.loading-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loading-panel.show {
  opacity: 1;
  pointer-events: all;
}

.loading-panel-content {
  text-align: center;
}

.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(108,99,255,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-panel-content p {
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
}

/* =========== TOAST CONTAINER =========== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.success {
  background: rgba(67,233,123,0.1);
  border-color: var(--success);
  color: var(--success);
}

.toast.error {
  background: rgba(255,101,132,0.1);
  border-color: var(--danger);
  color: var(--danger);
}

.toast.info {
  background: rgba(108,99,255,0.1);
  border-color: var(--primary);
  color: var(--primary);
}

/* =========== QUIZ PLAY SCREEN =========== */
#quiz-play-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  flex-direction: column;
  z-index: 2500;
  overflow-y: auto;
}

#quiz-play-screen.show {
  display: flex;
}

.quiz-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.quiz-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg3);
  border-radius: 10px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  width: 0%;
  transition: width 0.3s ease;
}

.quiz-timer {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 50px;
  text-align: right;
}

.quiz-timer.danger {
  color: var(--danger);
  animation: pulse 0.5s infinite;
}

@keyframes pulse {
  50% { opacity: 0.5; }
}

.quiz-q-counter {
  font-size: 13px;
  color: var(--text-muted);
  min-width: 60px;
  text-align: right;
  font-weight: 600;
}

#quiz-body {
  padding: 40px 24px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.question-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 28px;
  line-height: 1.6;
}

.answers-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.answer-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  min-height: 54px;
  -webkit-user-select: none;
  user-select: none;
}

.answer-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--card2);
}

.answer-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.answer-btn:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

.answer-btn.selected {
  border-color: var(--primary);
  background: rgba(108,99,255,0.1);
}

.answer-btn.correct {
  border-color: var(--success);
  background: rgba(67,233,123,0.1);
  color: var(--success);
}

.answer-btn.wrong {
  border-color: var(--danger);
  background: rgba(255,101,132,0.1);
  color: var(--danger);
}

.answer-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.answer-btn.correct .answer-letter {
  background: var(--success);
}

.answer-btn.wrong .answer-letter {
  background: var(--danger);
}

/* ===== RESULTS SCREEN ===== */
.results-screen {
  text-align: center;
  padding: 20px 0;
}

.result-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 28px auto;
  box-shadow: 0 16px 48px rgba(108,99,255,0.3);
}

.result-percentage {
  font-size: 48px;
  font-weight: 900;
  color: #fff;
}

.result-label {
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 28px 0;
}

.result-stat {
  background: var(--card);
  padding: 16px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.result-stat .val {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

.result-stat .lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* =========== USER MENU DROPDOWN =========== */
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 180px;
  z-index: 1000;
  overflow: hidden;
}

.user-menu-dropdown a {
  display: block;
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  border-bottom: 1px solid var(--border);
}

.user-menu-dropdown a:last-child {
  border-bottom: none;
}

.user-menu-dropdown a:hover {
  background: var(--bg3);
  color: var(--primary);
}
