* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Comic Sans MS", "Trebuchet MS", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, #fde68a, transparent 30%),
    radial-gradient(circle at bottom right, #bfdbfe, transparent 35%),
    linear-gradient(135deg, #fef3c7, #dbeafe);
  min-height: 100vh;
  color: #1f2937;
}

.math-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.math-app {
  width: min(920px, 100%);
}

.math-card {
  background: #ffffff;
  border: 5px solid #111827;
  border-radius: 32px;
  box-shadow: 10px 10px 0 #111827;
  padding: 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.game-title {
  font-size: clamp(1.5rem, 5vw, 4rem);
  margin: 0 0 10px;
}



.top-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.info-pill {
  flex: 1;
  min-width: 140px;
  background: #fef3c7;
  border: 3px solid #111827;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 900;
  box-shadow: 4px 4px 0 #111827;
}

.question-box {
  background: #eff6ff;
  border: 4px solid #111827;
  border-radius: 28px;
  padding: 32px 18px;
  box-shadow: inset 0 0 0 6px #bfdbfe;
}

.question {
  font-size: clamp(4rem, 14vw, 8rem);
  font-weight: 900;
  line-height: 1;
}


/* clavier mobile */
.answer-box {
  margin: 22px auto;
  width: min(360px, 100%);
  min-height: 86px;
  border: 4px solid #111827;
  border-radius: 24px;
  background: #f9fafb;
  display: grid;
  place-items: center;
  font-size: clamp(2.8rem, 8vw, 5rem);
  font-weight: 900;
  box-shadow: 6px 6px 0 #111827;
}


.answer-input {
  width: 100%;
  min-height: 86px;
  border: none;
  outline: none;
  background: transparent;
  text-align: center;
  font: inherit;
  font-weight: 900;
  color: #111827;
  caret-color: transparent;
}

.answer-input::placeholder {
  color: #9ca3af;
}


.answer-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  text-align: center;
  font: inherit;
  font-weight: 900;
  color: #111827;
}

.answer-input::placeholder {
  color: #9ca3af;
}




.answer-placeholder {
  color: #9ca3af;
}

.help-text {
  font-size: 1.05rem;
  color: #4b5563;
  margin: 0 0 22px;
}

.message {
  min-height: 46px;
  font-size: 1.5rem;
  font-weight: 900;
  margin: 12px 0;
}

.message.good {
  color: #16a34a;
}

.message.bad {
  color: #dc2626;
}

.action-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.btn {
  border: 4px solid #111827;
  border-radius: 999px;
  padding: 14px 24px;
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
  background: #ffffff;
  color: #111827;
  box-shadow: 5px 5px 0 #111827;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 #111827;
}

.btn-primary {
  background: #86efac;
}

.btn-secondary {
  background: #bfdbfe;
}

.progress-bar {
  height: 20px;
  background: #e5e7eb;
  border: 3px solid #111827;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 22px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #86efac, #facc15);
  transition: width 0.35s ease;
}

.stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.star {
  position: absolute;
  font-size: 2rem;
  animation: star-pop 900ms ease forwards;
}

.good-animation {
  animation: bounce-good 650ms ease;
}

.bad-animation {
  animation: shake-bad 420ms ease;
}

.finish-title {
  font-size: clamp(2.6rem, 8vw, 5rem);
  margin: 0 0 12px;
}

.finish-score {
  font-size: 2rem;
  font-weight: 900;
  margin: 16px 0;
}

.finish-comment {
  font-size: 1.3rem;
  color: #4b5563;
}


.success-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  animation: success-flash 850ms ease forwards;
}

.plus-one {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(2.4rem, 8vw, 5rem);
  font-weight: 900;
  color: #16a34a;
  text-shadow: 3px 3px 0 #111827;
  animation: plus-one-pop 900ms ease forwards;
  pointer-events: none;
  z-index: 5;
}

.rainbow-ring {
  position: absolute;
  width: 120px;
  height: 120px;
  border: 8px solid #facc15;
  border-radius: 50%;
  opacity: 0;
  animation: ring-pop 850ms ease forwards;
  pointer-events: none;
}

.score-pop {
  animation: score-pop 550ms ease;
}

.super-good-animation {
  animation: super-bounce-good 800ms ease;
}

@keyframes success-flash {
  0% {
    background: rgba(250, 204, 21, 0);
  }
  25% {
    background: rgba(250, 204, 21, 0.25);
  }
  50% {
    background: rgba(134, 239, 172, 0.25);
  }
  100% {
    background: rgba(250, 204, 21, 0);
  }
}

@keyframes plus-one-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, 30px) scale(0.5) rotate(-8deg);
  }
  30% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.25) rotate(4deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -90px) scale(0.9) rotate(0deg);
  }
}

@keyframes ring-pop {
  0% {
    opacity: 0.8;
    transform: scale(0.2);
  }
  100% {
    opacity: 0;
    transform: scale(2.4);
  }
}

@keyframes score-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.2) rotate(-2deg); }
  100% { transform: scale(1); }
}

@keyframes super-bounce-good {
  0% { transform: scale(1) rotate(0); }
  20% { transform: scale(1.08) rotate(-2deg); }
  40% { transform: scale(0.96) rotate(2deg); }
  60% { transform: scale(1.05) rotate(-1deg); }
  80% { transform: scale(0.99) rotate(1deg); }
  100% { transform: scale(1) rotate(0); }
}











@keyframes bounce-good {
  0% { transform: scale(1); }
  30% { transform: scale(1.08) rotate(-1deg); }
  55% { transform: scale(0.96) rotate(1deg); }
  80% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

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

@keyframes star-pop {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.4) rotate(0deg);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-140px) scale(1.4) rotate(260deg);
  }
}

@media (max-width: 520px) {
  .math-card {
    padding: 20px;
    border-radius: 24px;
    box-shadow: 6px 6px 0 #111827;
  }

  .question-box {
    padding: 24px 12px;
  }

  .info-pill {
    font-size: 0.95rem;
  }
}