/* Kind Distance · a calm watch-from-far game for ages 4 to 7. Brand kit v1, same 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;
  --sand: #F1D1A6;
  --blush: #FBB5A8;
  --kind: #B4E89C;   /* the soft green of "we're being kind" */
}

html, body {
  margin: 0; height: 100%; overflow: hidden;
  overscroll-behavior: none;
  background: #9FD9F2;
}
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; }

.beach { position: absolute; inset: 0; overflow: hidden; background: #9FD9F2; cursor: pointer; }
/* everything on the beach lives in .world, so the binoculars can ease in on it */
.world { position: absolute; inset: 0; overflow: hidden; transform-origin: 0 0; z-index: 0; --hz: 33vh; --sh: 52vh; }
.layer { position: absolute; inset: 0; pointer-events: none; }

/* sky, sun, slow clouds */
.sky {
  position: absolute; left: 0; right: 0; top: 0; height: calc(var(--hz) + 2px); overflow: hidden;
  background: linear-gradient(180deg, #9FD9F2 0%, #C3EAF7 52%, #EAF6EF 100%);
}
.sun {
  position: absolute; right: 11%; top: 16%;
  width: 14vmin; height: 14vmin; min-width: 54px; min-height: 54px; border-radius: 50%;
  background: radial-gradient(circle, #FFFBE6 0 52%, var(--sun) 64%, rgba(253, 242, 197, 0) 72%);
  box-shadow: 0 0 70px 26px rgba(253, 242, 197, 0.6);
}
.cloud { position: absolute; left: 0; width: 24vmin; min-width: 96px; height: auto; opacity: 0.9; animation: cloud 150s linear infinite; }
.cloud path { fill: #fff; }
.cloud--a { top: 18%; animation-delay: -50s; }
.cloud--b { top: 50%; width: 16vmin; min-width: 68px; opacity: 0.7; animation-duration: 190s; animation-delay: -130s; }
@keyframes cloud { from { transform: translateX(-30vmin); } to { transform: translateX(105vw); } }

/* the sea: three slow rolling swells, lighter as they come in */
.sea {
  position: absolute; left: 0; right: 0; top: var(--hz); height: calc(var(--sh) - var(--hz) + 24px); overflow: hidden;
  background: linear-gradient(180deg, #0A8DC1 0%, #0FA4D2 40%, #1DB7DA 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35);
}
.swell { position: absolute; left: 0; right: 0; bottom: -14px; background: var(--c); animation: bob 8s ease-in-out infinite alternate; }
.swell svg { position: absolute; left: 0; bottom: calc(100% - 1px); width: 200%; height: 9px; animation: roll 70s linear infinite; }
.swell .w { fill: var(--c); }
.swell .crest { fill: none; stroke: rgba(255, 255, 255, 0.5); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.swell--far { top: 24%; --c: #14AAD4; }
.swell--mid { top: 49%; --c: #2DBDDD; animation-duration: 9.5s; animation-delay: -3s; }
.swell--mid svg { height: 12px; animation-duration: 54s; animation-direction: reverse; }
.swell--mid .crest { stroke: rgba(255, 255, 255, 0.6); stroke-width: 2; }
.swell--near { top: 73%; --c: #5ACDE4; animation-duration: 7s; animation-delay: -5s; }
.swell--near svg { height: 16px; animation-duration: 40s; }
.swell--near .crest { stroke: rgba(255, 255, 255, 0.75); stroke-width: 2.4; }
@keyframes roll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes bob { from { transform: translateY(-2.5px); } to { transform: translateY(2.5px); } }

/* sand, with a gentle wash lapping at the edge */
.sand {
  position: absolute; left: 0; right: 0; top: var(--sh); bottom: 0;
  background:
    radial-gradient(40% 26% at 22% 46%, rgba(255, 255, 255, 0.32), transparent 70%),
    radial-gradient(32% 22% at 74% 72%, rgba(255, 255, 255, 0.26), transparent 70%),
    linear-gradient(180deg, #E2C394 0%, #EED6A9 6%, #F3DDB3 15%, #ECCD98 100%);
}
.foam { position: absolute; left: 0; top: -10px; width: 100%; height: 20px; animation: lap 7s ease-in-out infinite alternate; }
.foam svg { display: block; width: 200%; height: 100%; animation: roll 90s linear infinite; }
.foam__wash { fill: url(#kd-wash); }
.foam__line { fill: none; stroke: #fff; stroke-width: 2.6; vector-effect: non-scaling-stroke; }
@keyframes lap { from { transform: translateY(-3px); } to { transform: translateY(4px); } }
.shell { position: absolute; left: 7%; top: 34%; width: 5vmin; min-width: 22px; height: auto; }
.shell__fan { fill: #F7CDBB; }
.shell__ridge { fill: none; stroke: #E6A48C; stroke-width: 1.4; stroke-linecap: round; }

/* the rock, and the sea lion who sometimes rests on it */
.rock { position: absolute; left: 0; top: 0; overflow: visible; }
.lion { position: absolute; left: 0; top: 0; pointer-events: none; }
.lion.is-here { pointer-events: auto; }
.lion__in { opacity: 0; transform: translateY(10%); transition: opacity 1.3s ease, transform 1.4s cubic-bezier(0.3, 0.7, 0.3, 1); }
.lion.is-here .lion__in { opacity: 1; transform: none; }
.lion__lift { transform-origin: 46% 96%; transition: transform 0.9s ease-in-out; }
.lion.is-up .lion__lift { transform: rotate(-5deg); }
.lion__img { display: block; width: 100%; height: auto; transform-origin: 50% 100%; filter: drop-shadow(0 6px 5px rgba(60, 50, 40, 0.2)); }

/* far out in the water: just her head, bobbing */
.far__head { position: absolute; left: 0; top: 0; pointer-events: none; }
.far__head.is-up { pointer-events: auto; }
.far__clip { position: absolute; inset: 0; overflow: hidden; }
.far__rise { position: absolute; inset: 0; transform: translateY(104%); transition: transform 1.1s cubic-bezier(0.3, 0.7, 0.3, 1); }
.far__head.is-up .far__rise { transform: none; }
.far__bob { position: absolute; inset: 0; animation: farbob 3.4s ease-in-out infinite alternate; }
@keyframes farbob { from { transform: translateY(0); } to { transform: translateY(5%); } }
/* only her head shows: the rest of the cutout fades away to the right */
.far__img {
  position: absolute; left: 0; top: 0; width: 304%; max-width: none; height: auto;
  -webkit-mask-image: linear-gradient(90deg, #000 23%, transparent 29%);
  mask-image: linear-gradient(90deg, #000 23%, transparent 29%);
}
.far__head .flipper { left: 64%; top: auto; bottom: -10%; width: 24%; z-index: 2; }
.far__foam { position: absolute; left: 0%; width: 80%; bottom: -9%; height: 20%; overflow: visible; opacity: 0; transition: opacity 0.8s ease; }
.far__foam ellipse { fill: rgba(255, 255, 255, 0.35); stroke: rgba(255, 255, 255, 0.9); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.far__head.is-up .far__foam { opacity: 1; }

/* her resting space: a soft dotted ring on the sand, green when we're being kind */
.bubble {
  position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none;
  filter: drop-shadow(0 0 0 rgba(180, 232, 156, 0));
  transition: opacity 1.2s ease, filter 1s ease;
}
.bubble.is-gone { opacity: 0; }
.bubble__fill { fill: rgba(255, 252, 240, 0.14); transition: fill 1s ease; }
.bubble__dots { fill: none; stroke: rgba(255, 255, 255, 0.92); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 0.1 15; transition: stroke 1s ease; }
.bubble.is-kind { filter: drop-shadow(0 0 9px rgba(180, 232, 156, 0.95)); }
.bubble.is-kind .bubble__fill { fill: rgba(180, 232, 156, 0.28); }
.bubble.is-kind .bubble__dots { stroke: var(--kind); }

/* footprints in the sand */
.step { position: absolute; left: 0; top: 0; }
.step svg { display: block; width: 100%; height: 100%; overflow: visible; }
.foot__rim { fill: #FBF0D8; opacity: 0.8; }
.foot__print { fill: #B88C55; opacity: 0.85; }

/* the harbor seal (and, later, her pup) */
.seal { position: absolute; left: 0; top: 0; }
.seal.is-gone { visibility: hidden; }
.seal__move { position: relative; transform-origin: 50% 100%; }
.seal__move::before {
  content: ""; position: absolute; left: 6%; right: 2%; bottom: -7%; height: 24%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(150, 110, 60, 0.32), rgba(150, 110, 60, 0));
}
.seal__lift { position: relative; transform-origin: 86% 90%; transition: transform 1s ease-in-out; }
.seal.is-up .seal__lift { transform: rotate(-6deg); }
.seal__breathe { position: relative; transform-origin: 50% 100%; animation: breathe 4.4s ease-in-out infinite alternate; }
.seal--pup .seal__breathe { animation-duration: 3.2s; }
@keyframes breathe { from { transform: scaleY(1); } to { transform: scaleY(1.025); } }
.seal__img { position: relative; z-index: 1; display: block; width: 100%; height: auto; }
/* eyelids: closed while she naps, open when she's awake */
.seal__lid {
  position: absolute; z-index: 2; border-radius: 50%;
  background: #A6A49F; border-bottom: 1.5px solid #4E4C49;
  transform-origin: 50% 0; transform: scaleY(1); transition: transform 0.4s ease;
}
.seal__lid--l { left: 4.3%; top: 15.9%; width: 3.4%; height: 6.8%; }
.seal__lid--r { left: 13.8%; top: 16.4%; width: 3.8%; height: 7.3%; background: #B2AFAA; }
.seal.is-awake .seal__lid { transform: scaleY(0); }

/* the little waving flipper (behind her shoulder on the beach, out of the water far away) */
.flipper { position: absolute; left: 20.5%; top: -15%; width: 8.5%; height: auto; aspect-ratio: 40 / 72; z-index: 0; opacity: 0; overflow: visible; transform-origin: 50% 92%; }
.flipper__paddle { fill: #7E8389; stroke: #4D5157; stroke-width: 2.2; }
.flipper__light { fill: #A3A7AC; opacity: 0.7; }
.flipper__spots circle { fill: #50545A; }
.flipper__claws { fill: none; stroke: #3E4146; stroke-width: 1.8; stroke-linecap: round; }

/* little visitors */
.pelican, .dolphin, .gull, .birds, .whale { position: absolute; left: 0; top: 0; }
.pelican svg, .dolphin svg, .gull svg, .whale svg { display: block; width: 100%; height: 100%; overflow: visible; }
/* sanderlings: tiny shorebirds that run back and forth with the waves */
.bird { position: absolute; left: 0; top: 0; }
.bird svg { display: block; width: 100%; height: 100%; overflow: visible; }
.bird__legs { animation: patter 0.22s linear infinite alternate; transform-origin: 50% 0; transform-box: fill-box; }
.bird.is-still .bird__legs { animation: none; }
@keyframes patter { from { transform: scaleX(1); } to { transform: scaleX(-1); } }
.spout { position: absolute; left: 0; top: 0; border-radius: 50% 50% 40% 40%; background: radial-gradient(closest-side, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0)); }

/* the friends you've watched (top right on wide screens, a row under the buttons on tall phones) */
.seen {
  position: absolute; z-index: 6; margin: 0; padding: 3px 8px; list-style: none;
  top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  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);
  pointer-events: none;
}
.seen__item { width: 36px; height: 36px; display: grid; place-items: center; }
.seen__item img, .seen__item svg { width: 100%; height: 100%; object-fit: contain; display: block; overflow: visible; filter: brightness(0); opacity: 0.2; transition: filter 1.2s ease, opacity 1.2s ease; }
.seen__item.is-seen img, .seen__item.is-seen svg { filter: none; opacity: 1; }
.seen__item--medal { width: 38px; height: 38px; }
.seen__item--medal svg { filter: grayscale(1) brightness(1.3); opacity: 0.35; }
.seen__item--medal.is-seen svg { filter: drop-shadow(0 0 6px rgba(253, 242, 197, 0.95)); opacity: 1; }
@media (max-aspect-ratio: 23/20) and (max-width: 640px) {
  .seen { top: calc(max(12px, env(safe-area-inset-top)) + 54px); right: auto; left: 50%; transform: translateX(-50%); }
}
@media (max-width: 360px) {
  .seen { gap: 2px; padding: 3px 6px; }
  .seen__item { width: 30px; height: 30px; }
}
.leap { position: absolute; left: 0; top: 0; overflow: hidden; }
.dolphin { transform-origin: 50% 50%; }
.gull svg { transform-origin: 50% 70%; animation: flap 0.55s ease-in-out infinite alternate; }
@keyframes flap { from { transform: scaleY(1); } to { transform: scaleY(0.55); } }

/* little effects: hearts, sparkles, rings, sleepy z's, sand bits */
.fl { position: absolute; left: 0; top: 0; }
.fl svg { display: block; width: 100%; height: 100%; overflow: visible; }
.fl--heart path { fill: var(--blush); stroke: #fff; stroke-width: 1.5; }
.fl--spark path { fill: var(--sun); stroke: #fff; stroke-width: 1; }
.fl--ui { z-index: 7; pointer-events: none; }
.ring { position: absolute; left: 0; top: 0; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, 0.85); }
.ring--sand { border-color: rgba(176, 128, 70, 0.5); }
.bit { position: absolute; left: 0; top: 0; border-radius: 50%; background: #D7B47F; }
.zz { position: absolute; left: 0; top: 0; font-weight: 600; line-height: 1; color: #FFFCF0; text-shadow: 0 1px 3px rgba(46, 50, 83, 0.35); }

/* binoculars: a soft round view, everything else gently dimmed */
.binoc { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; opacity: 0; pointer-events: none; z-index: 4; }
.binoc__veil { fill: var(--navy); fill-opacity: 0.8; }

/* the two big picture buttons */
.actions {
  position: absolute; z-index: 6;
  left: 50%; transform: translateX(-50%);
  bottom: calc(max(8px, env(safe-area-inset-bottom)) + 46px); /* room for the caption, even on two lines */
  display: flex; gap: 18px;
}
.act {
  position: relative; width: 84px; height: 84px; padding: 0; border-radius: 50%;
  display: grid; place-items: center;
  border: 3px solid #fff;
  background: radial-gradient(circle at 35% 30%, #FFFDF3, var(--sun) 70%);
  box-shadow: 0 12px 20px -8px rgba(2, 80, 120, 0.45), inset 0 -3px 0 rgba(214, 180, 120, 0.35);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform 0.25s ease;
}
.act:active { transform: scale(0.94); }
.act:focus-visible { outline: 4px solid var(--navy); outline-offset: 4px; }
.act svg { width: 52px; height: 52px; overflow: visible; }
.act .ink { fill: var(--navy); }
.act .lens { fill: #8EDDEB; }
.act .glint { fill: #fff; }
/* a slow, soft ring that says "try me" */
.act.hint::after {
  content: ""; position: absolute; inset: -9px; border-radius: 50%; pointer-events: none;
  border: 4px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 12px rgba(253, 242, 197, 0.9);
  animation: hint 2.4s ease-out infinite;
}
@keyframes hint { 0% { transform: scale(0.88); opacity: 0.95; } 100% { transform: scale(1.3); opacity: 0; } }

/* the grown-up caption (not needed to play) */
.note {
  position: absolute; z-index: 5; margin: 0;
  left: 50%; transform: translateX(-50%); bottom: max(8px, env(safe-area-inset-bottom));
  max-width: calc(100% - 32px); box-sizing: border-box; text-align: center;
  padding: 3px 10px; border-radius: 999px;
  background: rgba(255, 252, 240, 0.72);
  font: 500 0.75rem/1.25 "Fredoka", system-ui, sans-serif; color: var(--navy);
  pointer-events: none;
}

/* grown-up controls (small, out of the way), same as Play with Ellie */
.controls {
  position: absolute; left: max(12px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top));
  display: flex; gap: 8px; z-index: 6;
}
.ctl {
  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;
}
.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; }

/* landscape: buttons tuck into the bottom right, the caption into the bottom left (kind.js uses the same 1.15 cut) */
@media (min-aspect-ratio: 23/20) {
  .actions { left: auto; transform: none; right: max(16px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); }
  .note { left: max(16px, env(safe-area-inset-left)); transform: none; max-width: 46%; text-align: left; }
}
@media (min-aspect-ratio: 23/20) and (max-height: 430px) {
  .actions { gap: 14px; }
  .act { width: 72px; height: 72px; }
  .act svg { width: 44px; height: 44px; }
}

/* reduced motion: nothing drifts, zooms or travels; changes are instant or soft fades */
@media (prefers-reduced-motion: reduce) {
  .cloud, .swell, .swell svg, .foam, .foam svg, .seal__breathe, .far__bob, .gull svg, .bird__legs { animation: none !important; }
  .seal__lift, .lion__lift, .seal__lid, .act { transition: none; }
  .lion__in { transform: none; transition: opacity 1s ease; }
  .far__rise { transform: none; transition: none; }
  .far__head { opacity: 0; transition: opacity 0.7s ease; }
  .far__head.is-up { opacity: 1; }
  .act.hint::after { animation: none; transform: none; opacity: 1; }
}

/* 10/5 (Des's look): on the sand she greets with a head lift, a blink and hearts. The drawn flipper read like a fin on
   her back, so it only waves when she's far out in the water, where it sits beside her head. */
.seal .flipper { display: none; }
