@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Comic+Neue:wght@400;700&display=swap');

:root {
  /* Vibrant Theme (Default) */
  --bg-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
  --app-bg: #090d16;
  --surface: rgba(22, 28, 45, 0.88);
  --surface-hover: rgba(35, 44, 70, 0.95);
  --surface-border: rgba(255, 255, 255, 0.12);
  --text-main: #ffffff;
  --text-muted: #94a3b8;
  
  --primary: #8b5cf6;
  --primary-glow: rgba(139, 92, 246, 0.45);
  --accent-pink: #ec4899;
  --accent-cyan: #06b6d4;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;

  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

/* Sensory Calm Mode (ADHD & Sensory Overload friendly) */
body.theme-calm {
  --bg-gradient: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 50%, #64748b 100%);
  --app-bg: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --surface-border: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.2);
  --accent-pink: #d946ef;
  --accent-cyan: #0284c7;
  --accent-amber: #d97706;
  --accent-emerald: #059669;
  --accent-rose: #e11d48;
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* High Contrast Mode */
body.theme-highcontrast {
  --bg-gradient: #000000;
  --app-bg: #000000;
  --surface: #121212;
  --surface-hover: #1f1f1f;
  --surface-border: #ffff00;
  --text-main: #ffffff;
  --text-muted: #e2e8f0;
  --primary: #ffff00;
  --primary-glow: rgba(255, 255, 0, 0.4);
  --accent-pink: #ff007f;
  --accent-cyan: #00ffff;
  --accent-amber: #ffa500;
  --accent-emerald: #00ff66;
  --accent-rose: #ff3333;
}

/* Dyslexia Friendly Font Mode */
body.font-dyslexic {
  --font-family: 'Comic Neue', cursive, sans-serif;
  letter-spacing: 0.035em;
  word-spacing: 0.06em;
  line-height: 1.75;
}

* {
  box-sizing: border-box;
  font-family: var(--font-family);
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

/* Mobile Frame Container */
.mobile-container {
  width: 100%;
  max-width: 440px;
  height: 100vh;
  max-height: 900px;
  background: var(--app-bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6);
}

@media (min-width: 768px) {
  .mobile-container {
    height: 92vh;
    border-radius: 36px;
    border: 3px solid rgba(255, 255, 255, 0.18);
  }
}

/* Header */
.app-header {
  padding: max(16px, env(safe-area-inset-top)) 18px 12px 18px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--surface-border);
  z-index: 20;
}

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

.app-title-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.streak-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.xp-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.xp-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.xp-bar-bg {
  height: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #ec4899, #8b5cf6);
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Scroll Area */
.view-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 90px 16px;
  scroll-behavior: smooth;
}

.view-content::-webkit-scrollbar {
  width: 4px;
}
.view-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* Glass Card */
.glass-card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--card-shadow);
  margin-bottom: 16px;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.glass-card.interactive:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.25);
}

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

/* Bottom Navigation Bar */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--surface-border);
  display: flex;
  justify-content: space-around;
  padding: 8px 6px 14px 6px;
  z-index: 30;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 16px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item.active {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 4px 14px var(--primary-glow);
  transform: translateY(-2px);
}

/* Quest Card Step Progression */
.quest-step-pill {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border: 1px solid var(--surface-border);
}

.quest-step-pill.completed {
  background: var(--accent-emerald);
  color: #ffffff;
  border-color: var(--accent-emerald);
}

.quest-step-pill.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Big Action Button */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent-pink));
  color: white;
  border: none;
  border-radius: 16px;
  padding: 12px 20px;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(139, 92, 246, 0.5);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Audio Speaker Button */
.audio-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--surface-border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.audio-btn:hover {
  background: var(--accent-cyan);
  color: white;
  transform: scale(1.1);
}

/* Quiz Option Button */
.quiz-opt {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--surface-border);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.quiz-opt:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.quiz-opt.correct {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--accent-emerald);
  color: #34d399;
}

.quiz-opt.incorrect {
  background: rgba(244, 63, 94, 0.2);
  border-color: var(--accent-rose);
  color: #fb7185;
}

/* Floating Confetti Canvas */
#confetti-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

/* Micro-reward Pop Notification */
.xp-popup {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.3);
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  color: white;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.5);
  opacity: 0;
  pointer-events: none;
  z-index: 110;
  transition: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.xp-popup.show {
  opacity: 1;
  transform: translate(-50%, -70%) scale(1.08);
}

/* Category Filter Tags */
.filter-chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border: 1px solid var(--surface-border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Badges Grid */
.badge-tile {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--surface-border);
  border-radius: 18px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  transition: transform 0.2s ease;
}

.badge-tile.locked {
  opacity: 0.45;
  filter: grayscale(1);
}

.badge-tile:hover {
  transform: translateY(-2px);
}
