/* Waterside — a river you sit beside with a net.
   Sibling to the other games here and shares their look: big buttons,
   big taps, nothing small enough to miss. */

:root {
  --bg: #e0f2fe;
  --ink: #133247;
  --muted: #4d7c95;
  --card: #ffffff;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Baloo 2", "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  /* The bar sits above the river, and the river takes whatever is left. */
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

.hidden {
  display: none !important;
}

/* --- Top bar --- */
#bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px clamp(10px, 3vw, 28px);
  flex: none;
}

#stars,
#bucket {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 800;
}

#bucket {
  margin-left: auto;
  margin-right: auto;
  color: var(--muted);
}

.icon-btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(19, 50, 71, 0.08);
  color: var(--ink);
  display: grid;
  place-items: center;
  flex: none;
}

.icon-btn:active {
  transform: scale(0.92);
}

.pill {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  font-size: clamp(1rem, 2.6vw, 1.25rem);
  padding: 16px 30px;
  border-radius: 999px;
  background: #ffb066;
  color: var(--ink);
  box-shadow: 0 6px 0 #ef8a30;
  min-height: 60px;
}

.pill:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #ef8a30;
}

.pill.big {
  font-size: clamp(1.3rem, 5vw, 2rem);
  padding: 22px 60px;
}

/* --- The river --- */
#screen {
  flex: 1;
  min-height: 0;
}

/* touch-action: none stops the page bouncing while a finger drags the net. */
#river {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
}

/* --- Bucket full screen --- */
#done {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(19, 50, 71, 0.55);
  padding: 18px;
}

#done-inner {
  background: var(--card);
  border-radius: 32px;
  padding: clamp(24px, 6vw, 44px);
  text-align: center;
  width: min(440px, 100%);
  animation: pop 320ms ease;
}

#done-face {
  font-size: clamp(3.5rem, 16vw, 6rem);
  line-height: 1;
}

#done-word {
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 800;
  margin: 10px 0 24px;
}

@keyframes pop {
  0% { transform: scale(0.8); }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* --- Title screen --- */
#start {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 18%, #f0fbff, #7dd3fc 75%);
  text-align: center;
  padding: 20px;
}

#start h1 {
  font-size: clamp(2rem, 11vw, 5rem);
  margin: 0;
  line-height: 1;
  letter-spacing: 0.04em;
}

#start h1 span {
  color: hsl(var(--h) 75% 38%);
  display: inline-block;
  animation: bob 2.4s ease-in-out infinite;
}

/* Each letter starts its bob a moment after the one before, so the word
   rolls along like a little wave. */
#start h1 span:nth-child(2) { animation-delay: 0.1s; }
#start h1 span:nth-child(3) { animation-delay: 0.2s; }
#start h1 span:nth-child(4) { animation-delay: 0.3s; }
#start h1 span:nth-child(5) { animation-delay: 0.4s; }
#start h1 span:nth-child(6) { animation-delay: 0.5s; }
#start h1 span:nth-child(7) { animation-delay: 0.6s; }
#start h1 span:nth-child(8) { animation-delay: 0.7s; }
#start h1 span:nth-child(9) { animation-delay: 0.8s; }

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

#start p {
  font-size: clamp(1.1rem, 4vw, 1.6rem);
  color: #0c4a6e;
  margin: 14px auto 32px;
  max-width: 22ch;
}

/* --- Confetti --- */
#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 40;
}

#confetti span {
  position: absolute;
  font-size: 1.8rem;
  animation: fall 1.5s linear forwards;
}

@keyframes fall {
  0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(540deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  #start h1 span,
  #confetti span,
  #done-inner {
    animation: none;
  }
}
