:root {
  color-scheme: light;
  --cream: #f6f0e3;
  --ink: #17382d;
  --green: #215b42;
  --green-dark: #123d2c;
  --green-light: #6f9f75;
  --pink: #f4768d;
  --yellow: #f6c55a;
  --white: #fffefa;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--cream);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  background:
    radial-gradient(circle at 15% 18%, rgb(244 118 141 / 12%) 0 8%, transparent 8.2%),
    radial-gradient(circle at 86% 72%, rgb(246 197 90 / 14%) 0 10%, transparent 10.2%),
    var(--cream);
}

button {
  font: inherit;
}

.page-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  padding: clamp(36px, 7vh, 76px) 20px 24px;
}

.intro {
  position: relative;
  z-index: 5;
  width: 100%;
  min-width: 0;
  margin-inline: auto;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--pink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.25rem, 6vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 0.95;
}

.subhead {
  margin: 17px 0 0;
  color: rgb(23 56 45 / 66%);
  font-size: clamp(0.88rem, 2vw, 1rem);
}

.game {
  position: relative;
  display: grid;
  place-items: end center;
  width: min(100%, 860px);
  min-height: 470px;
  margin: 0 auto;
}

.game::before,
.game::after {
  position: absolute;
  bottom: 38px;
  width: 180px;
  height: 120px;
  content: "";
  background: #183f30;
  border-radius: 50% 50% 8% 8%;
  opacity: 0.08;
  filter: blur(1px);
}

.game::before {
  left: -60px;
  transform: rotate(20deg);
}

.game::after {
  right: -70px;
  transform: rotate(-17deg);
}

.play-area {
  position: absolute;
  bottom: 74px;
  left: 50%;
  width: 320px;
  height: 370px;
  transform: translateX(-50%);
}

.play-area::after {
  position: absolute;
  right: 50%;
  bottom: -26px;
  width: min(100vw, 760px);
  height: 115px;
  content: "";
  background:
    radial-gradient(ellipse at center, #397251 0 54%, #2e6347 55% 70%, transparent 71%);
  transform: translateX(50%);
}

.ball-button {
  position: absolute;
  z-index: 4;
  bottom: 35px;
  left: 50%;
  width: 184px;
  height: 184px;
  padding: 0;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 50%;
  outline: none;
  transform: translateX(-50%);
  transform-origin: center bottom;
  -webkit-tap-highlight-color: transparent;
}

.ball-button:focus-visible {
  outline: 4px solid var(--pink);
  outline-offset: 8px;
}

.ball-button:hover:not(.is-jumping) {
  animation: ball-wiggle 700ms ease-in-out;
}

.golf-ball {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #fbfbf7;
  background-image:
    radial-gradient(circle, rgb(129 140 132 / 24%) 0 3px, transparent 3.8px),
    radial-gradient(circle, rgb(129 140 132 / 18%) 0 3px, transparent 3.8px),
    radial-gradient(circle, rgb(255 255 255 / 85%) 0 2.5px, transparent 3.3px),
    radial-gradient(circle at 36% 27%, #fff 0 9%, transparent 28%),
    radial-gradient(circle at 65% 72%, #d9ded8 0, #f4f5ef 48%, #fff 76%);
  background-position: 0 0, 13px 13px, 7px 19px, 0 0, 0 0;
  background-size: 26px 26px, 26px 26px, 26px 26px, 100% 100%, 100% 100%;
  border: 1px solid rgb(23 56 45 / 8%);
  border-radius: 50%;
  box-shadow:
    inset -16px -18px 25px rgb(24 59 44 / 13%),
    inset 12px 12px 19px rgb(255 255 255 / 75%),
    0 17px 25px rgb(18 61 44 / 24%);
}

.ball-shine {
  position: absolute;
  top: 19%;
  left: 23%;
  width: 28%;
  height: 18%;
  background: rgb(255 255 255 / 65%);
  border-radius: 50%;
  filter: blur(8px);
  transform: rotate(-32deg);
}

.ball-button.is-jumping {
  animation: ball-jump 1.25s cubic-bezier(0.25, 0.75, 0.32, 1) both;
}

.ball-button.is-jumping .golf-ball {
  animation: ball-spin 1.25s ease-in-out both;
}

.ball-shadow {
  position: absolute;
  z-index: 3;
  bottom: 23px;
  left: 50%;
  width: 138px;
  height: 30px;
  background: rgb(6 42 27 / 34%);
  border-radius: 50%;
  filter: blur(5px);
  transform: translateX(-50%);
}

.play-area.is-active .ball-shadow {
  animation: shadow-jump 1.25s ease-in-out both;
}

.hole {
  position: absolute;
  z-index: 2;
  bottom: 11px;
  left: 50%;
  width: 164px;
  height: 47px;
  background: #0d3023;
  border-radius: 50%;
  box-shadow: inset 0 7px 6px rgb(1 21 13 / 45%);
  transform: translateX(-50%);
}

.reveal-text {
  position: absolute;
  z-index: 3;
  bottom: 77px;
  left: 50%;
  width: max-content;
  margin: 0;
  color: var(--white);
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.35rem, 9vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1;
  opacity: 0;
  text-shadow: 0 4px 0 rgb(18 61 44 / 35%);
  transform: translate(-50%, 20px) scale(0.82);
  white-space: nowrap;
}

.question-mark {
  display: inline-block;
  margin-left: 0.04em;
  color: var(--yellow);
}

.play-area.is-active .reveal-text {
  animation: reveal-word 1.25s ease-in-out both;
}

.sparkles span {
  position: absolute;
  z-index: 5;
  width: 16px;
  height: 16px;
  opacity: 0;
}

.sparkles span::before,
.sparkles span::after {
  position: absolute;
  top: 50%;
  left: 50%;
  content: "";
  background: var(--yellow);
  border-radius: 99px;
  transform: translate(-50%, -50%);
}

.sparkles span::before {
  width: 100%;
  height: 3px;
}

.sparkles span::after {
  width: 3px;
  height: 100%;
}

.sparkles span:nth-child(1) {
  top: 88px;
  left: 18px;
}

.sparkles span:nth-child(2) {
  top: 34px;
  right: 46px;
  transform: scale(0.65);
}

.sparkles span:nth-child(3) {
  top: 126px;
  right: -8px;
  transform: scale(0.8);
}

.sparkles span:nth-child(4) {
  top: 12px;
  left: 78px;
  transform: scale(0.45);
}

.play-area.is-active .sparkles span {
  animation: sparkle-pop 1.25s ease-in-out both;
}

.play-area.is-active .sparkles span:nth-child(2) {
  animation-delay: 70ms;
}

.play-area.is-active .sparkles span:nth-child(3) {
  animation-delay: 130ms;
}

.play-area.is-active .sparkles span:nth-child(4) {
  animation-delay: 200ms;
}

.flag {
  position: absolute;
  right: max(6%, calc(50% - 360px));
  bottom: 103px;
  z-index: 2;
  width: 82px;
  height: 205px;
  transform: rotate(3deg);
  transform-origin: bottom center;
}

.flag-pole {
  position: absolute;
  right: 8px;
  bottom: 0;
  width: 5px;
  height: 100%;
  background: var(--white);
  border-radius: 10px;
  box-shadow: 2px 2px 0 rgb(18 61 44 / 13%);
}

.flag-cloth {
  position: absolute;
  top: 7px;
  right: 9px;
  width: 72px;
  height: 48px;
  background: var(--pink);
  border-radius: 5px 0 7px 5px;
  box-shadow: 0 5px 0 rgb(115 41 61 / 10%);
  clip-path: polygon(0 0, 100% 14%, 76% 100%, 0 84%);
}

.hint {
  position: relative;
  z-index: 8;
  display: flex;
  gap: 9px;
  align-items: center;
  margin-bottom: 4px;
  padding: 9px 14px;
  cursor: pointer;
  color: rgb(23 56 45 / 68%);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: transparent;
  border: 0;
  border-radius: 99px;
}

.hint:hover {
  color: var(--ink);
  background: rgb(255 255 255 / 45%);
}

.hint:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 3px;
}

.mouse-icon {
  position: relative;
  width: 15px;
  height: 21px;
  border: 2px solid currentColor;
  border-radius: 9px;
}

.mouse-icon::after {
  position: absolute;
  top: 3px;
  left: 50%;
  width: 2px;
  height: 5px;
  content: "";
  background: currentColor;
  border-radius: 99px;
  transform: translateX(-50%);
  animation: scroll-hint 1.5s ease-in-out infinite;
}

@keyframes ball-jump {
  0% { transform: translateX(-50%) translateY(0) scale(1); }
  9% { transform: translateX(-50%) translateY(7px) scale(1.05, 0.92); }
  38% { transform: translateX(-50%) translateY(-242px) scale(0.98, 1.02); }
  55% { transform: translateX(-50%) translateY(-255px) scale(1); }
  85% { transform: translateX(-50%) translateY(6px) scale(1.06, 0.91); }
  92% { transform: translateX(-50%) translateY(-20px) scale(0.98, 1.02); }
  100% { transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes ball-spin {
  0%, 10% { transform: rotate(0deg); }
  55% { transform: rotate(82deg); }
  100% { transform: rotate(120deg); }
}

@keyframes shadow-jump {
  0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
  45%, 57% { opacity: 0.18; transform: translateX(-50%) scale(0.38); }
  85% { opacity: 1; transform: translateX(-50%) scale(1.08); }
}

@keyframes reveal-word {
  0%, 17% { opacity: 0; transform: translate(-50%, 20px) scale(0.82); }
  36%, 68% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  83%, 100% { opacity: 0; transform: translate(-50%, 10px) scale(0.94); }
}

@keyframes sparkle-pop {
  0%, 28% { opacity: 0; transform: rotate(0) scale(0); }
  45%, 65% { opacity: 1; transform: rotate(45deg) scale(1); }
  85%, 100% { opacity: 0; transform: rotate(80deg) scale(0.5); }
}

@keyframes ball-wiggle {
  0%, 100% { transform: translateX(-50%) rotate(0); }
  25% { transform: translateX(-50%) rotate(-3deg); }
  60% { transform: translateX(-50%) rotate(3deg); }
}

@keyframes scroll-hint {
  0%, 100% { opacity: 0.3; transform: translate(-50%, 0); }
  50% { opacity: 1; transform: translate(-50%, 3px); }
}

@media (max-width: 620px) {
  .page-shell {
    padding-top: 48px;
  }

  .game {
    min-height: 450px;
  }

  h1 {
    max-width: 340px;
    margin-inline: auto;
  }

  .play-area {
    bottom: 62px;
    transform: translateX(-50%) scale(0.88);
    transform-origin: bottom center;
  }

  .flag {
    right: 5%;
    bottom: 87px;
    transform: rotate(3deg) scale(0.82);
    transform-origin: bottom right;
  }

  .game::before,
  .game::after {
    display: none;
  }
}

@media (max-height: 720px) and (min-width: 621px) {
  .page-shell {
    padding-top: 30px;
  }

  .game {
    min-height: 430px;
  }

  .play-area {
    bottom: 58px;
    transform: translateX(-50%) scale(0.88);
    transform-origin: bottom center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mouse-icon::after,
  .ball-button:hover:not(.is-jumping) {
    animation: none;
  }

  .ball-button.is-jumping {
    animation: ball-jump-reduced 1.25s ease-in-out both;
  }

  .ball-button.is-jumping .golf-ball {
    animation: none;
  }

  @keyframes ball-jump-reduced {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    35%, 70% { transform: translateX(-50%) translateY(-195px); }
  }
}
