/* ==========================================================================
   KIDS LEARNING SITE - MODULAR ORGANIZED STYLESHEET
   ========================================================================== */

/*
   This file maintains the exact functionality and order of the original 
   style.css but adds clear modular organization for better maintainability.
   
   SECTIONS:
   1. Base Styles & Typography
   2. Layout & Components  
   3. Navigation System
   4. Tiles & Interactions
   5. Authentication
   6. Questions & Results
   7. Safari Features
   8. Responsive Design
*/

/* ==========================================================================
   1. BASE STYLES & TYPOGRAPHY
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700&family=Poppins:wght@400;700&display=swap');

/* --- Playful Animated Background --- */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: 0;
  pointer-events: none;
  background: url('data:image/svg+xml;utf8,<svg width="400" height="400" xmlns="http://www.w3.org/2000/svg"><circle cx="60" cy="60" r="32" fill="%237ed957" fill-opacity="0.13"/><circle cx="340" cy="120" r="24" fill="%232d5be3" fill-opacity="0.10"/><rect x="200" y="300" width="60" height="60" rx="18" fill="%23e6b800" fill-opacity="0.10"/><ellipse cx="320" cy="340" rx="18" ry="12" fill="%23ffb347" fill-opacity="0.10"/><polygon points="100,350 120,370 80,370" fill="%23ff6b6b" fill-opacity="0.10"/></svg>');
  background-repeat: repeat;
  animation: bg-move 30s linear infinite;
}
@keyframes bg-move {
  0% { background-position: 0 0; }
  100% { background-position: 400px 400px; }
}
body {
  position: relative;
  z-index: 1;
}

body {
  font-family: 'Poppins', 'Nunito', 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(120deg, #e0eafc 0%, #c2e9fb 100%);
  margin: 0;
  padding: 0;
  color: #263159;
}
#app {
  max-width: 800px;
  margin: 40px auto;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 6px 32px rgba(44, 62, 80, 0.10);
  padding: 40px 28px 32px 28px;
  border: 1.5px solid #e3e8ee;
}
h1 {
  color: #2d5be3;
  text-align: center;
  font-family: 'Poppins', 'Nunito', Arial, sans-serif;
  font-size: 2.5rem;
  margin-bottom: 18px;
  letter-spacing: 1.5px;
  text-shadow: 0 2px 0 #e0eafc;
}
select, button {
  font-size: 1.1rem;
  margin: 10px 0;
  padding: 8px 18px;
  border-radius: 8px;
  border: 1.5px solid #b6c6e3;
  background: #f5f8fa;
  color: #2d5be3;
  font-weight: 600;
  transition: background 0.2s, color 0.2s, border 0.2s;
}
select:focus, button:focus {
  outline: none;
  border-color: #2d5be3;
}
button:hover {
  background: #2d5be3;
  color: #fff;
  border-color: #2d5be3;
}
.question {
  margin: 22px 0;
  padding: 22px 18px 18px 18px;
  background: #f5f8fa;
  border-radius: 14px;
  color: #2d5be3;
  font-size: 1.15rem;
  box-shadow: 0 2px 8px rgba(45,91,227,0.06);
  border: 1.5px solid #e3e8ee;
}
.question label {
  display: block;
  margin: 10px 0;
  background: #e0eafc;
  color: #2d5be3;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 1.1rem;
  transition: background 0.2s;
}
.question label:hover {
  background: #cfdef3;
}
#result p {
  font-size: 1.15rem;
  color: #1a7f37;
  font-weight: bold;
  margin-top: 18px;
  text-align: center;
}
.tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 32px 0 18px 0;
  justify-content: flex-start;
}
.tile, .tile-responsive {
  background: #e0eafc;
  color: #2d5be3;
  border-radius: 16px;
  padding: 26px 36px;
  font-size: 1.18rem;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(45,91,227,0.10);
  cursor: pointer;
  border: 2px solid #b6c6e3;
  transition: background 0.2s, color 0.2s, border 0.2s, box-shadow 0.2s;
  text-align: center;
  min-width: 120px;
  margin-bottom: 8px;
}
.tile:hover, .tile-responsive:hover {
  background: #7ed957;
  color: #fff;
  border-color: #2d5be3;
  box-shadow: 0 4px 16px rgba(45,91,227,0.13);
}
.nav {
  margin-bottom: 18px;
  font-size: 1.1rem;
  color: #2d5be3;
  font-weight: 600;
}
.nav-link {
  color: #2d5be3;
  text-decoration: underline;
  cursor: pointer;
  margin-right: 4px;
}
.nav-link:hover {
  color: #1a3e8a;
}
.site-title {
  font-family: 'Nunito', 'Segoe UI', Arial, sans-serif;
  color: #2d5be3;
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 10px;
  letter-spacing: 1.5px;
  text-shadow: 0 1px 0 #e0eafc;
}

.subtitle {
  font-family: 'Nunito', 'Segoe UI', Arial, sans-serif;
  color: #5a6c85;
  text-align: center;
  font-size: 1.3rem;
  margin-bottom: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}
/* ==========================================================================
   3. NAVIGATION SYSTEM
   ========================================================================== */

.topnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  background: #f5f8fa;
  border-radius: 12px;
  padding: 10px 18px;
  box-shadow: 0 2px 8px rgba(45,91,227,0.06);
  position: relative;
  z-index: 200;
  /* Ensure hamburger and coins are always visible above background and overlays */
}
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 38px;
  height: 38px;
  background: #fffbe7; /* Add a bun background for more hamburger look */
  border: 2px solid #e6b800;
  border-radius: 12px;
  cursor: pointer;
  margin-right: 10px;
  z-index: 9999; /* Highest z-index to ensure it's always on top */
  box-shadow: 0 2px 8px #e6b80033;
  position: relative;
  overflow: visible;
}
.hamburger span {
  display: block;
  height: 5px;
  width: 26px;
  margin: 4px 0;
  border-radius: 3px;
  transition: 0.3s;
  background: #e6b800;
  box-shadow: 0 1px 2px #bfa10044;
}
.hamburger span:nth-child(1) {
  background: linear-gradient(90deg, #ffe066 60%, #e6b800 100%); /* Top bun */
  box-shadow: 0 1px 2px #bfa10044;
}
.hamburger span:nth-child(2) {
  background: linear-gradient(90deg, #7ed957 60%, #b6e67e 100%); /* Lettuce */
  box-shadow: 0 1px 2px #5fae3c44;
}
.hamburger span:nth-child(3) {
  background: linear-gradient(90deg, #c44 60%, #a22a2a 100%); /* Patty */
  box-shadow: 0 1px 2px #a22a2a44;
}
/* Add a fourth line for the bottom bun */
.hamburger span:nth-child(4) {
  background: linear-gradient(90deg, #ffe066 60%, #e6b800 100%); /* Bottom bun */
  box-shadow: 0 1px 2px #bfa10044;
}

/* Hamburger open/close animation (now with 4 lines) */
.hamburger.active span:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  opacity: 0;
}
.hamburger.active span:nth-child(4) {
  transform: translateY(-10px) rotate(-45deg);
}

.topnav-links {
  position: absolute;
  top: 100%;
  left: auto;
  right: 18px;
  width: 260px;
  max-width: 90vw;
  background: #f5f8fa;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 2px 8px rgba(45,91,227,0.06);
  padding: 0 0 10px 0;
  display: none;
  z-index: 9998; /* High z-index for dropdown menu */
}
.topnav-links.open {
  display: flex;
}
.topnav-links .nav-link, .topnav-links .user-greeting, .topnav-links .logout-btn {
  width: 100%;
  padding: 12px 18px;
  border-bottom: 1px solid #e3e8ee;
  margin: 0;
  text-align: left;
}
.topnav-links .logout-btn {
  border-bottom: none;
}

/* Hide nav links when hamburger is closed */
.topnav-links {
  display: none;
}

.user-greeting {
  font-size: 1.1rem;
  color: #2d5be3;
  margin-right: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.coins-bar {
  text-align: center;
  font-size: 1.2rem;
  margin-bottom: 16px;
  font-weight: bold;
  color: #e6b800;
  background: #f9fbe7;
  border-radius: 8px;
  padding: 8px 0;
  box-shadow: 0 1px 4px rgba(230, 184, 0, 0.08);
}
.coins-bar.topnav-coins {
  margin: 0 0 0 auto;
  background: none;
  box-shadow: none;
  color: #e6b800;
  font-size: 1.1rem;
  font-weight: bold;
  padding: 0 10px;
  z-index: 110;
  display: flex;
  align-items: center;
}

/* Speech toggle button in top navigation */
.speech-toggle-btn {
  background: linear-gradient(145deg, #4CAF50, #45a049);
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  z-index: 120;
}

.speech-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.speech-toggle-btn:active {
  transform: scale(0.95);
}
.welcome-msg {
  text-align: center;
  margin-bottom: 18px;
  font-size: 1.13rem;
  color: #2d5be3;
  background: #e0eafc;
  border-radius: 8px;
  padding: 10px 0;
  font-family: 'Nunito', Arial, sans-serif;
}
.about-teddy {
  max-width: 520px;
  margin: 32px auto;
  background: #f5f8fa;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(45,91,227,0.08);
  padding: 32px 28px 24px 28px;
  border: 1px solid #e3e8ee;
  text-align: center;
}
.teddy-img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  margin-bottom: 18px;
  border: 3px solid #2d5be3;
}
.about-teddy h2 {
  color: #2d5be3;
  margin-bottom: 10px;
}
.about-teddy p {
  color: #333;
  font-size: 1.13rem;
  margin-bottom: 12px;
}

.team-credits {
  margin-top: 20px !important;
  padding: 15px !important;
  background: #f0f8ff !important;
  border-radius: 10px !important;
  border-left: 4px solid #2d5be3 !important;
  text-align: left !important;
}

.team-credits h3 {
  color: #2d5be3;
  margin-bottom: 12px;
  font-size: 1.2rem;
}

.team-credits p {
  margin-bottom: 8px;
  font-size: 1rem;
  line-height: 1.4;
}

.team-credits em {
  color: #666;
  font-style: italic;
}

/* Authentication Styles */
/* ==========================================================================
   5. AUTHENTICATION SCREENS
   ========================================================================== */

.auth-container {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.auth-header h1 {
  font-size: 2.5rem;
  color: #2d5be3;
  margin-bottom: 10px;
}

.auth-header .main-tagline {
  font-size: 1.3rem;
  color: #666;
  margin-bottom: 40px;
  font-weight: 500;
}

/* Updated layout with buttons positioned after Teddy intro */
.auth-header .main-tagline {
  margin-bottom: 20px !important;
}

.teddy-welcome {
  margin-bottom: 30px !important;
}

.auth-options {
  margin-bottom: 30px !important;
}

.auth-info-section {
  margin-top: 20px !important;
}

/* Auth Info Section */
.auth-info-section {
  margin-bottom: 40px;
}

.teddy-welcome {
  margin-bottom: 40px;
}

.teddy-intro-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  background: linear-gradient(135deg, #fff8e1 0%, #ffe0b2 100%);
  border-radius: 20px;
  padding: 25px;
  border: 2px solid #ffcc80;
  box-shadow: 0 4px 15px rgba(255, 193, 7, 0.1);
  text-align: left;
  max-width: 600px;
  margin: 0 auto;
}

.teddy-avatar {
  font-size: 3rem;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.teddy-speech-bubble {
  flex: 1;
}

.teddy-speech-bubble p {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.6;
  color: #5d4037;
}

.teddy-speech-bubble strong {
  color: #e65100;
  font-size: 1.2rem;
}

/* Get Started Button - Repositioned above features */
.get-started {
  text-align: center;
  margin: 30px 0 40px 0;
}

.get-started .cta-button {
  background: linear-gradient(135deg, #2d5be3 0%, #1e3db8 100%);
  color: white;
  border: none;
  padding: 18px 40px;
  font-size: 1.3rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(45, 91, 227, 0.3);
  text-transform: none;
  letter-spacing: 0.5px;
}

.get-started .cta-button:hover {
  background: linear-gradient(135deg, #1e3db8 0%, #162d95 100%);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(45, 91, 227, 0.4);
}

.get-started .cta-button:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(45, 91, 227, 0.3);
}

/* Learning Preview Section */
.learning-preview {
  margin-bottom: 40px;
}

.learning-preview h3 {
  color: #2d5be3;
  font-size: 1.8rem;
  margin-bottom: 25px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.preview-item {
  display: flex;
  align-items: center;
  gap: 15px;
  background: linear-gradient(135deg, #f8f9ff 0%, #e8f1ff 100%);
  border-radius: 15px;
  padding: 20px;
  border: 2px solid #c2d5ff;
  transition: all 0.3s ease;
  text-align: left;
}

.preview-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(45, 91, 227, 0.15);
  border-color: #4c6ef5;
}

.preview-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.preview-content strong {
  display: block;
  color: #2d5be3;
  font-size: 1.2rem;
  margin-bottom: 5px;
  font-weight: 600;
}

.preview-content p {
  margin: 0;
  color: #5a6c7d;
  font-size: 1rem;
  line-height: 1.4;
}

/* Why Account Section */
.why-account {
  margin-bottom: 40px;
}

.why-account h3 {
  color: #2d5be3;
  font-size: 1.8rem;
  margin-bottom: 25px;
}

.benefits-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 500px;
  margin: 0 auto;
}

.benefit-item {
  display: flex;
  align-items: center;
  gap: 15px;
  background: white;
  border-radius: 12px;
  padding: 18px 20px;
  border: 2px solid #e8f1ff;
  box-shadow: 0 2px 8px rgba(45, 91, 227, 0.05);
  text-align: left;
  transition: all 0.3s ease;
}

.benefit-item:hover {
  transform: translateX(5px);
  border-color: #c2d5ff;
  box-shadow: 0 4px 12px rgba(45, 91, 227, 0.1);
}

.benefit-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.benefit-text {
  font-size: 1rem;
  color: #4a5568;
  line-height: 1.4;
}

.benefit-text strong {
  color: #2d5be3;
  font-weight: 600;
}

/* Enhanced Auth Options */
.auth-options h3 {
  color: #2d5be3;
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.auth-options-subtitle {
  font-size: 1.1rem;
  color: #666;
  margin-bottom: 30px;
  font-weight: 400;
}

.auth-buttons {
  display: flex;
  gap: 25px;
  justify-content: center;
  flex-wrap: wrap;
}

.auth-btn {
  padding: 20px 30px;
  font-size: 1.2rem;
  border-radius: 15px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.auth-btn .btn-subtitle {
  font-size: 0.9rem;
  font-weight: 400;
  opacity: 0.8;
  line-height: 1.2;
}

.auth-btn.primary {
  background: #2d5be3;
  color: white;
}

.auth-btn.primary:hover {
  background: #1e3db8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(45, 91, 227, 0.3);
}

.auth-btn.secondary {
  background: #f5f8fa;
  color: #2d5be3;
  border: 2px solid #2d5be3;
}

.auth-btn.secondary:hover {
  background: #2d5be3;
  color: white;
}

.auth-btn:disabled {
  background: #ccc;
  color: #666;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-form {
  background: #f9fbfc;
  padding: 30px;
  border-radius: 16px;
  border: 2px solid #e3e8ee;
  text-align: left;
  max-width: 500px;
  margin: 0 auto;
}

.auth-form h3 {
  color: #2d5be3;
  text-align: center;
  margin-bottom: 10px;
  font-size: 1.5rem;
}

.auth-form > p {
  text-align: center;
  color: #666;
  margin-bottom: 25px;
}

.form-group {
  margin-bottom: 25px;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: #2d5be3;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e3e8ee;
  border-radius: 8px;
  font-size: 1.1rem;
  box-sizing: border-box;
}

.form-group input:focus {
  border-color: #2d5be3;
  outline: none;
}

.help-text {
  font-size: 0.9rem;
  color: #888;
  margin-top: 5px;
  margin-bottom: 15px;
}

.picture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 12px;
  margin-top: 15px;
}

.picture-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  border: 2px solid #e3e8ee;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 70px;
}

.picture-option:hover {
  border-color: #2d5be3;
  background: #f5f8fa;
}

.picture-option.selected {
  border-color: #2d5be3;
  background: #e6f0ff;
  transform: scale(1.05);
}

.picture-emoji {
  font-size: 1.8rem;
  margin-bottom: 4px;
}

.picture-name {
  font-size: 0.8rem;
  color: #666;
  text-align: center;
}

.name-suggestions {
  margin-top: 15px;
}

.suggestions-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #f8f9ff 0%, #e8f1ff 100%);
  border-radius: 6px;
  border: 1px solid #c2d5ff;
}

.profile-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-suggestion {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  background: white;
  border: 2px solid #e0e8ff;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.profile-suggestion:hover {
  background: #f0f4ff;
  border-color: #2d5be3;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(45, 91, 227, 0.15);
}

.profile-suggestion .profile-emoji {
  font-size: 1.2rem;
}

.profile-suggestion .profile-name {
  font-weight: 500;
  color: #2d5be3;
}

/* Question Feedback Styling */
.correct-feedback {
  background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  display: inline-block;
  margin-top: 10px;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
  border: 2px solid #43a047;
}

.incorrect-feedback {
  background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  display: inline-block;
  margin-top: 10px;
  box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
  border: 2px solid #d32f2f;
}

.answer-feedback {
  background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  display: inline-block;
  margin-top: 10px;
  margin-left: 10px;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
  border: 2px solid #1976d2;
}

/* Feedback container styling */
.feedback-responsive {
  text-align: center;
  margin-top: 20px;
  padding: 15px;
  border-radius: 12px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* Animation for feedback appearance */
.correct-feedback,
.incorrect-feedback,
.answer-feedback {
  animation: feedbackSlideIn 0.3s ease-out;
}

@keyframes feedbackSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile responsive feedback */
@media (max-width: 768px) {
  .correct-feedback,
  .incorrect-feedback,
  .answer-feedback {
    padding: 8px 15px;
    font-size: 0.9rem;
    margin: 5px;
    display: block;
    text-align: center;
  }
  
  .answer-feedback {
    margin-left: 0;
    margin-top: 8px;
  }
}

/* Results Page Styling */
.results-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

.read-results-btn {
  background: #2d5be3;
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
  margin: 10px 0 20px 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.3s ease;
}

.read-results-btn:hover {
  background: #1e3f8f;
}

.results-summary-stats {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 25px;
  border-radius: 12px;
  margin: 20px 0;
  text-align: center;
}

.results-summary-stats h3 {
  margin-top: 0;
  font-size: 1.5rem;
}

.stats-highlight {
  font-size: 1.2rem;
  font-weight: bold;
  margin: 15px 0;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.progress-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.stat-box {
  background: rgba(255,255,255,0.2);
  padding: 15px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.stat-box.correct {
  background: rgba(34, 197, 94, 0.3);
}

.stat-box.incorrect {
  background: rgba(239, 68, 68, 0.3);
}

.stat-box.accuracy {
  background: rgba(245, 158, 11, 0.3);
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: bold;
  line-height: 1;
}

.stat-label {
  display: block;
  font-size: 0.9rem;
  margin-top: 5px;
  opacity: 0.9;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.results-table th {
  background: #2d5be3;
  color: white;
  padding: 15px 10px;
  text-align: left;
  font-weight: 600;
}

.results-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #f1f5f9;
}

.results-table tr:nth-child(even) {
  background: #f8fafc;
}

.results-table tr:hover {
  background: #e2e8f0;
}

.correct-cell {
  color: #059669;
  font-weight: 600;
}

.incorrect-cell {
  color: #dc2626;
  font-weight: 600;
}

.accuracy-cell {
  font-weight: 600;
  color: #7c3aed;
}

/* Mastery Progress Styles */
.mastery-progress {
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mastery-item {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 1px solid #e2e8f0;
}

.mastery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

.mastery-header h4 {
  margin: 0;
  color: #2d5be3;
  font-size: 1.1rem;
  font-weight: 600;
}

.mastery-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-pill {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: white;
}

.stat-pill.correct {
  background: #10b981;
}

.stat-pill.attempted {
  background: #3b82f6;
}

.stat-pill.accuracy {
  background: #8b5cf6;
}

.progress-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.progress-bar-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 500;
  color: #64748b;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-fill.attempted {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.progress-fill.mastery {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.mastery-cell {
  font-weight: 600;
  color: #10b981;
}

/* ==========================================================================
   8. RESPONSIVE DESIGN
   ========================================================================== */

/* Responsive design for results page */
@media (max-width: 768px) {
  .results-page {
    padding: 15px;
  }
  
  .progress-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stat-number {
    font-size: 1.5rem;
  }
  
  .results-table {
    font-size: 0.9rem;
  }
  
  .results-table th,
  .results-table td {
    padding: 8px 6px;
  }
  
  .mastery-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .mastery-stats {
    width: 100%;
  }
  
  .stat-pill {
    font-size: 0.8rem;
    padding: 3px 10px;
  }
}

@media (max-width: 480px) {
  .progress-stats {
    grid-template-columns: 1fr;
  }
  
  .results-table {
    font-size: 0.8rem;
  }
}

/* Learning Content Styling - Mobile-First Responsive Design */
.learning-content {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.learning-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
  align-items: flex-start;
}

.learning-header h3 {
  color: #1e40af;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.read-explanation-btn {
  background: #10b981;
  color: white;
  border: none;
  padding: 8px 16px;
  font-size: 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
  align-self: flex-start;
}

.read-explanation-btn:hover {
  background: #059669;
  transform: translateY(-1px);
}

.learning-image-container {
  text-align: center;
  margin: 15px 0;
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.learning-image {
  max-width: 100%;
  height: auto;
  max-height: 300px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease;
}

.learning-image:hover {
  transform: scale(1.02);
}

.image-fallback {
  color: #64748b;
  font-style: italic;
  padding: 20px;
  background: #f1f5f9;
  border-radius: 6px;
  border: 2px dashed #cbd5e1;
}

.learning-explanation {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: white;
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid #3b82f6;
  margin-top: 15px;
}

.explanation-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.explanation-text {
  color: #374151;
  line-height: 1.6;
  font-size: 1rem;
}

/* Tablet Responsive Design */
@media (min-width: 768px) {
  .learning-content {
    padding: 25px;
  }
  
  .learning-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .learning-header h3 {
    font-size: 1.2rem;
  }
  
  .read-explanation-btn {
    padding: 10px 20px;
    font-size: 1rem;
  }
  
  .learning-image {
    max-height: 400px;
  }
  
  .learning-explanation {
    padding: 20px;
  }
  
  .explanation-text {
    font-size: 1.1rem;
  }
}

/* Desktop Responsive Design */
@media (min-width: 1024px) {
  .learning-content {
    padding: 30px;
    margin: 25px 0;
  }
  
  .learning-header h3 {
    font-size: 1.3rem;
  }
  
  .learning-image {
    max-height: 500px;
  }
}

/* High-density screens */
@media (min-resolution: 192dpi) {
  .learning-image {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Dark mode support (if needed in future) */
@media (prefers-color-scheme: dark) {
  .learning-content {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-color: #475569;
    color: #e2e8f0;
  }
  
  .learning-header h3 {
    color: #60a5fa;
  }
  
  .learning-explanation {
    background: #1e293b;
    color: #e2e8f0;
    border-left-color: #60a5fa;
  }
  
  .explanation-text {
    color: #cbd5e1;
  }
  
  .image-fallback {
    background: #374151;
    border-color: #4b5563;
    color: #9ca3af;
  }
}

/* Print styles (for educational worksheets) */
@media print {
  .learning-content {
    background: white !important;
    box-shadow: none !important;
    border: 1px solid #000 !important;
    page-break-inside: avoid;
  }
  
  .read-explanation-btn {
    display: none !important;
  }
  
  .learning-image {
    max-height: 250px;
    filter: grayscale(100%);
  }
}

/* Enhanced Question Layout for Learning Content */
.question-responsive {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.question-options {
  margin: 15px 0;
}

.question-option {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px;
  margin: 8px 0;
  cursor: pointer;
  transition: all 0.3s ease;
  display: block;
}

.question-option:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.question-option input[type="radio"] {
  margin-right: 10px;
  transform: scale(1.2);
}

/* Answer state styling */
.question-option.option-correct {
  background: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}

.question-option.option-incorrect {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.question-option.option-answer {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
}

/* Feedback styling */
.feedback-responsive {
  margin: 15px 0;
  padding: 10px;
  border-radius: 6px;
  font-weight: 600;
}

.correct-feedback {
  color: #059669;
}

.incorrect-feedback {
  color: #dc2626;
}

.answer-feedback {
  color: #1d4ed8;
  margin-left: 10px;
}

/* --- Mastery Progress Display --- */
.mastery-progress-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 20px 0 16px 0; /* Changed margin to work better at bottom */
  box-shadow: 0 3px 10px rgba(102, 126, 234, 0.25);
}

.mastery-stats-row {
  display: flex;
  justify-content: space-around;
  gap: 16px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.mastery-stat {
  text-align: center;
  flex: 1;
  min-width: 80px;
}

.mastery-percentage {
  display: block;
  font-size: 1.5rem;
  font-weight: bold;
  color: #fef08a;
  margin-bottom: 2px;
  line-height: 1;
}

.mastery-number {
  display: block;
  font-size: 1.3rem;
  font-weight: bold;
  color: #a7f3d0;
  margin-bottom: 2px;
  line-height: 1;
}

.mastery-label {
  display: block;
  font-size: 0.75rem;
  color: #e0e7ff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mastery-progress-bar {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  height: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.mastery-progress-fill {
  background: linear-gradient(90deg, #fbbf24, #f59e0b, #10b981);
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s ease-in-out; /* Longer transition for smoother updates */
}

.mastery-description {
  text-align: center;
  margin: 0;
  font-size: 0.85rem;
  color: #e0e7ff;
  font-style: italic;
}

.mastery-complete {
  text-align: center;
  padding: 40px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.mastery-complete h2 {
  margin: 0 0 20px 0;
  font-size: 2.2rem;
  color: white;
}

.mastery-complete .mastery-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.mastery-complete-stat {
  background: rgba(255, 255, 255, 0.15) !important;
  border: 2px solid rgba(255, 255, 255, 0.3) !important;
}

/* Mobile responsiveness for mastery progress */
@media (max-width: 600px) {
  .mastery-stats-row {
    gap: 8px;
  }
  
  .mastery-stat {
    min-width: 70px;
  }
  
  .mastery-percentage,
  .mastery-number {
    font-size: 1.2rem;
  }
  
  .mastery-label {
    font-size: 0.7rem;
  }
  
  .mastery-progress-header {
    padding: 10px 12px;
    margin-bottom: 16px;
  }
  
  .mastery-description {
    font-size: 0.8rem;
  }
  
  .mastery-complete {
    padding: 24px;
  }
  
  .mastery-complete h2 {
    font-size: 1.8rem;
  }
  
  .mastery-complete .mastery-stats {
    flex-direction: column;
    gap: 16px;
  }
}

/* Mastery progress update animation */
.mastery-progress-header.updating {
  animation: masteryUpdate 0.5s ease-in-out;
}

@keyframes masteryUpdate {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4); }
  100% { transform: scale(1); }
}

.mastery-progress-fill {
  background: linear-gradient(90deg, #fbbf24, #f59e0b, #10b981);
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s ease-in-out; /* Longer transition for smoother updates */
}

.mastery-percentage, .mastery-number {
  transition: all 0.3s ease-in-out; /* Smooth number changes */
}

.correct-feedback {
  color: #059669;
}

.incorrect-feedback {
  color: #dc2626;
}

.answer-feedback {
  color: #1d4ed8;
  margin-left: 10px;
}

/* --- Compact Question Header Styles --- */
.compact-question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
  position: relative;
}

.compact-header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.compact-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.compact-hamburger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.3s ease;
  z-index: 9999; /* Ensure compact hamburger is also on top */
}

.compact-hamburger:hover {
  background: rgba(255, 255, 255, 0.1);
}

.compact-hamburger span {
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  transition: all 0.3s ease;
}

.compact-hamburger.active span:first-child {
  transform: rotate(45deg) translate(5px, 5px);
}

.compact-hamburger.active span:nth-child(2) {
  opacity: 0;
}

.compact-hamburger.active span:last-child {
  transform: rotate(-45deg) translate(7px, -6px);
}

.compact-title {
  color: #fff;
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.compact-coins {
  background: rgba(255, 255, 255, 0.15);
  padding: 8px 12px;
  border-radius: 20px;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.compact-speech {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 10px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.compact-speech:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* Dropdown menu for compact header */
.compact-question-header .topnav-links {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 0 0 16px 16px;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
  padding: 16px 20px;
  transform: translateY(-10px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 10000; /* Higher than regular nav to ensure visibility */
  border: 1px solid rgba(102, 126, 234, 0.1);
  border-top: none;
}

.compact-question-header .topnav-links.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.compact-question-header .topnav-links .user-greeting {
  display: block;
  color: #667eea;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e3e8ee;
  font-size: 0.95rem;
}

.compact-question-header .topnav-links .nav-link {
  display: block;
  padding: 10px 0;
  color: #263159;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 2px 0;
}

.compact-question-header .topnav-links .nav-link:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  transform: translateX(5px);
}

.compact-question-header .logout-btn {
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  margin-top: 8px;
  transition: all 0.3s ease;
  width: 100%;
}

.compact-question-header .logout-btn:hover {
  background: linear-gradient(135deg, #ee5a52, #e53e3e);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(238, 90, 82, 0.3);
}

/* --- Wonder Path Panel Styles --- */
.wonder-path-panel {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 30px;
  color: white;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
  position: relative;
  overflow: hidden;
}

.wonder-path-panel::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.wonder-path-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
  position: relative;
  z-index: 1;
}

.wonder-path-icon {
  font-size: 3rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.wonder-path-content {
  color: white !important;
}

.wonder-path-content * {
  color: inherit;
}

.wonder-path-content h2 {
  margin: 0 0 10px 0;
  font-size: 2rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.wonder-path-content p {
  margin: 0;
  font-size: 1.1rem;
  opacity: 0.95;
  line-height: 1.5;
}

.wonder-path-teddy {
  font-size: 4rem;
  margin-left: auto;
  animation: wave 3s ease-in-out infinite;
}

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

.wonder-path-actions {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.wonder-path-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wonder-path-btn.primary {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.wonder-path-btn.primary:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.wonder-path-btn.secondary {
  background: rgba(255, 255, 255, 0.9);
  color: #667eea;
  border: 2px solid transparent;
}

.wonder-path-btn.secondary:hover {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.wonder-path-features {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.wonder-path-features .feature {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
}

/* --- Learning Quest Panel Styles --- */
.learning-quest-panel {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid #e3e8ee;
}

.learning-quest-header {
  text-align: center;
  margin-bottom: 30px;
}

.learning-quest-header h2 {
  color: #2d3748;
  margin: 0 0 10px 0;
  font-size: 2rem;
  font-weight: 700;
}

.learning-quest-header p {
  color: #718096;
  margin: 0;
  font-size: 1.1rem;
}

.learning-quest-content .tiles {
  /* The existing .tiles styles will apply here */
  margin-top: 0;
}

/* --- LESSON COMPONENTS
   ========================================================================== */

.lesson-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  animation: fadeIn 0.6s ease-out;
}

.lesson-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #f0f0f0;
}

.lesson-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #2d5be3;
  margin: 0;
  flex-grow: 1;
  text-align: center;
}

.lesson-overview {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 24px;
  text-align: center;
}

.lesson-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.lesson-overview h3 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 12px 0;
}

.lesson-intro {
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 0 0 16px 0;
  opacity: 0.95;
}

.lesson-objectives {
  background: rgba(255, 255, 255, 0.1);
  padding: 16px;
  border-radius: 8px;
  margin-top: 16px;
}

.lesson-objectives h4 {
  margin: 0 0 12px 0;
  font-size: 1.1rem;
}

.lesson-objectives ul {
  margin: 0;
  padding-left: 20px;
}

.lesson-objectives li {
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.lesson-sections {
  margin-bottom: 24px;
}

.lesson-section {
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.lesson-section:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.lesson-section h4 {
  color: #2d5be3;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-content {
  font-size: 1rem;
  line-height: 1.6;
  color: #333;
}

.section-image {
  margin: 16px 0;
  text-align: center;
}

.section-image img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.key-points {
  background: #e8f4fd;
  border-left: 4px solid #2d5be3;
  padding: 16px;
  margin: 16px 0;
  border-radius: 0 8px 8px 0;
}

.key-points h5 {
  margin: 0 0 8px 0;
  color: #2d5be3;
  font-weight: 600;
}

.key-points ul {
  margin: 0;
  padding-left: 20px;
}

.key-points li {
  margin-bottom: 4px;
  color: #444;
}

.lesson-example {
  background: #fff9e6;
  border: 1px solid #ffd700;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.example-header {
  font-weight: 600;
  color: #b8860b;
  margin-bottom: 8px;
}

.example-content {
  font-style: italic;
  color: #666;
}

.lesson-activities {
  background: #f0f8ff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.lesson-activities h4 {
  color: #2d5be3;
  font-size: 1.3rem;
  margin: 0 0 16px 0;
}

.activities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.activity-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  transition: all 0.3s ease;
}

.activity-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.activity-title {
  font-weight: 600;
  color: #2d5be3;
  margin-bottom: 8px;
}

.activity-description {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.5;
}

.lesson-vocabulary {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.lesson-vocabulary h4 {
  color: #2d5be3;
  font-size: 1.3rem;
  margin: 0 0 16px 0;
}

.vocabulary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.vocab-term {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.vocab-term strong {
  color: #2d5be3;
}

.lesson-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 2px solid #f0f0f0;
}

.start-questions-btn, .review-lesson-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.start-questions-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.start-questions-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.review-lesson-btn {
  background: #f8f9fa;
  color: #2d5be3;
  border: 2px solid #2d5be3;
}

.review-lesson-btn:hover {
  background: #2d5be3;
  color: white;
  transform: translateY(-2px);
}

.read-lesson-btn {
  background: #28a745;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.read-lesson-btn:hover {
  background: #218838;
  transform: translateY(-1px);
}

/* Responsive Design for Lessons */
@media (max-width: 768px) {
  .lesson-container {
    margin: 10px;
    padding: 16px;
  }
  
  .lesson-header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  
  .lesson-title {
    font-size: 1.5rem;
  }
  
  .lesson-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .activities-grid {
    grid-template-columns: 1fr;
  }
  
  .vocabulary-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   ANALYTICS DASHBOARD STYLES
   ========================================================================== */

.analytics-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.analytics-header {
  text-align: center;
  margin-bottom: 30px;
}

.analytics-header h2 {
  color: #2d5be3;
  margin-bottom: 8px;
}

.analytics-subtitle {
  color: #666;
  font-size: 1.1rem;
}

.analytics-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: bold;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 0.95rem;
  opacity: 0.9;
}

.analytics-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.analytics-section {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.analytics-section h3 {
  color: #2d5be3;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

.popularity-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.popularity-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.popularity-bar {
  flex: 1;
  height: 8px;
  background: #e0e7ff;
  border-radius: 4px;
  overflow: hidden;
}

.popularity-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.popularity-label {
  min-width: 120px;
  font-size: 0.9rem;
  color: #374151;
}

.user-table-container {
  overflow-x: auto;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.user-table th,
.user-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.user-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}

.user-table tr:hover {
  background: #f9fafb;
}

.user-name {
  font-weight: 600;
 

  color: #1f2937;
}

.user-id {
  font-family: monospace;
 
  font-size: 0.85rem;
  color: #6b7280;
}

.accuracy.high {
  color: #059669;
  font-weight: 600;
}

.accuracy.medium {
  color: #d97706;
  font-weight: 600;
}

.accuracy.low {
  color: #dc2626;
  font-weight: 600;
}

.coins {
  color: #d97706;
  font-weight: 600;
}

.subjects,
.grades {
  font-size: 0.9rem;
  color: #6b7280;
}

.last-activity {
  font-size: 0.9rem;
  color: #6b7280;
}

.analytics-actions {
     display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.refresh-analytics-btn,
.export-analytics-btn,
.back-to-home-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.refresh-analytics-btn {
  background: #2d5be3;
  color: white;
}

.refresh-analytics-btn:hover {
  background: #1e40af;
}

.refresh-analytics-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.export-analytics-btn {
  background: #059669;
  color: white;
}

.export-analytics-btn:hover {
  background: #047857;
}

.back-to-home-btn {
  background: #6b7280;
  color: white;
}

.back-to-home-btn:hover {
  background: #4b5563;
}

/* Admin Modal Styles */
.admin-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(5px);
}

.admin-modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.admin-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 16px 16px 0 0;
}

.admin-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.admin-modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.admin-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.admin-modal-content {
  padding: 24px;
}

.admin-modal-content p {
  margin: 0 0 20px 0;
  color: #374151;
  line-height: 1.5;
}

.admin-form-group {
  margin-bottom: 16px;
}

.admin-form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #374151;
}

.admin-input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.admin-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.admin-input[readonly] {
  background: #f9fafb;
  color: #6b7280;
}

.admin-form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.admin-cancel-btn,
.admin-login-btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-cancel-btn {
  background: #f3f4f6;
  color: #374151;
}

.admin-cancel-btn:hover {
  background: #e5e7eb;
}

.admin-login-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.admin-login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.admin-login-btn:active {
  transform: translateY(0);
}

.admin-error-message {
  margin-top: 16px;
  padding: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  font-size: 0.9rem;
  text-align: center;
}

/* Hide analytics link for non-admin users */
.nav-link.analytics-hidden {
  display: none !important;
}

/* Admin indicator in navigation */
.admin-indicator {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  background: #059669;
  color: white;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* --- Safari Assessment Modal Styles --- */
.safari-assessment-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.assessment-content {
  background: white;
  border-radius: 20px;
  padding: 30px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.assessment-header {
  text-align: center;
  margin-bottom: 25px;
  position: relative;
}

.assessment-header h3 {
  color: #2d3748;
  margin: 0 0 10px 0;
  font-size: 1.8rem;
  font-weight: 700;
}

.assessment-header p {
  color: #718096;
  margin: 0;
  font-size: 1.1rem;
}

.close-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #ff6b6b;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: #ff5252;
}

.question-container {
  background: #f7fafc;
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 20px;
  min-height: 200px;
}

.question h4 {
  color: #4a5568;
  margin: 0 0 15px 0;
  font-size: 1.2rem;
}

.question-text {
  color: #2d3748;
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 20px 0;
  text-align: center;
}

.answer-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.option-btn {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 15px 20px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #4a5568;
  font-weight: 500;
}

.option-btn:hover {
  border-color: #4299e1;
  background: #ebf8ff;
  transform: translateY(-2px);
}

.option-btn.selected {
  border-color: #48bb78;
  background: #f0fff4;
  color: #22543d;
  box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.assessment-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 20px;
}

.assessment-actions .btn {
  padding: 12px 25px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.assessment-actions .btn.primary {
  background: #4299e1;
  color: white;
}

.assessment-actions .btn.primary:hover {
  background: #3182ce;
  transform: translateY(-2px);
}

.assessment-actions .btn.secondary {
  background: #edf2f7;
  color: #4a5568;
}

.assessment-actions .btn.secondary:hover {
  background: #e2e8f0;
}

.assessment-actions .btn.success {
  background: #48bb78;
  color: white;
}

.assessment-actions .btn.success:hover {
  background: #38a169;
  transform: translateY(-2px);
}

.assessment-actions .btn.hidden {
  display: none;
}

.assessment-progress {
  margin-top: 20px;
  text-align: center;
}

.assessment-progress.hidden {
  display: none;
}

.progress-bar {
  background: #edf2f7;
  border-radius: 10px;
  height: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.progress-fill {
  background: linear-gradient(90deg, #4299e1, #48bb78);
  height: 100%;
  transition: width 0.5s ease;
  border-radius: 10px;
}

.assessment-results {
  text-align: center;
  padding: 20px;
}

.assessment-results h4 {
  color: #48bb78;
  font-size: 1.6rem;
  margin: 0 0 15px 0;
}

.assessment-results p {
  color: #4a5568;
  font-size: 1.1rem;
  margin: 10px 0;
}

/* Assessment intro styles */
.assessment-intro {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.assessment-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #333;
}

.feature-item .feature-icon {
  font-size: 1.1rem;
}

.assessment-note {
  font-size: 0.9rem;
  color: #555;
  margin-top: 10px;
  font-style: italic;
}

/* Mobile responsive for assessment intro */
@media (max-width: 768px) {
  .assessment-features {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}