/* Nunito est chargé depuis index.html (display=swap, non bloquant) */

:root {
  --primary:   #7C3AED;
  --secondary: #F59E0B;
  --success:   #10B981;
  --danger:    #EF4444;
  --dark:      #0F172A;
  --card-bg:   rgba(255,255,255,0.08);
  --radius:    18px;
  --shadow:    0 8px 32px rgba(0,0,0,0.35);
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'Nunito', sans-serif;
  background: radial-gradient(ellipse at top, #1e1b4b 0%, #0F172A 60%);
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

/* Stars background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 15%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 60%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 40%, rgba(255,255,255,0.3) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

/* === SCREENS === */
.screen { display: none; flex-direction: column; flex: 1; animation: fadeUp 0.4s ease; }
.screen.active { display: flex; }

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

/* === CARDS (UI) === */
.card {
  background: var(--card-bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  padding: 1.2rem;
}

/* === BUTTONS === */
.btn {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  border: none;
  border-radius: 50px;
  padding: 0.75rem 1.8rem;
  min-height: 48px; /* cible tactile confortable pour de petites mains */
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.5px;
}
.btn:hover  { transform: translateY(-2px); }
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: linear-gradient(135deg, #7C3AED, #A855F7);
  color: white;
  box-shadow: 0 4px 20px rgba(124,58,237,0.5);
}
.btn-secondary {
  background: linear-gradient(135deg, #F59E0B, #FBBF24);
  color: #0F172A;
  box-shadow: 0 4px 20px rgba(245,158,11,0.4);
}
.btn-ghost {
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
}
.btn-success {
  background: linear-gradient(135deg, #10B981, #34D399);
  color: white;
  box-shadow: 0 4px 20px rgba(16,185,129,0.4);
}
.btn-sm { padding: 0.6rem 1.2rem; font-size: 0.9rem; min-height: 44px; }

/* === INPUT === */
.input {
  font-family: 'Nunito', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 50px;
  padding: 0.8rem 1.5rem;
  color: white;
  width: 100%;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}
.input:focus { border-color: var(--primary); }
.input::placeholder { color: rgba(255,255,255,0.4); }

/* === PROGRESS BAR === */
.progress-track {
  height: 10px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.5s ease;
}

/* === UTILS === */
.row   { display:flex; align-items:center; gap:0.8rem; }
.col   { display:flex; flex-direction:column; gap:0.5rem; }
.center { display:flex; align-items:center; justify-content:center; }
.text-center { text-align:center; }
.mt-1 { margin-top:0.5rem; }
.mt-2 { margin-top:1rem; }
.mt-3 { margin-top:1.5rem; }
.mb-1 { margin-bottom:0.5rem; }
.mb-2 { margin-bottom:1rem; }
.gap-1 { gap:0.5rem; }
.gap-2 { gap:1rem; }
.flex-wrap { flex-wrap:wrap; }
.h1 { font-size:1.8rem; font-weight:900; }
.h2 { font-size:1.4rem; font-weight:900; }
.h3 { font-size:1.1rem; font-weight:700; }
.muted { color:#A7B4C9; font-size:0.9rem; }
.badge {
  display:inline-block;
  padding:0.2rem 0.8rem;
  border-radius:50px;
  font-size:0.8rem;
  font-weight:700;
}
.badge-common    { background:#475569; }
.badge-rare      { background:#1D4ED8; }
.badge-epic      { background:#7C3AED; }
.badge-legendary { background: linear-gradient(135deg,#D97706,#F59E0B); color:#0F172A; }

/* === ACCESSIBILITÉ TACTILE === */
/* Pas de zoom double-tap ni de délai 300ms sur les contrôles du jeu */
button, .minigame-card, .diff-card, .choice-btn, .hub-collection-btn,
.coll-item, .card-wrap, .speech-bubble, .target-letter, .builder-word-display {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
  border-radius: 8px;
}

/* === FLASH TOAST (remplace alert, toujours accompagné de la voix) === */
.flash-toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-200%);
  background: var(--danger);
  color: white;
  font-weight: 900;
  font-size: 1rem;
  padding: 0.7rem 1.4rem;
  border-radius: 50px;
  z-index: 10000;
  transition: transform 0.3s ease;
  box-shadow: var(--shadow);
  pointer-events: none;
}
.flash-toast.show { transform: translateX(-50%) translateY(0); }

/* === UNIVERS — le choix de l'enfant colore son monde === */
body.universe-space  { background: radial-gradient(ellipse at top, #1e1b4b 0%, #0F172A 60%); }
body.universe-jungle { background: radial-gradient(ellipse at top, #14532D 0%, #052E16 60%); }
body.universe-ocean  { background: radial-gradient(ellipse at top, #0C4A6E 0%, #082F49 60%); }

/* === MOUVEMENT RÉDUIT — pour les enfants sensibles aux animations === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .companion-placeholder, .hub-companion-img,
  .target-letter.audio-mode, .timer-badge.urgent, .spc-epic {
    animation: none !important;
  }
}
