/* ===================================================================
   IrisKids — Kids Quiz
   Aligné sur le design system (iriskids-ui.css déjà importé)
   =================================================================== */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--ik-font, 'Baloo 2', system-ui, sans-serif);
  color: var(--ik-text, #1a1033);
  background:
    radial-gradient(circle at 15% -10%, #fef3c7 0%, transparent 45%),
    radial-gradient(circle at 100% 100%, #ede9fe 0%, transparent 50%),
    #fffafc;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* === Layout commun aux écrans === */
.screen {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(var(--ik-header-h, 52px) + 20px) 18px 40px;
  animation: screen-in .3s cubic-bezier(.34,1.56,.64,1);
}
.screen.hidden { display: none; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === HERO (écran d'accueil) === */
.hero {
  text-align: center;
  padding: 12px 0 8px;
}
.hero-emoji {
  font-size: 64px;
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 6px 12px rgba(234, 179, 8, .35));
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0)    rotate(-3deg); }
  50%      { transform: translateY(-6px) rotate(3deg); }
}
.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin: 8px 0 4px;
  background: linear-gradient(135deg, #eab308 0%, #f97316 60%, #ec4899 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -.01em;
}
.hero-sub {
  margin: 0;
  font-size: 1rem;
  color: var(--ik-muted, #6b7280);
}

/* === Section labels === */
.section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ik-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin: 26px 4px 10px;
}

/* === Catégories === */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 10px;
}
.cat-btn {
  position: relative;
  background: #fff;
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 16px 10px 14px;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  box-shadow: 0 4px 16px rgba(15, 10, 30, .06);
  transition: transform .15s cubic-bezier(.34,1.56,.64,1), border-color .15s, box-shadow .15s;
}
.cat-btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  border-radius: 18px 18px 0 0;
  background: var(--cat-color, #eab308);
}
.cat-btn:hover  { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(15, 10, 30, .12); }
.cat-btn:active { transform: scale(.96); }
.cat-btn.active {
  border-color: var(--cat-color, #eab308);
  box-shadow: 0 8px 24px rgba(234, 179, 8, .25);
}
.cat-btn .cat-emoji { display: block; font-size: 32px; line-height: 1; margin-bottom: 4px; }
.cat-btn .cat-name  { font-size: .95rem; font-weight: 700; color: var(--ik-text, #1a1033); }

/* === Difficulté === */
.difficulty-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.diff-btn {
  background: #fff;
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 12px 8px;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  box-shadow: 0 4px 12px rgba(15, 10, 30, .05);
  transition: transform .15s, border-color .15s, background .15s;
}
.diff-btn:active { transform: scale(.96); }
.diff-btn.active {
  background: linear-gradient(135deg, #fef3c7, #fff);
  border-color: var(--ik-accent, #eab308);
  box-shadow: 0 8px 18px rgba(234, 179, 8, .22);
}
.diff-emoji { display: block; font-size: 24px; line-height: 1; margin-bottom: 2px; }
.diff-name  { font-size: .9rem; font-weight: 700; color: var(--ik-text, #1a1033); }

/* === Boutons primaires / secondaires === */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s, box-shadow .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary {
  background: linear-gradient(135deg, #eab308, #f97316);
  color: #fff;
  box-shadow: 0 8px 22px rgba(234, 179, 8, .35);
  width: 100%;
  margin-top: 22px;
}
.btn-primary:hover  { box-shadow: 0 14px 28px rgba(234, 179, 8, .45); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-secondary {
  background: #fff;
  color: var(--ik-text, #1a1033);
  border: 2px solid #e5e7eb;
  width: 100%;
  margin-top: 10px;
}
.btn-secondary:hover { border-color: var(--ik-accent, #eab308); }
.btn-icon  { font-size: 1.2em; line-height: 1; }
.btn-label { white-space: nowrap; }

/* === Topbar du quiz === */
.quiz-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.progress-wrap { flex: 1; }
.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .82rem;
  font-weight: 700;
  color: var(--ik-muted, #6b7280);
  margin-bottom: 6px;
}
.streak-badge {
  background: linear-gradient(135deg, #fb923c, #ef4444);
  color: #fff;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .8rem;
  animation: streak-pop .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes streak-pop {
  0%   { transform: scale(.6); opacity: 0; }
  70%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.progress-bar {
  height: 8px;
  background: rgba(0, 0, 0, .06);
  border-radius: 999px;
  overflow: hidden;
}
#progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #eab308, #f97316);
  border-radius: 999px;
  transition: width .35s ease;
}
.score-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(15, 10, 30, .08);
}
.score-icon { font-size: 1.1em; }

/* === Carte de question === */
.question-card {
  background: #fff;
  border-radius: 22px;
  padding: 22px 18px 18px;
  box-shadow: 0 12px 32px rgba(15, 10, 30, .08);
}
.question-cat {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--ik-muted, #6b7280);
  background: rgba(0, 0, 0, .04);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.question-text {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 18px;
  color: var(--ik-text, #1a1033);
}

/* === Options de réponse === */
.options-list {
  display: grid;
  gap: 10px;
}
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f9fafb;
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 14px 14px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  color: var(--ik-text, #1a1033);
  transition: transform .12s, border-color .15s, background .15s;
}
.option:hover  { background: #fff; border-color: #e5e7eb; transform: translateX(2px); }
.option:active { transform: scale(.98); }
.option .opt-letter {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .85rem;
  color: var(--ik-muted, #6b7280);
}

/* États après clic */
.option.correct {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
}
.option.correct .opt-letter { background: #22c55e; border-color: #22c55e; color: #fff; }

.option.wrong {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
  animation: shake .35s ease;
}
.option.wrong .opt-letter { background: #ef4444; border-color: #ef4444; color: #fff; }

.option.disabled { opacity: .55; cursor: default; }
.option.disabled:hover { transform: none; }

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

/* === Feedback === */
.feedback {
  margin-top: 16px;
  padding: 14px 14px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fef3c7, #fff7ed);
  animation: feedback-in .3s cubic-bezier(.34,1.56,.64,1);
}
.feedback.hidden { display: none; }
.feedback.is-correct { background: linear-gradient(135deg, #dcfce7, #ecfdf5); }
.feedback.is-wrong   { background: linear-gradient(135deg, #fee2e2, #fef2f2); }

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

.feedback-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.feedback-icon  { font-size: 1.4rem; line-height: 1; }
.feedback-title { font-size: 1.05rem; font-weight: 800; }
.feedback.is-correct .feedback-title { color: #166534; }
.feedback.is-wrong   .feedback-title { color: #991b1b; }

.feedback-fact {
  margin: 0 0 12px;
  font-size: .95rem;
  line-height: 1.45;
  color: var(--ik-text, #1a1033);
}
.feedback .btn-primary { margin-top: 4px; }

/* === Écran de résultat === */
.result-card {
  background: #fff;
  border-radius: 24px;
  padding: 28px 22px 22px;
  box-shadow: 0 16px 40px rgba(15, 10, 30, .1);
  text-align: center;
}
.result-stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 42px;
  line-height: 1;
}
.result-stars .star {
  filter: grayscale(1) opacity(.3);
  transform: scale(.8);
  transition: all .4s cubic-bezier(.34,1.56,.64,1);
}
.result-stars .star.lit {
  filter: none;
  transform: scale(1);
  animation: star-pop .5s cubic-bezier(.34,1.56,.64,1);
}
@keyframes star-pop {
  0%   { transform: scale(.4) rotate(-30deg); }
  60%  { transform: scale(1.2) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}
.result-title {
  font-size: 1.7rem;
  font-weight: 800;
  margin: 4px 0 6px;
  color: var(--ik-text, #1a1033);
}
.result-message {
  margin: 0 0 22px;
  color: var(--ik-muted, #6b7280);
  font-size: 1rem;
  line-height: 1.4;
}
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.stat-block {
  background: #f9fafb;
  border-radius: 14px;
  padding: 14px 6px 10px;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ik-text, #1a1033);
  line-height: 1.1;
}
.stat-total {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ik-muted, #6b7280);
  margin-left: 1px;
}
.stat-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--ik-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 4px;
}
.result-actions { display: flex; flex-direction: column; }

/* === Responsive === */
@media (max-width: 380px) {
  .categories-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-title      { font-size: 1.8rem; }
  .question-text   { font-size: 1.2rem; }
  .stat-value      { font-size: 1.25rem; }
}

@media (min-width: 720px) {
  .result-actions {
    flex-direction: row;
    gap: 10px;
  }
  .result-actions .btn-primary,
  .result-actions .btn-secondary {
    margin-top: 0;
  }
}
