/* ============================================================
   CCFS B1.1 — Le Grand Voyage de France
   Watercolor-themed French learning game
   ============================================================ */

/* --- Google Fonts loaded in base.html --- */

:root {
  /* Primary Palette (Watercolor zone colors) */
  --provence-gold: #E8C170;
  --lyon-amber: #D4845A;
  --bordeaux-wine: #7B2D3B;
  --loire-sage: #5B7F5E;
  --normandy-slate: #5A6E7F;
  --paris-midnight: #2C3E6B;
  --final-gold: #C9A84C;

  /* Future zone colors */
  --strasbourg-brown: #8B5E3C;
  --marseille-blue: #3A8FB7;
  --alps-frost: #6B8FA3;
  --brittany-green: #4A7C59;
  --riviera-azure: #0087B6;

  /* UI Colors */
  --bg-parchment: #FAF6EE;
  --bg-cream: #F5EFE3;
  --bg-warm: #FDF8F0;
  --text-ink: #2A2520;
  --text-muted: #8A7E72;
  --text-light: #B5A898;
  --border-soft: #E5DDD1;

  /* State Colors */
  --success: #5B8C5A;
  --success-light: #E8F5E8;
  --warning: #D4A03C;
  --warning-light: #FFF8E8;
  --danger: #B94A48;
  --danger-light: #FDE8E8;
  --info: #5A7F9B;

  /* Map States */
  --glow-unlocked: 0 0 15px rgba(232, 193, 112, 0.5);
  --glow-completed: 0 0 10px rgba(91, 140, 90, 0.3);
  --glow-boss: 0 0 20px rgba(201, 168, 76, 0.6);

  /* Surfaces */
  --card-bg: #FFFFFF;
  --card-shadow: 0 2px 12px rgba(42, 37, 32, 0.08);
  --card-shadow-hover: 0 6px 24px rgba(42, 37, 32, 0.14);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* French accents */
  --bleu-france: #002395;
  --rouge-france: #ED2939;
  --tricolore-gradient: linear-gradient(90deg, #002395 33%, #FFFFFF 33%, #FFFFFF 66%, #ED2939 66%);

  /* Typography */
  --font-serif: 'Playfair Display', 'Georgia', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-parchment);
  color: var(--text-ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.3;
}

a { color: var(--paris-midnight); text-decoration: none; }
a:hover { color: var(--lyon-amber); }

img { max-width: 100%; height: auto; display: block; }

/* --- Utility --- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  background: rgba(250, 246, 238, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-soft);
  padding: 0.6rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-ink);
  text-decoration: none;
}
.nav-brand img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.nav-brand:hover { color: var(--lyon-amber); }

.nav-links {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}
.nav-links a {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.nav-links a:hover {
  background: var(--bg-cream);
  color: var(--text-ink);
}
.nav-links a.active {
  color: var(--paris-midnight);
  background: rgba(44, 62, 107, 0.08);
}
.nav-links .nav-admin {
  color: var(--danger);
  font-size: 0.8rem;
}
.nav-links .nav-user {
  font-size: 0.8rem;
  color: var(--text-light);
  padding: 0.4rem 0.5rem;
}
.nav-links .nav-logout {
  color: var(--text-light);
  font-size: 0.8rem;
}

/* Mobile hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-ink);
}
.nav-toggle svg { width: 24px; height: 24px; }

/* Mobile nav drawer */
.nav-drawer {
  display: none;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem;
  flex: 1;
}

.footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-light);
  border-top: 1px solid var(--border-soft);
}
.footer .tricolore {
  display: inline-block;
  width: 40px;
  height: 3px;
  background: var(--tricolore-gradient);
  border-radius: 2px;
  margin: 0 0.5rem;
  vertical-align: middle;
}

/* Flash messages */
.flash-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem;
}
.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  animation: slideDown 0.3s ease;
}
.flash-error { background: var(--danger-light); color: var(--danger); border-left: 4px solid var(--danger); }
.flash-success { background: var(--success-light); color: var(--success); border-left: 4px solid var(--success); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all var(--transition-normal);
  line-height: 1.4;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--provence-gold), var(--lyon-amber));
  color: white;
  box-shadow: 0 2px 8px rgba(212, 132, 90, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(212, 132, 90, 0.4);
  transform: translateY(-1px);
  color: white;
}

.btn-secondary {
  background: var(--paris-midnight);
  color: white;
}
.btn-secondary:hover {
  background: #3A4F7D;
  transform: translateY(-1px);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--border-soft);
  color: var(--text-ink);
}
.btn-outline:hover {
  border-color: var(--paris-midnight);
  background: rgba(44, 62, 107, 0.04);
}

.btn-full { width: 100%; }
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #9A3C3A; color: white; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-parchment);
  position: relative;
  overflow: hidden;
}
.login-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.2;
  filter: blur(2px);
}
.login-card {
  position: relative;
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(42, 37, 32, 0.12);
  width: 100%;
  max-width: 400px;
  text-align: center;
  z-index: 1;
}
.login-card h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--text-ink);
  margin-bottom: 0.15rem;
}
.login-card h2 {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--lyon-amber);
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}
.login-subtitle {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 1.5rem;
}
.login-tricolore {
  width: 60px;
  height: 3px;
  background: var(--tricolore-gradient);
  border-radius: 2px;
  margin: 0 auto 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
  text-align: left;
}
.form-group label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.form-group input[type="text"],
.form-group input[type="password"] {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  background: var(--bg-warm);
  color: var(--text-ink);
  transition: border var(--transition-fast);
}
.form-group input:focus {
  border-color: var(--provence-gold);
  outline: none;
  background: white;
}

/* ============================================================
   GAME MAP
   ============================================================ */
.map-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

/* Stats header */
.map-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1rem 0 1.5rem;
}
.map-stat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-ink);
}
.map-stat .stat-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}
.map-stat .stat-icon.gold { background: var(--warning-light); color: var(--warning); }
.map-stat .stat-icon.green { background: var(--success-light); color: var(--success); }
.map-stat .stat-icon.red { background: #FDE8E8; color: var(--danger); }

/* Map journey path */
.map-journey {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* The vertical path line */
.map-journey::before {
  content: '';
  position: absolute;
  left: 24px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: repeating-linear-gradient(
    to bottom,
    var(--border-soft) 0px,
    var(--border-soft) 8px,
    transparent 8px,
    transparent 16px
  );
  z-index: 0;
}

/* Zone card on map */
.zone-card {
  position: relative;
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  z-index: 1;
}

/* Zone dot on the path */
.zone-dot {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 2;
  position: relative;
  transition: transform var(--transition-normal);
}
.zone-card:hover .zone-dot { transform: scale(1.08); }
.zone-dot.locked {
  background: var(--text-light);
  opacity: 0.6;
}

/* Zone content area */
.zone-content {
  flex: 1;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: box-shadow var(--transition-normal);
}
.zone-card:hover .zone-content:not(.coming-soon) {
  box-shadow: var(--card-shadow-hover);
}

/* Zone header with image */
.zone-header {
  position: relative;
  height: 140px;
  overflow: hidden;
  cursor: pointer;
}
.zone-header-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.zone-card:hover .zone-header-img {
  transform: scale(1.03);
}
.zone-header-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.1) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem 1.25rem;
}
.zone-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.zone-region {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.8);
  margin-top: 0.1rem;
}
.zone-grammar {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.65);
  font-style: italic;
}

/* Locked / coming soon zone */
.zone-header.locked .zone-header-img {
  filter: grayscale(1) brightness(0.5);
}
.zone-header.coming-soon .zone-header-img {
  filter: grayscale(1) brightness(0.3) blur(3px);
}
.zone-coming-soon-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.6);
  color: rgba(255,255,255,0.8);
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  font-style: italic;
  backdrop-filter: blur(4px);
}

/* Level grid inside zone */
.zone-levels {
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.6rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s ease;
  padding-top: 0;
  padding-bottom: 0;
}
.zone-card.expanded .zone-levels {
  max-height: 800px;
  padding-top: 0.75rem;
  padding-bottom: 1rem;
}
.zone-expand-hint {
  text-align: center;
  padding: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-light);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.zone-expand-hint:hover { color: var(--text-muted); }
.zone-card.expanded .zone-expand-hint .hint-show { display: none; }
.zone-card:not(.expanded) .zone-expand-hint .hint-hide { display: none; }

/* Level card */
.level-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--border-soft);
  transition: all var(--transition-normal);
  background: var(--card-bg);
}
.level-card:hover:not(.locked):not(.coming-soon) {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
}

.level-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text-ink);
  height: 100%;
}
.level-link.disabled { cursor: not-allowed; }

.level-thumb {
  height: 72px;
  overflow: hidden;
  position: relative;
  background: var(--bg-cream);
}
.level-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.level-card:hover:not(.locked) .level-thumb img {
  transform: scale(1.05);
}
.level-number-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}
.level-boss-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: linear-gradient(135deg, var(--final-gold), var(--lyon-amber));
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.level-info {
  padding: 0.5rem 0.6rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.level-title {
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1.3;
}
.level-flavor {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Level states */
.level-card.locked {
  opacity: 0.5;
  border-color: transparent;
}
.level-card.locked .level-thumb img {
  filter: grayscale(1) brightness(0.6);
}
.level-card .level-lock-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.2rem;
  opacity: 0.7;
}

.level-card.completed {
  border-color: var(--success);
}
.level-card.boss {
  border-color: var(--final-gold);
}
.level-card.boss.completed {
  border-color: var(--final-gold);
  box-shadow: var(--glow-boss);
}

/* Stars */
.level-stars {
  display: flex;
  gap: 2px;
  margin-top: auto;
  padding-top: 0.25rem;
}
.level-star {
  width: 14px;
  height: 14px;
  opacity: 0.2;
}
.level-star.earned { opacity: 1; }
.level-star.gold { filter: hue-rotate(0deg) saturate(1.5); }

/* Play indicator */
.level-play-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: auto;
  padding-top: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--provence-gold);
}
.level-play-btn .play-arrow {
  width: 0;
  height: 0;
  border-left: 6px solid var(--provence-gold);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

/* Unlocked pulse */
.level-card.unlocked:not(.completed) {
  animation: subtlePulse 3s ease-in-out infinite;
}

/* Grand Final zone */
.zone-final .zone-header {
  height: 180px;
}
.zone-final .zone-name {
  font-size: 1.5rem;
}

/* Coming soon zone */
.zone-content.coming-soon {
  opacity: 0.5;
}

/* ============================================================
   LEVEL PLAY PAGE
   ============================================================ */
.level-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.level-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
}
.back-link {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: color var(--transition-fast);
  text-decoration: none;
}
.back-link:hover { color: var(--text-ink); }
.back-link svg { width: 16px; height: 16px; }

.level-heading {
  text-align: center;
  margin-bottom: 0.5rem;
}
.level-heading h1 {
  font-size: 1.35rem;
  margin-bottom: 0.2rem;
}
.level-zone-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.level-flavor-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--lyon-amber);
  margin-top: 0.15rem;
}

/* Progress dots */
.progress-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 0.75rem 0;
  flex-wrap: wrap;
}
.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-soft);
  transition: all var(--transition-normal);
}
.progress-dot.current {
  background: var(--provence-gold);
  box-shadow: 0 0 8px rgba(232, 193, 112, 0.5);
  transform: scale(1.2);
}
.progress-dot.correct { background: var(--success); }
.progress-dot.incorrect { background: var(--danger); }

.score-display {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-ink);
  margin-bottom: 0.75rem;
}
.boss-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--final-gold), var(--lyon-amber));
  color: white;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* Grammar panel */
.grammar-panel {
  background: var(--bg-cream);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  border: 1px solid var(--border-soft);
}
.grammar-panel summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-weight: 500;
  color: var(--paris-midnight);
  font-size: 0.9rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.grammar-panel summary::-webkit-details-marker { display: none; }
.grammar-panel summary::before {
  content: '';
  width: 20px; height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%232C3E6B' stroke-width='2'%3E%3Cpath d='M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20'%3E%3C/path%3E%3C/svg%3E");
  background-size: contain;
  flex-shrink: 0;
}
.grammar-content {
  padding: 0 1rem 1rem;
}
.grammar-rule {
  margin-bottom: 0.75rem;
}
.grammar-rule h3 {
  font-size: 0.95rem;
  color: var(--paris-midnight);
  margin-bottom: 0.2rem;
}
.rule-summary {
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0.2rem 0;
}
.rule-warning {
  color: var(--warning);
  font-style: italic;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  background: var(--warning-light);
  border-radius: var(--radius-sm);
  margin-top: 0.3rem;
}
.rule-mnemonic {
  color: var(--info);
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  background: #E8F0F8;
  border-radius: var(--radius-sm);
  margin-top: 0.3rem;
}

/* Exercise area */
.exercise-area {
  animation: fadeInUp 0.3s ease;
}
.exercise-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--card-shadow);
  text-align: center;
  border: 1px solid var(--border-soft);
  transition: border-color var(--transition-normal);
}
.exercise-card.correct-flash {
  border-color: var(--success);
  box-shadow: 0 0 20px rgba(91, 140, 90, 0.15);
}
.exercise-card.incorrect-flash {
  border-color: var(--danger);
  animation: shake 0.4s ease;
}

.exercise-instruction {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  margin-bottom: 0.75rem;
}
.exercise-sentence {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
  color: var(--text-ink);
}
.blank {
  display: inline-block;
  min-width: 80px;
  border-bottom: 3px solid var(--provence-gold);
  padding: 0.1rem 0.3rem;
  margin: 0 0.15rem;
  color: var(--provence-gold);
  font-weight: 600;
  animation: blankPulse 2s ease-in-out infinite;
}

/* MC options */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.option-btn {
  padding: 0.85rem 0.75rem;
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  color: var(--text-ink);
  text-align: center;
}
.option-btn:hover:not(:disabled) {
  border-color: var(--provence-gold);
  background: var(--warning-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(212, 160, 60, 0.15);
}
.option-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.option-btn.selected-correct {
  border-color: var(--success);
  background: var(--success-light);
}
.option-btn.selected-incorrect {
  border-color: var(--danger);
  background: var(--danger-light);
}

/* Fill blank input */
.answer-form {
  display: flex;
  gap: 0.5rem;
}
.answer-input {
  flex: 1;
  padding: 0.8rem 1rem;
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 1.05rem;
  text-align: center;
  background: var(--bg-warm);
  color: var(--text-ink);
  transition: border var(--transition-fast);
}
.answer-input:focus {
  border-color: var(--provence-gold);
  outline: none;
  background: white;
}
.answer-input::placeholder { color: var(--text-light); }

.exercise-hint {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 1rem;
  font-style: italic;
  padding: 0.5rem;
  background: var(--bg-cream);
  border-radius: var(--radius-sm);
}

/* Speed round timer */
.speed-timer {
  width: 60px;
  height: 60px;
  margin: 0 auto 1rem;
  position: relative;
}
.speed-timer-ring {
  transform: rotate(-90deg);
}
.speed-timer-circle {
  fill: none;
  stroke: var(--success);
  stroke-width: 4;
  stroke-dasharray: 157;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
  stroke-linecap: round;
}
.speed-timer-circle.warning { stroke: var(--warning); }
.speed-timer-circle.danger { stroke: var(--danger); }
.speed-timer-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-ink);
}

/* Feedback */
.feedback-area {
  max-width: 640px;
  margin: 0.75rem auto;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  animation: fadeInUp 0.3s ease;
}
.feedback-correct {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success);
}
.feedback-incorrect {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger);
}
.feedback-icon {
  font-size: 1.4rem;
  line-height: 1;
}
.correct-answer {
  font-size: 0.85rem;
  width: 100%;
  margin-top: 0.3rem;
}

/* Completed area */
.completed-area {
  text-align: center;
  padding: 3rem 1rem;
  animation: fadeInUp 0.5s ease;
}
.completed-area h2 {
  font-family: var(--font-serif);
  color: var(--provence-gold);
}

/* ============================================================
   RESULTS PAGE
   ============================================================ */
.results-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  min-height: 70vh;
}

.results-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: 0 8px 40px rgba(42, 37, 32, 0.1);
  text-align: center;
  max-width: 480px;
  width: 100%;
  animation: fadeInUp 0.5s ease;
}

.results-illustration {
  width: 120px;
  height: 120px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.results-illustration img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.results-card h1 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin-bottom: 0.3rem;
}

.results-score {
  margin: 1rem 0;
}
.score-ring {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 0.5rem;
}
.score-ring svg {
  transform: rotate(-90deg);
  width: 120px;
  height: 120px;
}
.score-ring-bg {
  fill: none;
  stroke: var(--border-soft);
  stroke-width: 8;
}
.score-ring-fill {
  fill: none;
  stroke: var(--success);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 1.5s ease;
}
.score-ring-fill.fail { stroke: var(--danger); }
.score-ring-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.score-big {
  font-size: 1.6rem;
  font-weight: 700;
  display: block;
  line-height: 1.2;
}
.score-pct {
  font-size: 0.85rem;
  font-weight: 600;
}
.score-pct.pass { color: var(--success); }
.score-pct.fail { color: var(--danger); }

/* Stars */
.results-stars {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.result-star {
  font-size: 1.8rem;
  opacity: 0.15;
  transition: all 0.4s ease;
}
.result-star.earned {
  opacity: 1;
  animation: starPop 0.5s ease backwards;
}
.result-star:nth-child(1) { animation-delay: 0.3s; }
.result-star:nth-child(2) { animation-delay: 0.6s; }
.result-star:nth-child(3) { animation-delay: 0.9s; }

.results-badge {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0.5rem 0;
}
.results-badge.pass { background: var(--success-light); color: var(--success); }
.results-badge.fail { background: var(--danger-light); color: var(--danger); }

.points-breakdown {
  text-align: left;
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--bg-cream);
  border-radius: var(--radius-md);
}
.points-breakdown h3 {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
  color: var(--text-ink);
}
.points-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.9rem;
  animation: slideInLeft 0.4s ease backwards;
}
.points-row:nth-child(2) { animation-delay: 0.2s; }
.points-row:nth-child(3) { animation-delay: 0.4s; }
.points-row:nth-child(4) { animation-delay: 0.6s; }
.points-row.improvement { color: var(--info); }
.points-row.achievement { color: var(--warning); }
.points-total {
  display: flex;
  justify-content: space-between;
  padding-top: 0.6rem;
  margin-top: 0.3rem;
  border-top: 2px solid var(--border-soft);
  font-weight: 700;
  font-size: 1.05rem;
}

.results-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   LEADERBOARD
   ============================================================ */
.lb-page {
  max-width: 700px;
  margin: 0 auto;
}
.lb-page > h1 {
  font-family: var(--font-serif);
  text-align: center;
  margin-bottom: 0.25rem;
}
.subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  text-align: center;
}

/* Podium */
.podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding: 1rem 0;
}
.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.podium-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: white;
  margin-bottom: 0.3rem;
}
.podium-1 .podium-avatar {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #C9A84C, #E8C170);
  box-shadow: 0 4px 16px rgba(201, 168, 76, 0.4);
  font-size: 1.3rem;
}
.podium-2 .podium-avatar {
  background: linear-gradient(135deg, #8A8A8A, #B0B0B0);
  box-shadow: 0 3px 12px rgba(0,0,0,0.15);
}
.podium-3 .podium-avatar {
  background: linear-gradient(135deg, #8B5E3C, #B07D56);
  box-shadow: 0 3px 12px rgba(0,0,0,0.15);
}
.podium-name {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.1rem;
}
.podium-score {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.podium-bar {
  width: 80px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin-top: 0.5rem;
}
.podium-1 .podium-bar { height: 80px; background: linear-gradient(to top, #C9A84C, #E8C170); }
.podium-2 .podium-bar { height: 56px; background: linear-gradient(to top, #8A8A8A, #B0B0B0); }
.podium-3 .podium-bar { height: 40px; background: linear-gradient(to top, #8B5E3C, #B07D56); }

/* Rest of leaderboard */
.leaderboard { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 2rem; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  transition: all var(--transition-fast);
}
.lb-row:hover { box-shadow: var(--card-shadow-hover); }
.lb-me {
  border: 2px solid var(--provence-gold);
  background: var(--warning-light);
}
.lb-rank {
  font-size: 1rem;
  min-width: 2rem;
  text-align: center;
  font-weight: 700;
  color: var(--text-muted);
}
.lb-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}
.lb-name { font-weight: 600; flex: 1; }
.lb-details {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.lb-score { font-weight: 700; color: var(--paris-midnight); }

/* ============================================================
   STATS
   ============================================================ */
.my-stats h2 {
  font-family: var(--font-serif);
  margin-bottom: 0.75rem;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--card-bg);
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition-fast);
}
.stat-card:hover { transform: translateY(-2px); }
.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--paris-midnight);
  font-family: var(--font-serif);
}
.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.stat-icon-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ============================================================
   PROFILE
   ============================================================ */
.profile-header {
  text-align: center;
  margin-bottom: 1.5rem;
}
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--provence-gold), var(--lyon-amber));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: white;
  margin: 0 auto 0.75rem;
  box-shadow: 0 4px 16px rgba(212, 132, 90, 0.3);
}
.profile-header h1 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
}

.progress-list { display: flex; flex-direction: column; gap: 0.3rem; }
.progress-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  border: 1px solid var(--border-soft);
  transition: all var(--transition-fast);
}
.progress-item:hover { box-shadow: var(--card-shadow); }
.progress-item.completed {
  background: var(--success-light);
  border-color: var(--success);
}
.pi-level { font-weight: 600; flex: 1; }
.pi-zone { color: var(--text-muted); font-size: 0.75rem; }
.pi-score { font-weight: 700; color: var(--paris-midnight); }
.pi-attempts { color: var(--text-muted); font-size: 0.8rem; }
.pi-status { font-size: 0.85rem; }

/* ============================================================
   GRAMMAR PAGE
   ============================================================ */
.grammar-page {
  max-width: 700px;
  margin: 0 auto;
}
.grammar-card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  margin-bottom: 1rem;
  border: 1px solid var(--border-soft);
}
.grammar-card h2 {
  font-family: var(--font-serif);
  color: var(--paris-midnight);
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}
.full-explanation {
  margin: 0.5rem 0;
  line-height: 1.7;
  font-size: 0.95rem;
}

/* ============================================================
   ADMIN
   ============================================================ */
.admin-users { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }
.admin-user-card {
  background: var(--card-bg);
  padding: 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-soft);
}
.au-info { margin-bottom: 0.3rem; }
.au-username { color: var(--text-muted); font-size: 0.85rem; margin-left: 0.5rem; }
.au-badge {
  background: var(--paris-midnight);
  color: white;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  margin-left: 0.3rem;
}
.au-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.au-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.inline-form { display: flex; gap: 0.3rem; align-items: center; }
.inline-form input {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  width: 130px;
  font-family: var(--font-sans);
}
.admin-form { max-width: 420px; }
.admin-form .form-group { margin-bottom: 1rem; }

.empty-state { text-align: center; color: var(--text-muted); padding: 2rem; }

/* ============================================================
   CONFETTI CANVAS
   ============================================================ */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@keyframes subtlePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 193, 112, 0); }
  50% { box-shadow: 0 0 12px 2px rgba(232, 193, 112, 0.25); }
}

@keyframes blankPulse {
  0%, 100% { border-color: var(--provence-gold); }
  50% { border-color: var(--lyon-amber); }
}

@keyframes starPop {
  0% { opacity: 0; transform: scale(0) rotate(-30deg); }
  60% { opacity: 1; transform: scale(1.3) rotate(5deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

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

@keyframes ringFill {
  from { stroke-dashoffset: 314; }
}

/* Page load animation */
.container > * { animation: fadeInUp 0.4s ease backwards; }
.container > *:nth-child(2) { animation-delay: 0.05s; }
.container > *:nth-child(3) { animation-delay: 0.1s; }
.container > *:nth-child(4) { animation-delay: 0.15s; }

/* ============================================================
   RESPONSIVE — MOBILE FIRST
   ============================================================ */
@media (max-width: 600px) {
  .navbar { padding: 0.5rem 0.75rem; }

  /* Show hamburger, hide links */
  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
  }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 260px;
    background: var(--card-bg);
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    padding: 3.5rem 1.25rem 1.25rem;
    z-index: 200;
    gap: 0.25rem;
    animation: slideInRight 0.25s ease;
  }
  .nav-links.open a {
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
  }
  .nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
  }
  .nav-overlay.open { display: block; }

  .container { padding: 0.75rem; }

  /* Map */
  .map-stats { gap: 0.75rem; flex-wrap: wrap; }
  .map-stat { font-size: 0.85rem; }

  .zone-header { height: 110px; }
  .zone-name { font-size: 1rem; }

  .zone-levels {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }

  /* Level play */
  .exercise-sentence { font-size: 1.1rem; }
  .options-grid { grid-template-columns: 1fr; }
  .answer-form { flex-direction: column; }

  /* Results */
  .results-card { padding: 2rem 1.25rem; }
  .results-actions { flex-direction: column; }

  /* Stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Leaderboard */
  .podium { gap: 0.4rem; }
  .podium-bar { width: 60px; }
  .lb-details { flex-direction: column; gap: 0.1rem; }

  /* Profile */
  .progress-item { font-size: 0.8rem; }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@media (min-width: 600px) and (max-width: 900px) {
  .zone-levels {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

@media (min-width: 900px) {
  .map-page { padding: 0 2rem 2rem; }
  .zone-header { height: 160px; }
  .zone-levels {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}
