/* Tide Pool Peek · a calm tap game for ages 4 to 7. Same brand kit and feel as Play with Ellie. */
@font-face {
  font-family: "Fredoka";
  src: url("/assets/fonts/fredoka-latin.woff2") format("woff2");
  font-weight: 300 700; font-display: swap;
}

:root {
  --navy: #2E3253;
  --sun: #FDF2C5;
  --coral: #F56F56;
  --lagoon: #0EC0DB;
  --deep: #0293C6;
  --kelp: #8A9A2A;
  --ellie: #D29E76;
  --spots: #716166;
  --blush: #FBB5A8;
  --rim: #B89A78;
  --surf: #3E9E52;
}

html, body {
  margin: 0; height: 100%; overflow: hidden;
  overscroll-behavior: none;
  background: var(--rim);
}
body {
  position: fixed; inset: 0;
  font-family: "Fredoka", ui-rounded, system-ui, sans-serif;
  color: var(--navy);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
img { -webkit-user-drag: none; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* the shore: warm, wet sandstone all around the pool */
.shore {
  --t: calc(max(12px, env(safe-area-inset-top)) + 106px); /* phones: the friends strip gets its own row under the buttons */
  --b: calc(max(10px, env(safe-area-inset-bottom)) + 52px);
  --l: calc(max(10px, env(safe-area-inset-left)) + 1vw);
  --r: calc(max(10px, env(safe-area-inset-right)) + 1vw);
  position: absolute; inset: 0; overflow: hidden;
  background:
    radial-gradient(30% 22% at 12% 6%, rgba(255, 255, 255, 0.2), transparent 70%),
    radial-gradient(26% 18% at 90% 94%, rgba(70, 48, 30, 0.16), transparent 70%),
    radial-gradient(20% 14% at 82% 8%, rgba(70, 48, 30, 0.12), transparent 70%),
    radial-gradient(circle, rgba(80, 56, 36, 0.13) 1.2px, transparent 2px) 0 0 / 22px 19px,
    linear-gradient(160deg, #C9AE8B 0%, #B89A78 55%, #A8896A 100%);
  cursor: pointer;
}
/* the three tide pools (the levels): darker basalt-gray rocks, then warm sunset sandstone */
.shore[data-pool="rocky"] {
  background:
    radial-gradient(30% 22% at 12% 6%, rgba(255, 255, 255, 0.16), transparent 70%),
    radial-gradient(26% 18% at 90% 94%, rgba(40, 36, 32, 0.18), transparent 70%),
    radial-gradient(circle, rgba(50, 46, 40, 0.14) 1.2px, transparent 2px) 0 0 / 22px 19px,
    linear-gradient(160deg, #B2A693 0%, #9C8F7D 55%, #887B6B 100%);
}
.shore[data-pool="sunset"] {
  background:
    radial-gradient(40% 30% at 88% 4%, rgba(255, 214, 150, 0.45), transparent 70%),
    radial-gradient(26% 18% at 10% 94%, rgba(90, 50, 30, 0.16), transparent 70%),
    radial-gradient(circle, rgba(90, 56, 36, 0.13) 1.2px, transparent 2px) 0 0 / 22px 19px,
    linear-gradient(160deg, #DDB08E 0%, #C99578 55%, #B48066 100%);
}

/* one shared box for the pool, its play layer and its light */
.basin {
  position: absolute; top: var(--t); bottom: var(--b); left: var(--l); right: var(--r);
  border-radius: 30% 34% 28% 32% / 16% 18% 20% 15%;
}

/* clear, shallow water over sand */
.pool {
  --w1: #9CDFDC; --w2: #74CFD8; --w3: #55BFD0; --glow: rgba(253, 242, 197, 0.5);
  overflow: hidden;
  background:
    radial-gradient(70% 55% at 46% 40%, var(--glow), transparent 70%),
    radial-gradient(circle, rgba(150, 120, 80, 0.14) 1px, transparent 1.7px) 0 0 / 15px 13px,
    linear-gradient(180deg, var(--w1) 0%, var(--w2) 50%, var(--w3) 100%);
  box-shadow: 0 0 0 9px rgba(110, 86, 62, 0.32), 0 0 28px 16px rgba(90, 68, 48, 0.2);
}
.shore[data-pool="rocky"] .pool { --w1: #88D5D7; --w2: #5CBBCB; --w3: #3BA3BD; --glow: rgba(253, 242, 197, 0.3); }
.shore[data-pool="sunset"] .pool { --w1: #BADDCF; --w2: #96CAC5; --w3: #76B5C0; --glow: rgba(255, 214, 150, 0.62); }
.pebble { position: absolute; border-radius: 50%; opacity: 0.85; }

.layer { position: absolute; inset: 0; pointer-events: none; }
.layer > * { pointer-events: auto; }
.layer--fx { z-index: 6; }
.layer--fx > * { pointer-events: none; }
.stage { pointer-events: none; }

/* seaweed tufts (surfgrass and sea lettuce), swaying slowly */
.weed { position: absolute; left: 0; top: 0; pointer-events: none !important; }
.weed svg { width: 100%; height: 100%; display: block; overflow: visible; }
.weed__sway { transform-box: fill-box; transform-origin: 50% 50%; animation: sway 9s ease-in-out infinite alternate; }
.weed:nth-child(2n) .weed__sway { animation-duration: 11s; animation-delay: -4s; }
.weed:nth-child(3n) .weed__sway { animation-duration: 13s; animation-delay: -7s; }
@keyframes sway { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
.grass { fill: none; stroke: var(--surf); stroke-width: 4.5; stroke-linecap: round; }
.grass--light { stroke: #5CB866; }
.lettuce { fill: #8ED07A; }
.lettuce--dark { fill: #6DBA62; }
.lettuce__vein { fill: none; stroke: #B6E4A2; stroke-width: 2; stroke-linecap: round; }

/* light dancing on the water, above everything in the pool */
.over {
  pointer-events: none; overflow: hidden; z-index: 4;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 38%);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.38), inset 0 12px 34px rgba(10, 70, 92, 0.3), inset 0 -8px 26px rgba(10, 70, 92, 0.16);
}
.shore[data-pool="sunset"] .over {
  background:
    linear-gradient(200deg, rgba(255, 186, 120, 0.3), rgba(255, 170, 110, 0) 58%),
    linear-gradient(118deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 38%);
}
.over__light { position: absolute; inset: 0; }
.over__light i {
  position: absolute; width: 46vmin; height: 46vmin; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0) 58%, rgba(255, 255, 255, 0.55) 70%, rgba(255, 255, 255, 0) 84%);
  filter: blur(2px); opacity: 0.26;
  animation: shimmer 16s ease-in-out infinite alternate;
}
.over__light i:nth-child(1) { left: 2%; top: 6%; animation-delay: -3s; }
.over__light i:nth-child(2) { left: 52%; top: 0%; width: 36vmin; height: 36vmin; animation-duration: 19s; animation-delay: -9s; }
.over__light i:nth-child(3) { left: 26%; top: 38%; width: 40vmin; height: 40vmin; animation-duration: 14s; animation-delay: -6s; }
.over__light i:nth-child(4) { left: 68%; top: 44%; animation-duration: 21s; animation-delay: -12s; }
.over__light i:nth-child(5) { left: 6%; top: 66%; width: 34vmin; height: 34vmin; animation-duration: 17s; animation-delay: -1s; }
.over__light i:nth-child(6) { left: 50%; top: 74%; width: 42vmin; height: 42vmin; animation-duration: 15s; animation-delay: -8s; }
@keyframes shimmer {
  from { transform: translate(-14px, -8px) scale(0.94); opacity: 0.14; }
  to { transform: translate(14px, 10px) scale(1.06); opacity: 0.34; }
}

/* the visiting sea turtle (the gentle celebration) */
.visitor { position: absolute; left: 0; top: 0; }
.visitor img, .visitor svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 14px 10px rgba(12, 70, 92, 0.25)); animation: paddle 2.6s ease-in-out infinite alternate; }
.visitor .ce-tail { transform-box: fill-box; transform-origin: 0% 50%; animation: wag 1.8s ease-in-out infinite alternate; }
@keyframes wag { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
@keyframes paddle { from { transform: rotate(-2.5deg); } to { transform: rotate(2.5deg); } }

/* rocks: each one is a big, forgiving button */
.spot {
  position: absolute; left: 0; top: 0;
  margin: 0; padding: 0; border: 0; background: none;
  -webkit-appearance: none; appearance: none;
  border-radius: 44%;
  cursor: pointer; z-index: 1;
  -webkit-tap-highlight-color: transparent;
}
.spot > * { pointer-events: none; }
.spot.is-up { z-index: 3; }
.spot.is-swim { z-index: 4; }
.spot:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.spot__bed {
  position: absolute; left: 8%; right: 8%; top: 22%; bottom: 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(20, 70, 85, 0.4), rgba(20, 70, 85, 0.16) 72%, rgba(20, 70, 85, 0));
}
.rock { position: absolute; inset: 0; display: block; transform-origin: 50% 80%; }
.rock svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 7px 6px rgba(12, 70, 92, 0.28)); }
.rock__fill { fill: var(--tone, #A08F7E); }
.rock__shine { fill: #fff; opacity: 0.26; }
.rock__speck { fill: rgba(46, 50, 83, 0.2); }
.rock__pink { fill: #E9A6B4; opacity: 0.8; }
.rock__pink--more { display: none; }
.shore[data-pool="rocky"] .rock__pink { opacity: 0.95; }
.shore[data-pool="rocky"] .rock__pink--more { display: inline; }
.rock__barn { fill: #F3EEE4; stroke: #C9BDAB; stroke-width: 1.5; }
.spot.hint::after {
  content: ""; position: absolute; inset: -8% -5%; border-radius: 50%;
  border: 4px solid rgba(253, 242, 197, 0.95);
  animation: hint 2.2s ease-out infinite;
  pointer-events: none;
}
@keyframes hint { 0% { transform: scale(0.82); opacity: 1; } 100% { transform: scale(1.22); opacity: 0; } }

/* the friend under each rock */
.critter { position: absolute; display: block; }
.critter__move { position: absolute; inset: 0; display: block; filter: drop-shadow(0 4px 4px rgba(12, 70, 92, 0.25)); }
.critter__peek { position: absolute; inset: 0; display: block; opacity: 0; }
.critter__img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
/* sea star: one arm is its own layer so it can curl */
.star__body { clip-path: polygon(0 0, 82% 0, 61.7% 35.9%, 70.1% 59.4%, 100% 65.1%, 100% 100%, 0 100%); }
.star__arm { clip-path: polygon(82% 0, 100% 0, 100% 65.1%, 68.6% 60.6%, 59.8% 37.2%); transform-origin: 65.9% 47.7%; }
/* octopus: a rock-colored, mottled skin that fades in over the real one */
.critter__tint {
  position: absolute; inset: 0; display: block; opacity: 0;
  background:
    radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.24) 0 3px, transparent 4px) 0 0 / 14px 12px,
    radial-gradient(circle at 70% 70%, rgba(46, 50, 83, 0.2) 0 3px, transparent 4px) 0 0 / 18px 16px,
    var(--tone, #A08F7E);
  -webkit-mask: url("/assets/art/neighbors/octopus.webp") center / 100% 100% no-repeat;
  mask: url("/assets/art/neighbors/octopus.webp") center / 100% 100% no-repeat;
}

/* sea anemones: they close up when touched, then slowly open again */
.anem {
  position: absolute; left: 0; top: 0;
  margin: 0; padding: 0; border: 0; background: none;
  -webkit-appearance: none; appearance: none;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.anem > * { pointer-events: none; }
.anem svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 4px 4px rgba(12, 70, 92, 0.2)); }
.anem:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.anem__open, .anem__closed, .anem__wave { transform-box: fill-box; transform-origin: 50% 50%; }
.anem__open { transition: transform 1.9s cubic-bezier(0.3, 0, 0.2, 1), opacity 1.6s ease; }
.anem__closed { opacity: 0; transform: scale(0.7); transition: transform 1.9s ease, opacity 1.5s ease; }
.anem.is-shy .anem__open { transform: scale(0.3); opacity: 0; transition: transform 0.9s ease-in-out, opacity 0.8s ease; }
.anem.is-shy .anem__closed { opacity: 1; transform: scale(1); transition: transform 0.9s ease-in-out, opacity 0.7s ease; }
.anem__wave { animation: tentacles 7s ease-in-out infinite alternate; }
.anem:nth-child(2n) .anem__wave { animation-duration: 9s; animation-delay: -3s; }
@keyframes tentacles { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
.anem__arm { fill: none; stroke: #4FAE72; stroke-width: 7.5; stroke-linecap: round; }
.anem__arm--in { stroke: #79C98E; stroke-width: 6; }
.anem__tip { fill: #AFE6BA; }
.anem__disc { fill: #A6DDB2; }
.anem__mouth { fill: #4E9A6A; }
.anem__grit { fill: #F1E8D6; opacity: 0.9; }
.anem__pucker { fill: none; stroke: #3F8A5C; stroke-width: 2.4; stroke-linecap: round; }

/* tap ripples + bubbles */
.ripple {
  position: absolute; left: 0; top: 0; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.35);
}
.fxb {
  position: absolute; left: 0; top: 0; border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.95) 0 10%, rgba(255, 255, 255, 0.32) 14% 40%, rgba(255, 255, 255, 0.08) 65%, rgba(255, 255, 255, 0.04));
  border: 1.5px solid rgba(255, 255, 255, 0.8);
}

/* the little friends strip: faded shapes that fill in with color (no score) */
.strip {
  position: absolute; top: calc(max(12px, env(safe-area-inset-top)) + 54px); left: 50%; transform: translateX(-50%);
  margin: 0; padding: 3px 8px; list-style: none;
  display: flex; align-items: center; gap: 4px;
  box-sizing: border-box; height: 46px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 252, 240, 0.78);
  z-index: 6; pointer-events: none;
}
.strip__item { width: 36px; height: 36px; display: grid; place-items: center; }
.strip__art { width: 100%; height: 100%; object-fit: contain; display: block; filter: brightness(0); opacity: 0.2; transition: filter 1.2s ease, opacity 1.2s ease; }
.strip__item.is-found .strip__art { filter: brightness(1); opacity: 1; }

/* the tide that brings a new tide pool: it rises over everything, then goes back out */
.tide {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  visibility: hidden; transform: translateY(102%);
  background: linear-gradient(180deg, rgba(150, 222, 228, 0.95) 0%, rgba(86, 192, 211, 0.97) 34%, rgba(44, 156, 194, 0.99) 100%);
}
.tide.is-on { visibility: visible; }
.tide__crest { position: absolute; left: 0; top: -36px; width: 200%; height: 38px; display: block; animation: crest 8s linear infinite; }
.tide:not(.is-on) .tide__crest { animation-play-state: paused; }
.tide__water { fill: rgba(150, 222, 228, 0.95); }
.tide__foam { fill: none; stroke: rgba(255, 255, 255, 0.92); stroke-width: 6; stroke-linecap: round; }
@keyframes crest { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* the row of tide pools at the top right: found ones in color, the rest faded (no numbers, no words) */
.places {
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  display: flex; align-items: center; gap: 7px;
  box-sizing: border-box; height: 46px; padding: 3px 7px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 252, 240, 0.78);
  z-index: 6;
}
.place {
  position: relative; width: 34px; height: 34px;
  margin: 0; padding: 0; border: 0; background: none; border-radius: 50%;
  -webkit-appearance: none; appearance: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.place > * { pointer-events: none; }
.place::after { content: ""; position: absolute; inset: -6px -4px; border-radius: 50%; }
.place:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
.place__disc {
  position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.85);
  filter: grayscale(1) brightness(1.18); opacity: 0.32;
  transition: filter 1.6s ease, opacity 1.6s ease, box-shadow 0.8s ease;
}
.place.is-open .place__disc { filter: none; opacity: 1; }
.place.is-here .place__disc { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.85), 0 0 0 2.5px #fff, 0 0 0 5px rgba(2, 147, 198, 0.7); }
.place__disc svg { width: 76%; height: 76%; display: block; overflow: visible; }
.place--morning .place__disc { background: radial-gradient(circle at 36% 30%, #FFF6E2, #EEDBBC 60%, #DCC39E); }
.place--rocky .place__disc { background: radial-gradient(circle at 36% 30%, #EFEDE9, #CFC8BE 60%, #B3AA9C); }
.place--sunset .place__disc { background: radial-gradient(circle at 36% 30%, #FFE9D0, #F9CBA0 60%, #F0AC7C); }
.pi-sun { fill: #FFCF5C; }
.pi-pool { fill: #74CFD8; stroke: #9C8166; stroke-width: 1.3; }
.pi-rock { fill: #8A8680; }
.pi-rock--b { fill: #A39B90; }
.pi-dusk { fill: #FF9E58; }
.ring { position: absolute; left: 0; top: 0; border-radius: 50%; border: 3px solid rgba(253, 242, 197, 0.95); box-shadow: 0 0 10px rgba(253, 242, 197, 0.6); }

/* optional grown-up caption: one true fact at a time */
.caption {
  position: absolute; left: 50%; bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0; box-sizing: border-box;
  width: max-content; max-width: min(92vw, 640px);
  padding: 8px 16px; border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 252, 240, 0.84);
  font: 500 clamp(0.82rem, 2.4vw, 1rem)/1.3 "Fredoka", system-ui, sans-serif;
  text-align: center;
  z-index: 6; pointer-events: none;
  transition: opacity 0.35s ease;
}
.caption.is-fading { opacity: 0; }

/* grown-up controls (same as Play with Ellie; each hit area reaches 64px) */
.controls {
  position: absolute; left: max(12px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top));
  display: flex; gap: 18px; z-index: 6;
}
.ctl {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 252, 240, 0.78);
  color: var(--navy); text-decoration: none;
  font: 500 0.92rem/1 "Fredoka", system-ui, sans-serif;
  cursor: pointer;
  box-sizing: border-box;
}
.ctl::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; }
.ctl:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.ctl--round { width: 46px; height: 46px; padding: 0; justify-content: center; }
.ctl--round svg { width: 24px; height: 24px; fill: none; stroke: var(--navy); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ctl--pill { box-sizing: border-box; height: 46px; padding: 0 16px 0 11px; gap: 7px; font-size: 1rem; } /* "Games": the way to every game, labeled so grown-ups find it */
.ctl--pill svg { width: 22px; height: 22px; fill: none; stroke: var(--navy); stroke-width: 2.4; }
.ctl--round .spk { fill: var(--navy); }
.ctl--round .off { display: none; }
.ctl[aria-pressed="false"] .wave { display: none; }
.ctl[aria-pressed="false"] .off { display: inline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 379px) {
  .controls { gap: 12px; }
  .ctl--pill { padding: 0 12px 0 9px; }
  .places { gap: 5px; padding: 3px 5px; }
  .place { width: 30px; height: 30px; }
  .strip { gap: 3px; padding: 3px 6px; }
  .strip__item { width: 32px; height: 32px; }
}
/* wider screens: the strip sits in the top row, in the middle */
@media (min-width: 640px) {
  .shore { --t: calc(max(12px, env(safe-area-inset-top)) + 54px); }
  .strip { top: max(12px, env(safe-area-inset-top)); height: 46px; padding: 3px 7px; gap: 4px; }
  .strip__item { width: 34px; height: 34px; }
}
@media (min-width: 900px) {
  .strip { height: 56px; padding: 3px 10px; gap: 6px; }
  .strip__item { width: 46px; height: 46px; }
}
/* small phones turned sideways: one short row, small pictures */
@media (max-width: 639px) and (orientation: landscape) {
  .shore { --t: calc(max(12px, env(safe-area-inset-top)) + 54px); }
  .strip { top: max(12px, env(safe-area-inset-top)); height: 40px; padding: 3px 6px; gap: 2px; }
  .strip__item { width: 22px; height: 22px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .shore { --b: calc(max(8px, env(safe-area-inset-bottom)) + 38px); }
  .caption { padding: 5px 14px; font-size: 0.82rem; }
}

@media (prefers-reduced-motion: reduce) {
  .over__light i, .weed__sway, .anem__wave, .visitor img, .visitor svg, .visitor .ce-tail { animation: none !important; }
  .tide { transform: none; opacity: 0; }
  .tide__crest { display: none; }
  .anem__open, .anem__closed, .anem.is-shy .anem__open, .anem.is-shy .anem__closed { transform: none !important; }
  .spot.hint::after { animation: hintfade 2.2s ease-in-out infinite alternate; }
  .caption { transition: none; }
}
@keyframes hintfade { from { opacity: 0.25; } to { opacity: 1; } }
