/* ===== CSS VARIABLES & RESET ===== */
:root {
  --bg-primary: #f0f4ff; /* Mới: Xanh nhạt trong sáng */
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.4);
  --border-color: rgba(99, 102, 241, 0.1);
  --border-active: rgba(99, 102, 241, 0.6);
  --text-primary: #1e293b; /* Xám đậm dễ đọc */
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent-1: #3b82f6; /* Blue 2026 */
  --accent-2: #10b981; /* Mint 2026 */
  --accent-3: #6366f1;
  --gradient-primary: linear-gradient(135deg, #3b82f6, #10b981);
  --gradient-warm: linear-gradient(135deg, #f59e0b, #ef4444);
  --gradient-success: linear-gradient(135deg, #10b981, #059669);
  --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --shadow-lg: 0 20px 60px rgba(99, 102, 241, 0.12);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ===== PARTICLES CANVAS ===== */
#particles-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ===== HEADER ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
}

@media (max-width: 768px) {
  .header { padding: 0 16px; }
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  height: auto;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 0;
}

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

.logo-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 28px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.logo-text h1 {
  font-size: 18px;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-header-back {
  padding: 8px 14px;
  background: white;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--accent-1);
}

.btn-header-back:hover { 
  background: #f1f5f9; 
  border-color: var(--accent-1); 
  transform: translateX(-2px);
}

@media (max-width: 480px) {
  .header-back-active .logo-sub { display: none; }
  .header-back-active .logo-icon { font-size: 20px; }
  .header-back-active .logo-text h1 { font-size: 16px; }
}

/* ===== MAIN CONTENT ===== */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

@media (max-width: 600px) {
  .main-content { padding: 24px 20px 80px; }
}

/* ===== PLAYFUL MODERN NAVIGATION FOR KIDS ===== */
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap; /* Automatically wrap when space is insufficient */
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: white;
  color: var(--text-secondary);
  border: 2px solid #e2e8f0;
  box-shadow: 0 4px 0 #e2e8f0;
}

/* Specific Fun Colors for Navigation */
#nav-home { background: #fef3c7; color: #d97706; border-color: #fde68a; box-shadow: 0 4px 0 #fde68a; }
#nav-home:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 6px 12px rgba(217, 119, 6, 0.2); }

#nav-exam { background: #dcfce7; color: #16a34a; border-color: #bbf7d0; box-shadow: 0 4px 0 #bbf7d0; }
#nav-exam:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 6px 12px rgba(22, 163, 74, 0.2); }

#nav-history { background: #e0e7ff; color: #4f46e5; border-color: #c7d2fe; box-shadow: 0 4px 0 #c7d2fe; }
#nav-history:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 6px 12px rgba(79, 70, 229, 0.2); }

@media (max-width: 768px) {
  .nav-right {
    gap: 8px;
    justify-content: center;
    width: 100%;
  }
  .nav-link {
    padding: 8px 14px;
    font-size: 0.85rem;
    white-space: nowrap;
  }
  .logo-sub { display: none; }
  .header-content {
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .hero-title { font-size: 1.8rem; }
  .hero-desc { font-size: 14px; }
  .setup-header h2 { font-size: 22px; }
  .setup-header p { font-size: 13px; }
}

.nav-link.active {
  border-color: currentColor;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  transform: scale(0.95);
}

/* User Profile & Logout - Fun & Friendly */
.user-profile {
  display: flex;
  align-items: center;
  background: #fdf2f8; 
  padding: 6px 6px 6px 16px;
  border-radius: 50px;
  margin-left: 12px;
  border: 2px solid #fbcfe8;
  box-shadow: 0 4px 0 #fbcfe8;
}

#user-phone {
  font-weight: 700;
  color: #db2777;
  font-size: 0.9rem;
  margin-right: 12px;
}

.btn-logout {
  background: linear-gradient(135deg, #ef4444, #f87171);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 0 #b91c1c; 
  transition: all 0.2s;
}

.btn-logout:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 5px 10px rgba(239, 68, 68, 0.3);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: white;
  color: var(--text-secondary);
  border: 2px solid #e2e8f0;
  box-shadow: 0 4px 0 #e2e8f0;
}

/* Specific Fun Colors for Navigation */
#nav-home { background: #fef3c7; color: #d97706; border-color: #fde68a; box-shadow: 0 4px 0 #fde68a; }
#nav-home:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 6px 12px rgba(217, 119, 6, 0.2); }

#nav-exam { background: #dcfce7; color: #16a34a; border-color: #bbf7d0; box-shadow: 0 4px 0 #bbf7d0; }
#nav-exam:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 6px 12px rgba(22, 163, 74, 0.2); }

#nav-history { background: #e0e7ff; color: #4f46e5; border-color: #c7d2fe; box-shadow: 0 4px 0 #c7d2fe; }
#nav-history:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 6px 12px rgba(79, 70, 229, 0.2); }

.nav-link.active {
  border-color: currentColor;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  transform: scale(0.95);
}

/* User Profile & Logout - Fun & Friendly */
.user-profile {
  display: flex;
  align-items: center;
  background: #fdf2f8; 
  padding: 6px 6px 6px 16px;
  border-radius: 50px;
  margin-left: 12px;
  border: 2px solid #fbcfe8;
  box-shadow: 0 4px 0 #fbcfe8;
}

#user-phone {
  font-weight: 700;
  color: #db2777;
  font-size: 0.9rem;
  margin-right: 12px;
}

.btn-logout {
  background: linear-gradient(135deg, #ef4444, #f87171);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 0 #b91c1c; 
  transition: all 0.2s;
}

.btn-logout:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 5px 10px rgba(239, 68, 68, 0.3);
}

#user-phone {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-1);
  text-decoration: underline;
  cursor: pointer;
  padding: 0.5rem;
  font-size: 0.9rem;
}

/* Recaptcha */
#recaptcha-container {
  margin: 1rem 0;
  display: flex;
  justify-content: center;
}

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

.screen { display: none; }
.screen.active {
  display: block;
  animation: fadeIn 0.4s ease-out;
}

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 60px 0 48px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #eff6ff;
  color: #2563eb;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 800;
  margin-bottom: 24px;
  border: 2px solid #dbeafe;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

@media (max-width: 600px) {
  .hero-badge { font-size: 0.8rem; padding: 8px 16px; }
}

.hero-title {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 900;
  line-height: 1.1;
  color: #1e293b;
  margin-bottom: 24px;
  letter-spacing: -0.03em;
}

@media (max-width: 600px) {
  .hero-title { font-size: 2rem; margin-bottom: 16px; }
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, #6366f1, #10b981, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  filter: drop-shadow(0 4px 10px rgba(99, 102, 241, 0.2));
}

.hero-desc {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #3b82f6);
  color: white;
  padding: 14px 28px;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 6px 0 #1d4ed8, 0 10px 20px rgba(59, 130, 246, 0.3);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-4px);
  box-shadow: 0 10px 0 #1d4ed8, 0 15px 30px rgba(59, 130, 246, 0.4);
  filter: brightness(1.1);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #1d4ed8, 0 5px 10px rgba(59, 130, 246, 0.2);
}

.btn-primary span {
  font-size: 1.4rem;
  transition: transform 0.3s;
}

.btn-primary:hover span {
  transform: rotate(15deg) scale(1.2);
}

.btn-primary:disabled {
  background: #cbd5e1;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-lg {
  padding: 16px 36px;
  font-size: 1.2rem;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid var(--border-color);
}

.btn-outline:hover {
  border-color: var(--accent-1);
  background: rgba(99, 102, 241, 0.1);
}

.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

@media (max-width: 600px) {
  .stats-grid { 
    grid-template-columns: 1fr 1fr; 
    gap: 12px; 
    margin-bottom: 32px;
  }
  .stat-card { padding: 16px; border-radius: 16px; }
  .stat-icon { font-size: 32px; margin-bottom: 8px; }
  .stat-number { font-size: 22px; }
  .stat-label { font-size: 11px; }
}

.stat-card {
  background: white;
  border-radius: 24px;
  padding: 24px;
  text-align: center;
  border: 2px solid #f1f5f9;
  box-shadow: 0 10px 20px rgba(0,0,0,0.02);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stat-card:hover {
  transform: translateY(-8px) rotate(1deg);
  border-color: var(--accent-1);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  font-size: 40px;
  margin-bottom: 12px;
  display: block;
}

.stat-number {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  display: block;
}

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ===== SECTION TITLES ===== */
.section-title-row { margin-bottom: 16px; }

.section-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

/* ===== SCHOOLS GRID ===== */
.schools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 48px;
}

.school-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  transition: var(--transition);
}

.school-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-2);
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.15);
}

.school-emoji { font-size: 28px; margin-bottom: 8px; }
.school-name { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.school-location { font-size: 12px; color: var(--text-muted); }

/* ===== TOPICS GRID ===== */
.topics-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 48px;
}

.topic-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
}

.topic-chip:hover {
  border-color: var(--accent-1);
  color: var(--accent-3);
  background: rgba(99, 102, 241, 0.08);
}

/* ===== CITY TABS ===== */
.city-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.city-tab {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.city-tab:hover { border-color: var(--accent-1); color: var(--accent-3); }

.city-tab.active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.school-tag {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
}

.new-tag {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.school-card.hidden-school { display: none; }

/* ===== SETUP FORM ===== */
.setup-container {
  max-width: 640px;
  margin: 0 auto;
}

.setup-header {
  text-align: center;
  margin-bottom: 36px;
}

.setup-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.setup-header h2 {
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 8px;
}

.setup-header p {
  color: var(--text-secondary);
  font-size: 15px;
}

.setup-card, .setup-form {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  backdrop-filter: blur(10px);
}

@media (max-width: 600px) {
  .setup-card, .setup-form { padding: 24px 20px; border-radius: 20px; }
  .form-group { margin-bottom: 20px; }
}

.form-group { margin-bottom: 28px; }

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.radio-group { display: flex; gap: 10px; flex-wrap: wrap; }

.radio-card {
  flex: 1;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 12px;
  background: var(--bg-glass);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.radio-card input { display: none; }

.radio-card:hover {
  border-color: var(--accent-1);
  background: rgba(99, 102, 241, 0.06);
}

.radio-card.active {
  border-color: var(--accent-1);
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.radio-icon { font-size: 22px; }
.radio-text { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.radio-card.active .radio-text { color: var(--accent-3); }

.text-input {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-glass);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
  transition: var(--transition);
}

.text-input:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.text-input::placeholder { color: var(--text-muted); }

/* ===== EXAM SCREEN ===== */
.exam-container {
  max-width: 760px;
  margin: 0 auto;
}

/* Timer Bar */
.timer-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
}

.timer-left, .timer-right { display: flex; align-items: center; gap: 6px; }

.timer-icon { font-size: 20px; }
.timer-text { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent-3); }
.timer-text.warning { color: var(--yellow); }
.timer-text.danger { color: var(--red); animation: blink 1s infinite; }

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

.timer-progress-wrap {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.timer-progress {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width 1s linear;
  width: 100%;
}

.timer-progress.warning { background: var(--gradient-warm); }
.timer-progress.danger { background: var(--gradient-danger); }

.progress-text { font-size: 14px; font-weight: 700; color: var(--text-secondary); white-space: nowrap; }

/* Toast Notification System */
.toast-container {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  width: 90%;
  max-width: 400px;
}

.toast {
  background: white;
  padding: 15px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastSlideUp 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  font-weight: 500;
  font-size: 14px;
}

.toast-success { border-left: 5px solid #2ecc71; }
.toast-error { border-left: 5px solid #e74c3c; color: #c0392b; }
.toast-warning { border-left: 5px solid #f1c40f; }

@keyframes toastSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.toast-exit {
  animation: toastFadeOut 0.3s forwards;
}

@keyframes toastFadeOut {
  to { opacity: 0; transform: translateY(20px) scale(0.9); }
}

@media (max-width: 600px) {
  .toast-container { bottom: 20px; }
}

/* Question Nav Bar */
.question-nav-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

@media (max-width: 600px) {
  .question-nav-bar { 
    padding: 8px; 
    gap: 4px; 
    justify-content: center;
  }
}

.q-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
}

.q-nav-btn:hover { border-color: var(--accent-1); }
.q-nav-btn.current { background: var(--accent-1); color: white; border-color: var(--accent-1); }
.q-nav-btn.answered { background: rgba(99, 102, 241, 0.2); border-color: var(--accent-1); color: var(--accent-3); }

/* Question Card */
.question-card {
  background: white;
  border-radius: 32px;
  padding: 32px;
  border: 2px solid #f1f5f9;
  box-shadow: 0 20px 40px rgba(0,0,0,0.03);
  margin-bottom: 24px;
  transition: all 0.4s ease;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.q-badge {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.q-subject { background: rgba(99, 102, 241, 0.15); color: var(--accent-3); }
.q-topic { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; }
.q-school { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.q-diff { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }

.question-number {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-1);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.question-text {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: 24px;
}

/* Options */
/* Playful Options Grid */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: #f8fafc;
  border: 2px solid #f1f5f9;
  border-radius: 20px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 600;
  color: #475569;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 0 #f1f5f9;
}

.option-btn:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  transform: translateX(8px) scale(1.02);
  box-shadow: 0 6px 12px rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

.option-btn.selected {
  background: #3b82f6;
  color: white !important;
  border-color: #2563eb;
  transform: scale(0.98);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.option-label {
  background: #e2e8f0;
  color: #475569;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.9rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.option-btn:hover .option-label {
  background: #3b82f6;
  color: white;
  transform: rotate(-10deg);
}

.option-btn.selected .option-label {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.option-text { flex: 1; font-weight: 600; }

/* Exam Nav */
.exam-nav {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.hidden { display: none !important; }

/* ===== RESULT SCREEN ===== */
.result-container {
  max-width: 800px;
  margin: 0 auto;
}

.result-hero {
  text-align: center;
  padding: 48px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.result-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0.05;
}

.result-score-ring {
  width: 160px;
  height: 160px;
  margin: 0 auto 24px;
  position: relative;
}

.result-score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-bg { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 8; }

.score-fill {
  fill: none;
  stroke: url(#scoreGradient);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 440;
  stroke-dashoffset: 440;
  transition: stroke-dashoffset 1.5s ease;
}

.score-text-group {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-number { font-size: 42px; font-weight: 900; color: var(--text-primary); }
.score-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }

.result-name { font-size: 20px; font-weight: 800; margin-bottom: 4px; position: relative; }
.result-date { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; position: relative; }

.result-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  position: relative;
}

.result-stat {
  text-align: center;
}

.result-stat-val { font-size: 22px; font-weight: 800; }
.result-stat-val.correct { color: var(--green); }
.result-stat-val.wrong { color: var(--red); }
.result-stat-val.skip { color: var(--yellow); }
.result-stat-lbl { font-size: 12px; color: var(--text-muted); font-weight: 600; }

.result-grade {
  display: inline-block;
  padding: 8px 24px;
  border-radius: var(--radius-full);
  font-size: 16px;
  font-weight: 800;
  margin-top: 20px;
  position: relative;
}

.grade-excellent { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.grade-good { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.grade-average { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.grade-poor { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

/* Result Actions */
.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 32px;
}

/* Review Section */
.review-section { margin-top: 32px; }
.review-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
}

.review-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.review-tab {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.review-tab:hover { border-color: var(--accent-1); }
.review-tab.active { background: var(--accent-1); border-color: var(--accent-1); color: white; }

.review-list { display: flex; flex-direction: column; gap: 12px; }

.review-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
}

.review-card.correct-card { border-left: 3px solid var(--green); }
.review-card.wrong-card { border-left: 3px solid var(--red); }
.review-card.skip-card { border-left: 3px solid var(--yellow); }

.review-q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.review-q-num { font-size: 13px; font-weight: 800; color: var(--accent-1); }

.review-q-status {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}

.status-correct { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.status-wrong { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.status-skip { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.review-q-text { font-size: 15px; font-weight: 600; margin-bottom: 12px; line-height: 1.6; }

.review-options { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }

.review-option {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-glass);
  border: 1px solid transparent;
}

.review-option.is-correct { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.3); }
.review-option.is-wrong { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.3); }
.review-option .opt-marker { font-size: 16px; }

.review-explanation {
  padding: 14px 18px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.review-explanation strong { color: var(--accent-3); }

/* ===== HISTORY ===== */
.history-container {
  max-width: 640px;
  margin: 0 auto;
}

.history-list { display: flex; flex-direction: column; gap: 12px; }

.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.history-card:hover {
  border-color: var(--accent-1);
  transform: translateX(4px);
}

.history-info h4 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.history-info p { font-size: 12px; color: var(--text-muted); }

.history-score {
  font-size: 24px;
  font-weight: 900;
  color: var(--accent-3);
  text-align: right;
}

.history-score small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon { font-size: 48px; margin-bottom: 16px; }
.modal-icon.pulse { animation: pulse 1.5s infinite; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.modal-card h3 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.modal-card p { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }

/* ===== CHART & REWARDS ===== */
.chart-card {
  background: white;
  border-radius: 24px;
  padding: 24px;
  margin-bottom: 24px;
  border: 2px solid #f1f5f9;
  box-shadow: 0 10px 30px rgba(0,0,0,0.03);
}

.chart-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

.celebration-box {
  text-align: center;
  margin: 0 auto 24px;
  perspective: 1000px;
}

.celebration-img {
  max-width: 300px;
  width: 100%;
  border-radius: 32px;
  box-shadow: 0 30px 60px rgba(99, 102, 241, 0.3);
  border: 4px solid white;
  animation: rewardEntrance 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, 
             rewardFloat 3s ease-in-out infinite 0.8s;
  position: relative;
  overflow: hidden;
}

/* Shine Effect Overlay */
.celebration-box::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.6), transparent);
  transform: skewX(-25deg);
  animation: rewardShine 2s infinite 1.5s;
  pointer-events: none;
}

@keyframes rewardEntrance {
  0% { transform: scale(0.3) rotate(-15deg); opacity: 0; }
  70% { transform: scale(1.1) rotate(5deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes rewardFloat {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-15px) rotate(2deg); }
}

@keyframes rewardShine {
  0% { left: -100%; }
  100% { left: 200%; }
}

@media (max-width: 600px) {
  .chart-container { height: 200px; }
  .celebration-img { max-width: 220px; }
  .result-hero { padding: 32px 16px; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .header-content { height: auto; padding: 10px 0; }
  .logo-text h1 { font-size: 16px; }
  .main-content { padding: 20px 16px 60px; }
  .hero { padding: 40px 0 32px; }
  .hero-desc { font-size: 15px; padding: 0 10px; }
  
  .radio-group { gap: 8px; }
  .radio-card { min-width: 70px; padding: 12px 8px; }
  .radio-icon { font-size: 1.2rem; }
  .radio-text { font-size: 11px; }

  .question-card { padding: 20px; border-radius: 20px; }
  .question-text { font-size: 16px; }
  .option-btn { padding: 14px 16px; font-size: 0.95rem; border-radius: 16px; }
  
  .exam-nav { flex-direction: column; gap: 10px; }
  .exam-nav .btn { width: 100%; justify-content: center; }
  
  .result-stats { gap: 16px; }
  .result-stat-val { font-size: 18px; }
  .result-actions { flex-direction: column; }
  .result-actions .btn { width: 100%; }

  .q-nav-btn { width: 34px; height: 34px; font-size: 12px; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 1.8rem; }
  .hero-desc { font-size: 14px; }
  .setup-header h2 { font-size: 22px; }
  .setup-header p { font-size: 13px; }
  
  .timer-bar { padding: 10px 12px; gap: 8px; border-radius: 12px; }
  .timer-text { font-size: 16px; }
  .timer-icon { font-size: 16px; }
  .progress-text { font-size: 12px; }

  .question-meta { gap: 4px; }
  .q-badge { padding: 2px 8px; font-size: 10px; }
  
  .modal-card { padding: 30px 20px; }
  .modal-card h3 { font-size: 1.2rem; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }
}

/* ===== LOADING & ANIMATIONS ===== */
.btn-loading {
  position: relative !important;
  color: transparent !important;
  pointer-events: none !important;
  opacity: 0.8;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -10px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

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

/* DONATE STYLES */
.btn-donate {
  background: #ff813f;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 50px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 15px rgba(255, 129, 63, 0.3);
  text-decoration: none;
  font-size: 14px;
}
.btn-donate:hover {
  transform: scale(1.05) rotate(-2deg);
  background: #f07435;
  box-shadow: 0 6px 20px rgba(255, 129, 63, 0.4);
}
.btn-donate span { font-size: 18px; }

.donate-modal-content {
  text-align: center;
  padding: 20px;
}
.donate-qr-img {
  width: 100%;
  max-width: 250px;
  border-radius: 12px;
  margin: 20px 0;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  border: 4px solid white;
}
.donate-thanks {
  color: #475569;
  font-size: 14px;
  font-style: italic;
  margin-top: 10px;
}

.hidden { display: none !important; }
