:root {
  --primary: #5b5fff;
  --secondary: #22c55e;
  --dark: #0f172a;
  --light: #f8fafc;
}

* {
  box-sizing: border-box;
}

/* SMOOTH SCROLL */
html {
  scroll-behavior: smooth;
}

/* BOUTON RETOUR EN HAUT */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--primary);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(91, 95, 255, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 100;
}

.scroll-to-top.show {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(91, 95, 255, 0.6);
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--light);
  color: var(--dark);
}

/* TOPBAR */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 40px;
  background: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  font-weight: 800;
  font-size: 22px;
}

.logo {
  margin-right: 8px;
}

.menu a {
  margin-left: 25px;
  text-decoration: none;
  color: var(--dark);
  font-weight: 600;
}

.menu .cta {
  background: var(--primary);
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
}

/* HERO */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  padding: 80px 60px;
  gap: 40px;
}

.hero h1 {
  font-size: 48px;
  line-height: 1.1;
}

.hero h1 span {
  color: var(--primary);
}

.hero p {
  font-size: 18px;
  margin: 20px 0 30px;
}

.hero-actions a {
  margin-right: 15px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  padding: 14px 26px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
}

.btn-secondary {
  border: 2px solid var(--primary);
  color: var(--primary);
  padding: 12px 24px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
}

.monster-preview {
  font-size: 90px;
  text-align: center;
}

/* SECTIONS */
.section {
  padding: 80px 60px;
  text-align: center;
}

.section h2 {
  font-size: 36px;
  margin-bottom: 20px;
}

.subtitle {
  color: #64748b;
  margin-bottom: 40px;
}

/* STEPS */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 30px;
}

.step {
  background: white;
  padding: 30px;
  border-radius: 20px;
}

.step span {
  display: inline-block;
  background: var(--primary);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  line-height: 36px;
  font-weight: 700;
}

/* MONSTERS */
.monsters {
  background: #eef2ff;
}

.monster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px;
}

.monster-card {
  background: white;
  border-radius: 22px;
  padding: 30px;
  transition: transform 0.3s;
}

.monster-card:hover {
  transform: translateY(-8px);
}

.monster {
  font-size: 64px;
}

.locked {
  opacity: 0.4;
}

/* AUTH */
.auth {
  max-width: 420px;
  margin: 60px auto;
  background: white;
  padding: 35px;
  border-radius: 22px;
}

.auth input,
.auth select {
  width: 100%;
  padding: 14px;
  margin-bottom: 15px;
  border-radius: 12px;
  border: 1px solid #cbd5f5;
}

.auth button {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 14px;
  font-weight: 700;
}

.highlight {
  border: 3px solid var(--secondary);
}

/* FOOTER */
footer {
  text-align: center;
  color: #64748b;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-actions a {
    display: inline-block;
    margin-bottom: 10px;
  }
}

/* AUTH PAGES */
.auth-page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #eef2ff, #f8fafc);
}

.auth-card {
  background: white;
  border-radius: 24px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.1);
}

.auth-header {
  text-align: center;
  margin-bottom: 25px;
}

.auth-logo {
  font-size: 48px;
}

.auth-header h1 {
  margin: 10px 0 5px;
}

.auth-header p {
  color: #64748b;
}

.auth-card input,
.auth-card select {
  width: 100%;
  padding: 14px;
  margin-bottom: 15px;
  border-radius: 14px;
  border: 1px solid #cbd5f5;
  font-size: 15px;
}

.auth-card button {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
}

.auth-footer a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.auth-error {
  background: #fee2e2;
  color: #b91c1c;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 15px;
  text-align: center;
}

/* ONBOARDING */
.onboarding-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #eef2ff, #f8fafc);
  display: flex;
  justify-content: center;
  align-items: center;
}

.onboarding-card {
  background: white;
  padding: 45px;
  border-radius: 28px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0,0,0,0.12);
}

.onboarding-card h1 {
  margin-bottom: 10px;
}

.subtitle {
  color: #64748b;
  margin-bottom: 30px;
}

.onboarding-box {
  background: #f8fafc;
  border-radius: 18px;
  padding: 25px;
  margin-bottom: 20px;
}

.onboarding-box.highlight {
  border: 3px dashed var(--primary);
}

.code {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 3px;
  margin-top: 10px;
}

.onboarding-box input {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid #cbd5f5;
  margin-bottom: 10px;
}

.onboarding-box button {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-secondary {
  display: inline-block;
  margin-top: 15px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 2px solid var(--primary);
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}

/* DASHBOARD */
.dashboard-page {
  padding: 40px;
  background: #f8fafc;
}

.dashboard-card {
  background: white;
  padding: 25px;
  border-radius: 22px;
  margin-bottom: 30px;
  max-width: 600px;
}

.dashboard-card h3 {
  margin-bottom: 15px;
}

.dashboard-card input {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #cbd5f5;
  margin-bottom: 10px;
}

.dashboard-card button {
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.child-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
}

.child-row span {
  color: #64748b;
  font-size: 14px;
}

.child-row form {
  margin: 0;
}

.child-row .danger {
  background: #ef4444;
}

/* DASHBOARD ENFANT */
.child-dashboard {
  background: #f8fafc;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
}

.child-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  background: white;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.child-header .logout {
  text-decoration: none;
  color: #ef4444;
  font-weight: 700;
}

.child-container {
  max-width: 1100px;
  margin: auto;
  padding: 40px;
}

/* STATS */
.child-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px,1fr));
  gap: 25px;
  margin-bottom: 40px;
}

.stat-card {
  background: white;
  padding: 30px;
  border-radius: 26px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}

.stat-card .big {
  font-size: 36px;
  font-weight: 800;
  margin: 10px 0;
}

.stat-card.highlight {
  border: 3px dashed var(--primary);
}

.stat-card .code {
  font-size: 26px;
  letter-spacing: 3px;
  font-weight: 800;
}

/* PLAY */
.play-section {
  text-align: center;
  margin-bottom: 50px;
}

.play-btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), #22c55e);
  color: white;
  padding: 18px 34px;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 20px 40px rgba(91,95,255,0.4);
}

/* COLLECTION */
.collection h2 {
  margin-bottom: 25px;
}

.empty {
  color: #64748b;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px,1fr));
  gap: 25px;
}

.monster-card {
  background: white;
  border-radius: 24px;
  padding: 25px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  transition: transform 0.3s;
}

.monster-card:hover {
  transform: translateY(-10px);
}

.monster-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.monster-card.commun {
  border: 3px solid #e5e7eb;
}

.monster-card.rare {
  border: 3px solid #60a5fa;
}

.monster-card.legendaire {
  border: 3px solid #facc15;
  box-shadow: 0 0 25px rgba(250,204,21,0.6);
}

.monster-card .rarity {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: #64748b;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .child-container {
    padding: 20px;
  }
}

.xp-bar {
  background:#e5e7eb;
  border-radius:999px;
  height:12px;
  overflow:hidden;
  margin:10px 0;
}
.xp-fill {
  background:linear-gradient(135deg,#5b5fff,#22c55e);
  height:100%;
  transition:width 0.8s ease;
}

/* DASHBOARD ENFANT */
.child-dashboard {
  background:#f8fafc;
  min-height:100vh;
}

.child-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:20px 40px;
  background:white;
  box-shadow:0 10px 30px rgba(0,0,0,.05);
}

.logout {
  color:#ef4444;
  font-weight:700;
  text-decoration:none;
}

.child-container {
  max-width:1100px;
  margin:auto;
  padding:40px;
}

/* STATS */
.child-stats {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:25px;
  margin-bottom:40px;
}

.stat-card {
  background:white;
  padding:30px;
  border-radius:26px;
  text-align:center;
  box-shadow:0 20px 40px rgba(0,0,0,.08);
}

.stat-card .big {
  font-size:36px;
  font-weight:800;
}

.stat-card.highlight {
  border:3px dashed var(--primary);
}

.code {
  font-size:26px;
  letter-spacing:3px;
  font-weight:800;
}

/* XP BAR */
.xp-bar {
  background:#e5e7eb;
  border-radius:999px;
  height:12px;
  overflow:hidden;
  margin:10px 0;
}

.xp-fill {
  background:linear-gradient(135deg,#5b5fff,#22c55e);
  height:100%;
  transition:width .8s ease;
}

/* DÉFI */
.daily-challenge {
  background:white;
  padding:30px;
  border-radius:26px;
  margin-bottom:40px;
  box-shadow:0 20px 40px rgba(0,0,0,.08);
}

.daily-challenge .success {
  color:#22c55e;
  font-weight:800;
}

/* PLAY */
.play-section {
  text-align:center;
  margin-bottom:50px;
}

.play-btn {
  display:inline-block;
  background:linear-gradient(135deg,var(--primary),#22c55e);
  color:white;
  padding:18px 34px;
  border-radius:999px;
  font-size:18px;
  font-weight:800;
  text-decoration:none;
  box-shadow:0 20px 40px rgba(91,95,255,.4);
}

/* COLLECTION */
.card-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:25px;
}

.monster-card {
  background:white;
  border-radius:24px;
  padding:25px;
  text-align:center;
  box-shadow:0 20px 40px rgba(0,0,0,.1);
  transition:transform .3s;
}

.monster-card:hover {
  transform:translateY(-10px);
}

.monster-card.commun { border:3px solid #e5e7eb; }
.monster-card.rare { border:3px solid #60a5fa; }
.monster-card.legendaire {
  border:3px solid #facc15;
  box-shadow:0 0 25px rgba(250,204,21,.6);
}

.monster-icon {
  font-size:40px;
}

.rarity {
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
  color:#64748b;
}

/* RESPONSIVE */
@media(max-width:768px){
  .child-container{ padding:20px; }
}

/* LEADERBOARD */
.leaderboard-page {
  background:#f8fafc;
  padding:40px;
  text-align:center;
}

.subtitle {
  color:#64748b;
  margin-bottom:30px;
}

.leaderboard {
  max-width:600px;
  margin:30px auto;
}

.leader-row {
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:white;
  padding:16px 22px;
  border-radius:18px;
  margin-bottom:12px;
  box-shadow:0 10px 30px rgba(0,0,0,.08);
  font-weight:700;
}

.leader-row.first {
  border:3px solid gold;
  box-shadow:0 0 25px rgba(255,215,0,.6);
}

.rank {
  font-weight:900;
}

.btn-back {
  display:inline-block;
  margin-top:30px;
  font-weight:800;
  text-decoration:none;
  color:var(--primary);
}

/* MINI LEADERBOARD */
.leaderboard-mini {
  background:white;
  padding:30px;
  border-radius:26px;
  margin-bottom:40px;
  box-shadow:0 20px 40px rgba(0,0,0,.08);
}

.monster-card img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 12px;
  margin-bottom: 10px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.badge.rare {
  background: linear-gradient(135deg,#60a5fa,#2563eb);
  color: white;
}

.badge.legendaire {
  background: linear-gradient(135deg,#facc15,#f59e0b);
  color: #78350f;
}

.monster-card.see-more {
  text-decoration: none;
  background: linear-gradient(135deg,#5b5fff,#22c55e);
  color: white;
}

.badge.secrete{
  background:linear-gradient(135deg,#d946ef,#7c3aed);
  color:white;
  box-shadow:0 0 12px rgba(217,70,239,.9);
}
