/* ============================================================
   🎂 Jessica's Birthday Portal — dreamy pastel theme
   ============================================================ */

:root {
  --pink: #ff8fc4;
  --pink-deep: #ff5fa8;
  --lav: #b89bff;
  --lav-deep: #8a6bff;
  --peach: #ffc59e;
  --blue: #9fd8ff;
  --plum: #5b2a72;
  --plum-soft: #7a4f96;
  --ink: #4a2a5e;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-brd: rgba(255, 255, 255, 0.75);
  --shadow: 0 18px 50px rgba(150, 90, 180, 0.28);
  --radius: 30px;
  --font-display: "Fredoka", system-ui, sans-serif;
  --font-body: "Quicksand", system-ui, sans-serif;
  --font-hand: "Caveat", cursive;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  min-height: 100dvh;
  overflow-x: hidden;
  background: linear-gradient(135deg, #ffe0ef 0%, #f3e0ff 28%, #e6e2ff 52%, #ffe9d6 76%, #e0f3ff 100%);
  background-size: 300% 300%;
  animation: drift 22s ease infinite;
  -webkit-font-smoothing: antialiased;
}

@keyframes drift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ---------- decorative blobs ---------- */
.blobs { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.55; }
.blob-1 { width: 42vw; height: 42vw; background: #ffb3d9; top: -10vw; left: -8vw; animation: blobFloat 18s ease-in-out infinite; }
.blob-2 { width: 38vw; height: 38vw; background: #c4b3ff; bottom: -12vw; right: -6vw; animation: blobFloat 24s ease-in-out infinite reverse; }
.blob-3 { width: 30vw; height: 30vw; background: #ffd9b3; top: 40%; left: 55%; animation: blobFloat 20s ease-in-out infinite; }
@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4vw, -4vw) scale(1.12); }
}

/* ---------- sparkles ---------- */
.sparkle-layer { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
.sparkle { position: absolute; font-size: 16px; opacity: 0; animation: twinkle linear infinite; will-change: transform, opacity; }
@keyframes twinkle {
  0% { opacity: 0; transform: translateY(0) scale(0.4) rotate(0deg); }
  20% { opacity: 0.9; }
  50% { transform: translateY(-26px) scale(1.1) rotate(180deg); }
  80% { opacity: 0.7; }
  100% { opacity: 0; transform: translateY(-52px) scale(0.4) rotate(360deg); }
}

/* ---------- scenes ---------- */
main { position: relative; z-index: 2; }
.scene {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(16px, 4vw, 48px);
  opacity: 0; visibility: hidden;
  transform: translateY(18px) scale(0.98);
  transition: opacity 0.55s ease, transform 0.55s ease, visibility 0.55s;
  overflow-y: auto;
}
.scene.is-active { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

/* ---------- cards (glass) ---------- */
.card {
  position: relative;
  width: min(620px, 100%);
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1.5px solid var(--glass-brd);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(28px, 5vw, 52px);
  text-align: center;
  margin: auto;
}
.pop { animation: pop 0.6s cubic-bezier(0.22, 1.3, 0.4, 1) both; }
@keyframes pop {
  0% { opacity: 0; transform: translateY(24px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.badge {
  font-size: clamp(56px, 12vw, 92px);
  line-height: 1;
  margin-bottom: 14px;
  filter: drop-shadow(0 8px 18px rgba(255, 120, 180, 0.45));
}
.floaty { display: inline-block; animation: floaty 3.4s ease-in-out infinite; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-12px) rotate(4deg); }
}

/* ---------- typography ---------- */
.title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 6vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.5px;
  background: linear-gradient(100deg, var(--pink-deep), var(--lav-deep) 60%, var(--pink-deep));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}
.title.sm { font-size: clamp(22px, 4.5vw, 32px); }
.subtitle { font-size: clamp(15px, 2.6vw, 19px); color: var(--plum-soft); font-weight: 500; margin-bottom: 28px; }
.kicker { font-family: var(--font-hand); font-size: clamp(20px, 3vw, 26px); color: var(--pink-deep); margin-bottom: 6px; }

/* ---------- buttons ---------- */
.btn-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(15px, 2.4vw, 18px);
  padding: 14px 28px;
  border: none; border-radius: 999px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s, filter 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.95); }
.btn-primary {
  color: #fff;
  background: linear-gradient(120deg, var(--pink-deep), var(--lav-deep));
  box-shadow: 0 10px 26px rgba(255, 95, 168, 0.45);
}
.btn-primary:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 16px 34px rgba(255, 95, 168, 0.55); filter: brightness(1.05); }
.btn-ghost {
  color: var(--plum);
  background: rgba(255, 255, 255, 0.65);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 18px rgba(150, 90, 180, 0.18);
}
.btn-ghost:hover { transform: translateY(-3px) scale(1.03); background: rgba(255, 255, 255, 0.85); }
.hidden { display: none !important; }

.shake { animation: shake 0.5s; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 36px; z-index: 50;
  transform: translateX(-50%) translateY(140%);
  background: rgba(91, 42, 114, 0.95);
  color: #fff; font-weight: 600;
  padding: 14px 24px; border-radius: 999px;
  box-shadow: 0 12px 30px rgba(91, 42, 114, 0.4);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 88vw; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- gate / countdown ---------- */
.gate-teaser { min-height: 52px; transition: opacity 0.35s ease; display: flex; align-items: center; justify-content: center; }
.countdown { display: flex; align-items: flex-start; justify-content: center; gap: clamp(4px, 1.5vw, 10px); margin: 14px 0 26px; }
.cd-unit {
  display: flex; flex-direction: column; align-items: center;
  background: rgba(255, 255, 255, 0.55); border: 1.5px solid var(--glass-brd); border-radius: 18px;
  padding: clamp(9px, 2.4vw, 14px) clamp(7px, 2vw, 13px); min-width: clamp(58px, 16vw, 80px);
  box-shadow: 0 8px 20px rgba(150, 90, 180, 0.18);
}
.cd-num {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 7vw, 46px); line-height: 1;
  background: linear-gradient(120deg, var(--pink-deep), var(--lav-deep));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  transition: transform 0.15s ease;
}
.cd-lab { font-size: clamp(10px, 1.8vw, 12px); font-weight: 700; color: var(--plum-soft); margin-top: 7px; text-transform: uppercase; letter-spacing: 1.5px; }
.cd-sep { font-family: var(--font-display); font-weight: 700; font-size: clamp(22px, 5vw, 36px); color: var(--lav); margin-top: clamp(10px, 2.5vw, 16px); }
@media (max-width: 430px) { .cd-sep { display: none; } }

/* ---------- face scan (theatrical biometric HUD) ---------- */
.scanner {
  position: relative; width: clamp(220px, 70vw, 300px); height: clamp(220px, 70vw, 300px);
  margin: 22px auto 14px; border-radius: 26px; overflow: hidden; background: #2a1640;
  box-shadow: 0 16px 40px rgba(120, 60, 160, 0.4), inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}
#scan-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: none; }
.scan-noface { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 64px;
  background: linear-gradient(135deg, #6a3f96, #b06bbf); }
.scan-grid { position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 26px 26px; }
.scan-line { position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, transparent, #ff8fc4, #b89bff, transparent);
  box-shadow: 0 0 14px 3px rgba(255, 143, 196, 0.7); animation: scanmove 2.4s ease-in-out infinite; }
@keyframes scanmove { 0%, 100% { top: 4%; } 50% { top: 95%; } }
.scan-bracket { position: absolute; width: 26px; height: 26px; border: 3px solid #ffd9ec; }
.scan-bracket.tl { top: 12px; left: 12px; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.scan-bracket.tr { top: 12px; right: 12px; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.scan-bracket.bl { bottom: 12px; left: 12px; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.scan-bracket.br { bottom: 12px; right: 12px; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
.scan-status { position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 14px 12px; color: #fff; font-weight: 600;
  font-size: clamp(13px, 2.6vw, 15px); text-align: center; background: linear-gradient(transparent, rgba(20, 8, 36, 0.88)); }
.scan-bar { width: min(300px, 80%); height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.5); margin: 4px auto 18px; overflow: hidden; }
.scan-bar-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--pink-deep), var(--lav-deep)); transition: width 0.6s ease; }

/* ---------- verify list ---------- */
.verify-list { list-style: none; text-align: left; margin-top: 22px; display: grid; gap: 14px; }
.verify-list li {
  font-size: clamp(15px, 2.6vw, 18px); font-weight: 600; color: var(--plum-soft);
  display: flex; align-items: center; gap: 12px;
  opacity: 0; transform: translateX(-12px);
  transition: opacity 0.4s, transform 0.4s;
}
.verify-list li.in { opacity: 1; transform: translateX(0); }
.verify-list .check { color: #2ec45f; font-weight: 700; opacity: 0; transition: opacity 0.3s; }
.verify-list li.done .check { opacity: 1; }
.verify-list .spin { width: 16px; height: 16px; border: 2px solid var(--lav); border-top-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
.verify-list li.done .spin { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- quiz ---------- */
.progress { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.progress .dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(138, 107, 255, 0.3); transition: all 0.3s; }
.progress .dot.active { background: var(--lav-deep); transform: scale(1.3); }
.progress .dot.done { background: var(--pink-deep); }

.options { display: grid; gap: 12px; margin-top: 22px; }
.option {
  font-family: var(--font-body); font-weight: 600;
  font-size: clamp(14px, 2.4vw, 17px);
  text-align: left; color: var(--plum);
  background: rgba(255, 255, 255, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  border-radius: 18px; padding: 16px 20px; cursor: pointer;
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
}
.option:hover:not(:disabled) { transform: translateY(-2px); background: #fff; box-shadow: 0 8px 20px rgba(150, 90, 180, 0.2); }
.option:disabled { cursor: default; opacity: 0.55; }
.option.chosen { background: linear-gradient(120deg, var(--pink), var(--lav)); color: #fff; border-color: transparent; opacity: 1; transform: scale(1.02); }
.reaction {
  margin-top: 20px; font-size: clamp(15px, 2.8vw, 19px); font-weight: 600;
  color: var(--plum); min-height: 0; max-height: 0; overflow: hidden;
  opacity: 0; transition: all 0.45s ease;
}
.reaction.show { max-height: 240px; opacity: 1; margin-top: 22px; }
#quiz-next { margin-top: 22px; }

/* ---------- roast-o-matic ---------- */
.roast-screen {
  position: relative; min-height: 150px; display: flex; align-items: center; justify-content: center;
  padding: 24px; margin: 18px 0 8px; border-radius: 22px;
  background: rgba(255, 255, 255, 0.5); border: 1.5px solid var(--glass-brd);
  box-shadow: inset 0 2px 16px rgba(150, 90, 180, 0.12);
}
.roast-idle { font-size: 54px; animation: floaty 3s ease-in-out infinite; }
.roast-text {
  font-size: clamp(16px, 3vw, 21px); font-weight: 600; color: var(--plum); line-height: 1.45;
  opacity: 0; transform: translateY(8px); transition: opacity 0.4s ease, transform 0.4s ease;
}
.roast-text.in { opacity: 1; transform: translateY(0); }
.roast-meta { font-family: var(--font-hand); font-size: 22px; color: var(--pink-deep); margin: 0 0 16px; min-height: 26px; }

/* ---------- cake ---------- */
.hint { font-size: 14px; color: var(--plum-soft); margin-top: 6px; opacity: 0.85; }
.cake-wrap { display: flex; justify-content: center; margin: 26px 0 18px; }
.cake { position: relative; width: 252px; padding-top: 54px; }
.candles { position: absolute; top: 0; left: 0; right: 0; height: 54px; display: flex; align-items: flex-end; justify-content: center; gap: 11px; z-index: 5; }
.candle { position: relative; width: 9px; height: 50px; border-radius: 5px;
  background: repeating-linear-gradient(45deg, #ff8fc4 0 6px, #fff 6px 12px); cursor: pointer; }
.flame {
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  width: 16px; height: 24px; border-radius: 50% 50% 50% 50% / 70% 70% 40% 40%;
  background: radial-gradient(ellipse at 50% 75%, #fff 0%, #ffe08a 35%, #ffae3a 70%, #ff6a3a 100%);
  box-shadow: 0 0 18px 5px rgba(255, 170, 60, 0.75);
  transform-origin: center bottom; animation: flicker 0.5s ease-in-out infinite alternate;
}
@keyframes flicker {
  0% { transform: translateX(-50%) scaleY(1) rotate(-3deg); opacity: 0.92; }
  100% { transform: translateX(-50%) scaleY(1.12) rotate(3deg); opacity: 1; }
}
.candle.out .flame { display: none; }
.smoke {
  position: absolute; top: -16px; left: 50%; width: 7px; height: 7px; border-radius: 50%;
  background: rgba(180, 180, 200, 0.7); transform: translateX(-50%);
  animation: smoke 1s ease-out forwards; pointer-events: none;
}
@keyframes smoke { to { transform: translate(-50%, -38px) scale(2.4); opacity: 0; } }

/* tiers */
.tier { position: relative; margin: 0 auto; }
.tier-top { width: 178px; height: 64px; background: linear-gradient(#ffc8e1, #ff9ec8); border-radius: 12px 12px 8px 8px; z-index: 3;
  box-shadow: inset 0 -14px 20px rgba(214, 90, 150, 0.22), inset 0 4px 0 rgba(255, 255, 255, 0.25); }
.tier-bottom { width: 244px; height: 82px; margin-top: 9px; background: linear-gradient(#d2c2ff, #b39bff); border-radius: 12px 12px 16px 16px; z-index: 2;
  box-shadow: inset 0 -14px 20px rgba(120, 90, 200, 0.22), inset 0 4px 0 rgba(255, 255, 255, 0.22); }

/* frosting + drips */
.frosting { position: absolute; top: -13px; left: -7px; right: -7px; height: 24px; border-radius: 16px 16px 10px 10px;
  display: flex; justify-content: space-around; align-items: flex-start; padding: 0 10px; z-index: 4;
  box-shadow: 0 4px 6px rgba(150, 90, 180, 0.12); }
.tier-top .frosting { background: #fff6fb; }
.tier-bottom .frosting { background: #f6f0ff; }
.frosting i { width: 12px; background: inherit; border-radius: 0 0 60% 60%; margin-top: 20px; }
.frosting i:nth-child(odd) { height: 19px; }
.frosting i:nth-child(even) { height: 11px; }
.frosting i:nth-child(3n) { height: 27px; }

/* piping dots along each tier base */
.tier::after { content: ""; position: absolute; bottom: 8px; left: 14px; right: 14px; height: 9px;
  background: radial-gradient(circle 4px at 5px 4px, rgba(255, 255, 255, 0.85) 4px, transparent 5px) repeat-x; background-size: 17px 9px; }

/* sprinkles on the top tier */
.sprinkle { position: absolute; width: 9px; height: 4px; border-radius: 3px; z-index: 4; }
.sprinkle:nth-child(2) { top: 20px; left: 26px; transform: rotate(28deg); background: #ff5fa8; }
.sprinkle:nth-child(3) { top: 32px; left: 64px; transform: rotate(-20deg); background: #8a6bff; }
.sprinkle:nth-child(4) { top: 24px; left: 104px; transform: rotate(48deg); background: #ffba3a; }
.sprinkle:nth-child(5) { top: 38px; left: 138px; transform: rotate(-38deg); background: #38c98a; }
.sprinkle:nth-child(6) { top: 18px; left: 150px; transform: rotate(12deg); background: #5ec8ff; }

/* cake stand / pedestal */
.stand { margin-top: 2px; }
.plate { width: 258px; height: 17px; background: linear-gradient(#ffffff, #ecdcff); border-radius: 50%; margin: 2px auto 0;
  box-shadow: 0 7px 12px rgba(150, 90, 180, 0.18); }
.stem { width: 32px; height: 26px; background: linear-gradient(#f3e9ff, #dcc7ff); margin: -3px auto 0; border-radius: 0 0 8px 8px; }
.base { width: 100px; height: 16px; background: linear-gradient(#ffffff, #e6d6ff); border-radius: 50%; margin: -3px auto 0;
  box-shadow: 0 16px 24px rgba(150, 90, 180, 0.32); }
.wish { font-family: var(--font-hand); font-size: clamp(20px, 3.4vw, 28px); color: var(--lav-deep); margin-top: 14px; opacity: 0; transition: opacity 0.6s; }
.wish.show { opacity: 1; }
#btn-mic { margin-top: 18px; }

/* ---------- finale ---------- */
.finale-headline { font-size: clamp(30px, 7vw, 54px); margin-bottom: 24px; }
.polaroids { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-bottom: 26px; }
.polaroid {
  background: #fff; padding: 10px 10px 0; border-radius: 8px;
  box-shadow: 0 12px 26px rgba(150, 90, 180, 0.28);
  width: 150px; transition: transform 0.3s;
  animation: dropIn 0.7s cubic-bezier(0.22, 1.3, 0.4, 1) both;
}
.polaroid:nth-child(odd) { transform: rotate(-5deg); }
.polaroid:nth-child(even) { transform: rotate(4deg); }
.polaroid:hover { transform: rotate(0deg) scale(1.06); z-index: 5; }
.polaroid img, .polaroid .ph {
  width: 100%; height: 150px; object-fit: cover; border-radius: 4px; display: block; background: #f3e6ff;
}
.polaroid .ph { display: flex; align-items: center; justify-content: center; font-size: 38px;
  background: linear-gradient(135deg, #ffd9ec, #e0d4ff); color: var(--plum-soft); }
.polaroid .cap { font-family: var(--font-hand); font-size: 18px; color: var(--plum); padding: 8px 4px 12px; line-height: 1.1; }
@keyframes dropIn { 0% { opacity: 0; transform: translateY(-40px) rotate(0); } 100% { opacity: 1; } }

.message { text-align: left; }
.message p { font-size: clamp(15px, 2.7vw, 18px); line-height: 1.6; color: var(--plum); margin-bottom: 14px; font-weight: 500;
  opacity: 0; transform: translateY(12px); transition: opacity 0.6s, transform 0.6s; }
.message p.in { opacity: 1; transform: translateY(0); }
.sign-off { margin-top: 10px; font-size: clamp(15px, 2.7vw, 18px); color: var(--plum); font-weight: 600; opacity: 0; transition: opacity 0.6s; }
.signature { font-family: var(--font-hand); font-size: clamp(28px, 5vw, 40px); color: var(--pink-deep); margin-top: 2px; opacity: 0; transition: opacity 0.6s; }
.sign-off.in, .signature.in { opacity: 1; }
#btn-replay { margin-top: 26px; opacity: 0; transition: opacity 0.6s; }
#btn-replay.in { opacity: 1; }

/* ---------- balloons ---------- */
.balloons { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.balloon { position: absolute; bottom: -140px; width: 52px; height: 66px; border-radius: 50% 50% 48% 48%;
  opacity: 0.9; animation: rise linear forwards; }
.balloon::after { content: ""; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: inherit; }
.balloon::before { content: ""; position: absolute; bottom: -90px; left: 50%; width: 1px; height: 90px; background: rgba(255,255,255,0.6); }
@keyframes rise { to { transform: translateY(-118vh) translateX(var(--sway, 0)); } }

/* ---------- music toggle ---------- */
.music-toggle { position: fixed; top: 16px; right: 16px; z-index: 40; width: 46px; height: 46px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 20px; background: rgba(255,255,255,0.7); box-shadow: 0 6px 16px rgba(150,90,180,0.25); }

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