:root { --pad: 16px; --radius: 14px; }
* { box-sizing: border-box; }
body { font-family: -apple-system, system-ui, Segoe UI, Roboto, Arial, sans-serif; margin: 0; background: #f6f7fb; color: #222; }
nav { display: flex; gap: 12px; padding: var(--pad); background: white; position: sticky; top: 0; z-index: 200; border-bottom: 1px solid #e5e7eb; }
nav a { text-decoration: none; color: #111; padding: 8px 10px; border-radius: 10px; }
nav a:hover { background: #f0f2f7; }
main { max-width: 900px; margin: 24px auto; padding: 0 var(--pad); }
h1 { margin-top: 0; }
.card { background: white; padding: var(--pad); border-radius: var(--radius); box-shadow: 0 2px 12px rgba(0,0,0,0.06); margin-bottom: 20px; }
footer { text-align: center; padding: 20px; color: #6b7280; }

/* Shared quiz styles (math & geography) */
.feedback-correct { color: #10b981; animation: fadeIn 0.3s ease-in; }
.feedback-wrong { color: #ef4444; animation: fadeIn 0.3s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.quiz-nav { display: flex; width: fit-content; margin: 0 auto 1.5rem; padding: 4px; gap: 4px; background: #eef1f6; border-radius: 999px; }
.quiz-nav-link { font-weight: 600; padding: 0.5rem 1.25rem; border-radius: 999px; text-decoration: none; font-size: 1.05rem; background: transparent; color: #4a90e2; transition: background 0.15s, color 0.15s; }
.quiz-nav-link:hover { background: rgba(74,144,226,0.1); }
.quiz-nav-link.active { background: #fff; color: #111; box-shadow: 0 1px 4px rgba(0,0,0,0.12); }

.quiz-section { padding: 1.5rem; border-radius: 12px; margin-bottom: 2rem; background: #f9fafb; border: 1px solid #eef2f7; }
.quiz-section.highlight { background: #fef3c7; border-color: #fde68a; }
.quiz-section-title { margin: 0 0 1rem 0; font-size: 1.3rem; color: #111; }

/* Scoreboard stat chips */
.quiz-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-bottom: 2rem; }
.quiz-stat { min-width: 108px; padding: 0.6rem 1.1rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; text-align: center; }
.quiz-stat-value { display: block; font-size: 1.5rem; font-weight: 700; color: #111; line-height: 1.2; font-variant-numeric: tabular-nums; }
.quiz-stat-label { display: block; font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #6b7280; margin-top: 0.2rem; }
.quiz-stat.stat-correct .quiz-stat-value { color: #10b981; }
.quiz-stat.stat-incorrect .quiz-stat-value { color: #ef4444; }
.quiz-stat.stat-total { background: linear-gradient(135deg, #eff6ff, #e0f2fe); border-color: #bfdbfe; }
.quiz-stat.stat-total .quiz-stat-value { color: #4a90e2; }

/* Leaderboard rows */
.lb-row { display: flex; justify-content: space-between; align-items: center; padding: 0.7rem 0.9rem; background: white; border: 1px solid #eef2f7; border-radius: 10px; font-weight: 500; }
.lb-row.current { background: #eff6ff; border-color: #bfdbfe; font-weight: 600; box-shadow: inset 3px 0 0 #4a90e2; }
.lb-name { font-size: 1.05rem; }
.lb-score { color: #10b981; font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* Badge cards */
.badge-card { padding: 0.75rem 0.9rem; background: white; border: 1px solid #eef2f7; border-radius: 10px; }
.badge-card + .badge-card { margin-top: 0.5rem; }
.badge-name { font-size: 1.05rem; font-weight: 600; }
.badge-rank { color: #6b7280; font-size: 0.9rem; font-weight: 500; }
.badge-icons { font-size: 1.4rem; letter-spacing: 0.2rem; word-wrap: break-word; line-height: 1.9rem; margin-top: 0.35rem; }

.quiz-dropdowns-row { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 1.5rem; align-items: flex-end; justify-content: center; }
.quiz-dropdown-group { display: flex; flex-direction: column; gap: 0.5rem; }
.quiz-dropdown-label { font-weight: 600; font-size: 0.9rem; color: #374151; }

.modern-select {
  padding: 0.75rem 1rem; font-size: 1rem; font-weight: 500; color: #1f2937;
  background: linear-gradient(to bottom, #ffffff, #f9fafb);
  border: 2px solid #d1d5db; border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05); cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 0.75rem center; background-repeat: no-repeat; background-size: 1.25rem;
  padding-right: 2.5rem;
}
.modern-select:hover { border-color: #9ca3af; box-shadow: 0 2px 8px rgba(0,0,0,0.08); background-color: #ffffff; }
.modern-select:focus { outline: none; border-color: #4a90e2; box-shadow: 0 0 0 4px rgba(74,144,226,0.12), 0 2px 8px rgba(0,0,0,0.08); background-color: #ffffff; }
.modern-select:active { transform: translateY(1px); }
