/* Qui est-ce ? — version 6-9 ans. Feuille de style independante du jeu principal. */

:root {
  --sky: #3fa7f7;
  --sky-dark: #2586d9;
  --sun: #ffcc33;
  --coral: #ff6b6b;
  --coral-dark: #e6484a;
  --mint: #4bd68b;
  --mint-dark: #2fae6d;
  --purple: #9b6bff;
  --ink: #2c2c54;
  --paper: #ffffff;
  --bg-a: #cdeeff;
  --bg-b: #fff2cc;
  --shadow: 0 6px 0 rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Baloo 2", "Comic Sans MS", ui-rounded, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg-a) 0%, var(--bg-b) 100%);
  background-attachment: fixed;
  font-size: 19px;
  line-height: 1.4;
  overflow-x: hidden;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 16px 24px;
  position: relative;
  z-index: 1;
}

/* ---- Floating background decorations (purely decorative, behind content) ---- */

.bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-decor .bd {
  position: absolute;
  bottom: -10%;
  font-size: 1.8rem;
  opacity: 0.55;
  animation: floatUpBg linear infinite;
  will-change: transform;
}

.bd.b1 { left: 6%;  font-size: 1.6rem; animation-duration: 14s; animation-delay: 0s; }
.bd.b2 { left: 18%; font-size: 1.2rem; animation-duration: 18s; animation-delay: 2s; }
.bd.b3 { left: 32%; font-size: 1.8rem; animation-duration: 12s; animation-delay: 5s; }
.bd.b4 { left: 48%; font-size: 1.3rem; animation-duration: 20s; animation-delay: 1s; }
.bd.b5 { left: 62%; font-size: 1.7rem; animation-duration: 15s; animation-delay: 7s; }
.bd.b6 { left: 76%; font-size: 1.2rem; animation-duration: 17s; animation-delay: 3s; }
.bd.b7 { left: 88%; font-size: 1.5rem; animation-duration: 13s; animation-delay: 6s; }
.bd.b8 { left: 96%; font-size: 1.1rem; animation-duration: 19s; animation-delay: 4s; }

@keyframes floatUpBg {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  10%  { opacity: 0.55; }
  50%  { transform: translate(20px, -55vh) rotate(180deg); }
  90%  { opacity: 0.4; }
  100% { transform: translate(-10px, -115vh) rotate(360deg); opacity: 0; }
}

/* ---- Control bar (music / fullscreen) ---- */

.control-bar {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 200;
  display: flex;
  gap: 8px;
}

.ctrl-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 3px solid var(--sky);
  background: var(--paper);
  box-shadow: var(--shadow);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.ctrl-btn:active { transform: translateY(3px) scale(0.92); box-shadow: none; }
.ctrl-btn:hover { transform: translateY(-2px) rotate(-4deg); }

/* ---- Splash screen ---- */

.splash-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 30%, #63c1ff 0%, #3fa7f7 55%, #2f7fd6 100%);
  background-size: 180% 180%;
  overflow: hidden;
  animation: splashFadeIn 0.4s ease both, splashDrift 8s ease-in-out infinite;
}

@keyframes splashDrift {
  0%, 100% { background-position: 40% 20%; }
  50% { background-position: 60% 45%; }
}

.splash-overlay.splash-out {
  animation: splashFadeOut 0.45s ease both;
  pointer-events: none;
}

@keyframes splashFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes splashFadeOut {
  to { opacity: 0; transform: scale(1.15); }
}

.splash-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.splash-decor span {
  position: absolute;
  bottom: -10%;
  font-size: 2rem;
  animation: floatUpBg linear infinite, twinkle 1.7s ease-in-out infinite;
  opacity: 0.85;
}
.splash-decor span:nth-child(1) { left: 8%;  animation-duration: 9s, 1.5s;  animation-delay: 0s, 0s; }
.splash-decor span:nth-child(2) { left: 22%; animation-duration: 11s, 1.8s; animation-delay: 1.2s, 0.3s; }
.splash-decor span:nth-child(3) { left: 40%; animation-duration: 8s, 1.4s;  animation-delay: 2.4s, 0.6s; }
.splash-decor span:nth-child(4) { left: 58%; animation-duration: 12s, 2s;  animation-delay: 0.6s, 0.9s; }
.splash-decor span:nth-child(5) { left: 75%; animation-duration: 9.5s, 1.6s; animation-delay: 1.8s, 0.2s; }
.splash-decor span:nth-child(6) { left: 90%; animation-duration: 10.5s, 1.9s; animation-delay: 3s, 0.5s; }

@keyframes twinkle {
  0%, 100% { filter: brightness(1) drop-shadow(0 0 0 rgba(255,255,255,0)); transform: scale(1); }
  50% { filter: brightness(1.5) drop-shadow(0 0 8px rgba(255,255,255,0.9)); transform: scale(1.15); }
}

.splash-mascot {
  position: relative;
  font-size: 5rem;
  animation: mascotBounceIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both, mascotIdle 2.2s ease-in-out 0.8s infinite;
  filter: drop-shadow(0 8px 0 rgba(0, 0, 0, 0.15));
}
.splash-mascot::before {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 70%);
  animation: glowPulse 2.2s ease-in-out 0.8s infinite;
}
@keyframes glowPulse {
  0%, 100% { transform: scale(0.85); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 1; }
}

@keyframes mascotBounceIn {
  0%   { transform: scale(0) rotate(-30deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}
@keyframes mascotIdle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(-4deg); }
}

.splash-title {
  margin: 6px 0 0;
  font-size: 2.1rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.18);
}
.splash-title .sl {
  display: inline-block;
  animation: letterBounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: calc(var(--i, 0) * 0.045s);
}
@keyframes letterBounce {
  0%   { transform: translateY(40px) scale(0.4); opacity: 0; }
  70%  { transform: translateY(-8px) scale(1.08); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}

.splash-sub {
  color: #fff;
  font-weight: 700;
  max-width: 320px;
  margin: 4px 0 18px;
  animation: fadeInUp 0.6s ease 0.9s both;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Floating character silhouettes (splash) ---- */

.splash-chars {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.splash-char {
  position: absolute;
  bottom: -15%;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  animation: floatUpBg linear infinite;
  opacity: 0;
}

.splash-char img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) brightness(0.15) contrast(1.3);
}

.splash-char.sc1 { left: 10%;  width: 46px; height: 46px; animation-duration: 13s; animation-delay: 0.2s; }
.splash-char.sc2 { left: 24%;  width: 62px; height: 62px; animation-duration: 16s; animation-delay: 1.4s; }
.splash-char.sc3 { left: 38%;  width: 40px; height: 40px; animation-duration: 11s; animation-delay: 2.6s; }
.splash-char.sc4 { left: 52%;  width: 58px; height: 58px; animation-duration: 15s; animation-delay: 0.8s; }
.splash-char.sc5 { left: 66%;  width: 48px; height: 48px; animation-duration: 12.5s; animation-delay: 2s; }
.splash-char.sc6 { left: 80%;  width: 54px; height: 54px; animation-duration: 14s; animation-delay: 1s; }
.splash-char.sc7 { left: 90%;  width: 42px; height: 42px; animation-duration: 17s; animation-delay: 3s; }
.splash-char.sc8 { left: 4%;   width: 50px; height: 50px; animation-duration: 13.5s; animation-delay: 3.6s; }

.splash-credit {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 700;
  font-size: 0.85rem;
  font-style: italic;
  margin: 2px 0 16px;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.15);
  animation: fadeInUp 0.6s ease 1s both;
}
.splash-credit strong { font-style: normal; }

.splash-play-btn {
  background: var(--sun);
  color: #5a3d00;
  border: none;
  border-radius: 999px;
  padding: 16px 34px;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
  animation: fadeInUp 0.6s ease 1.1s both, pulseBtn 1.6s ease-in-out 1.8s infinite;
}
.splash-play-btn:active { transform: translateY(4px); box-shadow: none; }

@keyframes pulseBtn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.home-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0;
  color: var(--sky-dark);
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.6);
  animation: fadeInUp 0.5s ease both;
}

.wobble-emoji {
  display: inline-block;
  animation: wobble 2.4s ease-in-out infinite;
  transform-origin: 70% 70%;
}
@keyframes wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-12deg); }
  50% { transform: rotate(0deg); }
  75% { transform: rotate(10deg); }
}

.home-title small {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 3px solid var(--sky);
  color: var(--sky-dark);
  font-weight: 800;
  font-size: 1rem;
  padding: 8px 16px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.intro-card {
  background: var(--paper);
  border-radius: 24px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  font-weight: 600;
  animation: fadeInUp 0.5s ease 0.1s both;
}

/* ---- Level select grid ---- */

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 12px;
}

.level-btn {
  aspect-ratio: 1 / 1;
  border-radius: 20px;
  border: none;
  background: var(--paper);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease;
  animation: popIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: calc(var(--i, 0) * 25ms);
}

.level-btn:active { transform: translateY(4px) scale(0.95); box-shadow: none; }
.level-btn:hover { transform: translateY(-3px) rotate(-2deg); }

.level-btn .lvl-emoji {
  font-size: 1.6rem;
  display: inline-block;
  animation: wobble 3s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.level-btn .lvl-num { font-weight: 800; font-size: 1rem; color: var(--sky-dark); }

.level-btn.done {
  background: #dde1e7;
  color: #757e8c;
  border: 3px solid #c3c9d2;
  opacity: 0.8;
  animation: popIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.level-btn.done:hover { transform: none; }
.level-btn.done .lvl-num { color: #757e8c; }
.level-btn.done .lvl-emoji { filter: grayscale(1); opacity: 0.6; animation: none; }

.level-btn { position: relative; }
.lvl-check {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #8b93a1;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
  animation: spinIn 0.5s ease 0.15s both;
}

@keyframes popIn {
  0%   { transform: scale(0.3) rotate(-8deg); opacity: 0; }
  70%  { transform: scale(1.08) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}

.progress-line {
  text-align: center;
  font-weight: 700;
  margin-top: 18px;
  color: var(--ink);
}

.reset-row {
  text-align: center;
  margin-top: 26px;
}
.reset-row button {
  background: none;
  border: none;
  color: #888;
  text-decoration: underline;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}

/* ---- Play screen ---- */

.play-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-weight: 800;
}

.badge {
  background: var(--paper);
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: var(--shadow);
  font-size: 0.95rem;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.photo-frame {
  position: relative;
  width: min(100%, 38vh, 300px);
  aspect-ratio: 1 / 1;
  border-radius: 28px;
  overflow: hidden;
  background: #dfe9ff center/cover no-repeat;
  box-shadow: var(--shadow);
  margin: 0 auto 14px;
  transition: filter 0.5s ease, box-shadow 0.3s ease;
  animation: fadeInUp 0.5s ease both;
}

.photo-frame.shake-frame {
  animation: shake 0.4s ease;
  box-shadow: var(--shadow), 0 0 0 6px rgba(255, 107, 107, 0.45);
}

.photo-frame .lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  pointer-events: none;
  filter: none !important;
  animation: wobble 2.5s ease-in-out infinite;
}

.sparkle-ring {
  position: absolute;
  inset: -6px;
  pointer-events: none;
  border-radius: 34px;
  border: 6px dashed var(--sun);
  filter: none !important;
  animation: ringSpin 3.5s linear infinite, ringFade 0.4s ease both;
}
@keyframes ringSpin { to { transform: rotate(360deg); } }
@keyframes ringFade { from { opacity: 0; transform: scale(0.9) rotate(0deg); } to { opacity: 1; } }

.hint-stack {
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  margin-bottom: 12px;
}

.hint-bubble {
  background: var(--paper);
  border-radius: 18px;
  padding: 10px 16px;
  box-shadow: var(--shadow);
  font-weight: 600;
  animation: hintPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.hint-bubble .hint-num {
  display: inline-block;
  background: var(--sun);
  color: #5a3d00;
  border-radius: 999px;
  width: 26px;
  height: 26px;
  line-height: 26px;
  text-align: center;
  font-weight: 800;
  margin-right: 8px;
  animation: spinIn 0.5s ease both;
}

@keyframes hintPop {
  0%   { transform: translateY(16px) scale(0.85); opacity: 0; }
  70%  { transform: translateY(-3px) scale(1.03); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}
@keyframes spinIn {
  from { transform: rotate(-180deg) scale(0.4); opacity: 0; }
  to   { transform: rotate(0deg) scale(1); opacity: 1; }
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.choice-btn {
  background: var(--paper);
  border: 4px solid var(--sky);
  border-radius: 18px;
  padding: 12px 10px;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow);
  min-height: 52px;
  transition: transform 0.12s ease;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

.choice-btn:active { transform: translateY(4px) scale(0.95); box-shadow: none; }
.choice-btn:hover:not(:disabled) { transform: translateY(-2px) scale(1.02); }

.choice-btn.wrong {
  background: var(--coral);
  border-color: var(--coral-dark);
  color: #fff;
  animation: shake 0.4s ease;
}

.choice-btn.correct {
  background: var(--mint);
  border-color: var(--mint-dark);
  color: #06331f;
  animation: correctPulse 0.5s ease;
}

@keyframes correctPulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

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

.feedback-line {
  text-align: center;
  font-weight: 800;
  min-height: 1.6em;
  margin-bottom: 10px;
}
.feedback-line.wrong,
.feedback-line.correct {
  animation: feedbackPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.feedback-line.wrong { color: var(--coral-dark); }
.feedback-line.correct { color: var(--mint-dark); }

@keyframes feedbackPop {
  0%   { transform: scale(0.6); opacity: 0; }
  70%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

.skip-row { text-align: center; margin-bottom: 10px; }
.skip-btn {
  background: none;
  border: none;
  color: #7a6a00;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
}

/* ---- Reveal card ---- */

.reveal-card {
  background: var(--paper);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
  animation: cardBounceIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes cardBounceIn {
  0%   { transform: scale(0.6) translateY(30px); opacity: 0; }
  70%  { transform: scale(1.03) translateY(-4px); opacity: 1; }
  100% { transform: scale(1) translateY(0); }
}

.reveal-card img {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  animation: imgPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}
@keyframes imgPopIn {
  0%   { transform: scale(0.7) rotate(-6deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.reveal-card h2 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  color: var(--sky-dark);
  animation: fadeInUp 0.4s ease 0.25s both;
}
.reveal-card .reveal-bio {
  font-weight: 600;
  margin: 0 0 14px;
  animation: fadeInUp 0.4s ease 0.35s both;
}
.reveal-card .reveal-fact {
  background: #fff8e0;
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 600;
  margin-bottom: 18px;
  animation: fadeInUp 0.4s ease 0.45s both;
}

.reveal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeInUp 0.4s ease 0.55s both;
}

.btn-big {
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease;
}
.btn-big:active { transform: translateY(4px) scale(0.96); box-shadow: none; }
.btn-big:hover { transform: translateY(-2px); }
.btn-big.primary { background: var(--purple); color: #fff; animation: pulseBtn 1.8s ease-in-out 1s infinite; }
.btn-big.secondary { background: var(--paper); color: var(--sky-dark); border: 3px solid var(--sky); }

/* ---- Confetti ---- */
.confetti-piece {
  position: fixed;
  top: -20px;
  font-size: 1.6rem;
  pointer-events: none;
  animation: fall linear forwards;
  z-index: 999;
}
@keyframes fall {
  0%   { transform: translateY(0) rotate(0deg) translateX(0); }
  50%  { transform: translateY(52vh) rotate(180deg) translateX(var(--drift, 20px)); }
  to   { transform: translateY(105vh) rotate(360deg) translateX(0); opacity: 0.9; }
}

.wobble-hover:hover { animation: wobble 0.6s ease-in-out; }

[hidden] { display: none !important; }

@media (max-width: 380px) {
  body { font-size: 17px; }
  .choice-grid { grid-template-columns: 1fr; }
}
