@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;700&family=Comfortaa:wght@500;700&family=Quicksand:wght@400;500;600;700&display=swap');

/* ============ Reset & base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Quicksand', 'Segoe UI', 'Helvetica Neue', sans-serif;
  color: #4a4458;
  background:
    radial-gradient(circle at 20% 10%, #fde2ec 0%, transparent 40%),
    radial-gradient(circle at 80% 30%, #d6ecff 0%, transparent 45%),
    radial-gradient(circle at 50% 90%, #ffe4ef 0%, transparent 50%),
    linear-gradient(180deg, #fdf6fb 0%, #eaf4ff 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: 'Comfortaa', 'Quicksand', sans-serif;
  font-weight: 700;
  color: #6b5a83;
  letter-spacing: 0.3px;
}

/* ============ Floating background ============ */
.floating-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.floating-bg span {
  position: absolute;
  font-size: 2rem;
  opacity: 0.35;
  animation: floaty 18s linear infinite;
}
.floating-bg span:nth-child(1)  { top: 10%; left: 5%;  animation-duration: 22s; }
.floating-bg span:nth-child(2)  { top: 20%; left: 85%; animation-duration: 19s; font-size: 2.4rem; }
.floating-bg span:nth-child(3)  { top: 35%; left: 15%; animation-duration: 25s; }
.floating-bg span:nth-child(4)  { top: 45%; left: 75%; animation-duration: 20s; }
.floating-bg span:nth-child(5)  { top: 55%; left: 8%;  animation-duration: 23s; font-size: 1.8rem; }
.floating-bg span:nth-child(6)  { top: 65%; left: 90%; animation-duration: 26s; }
.floating-bg span:nth-child(7)  { top: 75%; left: 20%; animation-duration: 21s; }
.floating-bg span:nth-child(8)  { top: 85%; left: 70%; animation-duration: 24s; }
.floating-bg span:nth-child(9)  { top: 15%; left: 50%; animation-duration: 27s; font-size: 1.6rem; }
.floating-bg span:nth-child(10) { top: 50%; left: 45%; animation-duration: 28s; }
.floating-bg span:nth-child(11) { top: 30%; left: 35%; animation-duration: 22s; }
.floating-bg span:nth-child(12) { top: 70%; left: 55%; animation-duration: 25s; font-size: 2.2rem; }
.floating-bg span:nth-child(13) { top: 90%; left: 40%; animation-duration: 20s; }
.floating-bg span:nth-child(14) { top: 5%;  left: 65%; animation-duration: 26s; }
.floating-bg span:nth-child(15) { top: 40%; left: 95%; animation-duration: 23s; }

@keyframes floaty {
  0%   { transform: translate(0, 0) rotate(0deg); }
  50%  { transform: translate(15px, -25px) rotate(8deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

/* ============ Hero ============ */
.hero {
  position: relative;
  z-index: 1;
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
}
.hero-inner {
  max-width: 700px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  border-radius: 32px;
  padding: 3rem 2rem;
  box-shadow: 0 20px 50px rgba(180, 160, 200, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.8);
}
.kicker {
  margin: 0 0 1rem;
  color: #c98ab0;
  font-weight: 600;
  letter-spacing: 1px;
}
.hero h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  margin: 0 0 1rem;
  line-height: 1.2;
}
.name {
  background: linear-gradient(90deg, #ff9ec3, #8ec2f0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle {
  font-size: 1.05rem;
  color: #6e6585;
  margin: 0 auto 2rem;
  max-width: 520px;
  line-height: 1.6;
}

/* ============ Progress ============ */
.progress-wrap { max-width: 420px; margin: 0 auto 2rem; }
.progress-label {
  font-size: 0.9rem;
  color: #8b7ea3;
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.progress-bar {
  height: 14px;
  background: #f0e4ee;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(180, 160, 200, 0.2);
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffb3d1, #b3d9ff);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* ============ Buttons ============ */
.btn-primary, .btn-check {
  background: linear-gradient(135deg, #ffb3d1 0%, #b3d9ff 100%);
  color: #fff;
  border: none;
  padding: 0.85rem 2rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 8px 20px rgba(255, 180, 210, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover, .btn-check:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(255, 180, 210, 0.5);
}
.btn-primary:active, .btn-check:active {
  transform: translateY(0);
}

/* ============ Stages ============ */
main {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
.stage {
  margin: 3rem 0;
  scroll-margin-top: 2rem;
  transition: opacity 0.6s, transform 0.6s, filter 0.6s;
}
.stage.locked {
  opacity: 0.35;
  filter: blur(2px) saturate(0.6);
  pointer-events: none;
  user-select: none;
}
.stage.solved .card { border-color: #b8e6c8; }

.card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border-radius: 28px;
  padding: 2rem;
  box-shadow: 0 15px 40px rgba(180, 160, 200, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.9);
}
.card-header { margin-bottom: 1rem; }
.stage-num {
  display: inline-block;
  background: linear-gradient(90deg, #ffd6e6, #d6e9ff);
  color: #8b6a90;
  padding: 0.25rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: 0.5px;
}
.card h2 {
  margin: 0.25rem 0 0;
  font-size: 1.5rem;
}
.card-intro {
  color: #7a6e92;
  margin: 0.5rem 0 1.5rem;
  line-height: 1.6;
}

/* ============ Quiz ============ */
.quiz-q {
  background: #fef6f9;
  border-radius: 18px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.q-text { margin: 0 0 0.75rem; color: #5a5170; }
.options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.opt {
  background: #fff;
  border: 2px solid #f0e0ea;
  border-radius: 14px;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: #5a5170;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}
.opt:hover { border-color: #ffb3d1; background: #fff5f9; }
.opt.selected {
  background: linear-gradient(90deg, #ffe0ec, #e0ecff);
  border-color: #ffb3d1;
  color: #6b5a83;
  font-weight: 600;
}
.opt.correct {
  background: #e0f5e9 !important;
  border-color: #8bd4a5 !important;
}
.opt.wrong {
  background: #fde0e0 !important;
  border-color: #f0a8a8 !important;
}

/* ============ Rebus ============ */
.rebus {
  text-align: center;
  background: #f6f0fb;
  border-radius: 18px;
  padding: 2rem 1rem;
  margin-bottom: 1rem;
}
.rebus-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.emoji-big { font-size: 3.5rem; }
.plus {
  font-size: 2rem;
  color: #c98ab0;
  font-weight: 700;
}
.hint {
  color: #8b7ea3;
  font-style: italic;
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* ============ Inputs ============ */
.input-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.input-row input {
  flex: 1;
  min-width: 180px;
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  border: 2px solid #f0e0ea;
  font-family: inherit;
  font-size: 1rem;
  color: #5a5170;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}
.input-row input:focus { border-color: #ffb3d1; }
.code-row input {
  text-transform: uppercase;
  letter-spacing: 4px;
  font-weight: 700;
  text-align: center;
}

/* ============ Riddle ============ */
.riddle-clues {
  background: #f0f6fc;
  border-radius: 18px;
  padding: 1.25rem 1.25rem 1.25rem 2.5rem;
  margin: 0 0 1rem;
  color: #5a5170;
  line-height: 2;
}
.riddle-clues li { margin: 0.25rem 0; }

.riddle-box {
  background: #fef6f9;
  border-radius: 18px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  color: #5a5170;
  line-height: 1.7;
}

/* ============ Anagram ============ */
.anagram {
  text-align: center;
  background: #f6f0fb;
  border-radius: 18px;
  padding: 2rem 1rem;
  margin-bottom: 1rem;
}
.scrambled {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 4px;
  color: #6b5a83;
  display: inline-block;
  padding: 0.5rem 1rem;
}

/* ============ Memory ============ */
.memory-stats {
  text-align: center;
  color: #7a6e92;
  margin-bottom: 1rem;
  font-weight: 600;
}
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  max-width: 400px;
  margin: 0 auto;
}
.mem-card {
  aspect-ratio: 1;
  background: linear-gradient(135deg, #ffd6e6, #d6e9ff);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  cursor: pointer;
  user-select: none;
  transition: transform 0.3s, background 0.3s;
  border: 2px solid transparent;
  box-shadow: 0 4px 10px rgba(180, 160, 200, 0.2);
}
.mem-card:hover { transform: scale(1.03); }
.mem-card.flipped {
  background: #fff;
  border-color: #ffb3d1;
}
.mem-card:not(.flipped) .mem-icon { visibility: hidden; }
.mem-card.matched {
  background: #d8f0e0;
  border-color: #8bd4a5;
  cursor: default;
  animation: pop 0.5s;
}
@keyframes pop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ============ Feedback & Reward ============ */
.feedback {
  margin: 1rem 0 0;
  min-height: 1.4em;
  font-weight: 600;
}
.feedback.ok { color: #4caf80; }
.feedback.bad { color: #e08a8a; }

.reward {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #fff0f7, #f0f7ff);
  border-radius: 18px;
  border: 2px dashed #ffb3d1;
  animation: revealIn 0.6s ease-out;
}
.wish {
  margin: 0 0 0.75rem;
  color: #5a5170;
  line-height: 1.6;
}
.letter-reveal {
  margin: 0;
  text-align: center;
  color: #8b7ea3;
  font-weight: 600;
}
.letter {
  display: inline-block;
  margin-left: 0.5rem;
  width: 48px;
  height: 48px;
  line-height: 48px;
  text-align: center;
  background: linear-gradient(135deg, #ffb3d1, #b3d9ff);
  color: #fff;
  border-radius: 12px;
  font-size: 1.8rem;
  font-weight: 700;
  vertical-align: middle;
  box-shadow: 0 6px 14px rgba(255, 180, 210, 0.4);
}
@keyframes revealIn {
  from { opacity: 0; transform: translateY(15px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============ Final code ============ */
.final-card {
  background: linear-gradient(135deg, rgba(255, 224, 236, 0.95), rgba(224, 236, 255, 0.95));
}
.final-hint {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
  border: 2px dashed #ffb3d1;
}
.hint-line {
  margin: 0.5rem 0;
  color: #5a5170;
  line-height: 1.6;
}
.btn-secondary {
  display: inline-block;
  margin-top: 1rem;
  background: rgba(255, 255, 255, 0.9);
  color: #c98ab0;
  border: 2px solid #ffb3d1;
  padding: 0.65rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  font-family: inherit;
  transition: all 0.2s;
}
.btn-secondary:hover {
  background: linear-gradient(135deg, #ffb3d1, #b3d9ff);
  color: #fff;
  transform: translateY(-2px);
}

/* ============ Instax slideshow ============ */
.instax-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0 1rem;
  min-height: 380px;
}
.instax-frame-wrap {
  perspective: 1200px;
  flex: 0 1 auto;
}
.instax-frame {
  background: #ffffff;
  padding: 14px 14px 70px;
  border-radius: 4px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.06),
    0 12px 30px rgba(120, 100, 150, 0.22),
    0 30px 60px rgba(120, 100, 150, 0.12);
  display: inline-block;
  position: relative;
  transform: rotate(-2deg);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s;
  max-width: 320px;
}
.instax-frame::before {
  content: "";
  position: absolute;
  inset: 14px 14px 70px;
  pointer-events: none;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.08);
  border-radius: 2px;
}
.instax-frame.fading {
  opacity: 0;
  transform: rotate(-2deg) translateY(10px);
}
.instax-photo {
  width: 280px;
  height: 280px;
  background: linear-gradient(135deg, #f0e0ea, #d6e9ff);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
}
.placeholder-text {
  color: #a094b3;
  font-size: 0.95rem;
  font-style: italic;
  text-align: center;
  padding: 1rem;
}
.instax-nav {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(255, 180, 210, 0.5);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.6rem;
  color: #c98ab0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 700;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(180, 160, 200, 0.2);
}
.instax-nav:hover {
  background: linear-gradient(135deg, #ffb3d1, #b3d9ff);
  color: #fff;
  transform: scale(1.08);
}

.instax-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 0.5rem 0 1.5rem;
  flex-wrap: wrap;
}
.instax-dots { display: flex; gap: 0.4rem; }
.instax-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e0d4e8;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.instax-dot.active {
  background: linear-gradient(90deg, #ffb3d1, #b3d9ff);
  transform: scale(1.3);
}
.instax-counter {
  color: #8b7ea3;
  font-weight: 600;
  font-size: 0.9rem;
}

#toVideoBtn { margin-top: 0.5rem; }

/* ============ Reveal video ============ */
.reveal-card {
  background: linear-gradient(135deg, rgba(255, 224, 236, 0.95), rgba(224, 236, 255, 0.95));
  text-align: center;
}
.reveal-card h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}
.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  overflow: hidden;
  margin: 1.5rem 0;
  box-shadow: 0 15px 40px rgba(180, 160, 200, 0.3);
}
.video-wrap iframe,
.video-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.final-message {
  color: #5a5170;
  line-height: 1.7;
  font-size: 1.05rem;
  margin-top: 1.5rem;
}

/* ============ Footer ============ */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem 1rem 3rem;
  color: #a094b3;
  font-size: 0.9rem;
}

/* ============ Confetti canvas ============ */
#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* ============ Responsive ============ */
@media (max-width: 600px) {
  .hero-inner { padding: 2rem 1.25rem; border-radius: 24px; }
  .card { padding: 1.5rem 1.25rem; border-radius: 22px; }
  .emoji-big { font-size: 2.5rem; }
  .scrambled { font-size: 1.5rem; letter-spacing: 2px; }
  .memory-grid { grid-template-columns: repeat(3, 1fr); }
  .letter-slot { width: 44px; height: 52px; font-size: 1.4rem; }
  .instax-photo { width: 220px; height: 220px; }
  .instax-frame { max-width: 250px; }
}

