/* ============================================
   CSS Variables & Theme
   ============================================ */
:root {
  --primary: #4B2D8E;
  --primary-light: #6B42B8;
  --primary-dark: #3A1F70;
  --primary-bg: #f3eef9;
  --secondary: #00BCD4;
  --secondary-light: #26C6DA;
  --secondary-dark: #00838F;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --success: #10b981;
  --success-light: #34d399;
  --error: #ef4444;
  --error-light: #fca5a5;
  --bg: #f8f5fc;
  --bg-alt: #f3eef9;
  --card: #ffffff;
  --text: #1e293b;
  --text-secondary: #475569;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-md: 0 6px 12px -2px rgba(0,0,0,0.08), 0 3px 6px -3px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.1), 0 4px 10px -4px rgba(0,0,0,0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --radius-full: 9999px;
  --font: 'Rubik', 'Heebo', system-ui, -apple-system, sans-serif;
  --nav-height: 72px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  direction: rtl;
}

#app {
  position: relative;
  width: 100%;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}

/* ============================================
   Typography
   ============================================ */
h1 { font-size: 1.75rem; font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.35rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.1rem; font-weight: 600; line-height: 1.4; }
p { line-height: 1.6; }

/* ============================================
   Screens
   ============================================ */
.screen {
  display: none;
  position: absolute;
  inset: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 1;
}

.screen.active {
  display: flex;
  flex-direction: column;
  animation: screenFadeIn 0.3s ease;
}

.screen-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 16px;
  padding-bottom: calc(var(--nav-height) + 24px);
  -webkit-overflow-scrolling: touch;
}

.screen-header {
  margin-bottom: 20px;
}

.screen-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.96); }

.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; border-radius: var(--radius); }
.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: white;
  box-shadow: 0 4px 12px rgba(75, 45, 142, 0.3);
}
.btn-primary:hover { box-shadow: 0 6px 16px rgba(75, 45, 142, 0.4); }
.btn-primary:disabled {
  background: var(--border);
  color: var(--text-light);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-accent {
  background: linear-gradient(135deg, var(--secondary-light), var(--secondary));
  color: white;
  box-shadow: 0 4px 12px rgba(0, 188, 212, 0.3);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-light), var(--success));
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.btn-success:disabled {
  background: var(--border);
  color: var(--text-light);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover { background: rgba(0,0,0,0.05); }

/* ============================================
   Form Elements
   ============================================ */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
  background: var(--card);
  transition: border-color var(--transition);
  direction: rtl;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-group input::placeholder {
  color: var(--text-light);
}

/* ============================================
   Messages
   ============================================ */
.message {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 16px;
  text-align: center;
  animation: slideUp 0.3s ease;
}

.message.hidden { display: none; }
.message-success { background: #d1fae5; color: #065f46; }
.message-error { background: #fee2e2; color: #991b1b; }
.message-info { background: #dbeafe; color: #1e40af; }

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

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.login-lion-logo {
  max-width: 200px;
  height: auto;
  margin-bottom: 16px;
  animation: bounceIn 0.6s ease;
  filter: drop-shadow(0 4px 12px rgba(0, 56, 132, 0.25));
}

.login-logo-img {
  max-width: 180px;
  height: auto;
  margin-top: 16px;
  opacity: 0.9;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.login-tabs {
  display: flex;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: var(--radius-xs);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--text-light);
  transition: all var(--transition);
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: screenFadeIn 0.2s ease;
}

@keyframes bounceIn {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* ============================================
   HOME SCREEN
   ============================================ */
.home-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.home-logo {
  width: 56px;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.home-greeting h1 {
  color: var(--text);
  margin-bottom: 2px;
}

.student-number-display {
  font-size: 0.8rem;
  color: var(--text-light);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: transform var(--transition);
}

.stat-card:active { transform: scale(0.97); }

.stat-icon-wrap {
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: 500;
}

.stat-points .stat-value { color: var(--accent); }
.stat-reads .stat-value { color: var(--secondary-dark); }
.stat-stickers .stat-value { color: var(--primary); }

/* Progress Section */
.progress-section {
  margin-bottom: 20px;
}

.progress-section h3 {
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.progress-bar-container {
  height: 14px;
  background: var(--border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
}

/* Earned Stickers */
.earned-stickers-section {
  margin-bottom: 20px;
}

.earned-stickers-section h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.earned-stickers {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-sticker {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  background: var(--card);
  border-radius: 50%;
  box-shadow: var(--shadow);
  border: 2px solid var(--secondary-light);
  animation: stickerPop 0.4s ease backwards;
}

.mini-sticker:nth-child(2) { animation-delay: 0.1s; }
.mini-sticker:nth-child(3) { animation-delay: 0.2s; }
.mini-sticker:nth-child(4) { animation-delay: 0.3s; }
.mini-sticker:nth-child(5) { animation-delay: 0.4s; }

@keyframes stickerPop {
  0% { transform: scale(0); }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.no-stickers {
  color: var(--text-light);
  font-size: 0.85rem;
  font-style: italic;
}

/* Aquarium */
.aquarium-section {
  margin-bottom: 20px;
  overflow: hidden;
}

.aquarium-section h3 {
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.aquarium {
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 160px;
  position: relative;
}

.aquarium-water {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 50%, #0369a1 100%);
  position: relative;
  overflow: hidden;
}

.aquarium-sand {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(180deg, #d4a574, #c2956b);
  border-radius: 50% 50% 0 0 / 12px 12px 0 0;
}

.aquarium-item {
  position: absolute;
  font-size: 1.6rem;
  transition: all 0.5s ease;
}

.aquarium-item.fish {
  animation: swim 6s ease-in-out infinite alternate;
}

.aquarium-item.fish:nth-child(even) {
  animation-duration: 8s;
  animation-direction: alternate-reverse;
}

.aquarium-item.decoration {
  bottom: 20px;
}

@keyframes swim {
  0% { transform: translateX(0) scaleX(1); }
  49% { transform: translateX(100px) scaleX(1); }
  50% { transform: translateX(100px) scaleX(-1); }
  99% { transform: translateX(0) scaleX(-1); }
  100% { transform: translateX(0) scaleX(1); }
}

/* Bubbles */
.bubbles { position: absolute; inset: 0; pointer-events: none; }

.bubble {
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
  animation: bubbleRise 4s ease-in infinite;
}

.bubble:nth-child(1) { right: 20%; animation-delay: 0s; bottom: 0; }
.bubble:nth-child(2) { right: 50%; animation-delay: 1.5s; bottom: 0; width: 6px; height: 6px; }
.bubble:nth-child(3) { right: 75%; animation-delay: 3s; bottom: 0; width: 10px; height: 10px; }

@keyframes bubbleRise {
  0% { transform: translateY(0) scale(1); opacity: 0.6; }
  100% { transform: translateY(-150px) scale(0.5); opacity: 0; }
}

/* Home Actions */
.home-actions {
  margin-top: 8px;
  margin-bottom: 16px;
}

.btn-start-reading {
  font-size: 1.15rem;
  padding: 16px 28px;
}

/* ============================================
   PAGES SCREEN
   ============================================ */
.pages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px 4px;
  margin-top: 8px;
  border-bottom: 2px solid var(--primary);
}

.category-header:first-child {
  margin-top: 0;
}

.category-header h3 {
  color: var(--primary);
  font-size: 1rem;
}

.category-points {
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 600;
  background: var(--primary-bg);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.page-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: transform var(--transition), box-shadow var(--transition);
}

.page-card:active { transform: scale(0.98); }

.page-info { flex: 1; }

.page-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.page-meta {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-light);
}

.page-points {
  color: var(--secondary-dark);
  font-weight: 600;
}

.page-reads {
  color: var(--primary);
  font-weight: 500;
}

/* ============================================
   READING SCREEN
   ============================================ */
#screen-reading {
  display: none;
}

#screen-reading.active {
  display: flex;
  flex-direction: column;
}

.reading-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  z-index: 2;
}

.reading-header h2 {
  font-size: 1.1rem;
  flex: 1;
  text-align: center;
  margin-inline-start: 48px;
}

.reading-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.pdf-viewer {
  width: 100%;
  height: 100%;
  border: none;
}

.pdf-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  color: var(--text-secondary);
}

.pdf-fallback.hidden { display: none; }

.reading-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--card);
  border-top: 1px solid var(--border);
  gap: 12px;
}

.timer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.timer svg { color: var(--text-light); }

.timer.ready { color: var(--success); }
.timer.ready svg { color: var(--success); }

/* ============================================
   VERIFY SCREEN
   ============================================ */
.verify-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.verify-header {
  margin-bottom: 24px;
}

.verify-icon {
  margin-bottom: 12px;
}

.verify-header h2 {
  margin-bottom: 8px;
}

.verify-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.math-challenge {
  width: 100%;
  max-width: 340px;
}

.math-problem {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 20px;
  padding: 16px;
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  direction: ltr;
}

.verify-back {
  margin-top: 16px;
  color: var(--text-light);
}

/* ============================================
   SUCCESS OVERLAY
   ============================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: overlayFadeIn 0.3s ease;
  padding: 24px;
}

.overlay.hidden { display: none; }

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

.success-content {
  background: var(--card);
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  animation: successPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

@keyframes successPopIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.success-stars {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.star-float {
  font-size: 2rem;
  animation: starFloat 1.5s ease-in-out infinite alternate;
}

.star-float:nth-child(2) { animation-delay: 0.3s; }
.star-float:nth-child(3) { animation-delay: 0.6s; }

@keyframes starFloat {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-8px) rotate(10deg); }
}

.success-content h2 {
  font-size: 1.75rem;
  margin-bottom: 8px;
  color: var(--text);
}

.success-points {
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.success-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.new-sticker-section {
  margin: 16px 0;
  padding: 16px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: var(--radius);
  animation: stickerReveal 0.8s ease 0.3s backwards;
}

.new-sticker-section.hidden { display: none; }

@keyframes stickerReveal {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  60% { transform: scale(1.1) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.new-sticker-badge {
  font-size: 3.5rem;
  margin-bottom: 8px;
  animation: stickerBounce 0.6s ease 0.8s backwards;
}

@keyframes stickerBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.new-sticker-section h3 {
  margin-bottom: 4px;
}

.sticker-meaning-text {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ============================================
   STICKERS SCREEN
   ============================================ */
.stickers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding-bottom: 16px;
}

.sticker-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 2px solid var(--border-light);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.sticker-card.earned {
  border-color: var(--secondary-light);
  background: linear-gradient(135deg, #fffbeb, var(--card));
}

.sticker-card.earned::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(245,158,11,0.08), transparent);
}

.sticker-card.locked {
  opacity: 0.55;
  filter: grayscale(0.6);
}

.sticker-emoji {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 3px solid var(--border);
  background: var(--border-light);
  transition: all var(--transition);
}

.sticker-card.earned .sticker-emoji {
  border-color: var(--secondary);
  background: rgba(245, 158, 11, 0.1);
  box-shadow: 0 0 20px rgba(245,158,11,0.2);
}

.sticker-name {
  font-size: 1rem;
  margin-bottom: 4px;
}

.sticker-meaning {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 6px;
}

.sticker-condition {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
}

.sticker-card.earned .sticker-condition {
  color: var(--success);
}

/* ============================================
   LEADERBOARD SCREEN
   ============================================ */
.leaderboard-podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 24px;
  padding: 16px 8px;
  min-height: 180px;
}

.podium-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  max-width: 120px;
}

.podium-medal {
  font-size: 2.2rem;
  margin-bottom: 6px;
}

.podium-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 6px;
  border: 3px solid var(--border);
}

.podium-name {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-score {
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: 600;
}

.podium-bar {
  width: 100%;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin-top: 8px;
  transition: height 0.5s ease;
}

.podium-1 .podium-bar { height: 100px; background: linear-gradient(180deg, #fbbf24, #f59e0b); }
.podium-2 .podium-bar { height: 75px; background: linear-gradient(180deg, #d1d5db, #9ca3af); }
.podium-3 .podium-bar { height: 55px; background: linear-gradient(180deg, #fdba74, #f97316); }

.podium-1 .podium-avatar { border-color: #f59e0b; }
.podium-2 .podium-avatar { border-color: #9ca3af; }
.podium-3 .podium-avatar { border-color: #f97316; }

.podium-entry.is-me .podium-name { color: var(--primary); }

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leaderboard-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.leaderboard-entry.is-me {
  background: var(--primary-bg);
  border-color: var(--primary-light);
}

.lb-rank {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border-light);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.leaderboard-entry.is-me .lb-rank {
  background: var(--primary);
  color: white;
}

.lb-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
}

.lb-score {
  font-weight: 700;
  color: var(--secondary-dark);
  font-size: 0.9rem;
}

.leaderboard-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

/* ============================================
   BOTTOM NAVIGATION
   ============================================ */
#navbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 50;
}

#navbar.hidden { display: none; }

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.nav-btn svg {
  transition: all var(--transition);
}

.nav-btn.active {
  color: var(--primary);
}

.nav-btn.active svg {
  stroke: var(--primary);
  transform: scale(1.1);
}

.nav-btn.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}

.nav-btn span {
  font-weight: 600;
}

/* ============================================
   CONFETTI
   ============================================ */
#confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -10px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-10vh) rotate(0deg);
    opacity: 1;
  }
  80% { opacity: 1; }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* ============================================
   LOADING STATE
   ============================================ */
.loading-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-light);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 8px;
}

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 360px) {
  :root { font-size: 14px; }
  .stats-grid { gap: 8px; }
  .stat-card { padding: 12px 8px; }
  .stickers-grid { gap: 10px; }
}

/* Tablet */
@media (min-width: 600px) {
  .screen-scroll {
    padding: 28px 32px;
    padding-bottom: calc(var(--nav-height) + 32px);
  }

  .login-container {
    max-width: 440px;
  }

  .stats-grid {
    gap: 16px;
  }

  .stat-card {
    padding: 24px 16px;
  }

  .stat-value {
    font-size: 2.2rem;
  }

  .stickers-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .pages-list {
    gap: 14px;
  }

  .page-card {
    padding: 20px;
  }

  .leaderboard-entry {
    padding: 14px 20px;
  }
}

/* Desktop */
@media (min-width: 900px) {
  .screen-scroll {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 40px;
    padding-bottom: calc(var(--nav-height) + 40px);
  }

  .login-container {
    max-width: 480px;
  }

  .stats-grid {
    gap: 20px;
  }

  .stat-card {
    padding: 28px 20px;
  }

  .stat-value {
    font-size: 2.5rem;
  }

  .stickers-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .sticker-card {
    padding: 24px 20px;
  }

  .sticker-emoji {
    width: 88px;
    height: 88px;
    font-size: 3rem;
  }

  .page-card {
    padding: 24px;
  }

  .page-title {
    font-size: 1.15rem;
  }

  .aquarium {
    height: 200px;
  }

  .leaderboard-podium {
    min-height: 220px;
    gap: 16px;
  }

  .podium-entry {
    max-width: 160px;
  }

  .verify-container {
    max-width: 500px;
    margin: 0 auto;
  }

  .math-problem {
    font-size: 2.5rem;
  }

  .success-content {
    max-width: 440px;
  }

  #navbar {
    max-width: 600px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .nav-btn {
    padding: 10px 20px;
    font-size: 0.8rem;
  }
}

/* Wide desktop */
@media (min-width: 1200px) {
  .screen-scroll {
    max-width: 960px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 600px;
  }

  .pages-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .category-header {
    grid-column: 1 / -1;
  }

  .leaderboard-list {
    max-width: 600px;
    margin: 0 auto;
  }
}

/* ============================================
   UTILITY
   ============================================ */
.hidden { display: none !important; }

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

.fade-in {
  animation: screenFadeIn 0.3s ease;
}

/* Gentle pulse for important elements */
.pulse {
  animation: pulse 2s ease-in-out infinite;
}

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