
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&display=swap');

:root {
  --pink: #ed77ad;
  --purple: #9b80e7;
  --ink: #514363;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Fredoka', 'Trebuchet MS', sans-serif;
  color: var(--ink);
  background: linear-gradient(140deg, #fff0f7, #eee7ff, #e8f9ed);
}

button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }

.game {
  width: min(1100px, 100%);
  margin: auto;
  padding: 20px 16px 35px;
}

header { text-align: center; }

.eyebrow {
  font-size: 12px;
  letter-spacing: 3px;
  font-weight: 700;
  color: #a780bb;
}

h1 {
  margin: 5px 0 0;
  font-size: clamp(36px, 6vw, 67px);
  letter-spacing: 3px;
  color: #dc68a5;
  text-shadow: 3px 3px white;
}

.subtitle {
  margin: 0;
  color: #8c70b8;
  font-size: 22px;
}

.topic {
  display: inline-block;
  margin: 12px 0 20px;
  padding: 9px 22px;
  border-radius: 25px;
  background: white;
  box-shadow: 0 5px 16px #b9a1c344;
  font-size: 14px;
}

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

.score, .round-box {
  min-height: 112px;
  padding: 12px;
  border-radius: 20px;
  background: white;
  text-align: center;
  box-shadow: 0 6px 18px #ad91c32b;
}

.score { border: 3px solid; }
.score-a { border-color: #f4a5c8; }
.score-b { border-color: #b6a1f4; }
.score strong, .round-box strong { font-size: 14px; }

.number {
  font-size: 37px;
  font-weight: 700;
  line-height: 1.2;
}

.score small { color: #9585a3; }

.round-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.round-box span {
  font-size: 12px;
  color: #a477bb;
}

.timer {
  display: grid;
  place-items: center;
  width: 47px;
  height: 47px;
  border-radius: 50%;
  border: 3px solid #f5cc5c;
  background: #fff1b8;
  font-size: 22px;
  font-weight: 700;
}

.timer.urgent {
  background: #ffd5df;
  border-color: #ef8199;
  animation: pulse .5s infinite alternate;
}

/* ORIGINAL SHARED GARDEN */

.garden {
  position: relative;
  height: 420px;
  overflow: hidden;
  border: 5px solid white;
  border-radius: 28px;
  background: linear-gradient(
    #a5dffc 0%,
    #d8f4ff 55%,
    #e7f8e7 69%,
    #a9df98 70%,
    #7dc879 100%
  );
  box-shadow: 0 10px 28px #a98bc33b;
}

.garden-caption {
  position: absolute;
  z-index: 8;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 95%;
  padding: 8px 17px;
  border-radius: 20px;
  background: #ffffffdf;
  font-size: 13px;
  text-align: center;
}

.sun {
  position: absolute;
  top: 45px;
  right: 10%;
  width: 67px;
  height: 67px;
  border-radius: 50%;
  background: #ffe17d;
  box-shadow: 0 0 0 13px #ffe27b55, 0 0 40px #fff2a6;
}

.cloud {
  position: absolute;
  width: 115px;
  height: 33px;
  border-radius: 40px;
  background: #ffffffc7;
  animation: drift 12s ease-in-out infinite alternate;
}

.cloud:before, .cloud:after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.cloud:before {
  width: 58px;
  height: 50px;
  left: 15px;
  top: -23px;
}

.cloud:after {
  width: 48px;
  height: 43px;
  right: 12px;
  top: -17px;
}

.cloud-one { top: 83px; left: 10%; }
.cloud-two { top: 126px; right: 23%; transform: scale(.75); }

.butterfly {
  position: absolute;
  z-index: 8;
  top: 112px;
  left: 48%;
  font-size: 25px;
  animation: butterfly 5s ease-in-out infinite;
}

.garden-teams {
  position: absolute;
  inset: 55px 0 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.garden-team {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-direction: column;
}

.garden-team:first-child {
  border-right: 2px dashed #ffffffaa;
}

.garden-team.active:after {
  content: "";
  position: absolute;
  inset: 20px 12px 0;
  border: 3px dashed #ffffffc9;
  border-radius: 25px;
  pointer-events: none;
}

.level {
  position: absolute;
  z-index: 6;
  top: 35px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 12px;
  border-radius: 18px;
  background: #ffffffd9;
  color: #558b61;
  font-size: 12px;
  white-space: nowrap;
}

.flower-stage {
  position: relative;
  width: 200px;
  height: 245px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.flower {
  position: relative;
  width: 150px;
  height: 210px;
  transform: scale(.55);
  transform-origin: bottom center;
  transition: transform 1s cubic-bezier(.2,1.4,.3,1);
  --petal: #fb79af;
  --petal-light: #ffb1d2;
}

.purple-flower {
  --petal: #a988f0;
  --petal-light: #d2baff;
}

.flower-top {
  position: absolute;
  z-index: 2;
  top: 4px;
  left: 25px;
  width: 100px;
  height: 100px;
}

.petals {
  position: absolute;
  inset: 0;
}

.petals i {
  position: absolute;
  top: 15px;
  left: 21px;
  width: 58px;
  height: 70px;
  border-radius: 60% 60% 40% 40%;
  background: var(--petal);
  box-shadow: inset -8px -6px var(--petal-light);
  transform-origin: 29px 35px;
}

.petals i:nth-child(1) { transform: rotate(0deg) translateY(-45px); }
.petals i:nth-child(2) { transform: rotate(45deg) translateY(-45px); }
.petals i:nth-child(3) { transform: rotate(90deg) translateY(-45px); }
.petals i:nth-child(4) { transform: rotate(135deg) translateY(-45px); }
.petals i:nth-child(5) { transform: rotate(180deg) translateY(-45px); }
.petals i:nth-child(6) { transform: rotate(225deg) translateY(-45px); }
.petals i:nth-child(7) { transform: rotate(270deg) translateY(-45px); }
.petals i:nth-child(8) { transform: rotate(315deg) translateY(-45px); }

.flower-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border-radius: 50%;
  border: 5px solid #f5c761;
  background: #ffe69a;
  color: #9e665b;
}

.flower-eyes {
  font-size: 24px;
  letter-spacing: 8px;
  line-height: 1;
}

.flower-smile {
  font-size: 32px;
  line-height: 1;
}

.stem {
  position: absolute;
  z-index: 1;
  top: 98px;
  left: 70px;
  width: 13px;
  height: 115px;
  border-radius: 10px;
  background: linear-gradient(90deg, #3b9d55, #79cd78);
}

.leaf {
  position: absolute;
  top: 144px;
  width: 52px;
  height: 30px;
  background: #4cb96b;
  border-radius: 90% 0 90% 0;
}

.left-leaf { left: 27px; transform: rotate(25deg); }
.right-leaf { right: 25px; transform: scaleX(-1) rotate(25deg); }

/* ORIGINAL CARTOON CHARACTERS */

.kid {
  position: absolute;
  z-index: 9;
  bottom: 38px;
  left: 7%;
  width: 75px;
  height: 123px;
  transform-origin: bottom center;
}

.garden-team:nth-child(2) .kid {
  left: auto;
  right: 7%;
}

.hair {
  position: absolute;
  z-index: 4;
  top: 5px;
  left: 9px;
  width: 57px;
  height: 31px;
  border-radius: 50% 50% 25% 25%;
  background: #77465e;
}

.boy .hair {
  height: 24px;
  background: #684d43;
}

.face {
  position: absolute;
  z-index: 3;
  top: 16px;
  left: 11px;
  width: 53px;
  height: 55px;
  border: 2px solid #e7ab89;
  border-radius: 45%;
  background: #f5c69e;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.kid-eyes {
  color: #5c4651;
  font-size: 20px;
  letter-spacing: 5px;
  line-height: 1;
}

.kid-mouth {
  color: #9d5b65;
  font-size: 24px;
  line-height: 1;
}

.shirt {
  position: absolute;
  z-index: 2;
  top: 67px;
  left: 8px;
  width: 60px;
  height: 44px;
  border: 3px solid #d66c9a;
  border-radius: 20px 20px 9px 9px;
  background: #ef81ae;
}

.boy .shirt {
  background: #9883e9;
  border-color: #7b69d0;
}

.feet {
  position: absolute;
  bottom: 0;
  left: 20px;
  display: flex;
  gap: 11px;
}

.feet i {
  width: 13px;
  height: 23px;
  border-radius: 5px;
  background: #6b6085;
}

.bubble {
  position: absolute;
  z-index: 15;
  bottom: 145px;
  left: 0;
  opacity: 0;
  padding: 8px 14px;
  border-radius: 20px;
  background: white;
  color: #dd5e9a;
  font-size: 19px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 5px 15px #7773;
}

.boy .bubble {
  color: #9270d9;
  left: auto;
  right: 0;
}

.bubble.visible {
  opacity: 1;
  animation: pop .4s both;
}

.kid.happy { animation: jump .55s ease-in-out 3; }
.kid.sad { animation: sad .7s ease-in-out 2; }
.flower.blooming { animation: glow .9s ease-in-out; }

.team-tag {
  position: absolute;
  z-index: 10;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 17px;
  border-radius: 20px;
  background: white;
  font-weight: 700;
  white-space: nowrap;
}

.grass {
  position: absolute;
  z-index: 5;
  bottom: 0;
  width: 100%;
  height: 25px;
  background: repeating-linear-gradient(
    105deg, #58ac61 0 8px, #7cca78 8px 17px
  );
  clip-path: polygon(
    0 35%, 3% 0, 6% 40%, 9% 0, 12% 40%,
    15% 0, 18% 40%, 21% 0, 24% 40%,
    27% 0, 30% 40%, 33% 0, 36% 40%,
    39% 0, 42% 40%, 45% 0, 48% 40%,
    51% 0, 54% 40%, 57% 0, 60% 40%,
    63% 0, 66% 40%, 69% 0, 72% 40%,
    75% 0, 78% 40%, 81% 0, 84% 40%,
    87% 0, 90% 40%, 93% 0, 96% 40%,
    100% 0, 100% 100%, 0 100%
  );
}

#sparkles {
  position: absolute;
  z-index: 12;
  inset: 0;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  font-size: 24px;
  animation: sparkle 1.3s forwards;
}

/* QUESTIONS */

.question-card {
  margin-top: 17px;
  padding: 23px;
  border-radius: 25px;
  background: white;
  text-align: center;
  box-shadow: 0 8px 24px #b49ac344;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: #aa79b8;
}

.question-card h2 {
  margin: 17px 0 22px;
  font-size: clamp(19px, 2.5vw, 28px);
}

.answers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.answers button {
  padding: 15px 10px;
  border: 3px solid #e5d9f3;
  border-radius: 18px;
  background: #faf5ff;
  color: #654f84;
  font-size: 19px;
  font-weight: 700;
}

.answers button.correct {
  background: #d8f6df;
  border-color: #69c77e;
  color: #267b42;
}

.answers button.wrong {
  background: #ffe0e6;
  border-color: #ef8a9d;
  color: #a53c58;
}

.answers button:disabled { opacity: .8; }

#feedback {
  min-height: 24px;
  font-size: 14px;
  color: #8d7c9d;
}

.primary-button {
  border: 0;
  border-radius: 25px;
  padding: 14px 34px;
  background: linear-gradient(100deg, #ed77ad, #9d85e8);
  color: white;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 5px 13px #b08acb66;
}

.primary-button:active { transform: scale(.97); }

footer {
  padding: 16px;
  text-align: center;
  color: #9b8cac;
  font-size: 12px;
}

/* ORIGINAL WINNER CELEBRATION */

.overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 20px;
  background: #49365ec4;
}

.result-card {
  position: relative;
  z-index: 102;
  width: min(470px, 100%);
  padding: 32px 25px;
  border: 5px solid #ffd56b;
  border-radius: 30px;
  background: linear-gradient(145deg, #fffaf0, #ffe5f1, #eee6ff);
  text-align: center;
  box-shadow: 0 20px 70px #33224777;
  animation: winnerAppear .7s ease-out both;
}

.trophy {
  font-size: 65px;
  animation: trophyBounce 1.3s ease-in-out infinite;
}

.winner-label {
  margin: 10px 0;
  color: #b08b42;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
}

.result-card h2 {
  color: #d65e9f;
  font-size: clamp(22px, 4vw, 32px);
}

.winner-name {
  display: inline-block;
  padding: 12px 30px;
  border: 3px solid #f5ca67;
  border-radius: 25px;
  background: white;
  color: #9270ce;
  font-size: 30px;
  font-weight: 700;
}

.result-card p {
  line-height: 1.8;
  font-size: 17px;
}

.reward {
  margin: 15px 0 25px;
  font-size: 18px;
  font-weight: 700;
  color: #cf5d95;
}

.result-card .primary-button {
  margin: 5px;
}

#printCertificateBtn {
  background: linear-gradient(100deg, #d8ae4c, #edca75);
  color: #624d31;
}

#confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -30px;
  width: 11px;
  height: 17px;
  border-radius: 3px;
  animation: confettiFall linear infinite;
}

/* ANIMATIONS */

@keyframes jump {
  0%,100% { transform: translateY(0) rotate(0); }
  45% { transform: translateY(-45px) rotate(-8deg); }
}

@keyframes sad {
  0%,100% { transform: translateY(0) rotate(0); }
  35% { transform: translateY(8px) rotate(-12deg); }
  70% { transform: translateY(8px) rotate(10deg); }
}

@keyframes glow {
  0%,100% { filter: brightness(1); }
  50% {
    filter: brightness(1.4) drop-shadow(0 0 20px #fff0a0);
  }
}

@keyframes sparkle {
  from {
    opacity: 1;
    transform: translateY(0) scale(.4);
  }
  to {
    opacity: 0;
    transform: translateY(-85px) scale(1.5) rotate(50deg);
  }
}

@keyframes pop {
  from { transform: scale(.5); }
  to { transform: scale(1); }
}

@keyframes butterfly {
  0%,100% { transform: translate(0,0) rotate(-15deg); }
  50% { transform: translate(45px,-30px) rotate(15deg); }
}

@keyframes drift {
  from { translate: -15px 0; }
  to { translate: 35px 0; }
}

@keyframes pulse {
  to { transform: scale(1.12); }
}

@keyframes winnerAppear {
  from {
    opacity: 0;
    transform: scale(.65) translateY(45px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes trophyBounce {
  0%,100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-12px) rotate(5deg); }
}

@keyframes confettiFall {
  from {
    transform: translateY(-30px) rotate(0);
    opacity: 1;
  }
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: .8;
  }
}

@media (max-width: 650px) {
  .game { padding: 12px 9px; }
  .garden { height: 350px; }
  .garden-teams { inset: 50px 0 10px; }

  .flower-stage {
    transform: scale(.8);
    transform-origin: bottom;
  }

  .kid { scale: .75; left: 0; }

  .garden-team:nth-child(2) .kid {
    right: 0;
    left: auto;
  }

  .bubble { font-size: 14px; }
  .garden-caption { font-size: 10px; }
  .answers { grid-template-columns: repeat(2,1fr); }
  .number { font-size: 26px; }
  .score small { font-size: 10px; }
  .round-box strong { font-size: 10px; }
  .question-card { padding: 15px; }
}

/* PRINTABLE WINNER CERTIFICATE */

.certificate {
  display: none;
  width: 100%;
  max-width: 1100px;
  margin: 24px auto;
  padding: 12px;
  background: #fffaf0;
  border: 9px double #d5b25e;
  color: #5e4d70;
  text-align: center;
  font-family: Georgia, 'Times New Roman', serif;
}

.certificate-inner {
  border: 2px solid #e3a8c7;
  padding: 34px 25px;
}

.certificate-flowers {
  font-size: 34px;
  color: #c58ca9;
}

.certificate-school {
  letter-spacing: 3px;
  color: #a48248;
  font-size: 13px;
}

.certificate h1 {
  font-size: 44px;
  color: #d36c9d;
  letter-spacing: 1px;
  margin: 12px 0;
  text-shadow: none;
}

.certificate h2 {
  color: #8c6cb6;
  font-size: 28px;
}

.certificate p {
  font-size: 17px;
  line-height: 1.6;
}

.certificate-winner {
  display: inline-block;
  padding: 12px 40px;
  background: #f6e8f5;
  border-radius: 14px;
  font-size: 32px;
  font-weight: bold;
  color: #8060a9;
}

.certificate h3 {
  color: #d36c9d;
  font-size: 27px;
}

.certificate-score {
  font-weight: bold;
}

.certificate-bottom {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  gap: 16px;
  font-size: 15px;
}

/* A4 LANDSCAPE PRINT */

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  html, body {
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
  }

  body > *:not(#certificate) {
    display: none !important;
  }

  #certificate {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 10px !important;
    break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .certificate-inner {
    padding: 20px 25px;
  }

  .certificate h1 {
    font-size: 40px;
  }

  .certificate h2 {
    font-size: 25px;
  }

  .certificate p {
    font-size: 16px;
    margin: 10px;
  }

  .certificate-bottom {
    margin-top: 25px;
  }
}
