/* ========== PAGE ========== */
:root {
  --surface: max(22vh, 150px);   /* where the sky ends and the water starts */
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: 'Poppins', sans-serif;
  background: #0a3d66;
  color: #fff;
  overflow-x: hidden;
}

/* ========== SKY ========== */
.sky {
  position: fixed;
  left: 0; right: 0; top: 0;
  height: var(--surface);
  background: linear-gradient(#7fd3ff 0%, #bfe9ff 70%, #e6f7ff 100%);
  z-index: 0;
}
.sun {
  position: absolute;
  top: 18%; right: 12%;
  width: 70px; height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff9c4 0%, #ffe066 55%, #ffd23f 100%);
  box-shadow: 0 0 60px 20px rgba(255, 230, 120, .55);
}
/* A cloud = one rounded bar + two circles (::before and ::after) */
.cloud {
  position: absolute;
  height: 26px;
  border-radius: 30px;
  background: #fff;
  opacity: .9;
  animation: drift linear infinite;
}
.cloud::before, .cloud::after {
  content: '';
  position: absolute;
  background: #fff;
  border-radius: 50%;
}
.cloud::before { width: 40px; height: 40px; top: -20px; left: 14px; }
.cloud::after  { width: 54px; height: 54px; top: -30px; left: 40px; }
@keyframes drift {
  from { transform: translateX(-200px); }
  to   { transform: translateX(110vw); }
}

/* ========== WATER + LIGHT RAYS ========== */
.water {
  position: fixed;
  left: 0; right: 0; top: var(--surface); bottom: 0;
  background: linear-gradient(#1aa0d8 0%, #0d6fa8 30%, #0a4c7e 65%, #062d52 100%);
  z-index: 0;
  overflow: hidden;
}
/* Sunbeams: blurred white strips that fade downwards, each with its own angle (--r) */
.ray {
  position: absolute;
  top: -10%;
  width: 120px; height: 120%;
  background: linear-gradient(rgba(255,255,255,.28), rgba(255,255,255,0) 75%);
  transform-origin: top center;
  filter: blur(6px);
  animation: ray 7s ease-in-out infinite alternate;
}
@keyframes ray {
  from { opacity: .25; transform: rotate(var(--r)) scaleX(1); }
  to   { opacity: .7;  transform: rotate(calc(var(--r) + 4deg)) scaleX(1.4); }
}

/* ========== WAVES ========== */
/* Each wave strip is twice the screen width and slides left by half,
   so the pattern loops with no visible jump */
.waves {
  position: fixed;
  left: 0;
  width: 200%; height: 40px;
  top: calc(var(--surface) - 22px);
  z-index: 1;
  pointer-events: none;
}
.waves svg { display: block; width: 100%; height: 100%; }
.waves.back  { animation: waves 9s linear infinite; opacity: .55; }
.waves.front { animation: waves 6s linear infinite reverse; top: calc(var(--surface) - 14px); }
@keyframes waves {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ========== SEABED ========== */
.sand {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 13vh;
  z-index: 3;
}
.sand svg { display: block; width: 100%; height: 100%; }
/* Seaweed sways from its base */
.weed {
  position: fixed;
  bottom: 6vh;
  z-index: 2;
  transform-origin: bottom center;
  animation: sway ease-in-out infinite alternate;
}
@keyframes sway {
  from { transform: rotate(-5deg); }
  to   { transform: rotate(6deg); }
}

/* ========== BUBBLES ========== */
.bubble {
  position: fixed;
  bottom: -20px;
  border-radius: 50%;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.95), rgba(255,255,255,.25) 40%, rgba(255,255,255,.08) 70%);
  border: 1px solid rgba(255,255,255,.45);
  animation: rise linear forwards;
}
@keyframes rise {
  0%   { transform: translate(0, 0); opacity: 0; }
  10%  { opacity: 1; }
  50%  { transform: translate(14px, -50vh); }
  100% { transform: translate(-10px, -100vh); opacity: .9; }
}

/* ========== FISH + DOLPHIN ========== */
.fish, .dolphin {
  position: fixed;
  left: 0; top: 0;
  pointer-events: none;
  will-change: transform;
}
.fish svg { display: block; overflow: visible; }
/* transform-box: fill-box makes the origin relative to the fin itself, not the whole SVG */
.fish .tail { transform-box: fill-box; transform-origin: 100% 50%; animation: wag var(--wag, .35s) ease-in-out infinite alternate; }
.fish .pec  { transform-box: fill-box; transform-origin: 100% 0%;  animation: pec .5s ease-in-out infinite alternate; }
@keyframes wag { from { transform: rotate(-16deg) scaleX(.92); } to { transform: rotate(16deg) scaleX(1); } }
@keyframes pec { from { transform: rotate(-12deg); } to { transform: rotate(14deg); } }

.dolphin { z-index: 2; }
.dolphin .flukes { transform-box: fill-box; transform-origin: 100% 50%; animation: kick .42s ease-in-out infinite alternate; }
@keyframes kick { from { transform: rotate(-13deg); } to { transform: rotate(13deg); } }

#splash { position: fixed; inset: 0; z-index: 2; pointer-events: none; }

/* ========== GLASS FORM ========== */
.wrap {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(var(--surface) + 20px) 16px 24px;
  pointer-events: none;           /* only the card itself catches clicks */
}
.card {
  pointer-events: auto;
  width: min(380px, 100%);
  padding: 34px 30px 28px;
  border-radius: 26px;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.35);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 25px 60px rgba(0, 20, 50, .45), inset 0 1px 0 rgba(255,255,255,.4);
}
.card.shake { animation: shake .45s ease; }
@keyframes shake {
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}
.card h1 { font-size: 28px; font-weight: 700; text-align: center; letter-spacing: .3px; }
.card .sub { text-align: center; font-size: 13px; opacity: .85; margin: 2px 0 24px; }
.field { position: relative; margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; opacity: .95; }
.field input {
  width: 100%;
  padding: 13px 46px 13px 16px;
  border-radius: 14px;
  border: 1.5px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.12);
  color: #fff;
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.field input::placeholder { color: rgba(255,255,255,.65); }
.field input:focus {
  border-color: #7ff3ff;
  background: rgba(255,255,255,.2);
  box-shadow: 0 0 0 4px rgba(127,243,255,.18);
}
.field input[aria-invalid="true"] {
  border-color: #ff8f8f;
  background: rgba(255, 120, 120, .16);
  box-shadow: 0 0 0 4px rgba(255, 120, 120, .22);
}
.toggle {
  position: absolute;
  right: 10px; bottom: 10px;
  padding: 4px;
  border: none;
  border-radius: 6px;
  background: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.toggle:focus-visible { outline: 2px solid #7ff3ff; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; margin: 2px 0 18px; }
.row label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.row input { accent-color: #19c3e6; }
.row a, .foot a { color: #bff8ff; text-decoration: none; }
.row a:hover, .foot a:hover { text-decoration: underline; }
.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(135deg, #19c3e6, #0b7fd0);
  box-shadow: 0 10px 24px rgba(11, 127, 208, .45);
  transition: transform .15s, filter .2s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.msg { text-align: center; font-size: 13px; font-weight: 500; min-height: 18px; margin-top: 12px; }
.foot { text-align: center; font-size: 12.5px; margin-top: 6px; opacity: .9; }
.foot a { font-weight: 600; }

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
  .fish .tail, .fish .pec, .dolphin .flukes, .weed, .cloud, .waves, .ray { animation: none !important; }
  .card.shake { animation: none; }
}
