:root {
  --bg1: #ffdff0;
  --bg2: #e6dbff;
  --bg3: #ffe9d6;
  --ink: #3d2350;
  --ink-soft: #6f5588;
  --accent: #e6399b;
  --accent-dark: #c21f7e;
  --gold: #f5a623;
  --card: rgba(255, 255, 255, 0.82);
  --ok: #1fa06a;
  --bad: #d64545;
  --radius: 22px;
}

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

html, body { height: 100%; }

body {
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 600px at 15% -10%, var(--bg3), transparent 60%),
    radial-gradient(900px 700px at 110% 10%, var(--bg2), transparent 55%),
    linear-gradient(160deg, var(--bg1), #fff5fb 55%, var(--bg2));
  background-attachment: fixed;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

.brand {
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: 1.25rem;
}

.brand .date { color: var(--ink-soft); font-size: 1rem; font-weight: 600; }

.progress { display: flex; gap: 8px; align-items: center; }

.dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 800;
  background: rgba(255,255,255,0.7);
  border: 2px dashed rgba(61,35,80,0.25);
  color: var(--ink-soft);
  transition: all .3s ease;
}
.dot.current {
  border: 2px solid var(--accent);
  color: var(--accent);
  transform: scale(1.12);
  box-shadow: 0 0 0 4px rgba(230,57,155,0.15);
}
.dot.done {
  background: linear-gradient(135deg, var(--accent), #9b5de5);
  border: none;
  color: #fff;
}

main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px 16px 40px;
}

.screen { width: 100%; max-width: 640px; animation: rise .45s ease both; }
.hidden { display: none !important; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.card {
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(120, 60, 140, 0.18);
  padding: 34px 28px;
  text-align: center;
}

.big-emoji { font-size: 3.2rem; margin-bottom: 10px; }

h1 {
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: clamp(1.9rem, 6vw, 2.7rem);
  line-height: 1.1;
  background: linear-gradient(90deg, var(--accent-dark), #7b2ff7, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 12px;
}

h2 { font-family: "Fraunces", serif; font-size: 1.7rem; margin-bottom: 10px; }

.subtitle { color: var(--ink-soft); font-size: 1.05rem; margin-bottom: 22px; }

.intro-lines {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 auto 26px;
  max-width: 420px;
  display: grid;
  gap: 14px;
}

.btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #9b5de5);
  color: #fff;
  box-shadow: 0 10px 24px rgba(230, 57, 155, 0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(230,57,155,0.42); }
.btn-primary:disabled { opacity: .6; cursor: wait; transform: none; }

/* Gift envelope */
.envelope-zone { margin: 26px auto 6px; }
.envelope {
  position: relative;
  width: 250px;
  height: 160px;
  margin: 0 auto;
  cursor: pointer;
  perspective: 700px;
  filter: drop-shadow(0 14px 24px rgba(120, 60, 140, 0.28));
  animation: env-wiggle 2.4s ease-in-out infinite;
}
@keyframes env-wiggle {
  0%, 100% { transform: rotate(-1.5deg); }
  50% { transform: rotate(1.5deg) translateY(-3px); }
}
.envelope.open { animation: none; }

.env-flap {
  position: absolute; inset: 0 0 auto 0; height: 100%;
  background: linear-gradient(160deg, #ff9ecb, #e6399b);
  clip-path: polygon(0 0, 100% 0, 50% 55%);
  border-radius: 12px 12px 0 0;
  transform-origin: top center;
  transition: transform .55s cubic-bezier(.6,-0.2,.4,1.2);
  z-index: 4;
}
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 1; }

.env-letter {
  position: absolute;
  left: 14px; right: 14px; top: 10px; bottom: 10px;
  background: #fffaf3;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 2rem;
  z-index: 2;
  transition: transform .7s ease .45s;
}
.envelope.open .env-letter { transform: translateY(-78%); }

.env-pocket {
  position: absolute; inset: 0;
  background: linear-gradient(200deg, #ffb7d9, #f06db4);
  clip-path: polygon(0 0, 50% 48%, 100% 0, 100% 100%, 0 100%);
  border-radius: 12px;
  z-index: 3;
}
.env-seal {
  position: absolute;
  left: 50%; top: 48%;
  transform: translate(-50%, -50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd88a, var(--gold));
  color: #7a4a00;
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: 1.3rem;
  display: grid; place-items: center;
  box-shadow: 0 3px 8px rgba(0,0,0,0.22);
  z-index: 5;
  transition: opacity .3s ease, transform .4s ease;
}
.envelope.open .env-seal { opacity: 0; transform: translate(-50%, -50%) scale(1.6); }

.tap-hint {
  margin-top: 16px;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.95rem;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .65; } 50% { opacity: 1; } }

/* Voucher */
.voucher {
  margin: 22px auto 8px;
  max-width: 400px;
  background:
    linear-gradient(#fffdf8, #fffdf8) padding-box,
    linear-gradient(120deg, var(--gold), #ff9ecb, #9b5de5) border-box;
  border: 3px dashed transparent;
  border-radius: 18px;
  padding: 24px 20px;
  transform: rotate(-1.2deg);
  animation: voucher-in .6s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes voucher-in {
  from { opacity: 0; transform: rotate(-1.2deg) scale(.6) translateY(30px); }
  to { opacity: 1; transform: rotate(-1.2deg) scale(1) translateY(0); }
}
.voucher-eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.voucher-title {
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: 1.9rem;
  background: linear-gradient(90deg, var(--accent-dark), #9b5de5);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 10px;
}
.voucher-text { font-weight: 700; line-height: 1.55; color: var(--ink); margin-bottom: 14px; }
.voucher-sign { font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }

/* Stage */
.stage-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-dark);
  background: rgba(230, 57, 155, 0.12);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.clue-emoji { font-size: 2.6rem; margin-bottom: 8px; }

.clue-text {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1.15rem, 4vw, 1.45rem);
  line-height: 1.45;
  margin: 0 auto 24px;
  max-width: 520px;
}
.clue-text::before { content: "\201C"; color: var(--accent); }
.clue-text::after { content: "\201D"; color: var(--accent); }

/* Hangman word */
.word {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  margin-bottom: 24px;
}
.word .w { display: flex; gap: 5px; }
.tile {
  width: 30px; height: 40px;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--ink);
  border-bottom: 3px solid rgba(61,35,80,0.4);
}
.tile.shown { animation: pop .3s ease; }
.tile.blank { color: transparent; }
@keyframes pop {
  0% { transform: scale(.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

#guess-form { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#guess-input {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 13px 18px;
  border-radius: 999px;
  border: 2px solid rgba(61,35,80,0.2);
  background: #fff;
  color: var(--ink);
  min-width: 240px;
  flex: 1;
  max-width: 340px;
  outline: none;
  text-align: center;
}
#guess-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(230,57,155,0.12); }

.feedback { min-height: 26px; margin-top: 14px; font-weight: 700; }
.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--bad); }

.shake { animation: shake .4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}

/* Check-in */
.answer-reveal { margin-bottom: 8px; }
.answer-label { color: var(--ink-soft); font-weight: 700; margin-bottom: 6px; }
.answer-name {
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: clamp(1.5rem, 5.5vw, 2.1rem);
  color: var(--accent-dark);
  margin-bottom: 6px;
}
.checkin-hint { color: var(--ink-soft); margin: 10px 0 20px; font-weight: 600; }

/* Done */
.memory {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink-soft);
  max-width: 460px;
  margin: 0 auto 24px;
  line-height: 1.5;
}

/* Finale */
.finale-text { font-size: 1.08rem; line-height: 1.6; margin-bottom: 16px; color: var(--ink); font-weight: 600; }
.finale-sign { font-size: 1.05rem; color: var(--ink-soft); margin-bottom: 26px; }
.recap { display: grid; gap: 8px; text-align: left; max-width: 440px; margin: 0 auto; }
.recap .r {
  background: rgba(255,255,255,0.7);
  border-radius: 12px;
  padding: 9px 14px;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  gap: 10px;
  align-items: center;
}

.foot {
  text-align: center;
  padding: 14px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
}

.devbadge {
  position: fixed;
  bottom: 12px; left: 12px;
  background: #222; color: #ffd166;
  font-size: 0.72rem; font-weight: 800;
  padding: 4px 10px; border-radius: 999px;
  z-index: 60; letter-spacing: .08em;
}

@media (max-width: 480px) {
  .card { padding: 26px 18px; }
  .tile { width: 24px; height: 34px; font-size: 1.05rem; }
  .word { gap: 8px 14px; }
}
