:root {
  --pink: #ff8fc7;
  --peach: #ffc28b;
  --mint: #8ee8ca;
  --sky: #8fd7ff;
  --lemon: #ffe889;
  --lilac: #c9a6ff;
  --ink: #59446f;
  --white: #fffafc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Comic Sans MS", "Trebuchet MS", system-ui, sans-serif;
  background:
    radial-gradient(circle at 18% 15%, rgba(255, 232, 137, 0.7) 0 9%, transparent 10%),
    radial-gradient(circle at 85% 20%, rgba(142, 232, 202, 0.75) 0 10%, transparent 11%),
    linear-gradient(135deg, #ffe9f6 0%, #e3f7ff 48%, #fff7cf 100%);
  overflow-x: hidden;
}

.game {
  width: min(980px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
}

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

.guide {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.guide-face {
  position: relative;
  width: 82px;
  height: 82px;
  flex: 0 0 auto;
  border: 5px solid #fff;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe0ab, #ffb6d9);
  box-shadow: 0 8px 0 rgba(89, 68, 111, 0.14);
  animation: floaty 2.8s ease-in-out infinite;
}

.guide-face::before,
.guide-face::after {
  content: "";
  position: absolute;
  top: 28px;
  width: 18px;
  height: 24px;
  border-radius: 50%;
  background: #ffd5e8;
}

.guide-face::before {
  left: -9px;
}

.guide-face::after {
  right: -9px;
}

.eye {
  position: absolute;
  top: 30px;
  width: 10px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink);
}

.eye.left {
  left: 25px;
}

.eye.right {
  right: 25px;
}

.smile {
  position: absolute;
  left: 31px;
  top: 47px;
  width: 20px;
  height: 11px;
  border-bottom: 4px solid var(--ink);
  border-radius: 0 0 20px 20px;
}

.bow {
  position: absolute;
  top: -16px;
  right: 2px;
  width: 30px;
  height: 22px;
}

.bow::before,
.bow::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 20px;
  border-radius: 12px 12px 4px 12px;
  background: var(--pink);
}

.bow::before {
  left: 0;
  transform: rotate(-30deg);
}

.bow::after {
  right: 0;
  transform: rotate(30deg);
}

.guide-name,
.guide-message {
  margin: 0;
}

.guide-name {
  font-size: clamp(1.25rem, 4vw, 2rem);
  font-weight: 900;
}

.guide-message {
  font-size: clamp(0.95rem, 3vw, 1.3rem);
}

.score-box {
  min-width: 104px;
  padding: 10px 14px;
  text-align: center;
  border: 4px solid #fff;
  border-radius: 24px;
  background: var(--lemon);
  box-shadow: 0 8px 0 rgba(89, 68, 111, 0.14);
}

.score-box span,
.score-box strong {
  display: block;
}

.score-box strong {
  font-size: 2rem;
}

.play-card {
  position: relative;
  padding: clamp(18px, 5vw, 36px);
  border: 6px solid #fff;
  border-radius: 32px;
  background: rgba(255, 250, 252, 0.88);
  box-shadow: 0 14px 0 rgba(89, 68, 111, 0.13);
}

h1 {
  margin: 0 0 22px;
  text-align: center;
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 1;
  color: #ff62ad;
  text-shadow: 3px 3px 0 #fff;
}

.equation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 18px);
  min-height: 170px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.candy-group {
  display: grid;
  grid-template-columns: repeat(5, 34px);
  justify-content: center;
  align-content: center;
  gap: 10px;
  min-width: 210px;
  min-height: 110px;
  padding: 14px;
  border-radius: 24px;
  background: rgba(143, 215, 255, 0.22);
}

.candy {
  position: relative;
  width: 34px;
  height: 34px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--candy-color);
  box-shadow: 0 4px 0 rgba(89, 68, 111, 0.13);
  animation: wiggle 2s ease-in-out infinite;
  animation-delay: var(--delay);
}

.candy::before,
.candy::after {
  content: "";
  position: absolute;
  top: 8px;
  width: 12px;
  height: 14px;
  background: inherit;
  border: 2px solid #fff;
  transform: rotate(45deg);
}

.candy::before {
  left: -11px;
  border-radius: 10px 2px 10px 2px;
}

.candy::after {
  right: -11px;
  border-radius: 2px 10px 2px 10px;
}

.symbol,
.question {
  display: inline-grid;
  place-items: center;
  width: clamp(48px, 12vw, 82px);
  height: clamp(48px, 12vw, 82px);
  font-size: clamp(2.4rem, 9vw, 4.8rem);
  font-weight: 900;
  color: #6b58d8;
}

.question {
  border-radius: 50%;
  color: #fff;
  background: var(--lilac);
  box-shadow: 0 8px 0 rgba(89, 68, 111, 0.14);
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.answer-btn {
  min-height: 92px;
  border: 5px solid #fff;
  border-radius: 26px;
  color: var(--ink);
  font: 900 clamp(2rem, 8vw, 3.5rem) "Comic Sans MS", "Trebuchet MS", system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 9px 0 rgba(89, 68, 111, 0.16);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.answer-btn:nth-child(1) {
  background: var(--mint);
}

.answer-btn:nth-child(2) {
  background: var(--peach);
}

.answer-btn:nth-child(3) {
  background: var(--sky);
}

.answer-btn:hover,
.answer-btn:focus-visible {
  transform: translateY(-4px) scale(1.03);
  outline: none;
}

.answer-btn:active {
  transform: translateY(4px) scale(0.98);
  box-shadow: 0 3px 0 rgba(89, 68, 111, 0.16);
}

.feedback {
  min-height: 48px;
  text-align: center;
  font-size: clamp(1.35rem, 4vw, 2.3rem);
  font-weight: 900;
  color: #ff62ad;
}

.stars,
.confetti {
  pointer-events: none;
}

.star {
  position: absolute;
  width: 28px;
  height: 28px;
  background: #ffd94f;
  clip-path: polygon(50% 0%, 61% 34%, 98% 35%, 68% 56%, 79% 91%, 50% 70%, 21% 91%, 32% 56%, 2% 35%, 39% 34%);
  animation: pop-star 900ms ease-out forwards;
}

.confetti-piece {
  position: fixed;
  top: -18px;
  width: 14px;
  height: 22px;
  border-radius: 5px;
  background: var(--confetti-color);
  animation: fall 1.6s ease-in forwards;
}

.shake {
  animation: shake 280ms ease-in-out;
}

@keyframes floaty {
  0%, 100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-8px) rotate(2deg);
  }
}

@keyframes wiggle {
  0%, 100% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(7deg) translateY(-4px);
  }
}

@keyframes pop-star {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.3) rotate(0deg);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-105px) scale(1.25) rotate(120deg);
  }
}

@keyframes fall {
  to {
    transform: translateY(105vh) rotate(520deg);
    opacity: 0;
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  75% {
    transform: translateX(8px);
  }
}

@media (max-width: 720px) {
  .game {
    justify-content: flex-start;
  }

  .top-bar {
    align-items: flex-start;
  }

  .guide-face {
    width: 68px;
    height: 68px;
  }

  .eye {
    top: 25px;
  }

  .eye.left {
    left: 21px;
  }

  .eye.right {
    right: 21px;
  }

  .smile {
    left: 25px;
    top: 40px;
  }

  .candy-group {
    grid-template-columns: repeat(5, 28px);
    min-width: 170px;
    min-height: 92px;
    gap: 8px;
  }

  .candy {
    width: 28px;
    height: 28px;
  }

  .candy::before,
  .candy::after {
    top: 6px;
    width: 10px;
    height: 12px;
  }

  .answer-grid {
    grid-template-columns: 1fr;
  }

  .answer-btn {
    min-height: 74px;
  }
}
