@import url("https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Nunito:wght@700;800&display=swap");

:root {
  color-scheme: light;
  --ink: #25324a;
  --muted: #796f68;
  --paper: #fffdf8;
  --orange: #f5a94b;
  --green: #32b768;
  --shadow: 0 18px 45px rgba(89, 71, 52, 0.15);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 255, 255, 0.82) 0 4%, transparent 18%),
    linear-gradient(155deg, #f9edda 0%, #edf4df 54%, #dceef1 100%);
}

button {
  font: inherit;
}

.game {
  isolation: isolate;
  position: relative;
  width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto auto;
  align-content: center;
  align-items: center;
  gap: clamp(18px, 4vh, 42px);
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}

.decoration {
  position: absolute;
  z-index: -1;
  opacity: 0.48;
  pointer-events: none;
}

.decoration--sun {
  width: clamp(110px, 14vw, 190px);
  aspect-ratio: 1;
  top: -4vw;
  right: -2vw;
  border: clamp(18px, 2.5vw, 34px) dotted rgba(245, 169, 75, 0.48);
  border-radius: 50%;
}

.decoration--cloud {
  width: clamp(130px, 18vw, 250px);
  height: clamp(38px, 6vw, 74px);
  left: -3vw;
  bottom: 22%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 60px -28px 0 5px rgba(255, 255, 255, 0.38);
}

.prompt {
  position: relative;
  align-self: end;
  justify-self: center;
  width: min(920px, 92vw);
  min-height: clamp(190px, 34vh, 340px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(26px, 5vh, 54px) clamp(18px, 5vw, 70px);
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: clamp(30px, 5vw, 58px);
  background: rgba(255, 253, 248, 0.9);
  box-shadow: var(--shadow), inset 0 0 0 2px rgba(245, 169, 75, 0.12);
}

.instruction {
  margin: 0 0 clamp(10px, 2vh, 18px);
  color: var(--muted);
  font-size: clamp(0.78rem, 1.5vw, 1.05rem);
  font-weight: 800;
  letter-spacing: 0.18em;
}

.word {
  max-width: 100%;
  margin: 0;
  font-family: "Baloo 2", "Arial Rounded MT Bold", sans-serif;
  font-size: clamp(3.4rem, 10vw, 8.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0.035em;
  text-align: center;
  text-wrap: balance;
}

.success-mark {
  position: absolute;
  display: grid;
  place-items: center;
  width: clamp(70px, 10vw, 112px);
  aspect-ratio: 1;
  color: white;
  font-size: clamp(2.8rem, 6vw, 5rem);
  background: var(--green);
  border: 7px solid white;
  border-radius: 50%;
  box-shadow: 0 12px 30px rgba(50, 183, 104, 0.36);
  opacity: 0;
  transform: scale(0.3) rotate(-18deg);
  pointer-events: none;
}

.answers {
  align-self: start;
  justify-self: center;
  width: min(900px, 94vw);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 3vw, 38px);
}

.answer {
  appearance: none;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.5vh, 14px);
  padding: clamp(10px, 2vh, 18px) 8px 0;
  color: var(--ink);
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.emoji {
  width: min(100%, clamp(112px, 17vw, 180px));
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: clamp(4.3rem, 10vw, 7.6rem);
  line-height: 1;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: clamp(28px, 4vw, 46px);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 28px rgba(76, 65, 54, 0.12);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.key {
  width: clamp(58px, 7vw, 78px);
  height: clamp(45px, 5.5vw, 58px);
  display: grid;
  place-items: center;
  color: #4a566a;
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(2rem, 3vw, 2.7rem);
  line-height: 1;
  border: 2px solid #c7c8c4;
  border-bottom-width: 6px;
  border-radius: 15px;
  background: #fffefa;
  box-shadow: 0 7px 12px rgba(65, 61, 55, 0.1);
  transition: transform 120ms ease, border-color 120ms ease;
}

.answer:hover .emoji {
  transform: translateY(-4px);
}

.answer:active .key {
  transform: translateY(3px);
  border-bottom-width: 3px;
}

.answer:focus-visible {
  outline: none;
}

.answer:focus-visible .emoji {
  outline: 5px solid var(--orange);
  outline-offset: 5px;
}

.answer.is-correct .emoji {
  background: #dff8e8;
  box-shadow: 0 0 0 8px rgba(50, 183, 104, 0.25), 0 18px 35px rgba(50, 183, 104, 0.28);
  transform: translateY(-8px) scale(1.08);
}

.status {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.game.is-wrong .prompt,
.game.is-wrong .answers {
  animation: gentle-shake 360ms ease-in-out;
}

.game.is-success .prompt {
  animation: success-glow 850ms ease-out;
}

.game.is-success .success-mark {
  animation: check-pop 780ms cubic-bezier(0.2, 0.9, 0.25, 1.2) both;
}

@keyframes gentle-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

@keyframes success-glow {
  0%, 100% { box-shadow: var(--shadow), inset 0 0 0 2px rgba(245, 169, 75, 0.12); }
  42% { box-shadow: 0 0 0 18px rgba(50, 183, 104, 0.16), 0 22px 52px rgba(50, 183, 104, 0.24); }
}

@keyframes check-pop {
  0% { opacity: 0; transform: scale(0.3) rotate(-18deg); }
  35%, 72% { opacity: 1; transform: scale(1) rotate(0); }
  100% { opacity: 0; transform: scale(1.15) rotate(5deg); }
}

@media (min-width: 900px) and (min-height: 681px) {
  .game {
    gap: clamp(28px, 5vh, 60px);
  }

  .prompt {
    width: min(80vw, 1500px);
    min-height: clamp(280px, 38vh, 460px);
  }

  .instruction {
    font-size: clamp(1rem, 1.25vw, 1.5rem);
  }

  .word {
    font-size: clamp(6rem, 10vw, 12rem);
  }

  .answers {
    width: min(80vw, 1500px);
    gap: clamp(28px, 4vw, 72px);
  }

  .emoji {
    width: min(100%, clamp(180px, 16vw, 300px));
    font-size: clamp(7rem, 11vw, 12rem);
  }

  .key {
    width: clamp(78px, 7vw, 112px);
    height: clamp(58px, 5.5vw, 82px);
    font-size: clamp(2.7rem, 3vw, 4rem);
  }
}

@media (max-height: 680px) and (min-width: 620px) {
  .game {
    gap: 10px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .prompt {
    min-height: 170px;
    padding-block: 18px;
  }

  .word {
    font-size: clamp(3.2rem, 12vh, 6rem);
  }

  .emoji {
    width: clamp(92px, 20vh, 130px);
    font-size: clamp(3.8rem, 14vh, 6rem);
  }
}

@media (max-width: 600px) {
  .game {
    gap: 16px;
    padding: max(14px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .prompt {
    width: 100%;
    min-height: 32vh;
    border-radius: 30px;
  }

  .word {
    font-size: clamp(2.7rem, 13vw, 4.5rem);
  }

  .answers {
    width: 100%;
    gap: 7px;
  }

  .emoji {
    width: 100%;
    max-width: 128px;
    font-size: clamp(3.5rem, 18vw, 5.4rem);
    border-radius: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
