:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  background: #102a2c;
  color: #f2ffdb;
}

* { box-sizing: border-box; }

body { background: radial-gradient(ellipse at 50% 0, #234b43, #102a2c 67%); }

button, a { font: inherit; }

button:focus-visible, a:focus-visible {
  outline: 3px solid #ffec8d;
  outline-offset: 3px;
}

.game {
  width: min(100%, 52rem);
  height: 100vh;
  height: 100dvh;
  margin: auto;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(8px, 2vh, 16px);
}

.header { text-align: center; }

h1, h2 {
  margin: 0;
  font-family: "Trebuchet MS", system-ui, sans-serif;
  letter-spacing: -.045em;
  line-height: 1;
}

h1 {
  font-size: clamp(2.4rem, 8vh, 4.2rem);
  font-weight: 900;
  color: #e3ffab;
  text-shadow: 0 3px #325e42;
}

.header p {
  margin: 6px 0 0;
  color: #d3eee4;
}

.pond {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: clamp(18px, 5vw, 38px);
  border: 2px solid #4b8976;
  background:
    radial-gradient(ellipse at 70% -10%, #4c9f8399, transparent 67%),
    radial-gradient(ellipse at 48% 70%, #277067, transparent 85%),
    linear-gradient(145deg, #235653, #103d48);
  box-shadow: inset 0 0 50px #073838a8, 0 7px 24px #071a2260;
}

.water, #pads { position: absolute; inset: 0; }
.water { pointer-events: none; }

.ripple {
  position: absolute;
  width: 24%;
  aspect-ratio: 3;
  border: 2px solid #a5ffdb25;
  border-radius: 50%;
  box-shadow: 0 0 0 9px #a5ffdb11, inset 0 0 0 8px #a5ffdb0d;
  transform: rotate(-10deg);
}

.ripple:nth-child(1) { top: 18%; left: -8%; width: 32%; }
.ripple:nth-child(2) { top: 31%; right: 8%; }
.ripple:nth-child(3) { top: 60%; left: 22%; width: 33%; }
.ripple:nth-child(4) { bottom: 7%; right: -8%; width: 42%; }

.spark {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff1aa;
  box-shadow: 0 0 12px 3px #fbff7c70;
  animation: shimmer 3s ease-in-out infinite alternate;
}

.spark:nth-of-type(5) { top: 10%; left: 32%; }
.spark:nth-of-type(6) { top: 32%; left: 87%; animation-delay: -.9s; }
.spark:nth-of-type(7) { top: 44%; left: 6%; animation-delay: -1.5s; }
.spark:nth-of-type(8) { top: 69%; left: 72%; animation-delay: -2s; }
.spark:nth-of-type(9) { top: 91%; left: 39%; animation-delay: -.4s; }

@keyframes shimmer {
  from { opacity: .32; }
  to { opacity: .85; }
}

.reeds {
  position: absolute;
  bottom: -9%;
  left: -1%;
  width: 16%;
  height: 31%;
  transform: rotate(-22deg);
  color: #194944;
}

.reeds:last-child {
  left: auto;
  right: -2%;
  bottom: -5%;
  transform: scaleX(-1) rotate(-31deg);
  color: #1e5148;
}

.reeds i {
  position: absolute;
  left: 30%;
  bottom: 0;
  width: 28%;
  height: 85%;
  border-radius: 100% 0 100% 0;
  background: currentColor;
  transform-origin: bottom center;
}

.reeds i:nth-child(1) { transform: rotate(-39deg); }
.reeds i:nth-child(2) { transform: rotate(-10deg); height: 68%; }
.reeds i:nth-child(3) { transform: rotate(22deg); height: 100%; }
.reeds i:nth-child(4) { transform: rotate(54deg); height: 58%; }

.pad {
  position: absolute;
  display: grid;
  place-items: center;
  width: clamp(72px, 25%, 124px);
  height: clamp(64px, 16%, 97px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
}

.leaf {
  position: absolute;
  inset: 12% 3%;
  border-radius: 50%;
  transform: rotate(var(--tilt));
  background:
    radial-gradient(ellipse at 32% 27%, #a1e26d, transparent 50%),
    linear-gradient(155deg, #81cb62 5%, #428c58 65%, #317450);
  border-bottom: 4px solid #296447;
  mask-image: conic-gradient(from 49deg, transparent 0deg 20deg, #000 21deg 360deg);
  transition: filter .18s, scale .18s;
}

.leaf::after {
  content: "";
  position: absolute;
  top: 49%;
  left: 50%;
  width: 38%;
  height: 2px;
  transform-origin: left;
  transform: rotate(5deg);
  background: #29644770;
}

.pad:active .leaf { scale: .9; }
.pad[data-star] .leaf { filter: brightness(1.24); }

.star, .win-star {
  color: #ffe882;
  text-shadow: 0 2px 0 #c78338, 0 0 19px #ffd96a;
}

.star {
  position: relative;
  font-size: clamp(2.1rem, 7vw, 3.25rem);
  line-height: 1;
  animation: float .9s ease-in-out infinite alternate;
}

.star[hidden] { display: none; }

@keyframes float {
  from { transform: translateY(-2px) scale(.96); }
  to { transform: translateY(-9px) scale(1.06); }
}

.frog {
  position: absolute;
  z-index: 1;
  width: clamp(55px, 14vw, 79px);
  aspect-ratio: 1.12;
  pointer-events: none;
  transform: translate(-50%, -80%);
  filter: drop-shadow(0 4px 2px #174b4480);
}

.frog-body {
  position: absolute;
  inset: 40% 8% 5%;
  border-radius: 50%;
  background: #72bd49;
  box-shadow: -9px 8px 0 -4px #448945, 9px 8px 0 -4px #448945;
}

.frog-face {
  position: absolute;
  inset: 26% 6% 21%;
  border-radius: 46% 46% 50% 50%;
  background:
    radial-gradient(ellipse at 17% 69%, #ffaba7 0 6%, transparent 8%),
    radial-gradient(ellipse at 83% 69%, #ffaba7 0 6%, transparent 8%),
    linear-gradient(#a9e661, #82ca4d 79%, #6fae43);
}

.eye {
  position: absolute;
  top: -37%;
  left: 8%;
  width: 34%;
  height: 62%;
  border-radius: 50%;
  border: 3px solid #9cdb60;
  background:
    radial-gradient(circle at 59% 28%, white 0 9%, transparent 11%),
    radial-gradient(circle at 52% 52%, #183c39 0 33%, transparent 36%),
    #f9ffdb;
}

.eye:nth-child(2) { left: auto; right: 8%; }

.smile {
  position: absolute;
  left: 38%;
  top: 38%;
  width: 24%;
  height: 28%;
  border: solid #315433;
  border-width: 0 0 2px;
  border-radius: 50%;
}

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

.footer a, #again {
  display: grid;
  place-items: center;
  min-height: 50px;
  border-radius: 15px;
  padding: 0 16px;
  font-weight: 750;
}

.footer a {
  text-decoration: none;
  color: #d3eee4;
  background: #204741;
}

.score { text-align: right; font-weight: 700; }

.progress {
  display: flex;
  justify-content: flex-end;
  gap: clamp(3px, 1vw, 5px);
  margin-top: 5px;
}

.progress i {
  width: clamp(8px, 3vw, 15px);
  height: 6px;
  border-radius: 5px;
  background: #416761;
}

.progress .lit { background: #ffe882; }

.celebration {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #123839cf;
}

.celebration[hidden] { display: none; }

.win-card {
  width: min(100%, 23rem);
  padding: clamp(12px, 4vh, 28px);
  border: 2px solid #779e5d;
  border-radius: 26px;
  background: #214b40;
  text-align: center;
  box-shadow: 0 8px 24px #092d29a0;
}

.win-star { font-size: clamp(2rem, 9vh, 4rem); line-height: 1; }
h2 { margin-top: 8px; font-size: clamp(1.65rem, 6vw, 2.35rem); }
.win-card p { margin: 8px 0 14px; }

#again {
  min-height: 60px;
  margin: auto;
  border: 0;
  background: #e3ffab;
  color: #193c35;
}

@media (orientation: landscape) and (max-height: 500px) {
  .game {
    grid-template-columns: minmax(145px, 25%) minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    column-gap: 14px;
  }

  .header { align-self: center; }
  .pond { grid-area: 1 / 2 / 3 / 3; }
  .footer { flex-direction: column-reverse; }
  .score { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; transition: none !important; }
}
