/* River's Ocean Adventure — inside the submarine */
:root {
  --deep: #041c2f;
  --hull: #0a3550;
  --hull-2: #0e4566;
  --steel: #1a5a7d;
  --aqua: #2ec4b6;
  --aqua-2: #5fe3d4;
  --coral: #ff7a59;
  --coral-2: #ff9f7f;
  --sun: #ffd166;
  --sun-2: #ffe29a;
  --pink: #ff8fab;
  --foam: #e9fbff;
  --ink: #e8f7ff;
  --muted: #9fcbe3;
  --brass-1: #f6d98b;
  --brass-2: #c9973c;
  --brass-3: #7a5419;
  --radius: 22px;
  --display: 'Fredoka', 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font: 500 17px/1.5 var(--body);
  color: var(--ink);
  background-color: var(--deep);
  background-image:
    radial-gradient(circle at 12px 12px, rgba(255,255,255,.10) 2px, transparent 3px),
    linear-gradient(90deg, rgba(0,0,0,.25) 1px, transparent 1px),
    linear-gradient(rgba(0,0,0,.25) 1px, transparent 1px),
    radial-gradient(ellipse at 50% -10%, #0f5a80 0%, #08304b 45%, var(--deep) 100%);
  background-size: 120px 120px, 120px 120px, 120px 120px, 100% 100%;
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--sun); color: var(--deep); padding: 8px 14px; border-radius: 999px; z-index: 10; }
.skip:focus { left: 8px; }

.sub {
  max-width: 1280px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px 40px;
  display: grid;
  gap: 22px;
}

/* ---------------------------------------------------------------- title */
.title { text-align: center; margin: 6px 0 14px; }
.eyebrow {
  margin: 0 0 4px; font: 700 14px/1 var(--body); letter-spacing: .18em; text-transform: uppercase; color: var(--aqua-2);
}
.bubble-title {
  margin: 0; font-family: var(--display); font-weight: 700; line-height: .95;
  font-size: clamp(46px, 14vw, 84px);
  color: var(--sun);
  text-shadow: 0 3px 0 #e0952a, 0 6px 0 #b8691b, 0 10px 18px rgba(0,0,0,.45);
  letter-spacing: .01em;
}
.bubble-title .line { display: block; }
.bubble-title .line + .line { font-size: .62em; color: var(--foam); text-shadow: 0 3px 0 #3aa7c9, 0 6px 0 #1f6f93, 0 10px 18px rgba(0,0,0,.45); margin-top: 6px; }
.bubble-title .ch { display: inline-block; animation: bob 3.2s ease-in-out infinite; animation-delay: calc(var(--i) * -0.18s); }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(-2deg); } }
.subtitle {
  display: inline-block; margin: 14px 0 0; padding: 6px 16px; border-radius: 999px;
  font: 700 clamp(16px, 4.4vw, 20px)/1.2 var(--display); color: var(--deep); background: var(--aqua-2);
  box-shadow: 0 4px 0 #1b9c90, 0 8px 18px rgba(0,0,0,.3);
}

/* ---------------------------------------------------------------- porthole */
.porthole-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.porthole {
  --size: min(calc(100vw - 32px), 560px);
  position: relative; width: var(--size); aspect-ratio: 1; border-radius: 50%;
  filter: drop-shadow(0 18px 30px rgba(0,0,0,.55));
}
.glass {
  position: absolute; inset: 7.5%; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 10%, #57c7ec 0%, #1b7fb3 38%, #0a3f6a 75%, #062a46 100%);
  isolation: isolate; touch-action: manipulation;
}
.glass canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; cursor: default; -webkit-tap-highlight-color: transparent; }
.glass.has-scene .fallback { opacity: 0; pointer-events: none; }
.frame {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background:
    radial-gradient(circle closest-side, transparent 0 88%, rgba(60,35,0,.55) 89%, transparent 91.5%, transparent 96%, rgba(255,240,190,.45) 97%, transparent 98.5%),
    conic-gradient(from 210deg, var(--brass-1), var(--brass-2), var(--brass-3), var(--brass-2), var(--brass-1), var(--brass-2), var(--brass-3), var(--brass-2), var(--brass-1));
  -webkit-mask: radial-gradient(circle closest-side, transparent 0 84.6%, #000 85%);
          mask: radial-gradient(circle closest-side, transparent 0 84.6%, #000 85%);
  box-shadow: inset 0 0 0 3px rgba(255,240,200,.35), inset 0 -6px 10px rgba(0,0,0,.4);
}
.frame::before { /* inner lip around the glass */
  content: ''; position: absolute; inset: 7.5%; border-radius: 50%;
  box-shadow: 0 0 0 4px #6e4a14, 0 0 0 7px #f2cf7a, 0 0 0 9px #8a5f20;
}
.rivet {
  position: absolute; left: 50%; top: 50%; width: 3.6%; height: 3.6%; margin: -1.8% 0 0 -1.8%; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff7d6, #d9a74a 45%, #6e4a14 100%);
  box-shadow: 0 2px 3px rgba(0,0,0,.5);
  transform: rotate(var(--a)) translateY(calc(var(--size) * -0.465));
  pointer-events: none;
}
.glare {
  position: absolute; inset: 7.5%; border-radius: 50%; pointer-events: none;
  background:
    radial-gradient(ellipse 55% 30% at 30% 18%, rgba(255,255,255,.22), transparent 60%),
    linear-gradient(130deg, transparent 58%, rgba(255,255,255,.07) 62%, transparent 70%);
  box-shadow: inset 0 0 40px 14px rgba(0,15,35,.75), inset 0 0 6px 2px rgba(0,0,0,.6);
}
.sound-toggle {
  position: absolute; right: 6%; bottom: 6%; width: 13%; aspect-ratio: 1; min-width: 44px; border-radius: 50%;
  border: 3px solid #8a5f20; background: radial-gradient(circle at 35% 30%, #fff1c2, #e2b553 60%, #9a6b22);
  font-size: clamp(18px, 4vw, 24px); cursor: pointer; display: grid; place-items: center;
  box-shadow: 0 4px 8px rgba(0,0,0,.45); z-index: 3;
}
.sound-toggle .on { display: none; }
.sound-toggle[aria-pressed="true"] .on { display: inline; }
.sound-toggle[aria-pressed="true"] .off { display: none; }
.hint {
  margin: 0; display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px; border-radius: 999px;
  background: rgba(10, 60, 90, .75); border: 1px solid rgba(95,227,212,.35); color: var(--foam);
  font: 700 15px/1.2 var(--body); backdrop-filter: blur(6px);
}
.hint-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--aqua-2); box-shadow: 0 0 0 0 rgba(95,227,212,.7); animation: ping 1.8s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(95,227,212,.7); } 80%,100% { box-shadow: 0 0 0 12px rgba(95,227,212,0); } }

/* ---- fallback scene (no WebGL / before load) */
.fallback { position: absolute; inset: 0; transition: opacity .8s ease; }
.fb-rays { position: absolute; inset: -20%; background: repeating-conic-gradient(from 170deg at 50% -10%, rgba(255,255,255,.10) 0 4deg, transparent 4deg 12deg); }
.fb-river { position: absolute; left: 50%; bottom: 4%; width: 62%; transform: translateX(-50%); animation: bob 3s ease-in-out infinite; }
.fb-bubbles i { position: absolute; bottom: -20px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.6); background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.7), transparent 50%); animation: rise 7s linear infinite; }
.fb-bubbles i:nth-child(1) { left: 12%; animation-delay: -1s; } .fb-bubbles i:nth-child(2) { left: 24%; animation-delay: -4s; width: 9px; height: 9px; }
.fb-bubbles i:nth-child(3) { left: 38%; animation-delay: -2.5s; } .fb-bubbles i:nth-child(4) { left: 55%; animation-delay: -6s; width: 20px; height: 20px; }
.fb-bubbles i:nth-child(5) { left: 66%; animation-delay: -3s; } .fb-bubbles i:nth-child(6) { left: 78%; animation-delay: -5s; width: 10px; height: 10px; }
.fb-bubbles i:nth-child(7) { left: 86%; animation-delay: -.5s; } .fb-bubbles i:nth-child(8) { left: 46%; animation-delay: -3.7s; width: 8px; height: 8px; }
@keyframes rise { to { transform: translateY(-640px) translateX(20px); } }

/* ---------------------------------------------------------------- panels */
.panels-col { display: grid; gap: 22px; align-content: start; }
.panel {
  position: relative; padding: 26px 20px 22px; border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgba(255,255,255,.08), rgba(255,255,255,0) 40%),
    linear-gradient(180deg, var(--hull-2), var(--hull));
  border: 2px solid #1f6a92;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), inset 0 -4px 0 rgba(0,0,0,.25), 0 14px 30px rgba(0,0,0,.35);
}
.panel::before, .panel::after { /* rivets */
  content: ''; position: absolute; top: 10px; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d6f1ff, #4f8fb0 60%, #1d4b66);
  box-shadow: 0 1px 2px rgba(0,0,0,.5), 0 calc(100% - 0px) 0 transparent;
}
.panel::before { left: 10px; } .panel::after { right: 10px; }
.stencil {
  margin: 0 0 14px; font: 700 15px/1 var(--display); letter-spacing: .2em; text-transform: uppercase;
  color: var(--sun); display: inline-block; padding: 7px 12px 6px; border-radius: 8px;
  background: rgba(0,0,0,.25); border: 1px dashed rgba(255,209,102,.5);
}
.lead { font: 600 clamp(20px, 5.4vw, 24px)/1.3 var(--display); margin: 0 0 16px; color: var(--foam); }
.lead strong { color: var(--sun); }
.big-one {
  display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; margin: 0 2px; border-radius: 50%;
  background: var(--coral); color: #fff; font-weight: 700; box-shadow: 0 3px 0 #c9502f; vertical-align: -.25em;
}
.facts { margin: 0; display: grid; gap: 10px; }
.fact { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: start; padding: 12px 14px; border-radius: 16px; background: rgba(4, 28, 47, .45); }
.fact dt { font: 800 13px/1.6 var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--aqua-2); display: flex; align-items: center; gap: 6px; }
.fact dd { margin: 0; }
.fact dd strong { font: 600 19px/1.3 var(--display); color: #fff; display: block; }
.fact dd small { display: block; color: var(--muted); font-size: 15px; margin-top: 2px; }
.fact dd small:empty { display: none; }
.ico { font-size: 18px; }
.notes { margin: 14px 0 0; padding-left: 20px; color: var(--muted); } .notes:empty { display: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.btn {
  --c: var(--aqua); --s: #1b9c90; --t: var(--deep);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px;
  padding: 10px 18px; border-radius: 999px; border: 0; cursor: pointer; text-decoration: none;
  font: 700 16px/1 var(--display); color: var(--t); background: var(--c);
  box-shadow: 0 4px 0 var(--s), 0 8px 16px rgba(0,0,0,.25); transition: transform .12s ease, box-shadow .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--s), 0 12px 20px rgba(0,0,0,.3); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--s), 0 4px 8px rgba(0,0,0,.25); }
.btn-coral { --c: var(--coral); --s: #c9502f; --t: #fff; }
.btn-aqua { --c: var(--aqua-2); --s: #1b9c90; }
.btn-sun { --c: var(--sun); --s: #d39b23; }
.actions .btn { flex: 1 1 150px; }

/* countdown */
.gauges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.gauge {
  aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; align-content: center;
  background: radial-gradient(circle at 50% 40%, #0f5579, #072a42 70%);
  border: 4px solid #c9973c; box-shadow: inset 0 0 0 3px #6b4612, inset 0 6px 14px rgba(0,0,0,.6), 0 4px 10px rgba(0,0,0,.35);
  position: relative; overflow: hidden;
}
.gauge::after { /* sonar sweep */
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(95,227,212,.28), transparent 25%);
  animation: sweep 4s linear infinite;
}
.gauge:nth-child(2)::after { animation-delay: -1s; } .gauge:nth-child(3)::after { animation-delay: -2s; } .gauge:nth-child(4)::after { animation-delay: -3s; }
@keyframes sweep { to { transform: rotate(360deg); } }
.gauge b { font: 700 clamp(22px, 7vw, 34px)/1 var(--display); color: var(--aqua-2); text-shadow: 0 0 12px rgba(95,227,212,.6); position: relative; z-index: 1; }
.gauge span { font: 800 11px/1 var(--body); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 4px; position: relative; z-index: 1; }
.cd-caption { text-align: center; margin: 12px 0 0; font: 600 17px/1.3 var(--display); color: var(--foam); }

/* rsvp */
.rsvp-by { margin: -4px 0 16px; color: var(--muted); }
.field { margin: 0 0 16px; border: 0; padding: 0; min-width: 0; }
.field label, .field legend { display: block; font: 700 15px/1.3 var(--body); margin-bottom: 6px; color: var(--foam); padding: 0; }
.opt { font-weight: 600; color: var(--muted); font-size: 13px; }
input, textarea {
  width: 100%; font: 600 17px/1.3 var(--body); color: var(--deep); background: var(--foam);
  border: 3px solid transparent; border-radius: 14px; padding: 12px 14px; outline: none;
  box-shadow: inset 0 2px 0 rgba(0,0,0,.08); transition: border-color .15s;
}
input:focus, textarea:focus { border-color: var(--sun); }
input::placeholder, textarea::placeholder { color: #7a98a8; }
textarea { resize: vertical; min-height: 84px; }
.choices { display: grid; gap: 8px; }
.choice { position: relative; display: block; cursor: pointer; margin: 0 !important; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: block; padding: 13px 16px; border-radius: 14px; font: 600 17px/1.2 var(--display);
  background: rgba(4, 28, 47, .5); border: 3px solid #1f6a92; color: var(--foam); transition: all .15s;
}
.choice:hover span { border-color: var(--aqua-2); }
.choice input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 2px; }
.choice.yes input:checked + span { background: var(--aqua-2); border-color: #fff; color: var(--deep); }
.choice.maybe input:checked + span { background: var(--sun); border-color: #fff; color: var(--deep); }
.choice.no input:checked + span { background: var(--coral); border-color: #fff; color: #fff; }
.coming { transition: opacity .2s; }
.coming[hidden] { display: none; }
.steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.stepper { background: rgba(4, 28, 47, .5); border-radius: 14px; padding: 10px 12px; display: grid; gap: 8px; justify-items: center; }
.st-label { font: 800 13px/1 var(--body); text-transform: uppercase; letter-spacing: .1em; color: var(--aqua-2); }
.st-ctl { display: flex; align-items: center; gap: 12px; }
.st-ctl button {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; font: 700 24px/1 var(--display);
  background: var(--sun); color: var(--deep); box-shadow: 0 3px 0 #d39b23;
}
.st-ctl button:active { transform: translateY(2px); box-shadow: 0 1px 0 #d39b23; }
.st-ctl output { min-width: 32px; text-align: center; font: 700 28px/1 var(--display); color: #fff; }
.err { margin: 6px 0 0; color: var(--coral-2); font-weight: 800; font-size: 14px; } .err:empty { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.btn-big { width: 100%; min-height: 58px; font-size: 21px; --c: var(--coral); --s: #c9502f; --t: #fff; position: relative; overflow: hidden; }
.btn-big[disabled] { opacity: .75; cursor: progress; }
.btn-big .sonar { position: absolute; inset: 0; pointer-events: none; }
.btn-big.sending .sonar::before { content: ''; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px; border-radius: 50%; border: 2px solid #fff; animation: sonar 1s ease-out infinite; }
@keyframes sonar { to { transform: scale(40); opacity: 0; } }
.form-status { min-height: 1.4em; margin: 10px 0 0; text-align: center; font-weight: 800; }
.form-status.bad { color: var(--coral-2); }

.saved { text-align: center; padding: 10px 4px 4px; }
.saved-badge { font-size: 54px; animation: flip 2.6s ease-in-out infinite; display: inline-block; }
@keyframes flip { 0%,70%,100% { transform: rotate(0) translateY(0); } 80% { transform: rotate(-20deg) translateY(-14px); } 90% { transform: rotate(15deg) translateY(-6px); } }
.saved h3 { margin: 4px 0 6px; font: 700 26px/1.2 var(--display); color: var(--sun); }
.saved p { margin: 0 0 16px; color: var(--foam); }
form[hidden], .saved[hidden] { display: none; }

.foot { text-align: center; color: var(--muted); padding: 4px 0 20px; }
.foot p { margin: 4px 0; } .foot p:empty { display: none; }
.tiny { font-size: 13px; opacity: .8; }

/* ---------------------------------------------------------------- desktop */
@media (min-width: 980px) {
  .sub { grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr); gap: 40px; padding-top: 28px; align-items: start; }
  .viewport-col { position: sticky; top: 20px; }
  .porthole { --size: min(52vw, calc(100vh - 300px), 640px); }
  .panels-col { padding-top: 24px; }
  .panel { padding: 30px 28px 26px; }
  .choices { grid-template-columns: 1fr; }
}
@media (min-width: 980px) and (max-height: 760px) {
  .title { margin-bottom: 6px; }
  .bubble-title { font-size: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  .bubble-title .ch, .hint-dot, .gauge::after, .saved-badge, .fb-river, .fb-bubbles i { animation: none !important; }
}
.preview-note { margin: 0 0 14px; padding: 10px 12px; border-radius: 12px; background: rgba(255,209,102,.15); border: 1px dashed var(--sun); color: var(--sun-2); font-size: 14px; font-weight: 700; }

/* ---------------------------------------------------------------- bottle wall */
.check { display: flex !important; align-items: center; gap: 10px; margin-top: 10px !important; font-weight: 700; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--aqua); flex: none; }
.bw-lead { margin: -2px 0 14px; color: var(--foam); }
.bw-count { color: var(--sun); font-weight: 800; white-space: nowrap; }
.bw-empty { margin: 0 0 16px; padding: 14px; border-radius: 14px; text-align: center; color: var(--muted); background: rgba(4,28,47,.45); border: 2px dashed #1f6a92; }
.bw-empty[hidden] { display: none; }
.scrolls {
  display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 2px 16px; margin: 0 -4px 10px;
  -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--steel) transparent;
}
.scrolls:empty { display: none; }
.scroll-card {
  flex: 0 0 min(78%, 270px); min-width: 0; scroll-snap-align: start; position: relative;
  padding: 18px 16px 14px; border-radius: 6px 6px 14px 14px; color: #4a3216;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255,255,255,.55), transparent 55%),
    linear-gradient(170deg, #fff4d6 0%, #f6e2b3 60%, #e9cc8e 100%);
  box-shadow: inset 0 0 0 1px rgba(150,100,30,.25), inset 0 -10px 18px rgba(160,110,40,.18), 0 8px 16px rgba(0,0,0,.3);
  transform: rotate(var(--r, 0deg));
}
.scroll-card::before, .scroll-card::after { /* rolled ends */
  content: ''; position: absolute; left: -4px; right: -4px; height: 10px; border-radius: 999px;
  background: linear-gradient(180deg, #f3d99c, #c99a4d); box-shadow: 0 2px 3px rgba(0,0,0,.25);
}
.scroll-card::before { top: -5px; } .scroll-card::after { bottom: -5px; }
.scroll-card p { margin: 0; font: 600 17px/1.35 var(--display); overflow-wrap: anywhere; }
.scroll-card .from { margin-top: 10px; font: 800 14px/1.2 var(--body); color: #8a5a1c; }
.scroll-card.new { animation: splash .8s cubic-bezier(.2,1.6,.4,1); }
@keyframes splash { from { transform: translateY(30px) scale(.7) rotate(-8deg); opacity: 0; } }
.btn-sea { --c: var(--aqua-2); --s: #1b9c90; --t: var(--deep); }

/* message popped from a bottle in the porthole */
.note-pop {
  position: absolute; left: 50%; top: 50%; z-index: 4; width: min(72%, 340px); max-height: 70%; overflow: auto;
  transform: translate(-50%, -50%); padding: 22px 20px 16px; border-radius: 8px 8px 16px 16px; color: #4a3216; text-align: center;
  background: linear-gradient(170deg, #fff6dc, #f3dca6 70%, #e6c584);
  box-shadow: 0 0 0 3px rgba(150,100,30,.35), 0 18px 40px rgba(0,0,0,.5);
  animation: unroll .45s cubic-bezier(.2,1.4,.4,1);
}
.note-pop[hidden] { display: none; }
@keyframes unroll { from { transform: translate(-50%, -50%) scale(.2) rotate(-20deg); opacity: 0; } }
.note-msg { margin: 0; font: 600 clamp(17px, 4.6vw, 21px)/1.35 var(--display); overflow-wrap: anywhere; }
.note-from { margin: 10px 0 0; font: 800 14px/1.2 var(--body); color: #8a5a1c; }
.note-from::before { content: '— '; }
.note-close {
  position: absolute; top: 4px; right: 6px; width: 36px; height: 36px; border: 0; background: none; cursor: pointer;
  font: 700 26px/1 var(--display); color: #8a5a1c;
}
@media (prefers-reduced-motion: reduce) { .note-pop, .scroll-card.new { animation: none; } }
