:root {
  --pink: #ff4f9a;
  --pink2: #ff8cc6;
  --blush: #ffe3f1;
  --teal: #20bfb0;
  --lav: #9b7bff;
  --sun: #ffd34d;
  --ink: #4b1f52;
  --ink2: #7a4a80;
  --card: rgba(255, 255, 255, 0.8);
  --radius: 30px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Fredoka', system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(#fff3c4, #ffd1ea 40%, #c9f0d8);
  background-attachment: fixed;
  overflow-x: hidden;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
}
.no-webgl #scene { display: none; }

/* ------------------------------------------------------------ loader */
#loader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-content: center; text-align: center;
  background: radial-gradient(circle at 50% 40%, #fff6d6, #ffc6e4 60%, #e8d6ff);
  font-family: 'Chewy', cursive; font-size: 1.8rem; color: var(--pink);
  transition: opacity 0.8s, visibility 0.8s;
}
#loader.done { opacity: 0; visibility: hidden; }
.loader-cat { font-size: 5rem; animation: bounce 0.7s ease-in-out infinite alternate; }
@keyframes bounce { to { transform: translateY(-24px) rotate(8deg); } }

/* ------------------------------------------------------------ top bar */
.topbar {
  position: fixed; top: 12px; left: 12px; right: 12px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  pointer-events: none;
}
.logo, .nav { pointer-events: auto; }
.logo {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Chewy', cursive; font-size: 1.4rem; color: var(--pink);
  text-decoration: none; background: rgba(255, 255, 255, 0.85);
  padding: 8px 18px; border-radius: 999px; border: 3px solid #fff;
  box-shadow: 0 6px 20px rgba(214, 61, 134, 0.2);
}
.logo .paw { display: inline-block; animation: wiggle 2.4s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-15deg); } }
.nav {
  display: flex; gap: 4px; padding: 5px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.85); border: 3px solid #fff;
  box-shadow: 0 6px 20px rgba(214, 61, 134, 0.2);
  overflow-x: auto; scrollbar-width: none; min-width: 0;
}
.nav a {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  font-size: 1.3rem; text-decoration: none; border-radius: 50%;
  transition: transform 0.15s, background 0.2s;
}
.nav a:hover { transform: scale(1.18); background: var(--blush); }
.nav a.active { background: linear-gradient(180deg, #ffb3d9, #ff7ab8); transform: scale(1.08); }

/* ------------------------------------------------------- floating buttons */
.fabs {
  position: fixed; right: 16px; bottom: 16px; z-index: 20;
  display: flex; flex-direction: column; gap: 10px;
}
.fab {
  width: 64px; height: 64px; border-radius: 50%; border: 4px solid #fff; cursor: pointer;
  background: linear-gradient(180deg, #fff, #ffe3f1); color: var(--ink);
  box-shadow: 0 6px 18px rgba(214, 61, 134, 0.3);
  display: grid; place-items: center; align-content: center; gap: 0; padding: 0;
  font: inherit; transition: transform 0.15s;
}
.fab span { font-size: 1.6rem; line-height: 1; }
.fab small { font-size: 0.65rem; font-weight: 700; color: var(--ink2); }
.fab:hover { transform: scale(1.1) rotate(-6deg); }
.fab:active { transform: scale(0.94); }
.fab.off { opacity: 0.7; }

.peek main .card, .peek .scroll-hint { opacity: 0; visibility: hidden; transition: opacity 0.4s, visibility 0.4s; }
.card { transition: opacity 0.4s, visibility 0.4s; }

/* ------------------------------------------------------------ sections */
main { position: relative; z-index: 1; pointer-events: none; }
section {
  min-height: 115vh;
  display: flex; align-items: center;
  padding: 110px 6vw 60px;
}
section[data-side='left'] { justify-content: flex-start; }
section[data-side='right'] { justify-content: flex-end; }
section[data-side='center'] { justify-content: center; }

.card {
  pointer-events: auto;
  width: min(560px, 100%);
  background: var(--card);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border: 4px solid #fff;
  border-radius: var(--radius);
  padding: 26px 28px 30px;
  box-shadow: 0 20px 50px rgba(214, 70, 150, 0.25), inset 0 0 0 2px rgba(255, 140, 198, 0.25);
}

h1, h2, h3 { font-family: 'Chewy', cursive; font-weight: 400; letter-spacing: 0.5px; }
h1 { font-size: clamp(2.2rem, 5vw, 3.3rem); line-height: 1.05; margin: 0.25em 0 0.3em; color: var(--ink); }
h1 .name { color: var(--pink); text-shadow: 3px 3px 0 #fff, 5px 6px 0 rgba(255, 79, 154, 0.25); }
h2 { font-size: clamp(2rem, 5vw, 2.8rem); margin: 0.2em 0 0.25em; color: var(--pink); text-shadow: 2px 3px 0 #fff, 4px 6px 0 rgba(255, 79, 154, 0.2); }
h3 { font-size: 1.45rem; margin: 1em 0 0.4em; color: var(--lav); }
p { font-size: 1.15rem; line-height: 1.55; margin: 0.5em 0; }
.kicker {
  display: inline-block; background: var(--sun); color: var(--ink);
  font-weight: 700; padding: 4px 14px; border-radius: 999px; font-size: 0.95rem;
  transform: rotate(-2deg); box-shadow: 0 3px 0 #e6b52a;
}
.tip { font-size: 1rem; background: #fff; border-radius: 16px; padding: 8px 14px; border: 2px dashed var(--pink2); }

/* ------------------------------------------------------------ buttons */
.btn {
  font: inherit; font-weight: 700; font-size: 1.1rem;
  border: 0; border-radius: 999px; padding: 12px 22px; cursor: pointer;
  color: #fff; background: linear-gradient(180deg, #ff9ccf, #ff5fa8);
  box-shadow: 0 5px 0 #d63d86, 0 10px 20px rgba(214, 61, 134, 0.3);
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn:hover { transform: translateY(-2px) scale(1.03); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #d63d86; }
.btn.teal { background: linear-gradient(180deg, #6ff0e2, #20bfb0); box-shadow: 0 5px 0 #14968a, 0 10px 20px rgba(20, 150, 138, 0.3); }
.btn.lav { background: linear-gradient(180deg, #c3adff, #9b7bff); box-shadow: 0 5px 0 #7556de, 0 10px 20px rgba(117, 86, 222, 0.3); }
.btn.sun { color: var(--ink); background: linear-gradient(180deg, #ffe58a, #ffc62e); box-shadow: 0 5px 0 #d9a00f, 0 10px 20px rgba(217, 160, 15, 0.3); }
.btn.small { font-size: 0.95rem; padding: 8px 16px; }
.btn.big { font-size: 1.3rem; padding: 16px 28px; width: 100%; margin: 8px 0 4px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* --------------------------------------------------------------- hero */
.hero { align-items: flex-start; min-height: 100vh; position: relative; }
.hero-card {
  width: min(820px, 100%);
  display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: center;
}
.hero-pic {
  width: 200px; aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  border: 6px solid #fff;
  box-shadow: 0 0 0 6px #ffb3d9, 0 0 40px 10px rgba(111, 240, 255, 0.55);
  animation: float 4s ease-in-out infinite;
}
.hero-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
@keyframes float { 50% { transform: translateY(-10px) rotate(2deg); } }
.scroll-hint {
  position: absolute; bottom: 4vh; left: 50%; transform: translateX(-50%);
  font-family: 'Chewy', cursive; font-size: 1.4rem; color: #fff;
  text-shadow: 0 2px 6px rgba(214, 61, 134, 0.6);
  display: flex; flex-direction: column; align-items: center;
}
.scroll-hint span { font-size: 2rem; animation: bounce 0.8s ease-in-out infinite alternate; }

/* --------------------------------------------------------------- crew */
.crew-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.crew {
  background: #fff; border-radius: 20px; padding: 12px 8px 12px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  box-shadow: 0 4px 0 #ffd3ea;
}
.crew b { font-size: 1.05rem; }
.crew span { font-size: 0.85rem; color: var(--ink2); line-height: 1.25; min-height: 2.2em; }
.swatch {
  width: 58px; height: 52px; position: relative;
  background: var(--c); border-radius: 50% 50% 46% 46%;
  border: 3px solid #ffd3ea;
}
.swatch::before, .swatch::after {
  content: ''; position: absolute; top: -12px; width: 0; height: 0;
  border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 18px solid var(--c);
  filter: drop-shadow(0 -2px 0 #ffd3ea);
}
.swatch::before { left: 2px; transform: rotate(-12deg); }
.swatch::after { right: 2px; transform: rotate(12deg); }
.swatch.dog::before, .swatch.dog::after { top: 4px; border: 0; width: 16px; height: 28px; background: var(--c); border-radius: 50%; filter: brightness(0.85); }
.swatch.dog::before { left: -9px; }
.swatch.dog::after { right: -9px; }
.swatch.spots { background: radial-gradient(circle at 30% 60%, #2a2235 5px, transparent 6px), radial-gradient(circle at 72% 35%, #2a2235 4px, transparent 5px), var(--c); }
.swatch { --eyes: radial-gradient(circle at 32% 48%, var(--e) 6px, transparent 7px), radial-gradient(circle at 68% 48%, var(--e) 6px, transparent 7px); background-image: var(--eyes); }
.swatch.spots { background-image: var(--eyes), radial-gradient(circle at 25% 80%, #2a2235 5px, transparent 6px), radial-gradient(circle at 80% 22%, #2a2235 4px, transparent 5px); }
.crew-grid.three { grid-template-columns: repeat(3, 1fr); }
.facts-list { padding-left: 0; list-style: none; margin: 0; }
.facts-list li { background: #fff; border-radius: 14px; padding: 8px 12px; margin: 6px 0; font-size: 1.05rem; }

/* --------------------------------------------------------- flip cards */
.flip-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; }
.flip { perspective: 800px; height: 140px; border: 0; padding: 0; background: none; cursor: pointer; font: inherit; color: inherit; }
.flip-inner {
  position: relative; display: block; width: 100%; height: 100%;
  transition: transform 0.6s cubic-bezier(0.3, 1.4, 0.5, 1); transform-style: preserve-3d;
}
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; border-radius: 20px; padding: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  font-size: 1.8rem; line-height: 1.2;
}
.face b { font-size: 1rem; }
.front { background: var(--bg); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.06); }
.back { transform: rotateY(180deg); background: #fff; border: 3px dashed var(--pink2); font-size: 1rem; }
.flip:hover .front { filter: brightness(1.04); }

/* ------------------------------------------------------- generators */
.joke-box, .gen-box { background: #fff; border-radius: 22px; padding: 14px 18px 18px; margin-top: 14px; box-shadow: 0 4px 0 #ffd3ea; }
.gen-box h3 { margin-top: 0.2em; }
.joke-q { font-weight: 600; font-size: 1.25rem; }
.joke-a { font-family: 'Chewy', cursive; font-size: 1.6rem; color: var(--pink); animation: pop 0.5s; }
.gen-out { font-family: 'Chewy', cursive; font-size: 1.6rem; color: var(--lav); min-height: 1.5em; }
.gen-out.pop { animation: pop 0.5s; }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

.royal { background: linear-gradient(180deg, rgba(255, 246, 255, 0.85), rgba(244, 232, 255, 0.85)); }
.royal-out { background: linear-gradient(135deg, #fff6d6, #ffe3f1); border-radius: 18px; padding: 10px 14px; margin-bottom: 12px; border: 2px solid #ffd34d; }
.royal-title { font-family: 'Chewy', cursive; font-size: 1.6rem; color: #b03fd0; margin: 0.2em 0; }
.royal-detail { font-size: 1.05rem; margin: 0.3em 0; }
.rules { padding-left: 1.4em; margin: 0; font-size: 1.05rem; line-height: 1.7; }
.rules li::marker { color: var(--pink); font-weight: 700; }

/* ------------------------------------------------------------ nursery */
.baby-name { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 10px 0; flex-wrap: wrap; }
input {
  font: inherit; font-size: 1.05rem; padding: 10px 14px; border-radius: 999px;
  border: 3px solid #ffd3ea; outline: none; color: var(--ink); background: #fff; min-width: 0;
}
input:focus { border-color: var(--pink2); }
.care-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.care {
  font: inherit; font-size: 2rem; border: 3px solid #fff; border-radius: 20px; cursor: pointer;
  background: #fff; padding: 10px 4px; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  box-shadow: 0 4px 0 #ffd3ea; transition: transform 0.15s;
}
.care span { font-size: 0.9rem; font-weight: 600; }
.care:hover { transform: translateY(-3px); }
.care.done { background: linear-gradient(180deg, #e6fff8, #c6f7ea); box-shadow: 0 4px 0 #8fe3d1; position: relative; }
.care.done::after { content: '✔'; position: absolute; top: 4px; right: 10px; font-size: 1rem; color: var(--teal); }
.meter { height: 22px; border-radius: 999px; background: #fff; border: 3px solid #ffd3ea; margin: 14px 0 6px; overflow: hidden; }
.meter-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #ffb3d9, #ff5fa8, #b47cff); transition: width 0.4s cubic-bezier(0.3, 1.4, 0.5, 1); }
.care-msg { font-weight: 600; min-height: 1.6em; }

/* -------------------------------------------------------------- shows */
.show-list { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.show-list li { background: var(--blush); border-radius: 14px; padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.show-list li.empty { background: none; color: var(--ink2); font-weight: 400; }
.show-list .x { border: 0; background: #fff; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; color: var(--pink); font-size: 0.8rem; }
#show-form input { flex: 1 1 180px; }

/* ----------------------------------------------------------- pet kitty */
.pet-card { text-align: center; }
.pet-kitty {
  border: 6px solid #fff; padding: 0; border-radius: 50%; overflow: hidden;
  width: min(260px, 70vw); aspect-ratio: 1; cursor: grab; display: block; margin: 10px auto;
  box-shadow: 0 0 0 6px #ffb3d9, 0 0 40px 10px rgba(111, 240, 255, 0.5);
  touch-action: none; transition: transform 0.2s;
}
.pet-kitty img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.pet-kitty:active { transform: scale(0.97); }
.pet-kitty.happy { animation: purr 0.12s linear infinite alternate; }
@keyframes purr { from { transform: translateX(-1.5px) rotate(-0.5deg); } to { transform: translateX(1.5px) rotate(0.5deg); } }
.meter.purr { max-width: 320px; margin: 14px auto 6px; }
.bye { font-size: 1.2rem; }

/* ------------------------------------------------------------- footer */
footer {
  position: relative; z-index: 1; text-align: center; padding: 30px 16px 110px;
  font-weight: 600; color: var(--ink2);
}

/* ---------------------------------------------------- emoji effects */
.burst {
  position: fixed; z-index: 60; pointer-events: none; font-size: 28px;
  animation: burst 1.1s ease-out forwards;
}
@keyframes burst {
  from { transform: translate(-50%, -50%) scale(0.4); opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2) rotate(var(--rot)); opacity: 0; }
}
.rain { position: fixed; top: -50px; z-index: 60; pointer-events: none; animation: fall var(--dur) linear forwards; }
@keyframes fall { to { transform: translateY(115vh) rotate(var(--rot)); } }

/* ------------------------------------------------------------ phones */
@media (max-width: 820px) {
  section { min-height: auto; padding: 96px 16px 55vh; justify-content: center !important; }
  .hero { padding-bottom: 0; min-height: 100vh; }
  .card { padding: 20px 18px 22px; }
  .hero-card { grid-template-columns: 1fr; text-align: center; gap: 8px; }
  .hero-pic { width: 130px; margin: 0 auto; }
  .logo-text { display: none; }
  .logo { padding: 8px 12px; }
  .nav a { width: 34px; height: 34px; font-size: 1.1rem; }
  .crew-grid { grid-template-columns: repeat(2, 1fr); }
  .crew-grid.three { grid-template-columns: repeat(3, 1fr); }
  .crew-grid.three .crew span { font-size: 0.75rem; }
  .flip { height: 150px; }
  .face { font-size: 1.5rem; }
  .face b { font-size: 0.9rem; }
  .fab { width: 54px; height: 54px; }
  .fab span { font-size: 1.3rem; }
  .scroll-hint { bottom: 2vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-pic, .loader-cat, .logo .paw, .scroll-hint span { animation: none; }
}
