/* Self-hosted fonts — identical rendering on every device */
@font-face {
  font-family: 'Luckiest Guy';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/luckiest-guy-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url('/fonts/baloo2-latin.woff2') format('woff2');
}

:root {
  --cream: #fdf4e3;
  --ink: #3b2f3e;
  --coral: #ff6b6b;
  --coral-deep: #e14b4b;
  --teal: #2ec4b6;
  --sunny: #ffd93d;
  --lilac: #b197fc;
  --pink: #ff9ff3;
  --sky: #74c0fc;
  --muted: #8d7f91;
}

* { box-sizing: border-box; }

/* ── Confetti Canvas ── */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ── Body ── */

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  font-family: "Baloo 2", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 15%, rgba(255, 217, 61, 0.35), transparent 30%),
    radial-gradient(circle at 88% 20%, rgba(255, 159, 243, 0.3), transparent 32%),
    radial-gradient(circle at 15% 85%, rgba(116, 192, 252, 0.3), transparent 32%),
    radial-gradient(circle at 85% 88%, rgba(46, 196, 182, 0.28), transparent 30%),
    var(--cream);
  padding: 24px 16px;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Drifting pastel blobs */
body::before,
body::after {
  content: "";
  position: fixed;
  width: 55vmax;
  height: 55vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background: radial-gradient(circle, rgba(255, 159, 243, 0.5), transparent 62%);
  top: -20vmax;
  left: -16vmax;
  animation: blobDrift1 22s ease-in-out infinite alternate;
}

body::after {
  background: radial-gradient(circle, rgba(116, 192, 252, 0.5), transparent 62%);
  bottom: -20vmax;
  right: -16vmax;
  animation: blobDrift2 27s ease-in-out infinite alternate;
}

@keyframes blobDrift1 {
  from { translate: 0 0; }
  to { translate: 12vmax 8vmax; }
}

@keyframes blobDrift2 {
  from { translate: 0 0; }
  to { translate: -10vmax -10vmax; }
}

/* Soft polka dots */
.noise {
  position: fixed;
  inset: 0;
  opacity: 0.5;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(59, 47, 62, 0.07) 2px, transparent 2.5px);
  background-size: 34px 34px;
}

/* Floating doodles (spawned by fx.js) */
.doodle {
  position: fixed;
  bottom: -70px;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  animation: floatUp linear forwards;
}

@keyframes floatUp {
  0% { opacity: 0; transform: translate(0, 0) rotate(0deg); }
  8% { opacity: var(--op, 0.4); }
  85% { opacity: var(--op, 0.4); }
  100% { opacity: 0; transform: translate(var(--sway, 30px), -110vh) rotate(var(--spin, 40deg)); }
}

/* Cursor sparkles (spawned by fx.js) */
.sparkle {
  position: fixed;
  z-index: 5;
  pointer-events: none;
  user-select: none;
  font-size: 13px;
  animation: sparklePop 0.7s ease-out forwards;
}

@keyframes sparklePop {
  0% { opacity: 0.9; transform: scale(0.4) rotate(0deg); }
  100% { opacity: 0; transform: scale(1.3) translateY(-16px) rotate(35deg); }
}

/* ── Card ── */

.card {
  width: min(92vw, 700px);
  min-height: min(660px, calc(100svh - 48px));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: clamp(30px, 6vw, 48px) 24px 20px;
  position: relative;
  z-index: 1;
  border-radius: 36px;
  border: 4px solid var(--ink);
  background: #fffdf8;
  box-shadow:
    10px 12px 0 rgba(59, 47, 62, 0.16),
    0 0 0 10px rgba(255, 255, 255, 0.5);
  animation: popIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  will-change: transform;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.9) translateY(26px); }
  to { opacity: 1; transform: none; }
}

/* Staggered entrance for card children */
.warning, h1, .line, .mischief, .btn-base, .stats, .affiliate, .share-btn {
  animation: riseIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.warning { animation-delay: 0.15s; }
h1 { animation-delay: 0.25s; }
.line { animation-delay: 0.35s; }
.mischief { animation-delay: 0.42s; }
.btn-base { animation-delay: 0.5s; }
.stats { animation-delay: 0.62s; }
.affiliate { animation-delay: 0.7s; }
.share-btn { animation-delay: 0.78s; }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: none; }
}

/* ── Floating doodle stickers ── */

.burst {
  position: absolute;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 3px solid var(--ink);
  color: var(--ink);
  font-size: 26px;
  font-weight: 800;
  animation: bob 3.4s ease-in-out infinite;
}

.b1 { left: 28px; top: 32px; background: var(--sunny); transform: rotate(-8deg); }
.b2 { right: 30px; top: 36px; background: var(--pink); animation-delay: .5s; transform: rotate(7deg); }
.b3 { left: 34px; bottom: 36px; background: var(--sky); animation-delay: 1s; transform: rotate(6deg); }
.b4 { right: 34px; bottom: 36px; background: var(--teal); animation-delay: 1.5s; transform: rotate(-6deg); }

@keyframes bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -8px; }
}

/* ── Badge ── */

.warning {
  display: inline-block;
  background: var(--sunny);
  color: var(--ink);
  border: 3px solid var(--ink);
  padding: 8px 20px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform: rotate(-2deg);
  margin-bottom: 24px;
  box-shadow: 4px 4px 0 rgba(59, 47, 62, 0.2);
}

/* ── Title ── */

h1 {
  margin: 0;
  font-family: "Luckiest Guy", "Baloo 2", cursive;
  font-size: clamp(56px, 12vw, 118px);
  line-height: 0.95;
  text-transform: uppercase;
  color: var(--coral);
  letter-spacing: 0.02em;
  text-shadow:
    3px 3px 0 #fffdf8,
    6px 6px 0 var(--ink);
  animation:
    riseIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.25s backwards,
    sway 7s ease-in-out 1.2s infinite;
}

@keyframes sway {
  0%, 100% { rotate: -0.8deg; }
  50% { rotate: 0.8deg; }
}

h1 .accent { color: var(--teal); }

.line {
  margin: 22px auto 10px;
  max-width: 520px;
  font-size: clamp(17px, 2.8vw, 21px);
  line-height: 1.45;
  color: var(--ink);
  font-weight: 600;
}

.mischief {
  min-height: 26px;
  margin: 0 auto 24px;
  max-width: 560px;
  color: var(--muted);
  font-size: clamp(14px, 2.3vw, 16px);
  font-weight: 600;
  font-style: italic;
}

/* ── The Squishy Button ── */

.btn-base { display: inline-block; }

.btn {
  cursor: pointer;
  border: 4px solid var(--ink);
  border-radius: 999px;
  padding: 22px 48px;
  min-width: 300px;
  min-height: 84px;
  position: relative;
  overflow: hidden;
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(180deg, #ff8787, var(--coral) 55%, var(--coral-deep));
  box-shadow:
    0 10px 0 var(--ink),
    0 14px 24px rgba(59, 47, 62, 0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
}

/* Periodic glossy shine sweep */
.btn::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -75%;
  width: 45%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: skewX(-20deg);
  animation: shine 4.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shine {
  0%, 55% { translate: 0 0; }
  80%, 100% { translate: 420% 0; }
}

.btn:not(:disabled) {
  animation: wiggle 3.2s ease-in-out infinite;
}

@keyframes wiggle {
  0%, 88%, 100% { transform: rotate(0deg) scale(1); }
  90% { transform: rotate(-2deg) scale(1.04); }
  94% { transform: rotate(2deg) scale(1.04); }
  98% { transform: rotate(-1deg) scale(1.02); }
}

.btn:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 13px 0 var(--ink),
    0 18px 30px rgba(59, 47, 62, 0.3);
}

.btn:active:not(:disabled) {
  transform: translateY(7px) scale(0.97);
  box-shadow:
    0 3px 0 var(--ink),
    0 6px 12px rgba(59, 47, 62, 0.25);
}

.btn:disabled {
  cursor: wait;
  transform: translateY(6px);
  filter: saturate(0.7);
  box-shadow:
    0 4px 0 var(--ink),
    0 6px 12px rgba(59, 47, 62, 0.2);
}

.btn.loading::after {
  content: "";
  display: inline-block;
  width: .45em;
  text-align: left;
  animation: dots 1s steps(4, end) infinite;
}

/* ── Counter ── */

.stats {
  margin-top: 24px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats strong {
  display: inline-block;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  background: var(--sunny);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 3px 16px;
  min-width: 68px;
  box-shadow: 3px 3px 0 rgba(59, 47, 62, 0.2);
}

.counter-flip {
  animation: counterFlip 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes counterFlip {
  0% { transform: translateY(-100%) rotateX(-60deg); opacity: 0; }
  60% { transform: translateY(5px); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}

.message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--coral-deep);
  font-size: 14px;
  font-weight: 700;
}

/* ── Footer ── */

.affiliate {
  margin-top: 14px;
  display: grid;
  gap: 9px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.affiliate nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.affiliate a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  border: 2px solid rgba(59, 47, 62, 0.25);
  border-radius: 999px;
  padding: 6px 14px;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.affiliate a:hover {
  border-color: var(--ink);
  background: var(--sunny);
}

/* Share button */
.share-btn {
  margin-top: 14px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--sky);
  color: var(--ink);
  padding: 10px 26px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: "Baloo 2", system-ui, sans-serif;
  box-shadow: 3px 3px 0 rgba(59, 47, 62, 0.2);
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 4px 5px 0 rgba(59, 47, 62, 0.25);
}

@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75%, 100% { content: "..."; }
}

/* ── Responsive ── */

@media (max-width: 560px) {
  body {
    padding: 12px 10px;
  }

  .card {
    width: 100%;
    min-height: calc(100svh - 24px);
    border-radius: 24px;
    border-width: 3px;
    padding: clamp(16px, 3vh, 30px) 16px clamp(12px, 2.2vh, 22px);
    box-shadow: 6px 8px 0 rgba(59, 47, 62, 0.16);
  }

  .warning {
    font-size: 12px;
    max-width: 100%;
  }

  h1 {
    font-size: clamp(38px, min(17vw, 10.5vh), 76px);
    text-shadow: 2px 2px 0 #fffdf8, 4px 4px 0 var(--ink);
  }

  .btn-base { width: 100%; }

  .btn {
    min-width: 0;
    width: 100%;
    min-height: clamp(56px, 8.5vh, 74px);
    padding: clamp(12px, 2vh, 18px) 20px;
  }

  .burst {
    width: 40px;
    height: 40px;
    font-size: 20px;
    border-width: 2.5px;
  }

  .b1 { left: 14px; top: 18px; }
  .b2 { right: 14px; top: 18px; }
  .b3 { left: 16px; bottom: 20px; }
  .b4 { right: 16px; bottom: 20px; }
}

/* Short windows: trim the card padding a bit; the page scrolls if needed */
@media (max-height: 680px) and (min-width: 561px) {
  body { padding: 16px; }
  .card { padding-top: 26px; padding-bottom: 18px; }
  .burst { width: 40px; height: 40px; font-size: 20px; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
