:root {
  --bg: #f9c9e1;
  --ink: #c2185b;
  --card: #fff0f5;
  --accent: #e91e63;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: #6b2a4a;
  font-family: 'Fredoka', sans-serif;
  overflow: hidden;
}

#root {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 0px) 16px env(safe-area-inset-bottom, 0px);
  position: relative;
}

/* ---------- Intro screen ---------- */
.intro {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 40%, #fff5f9, #fbe7ef 80%);
  cursor: pointer;
  user-select: none;
  animation: fadeIn 0.6s ease;
  outline: none;
  z-index: 5;
}
.intro-icon {
  width: clamp(160px, 40vw, 240px);
  height: auto;
  margin-bottom: 24px;
  animation: float 3s ease-in-out infinite;
  pointer-events: none;
}
.intro-title {
  margin: 0 0 22px;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  color: #ff2d8f;
}
.intro-sub {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #7a6471;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Falling hearts and stars ---------- */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.confetti span {
  position: absolute;
  top: -5%;
  animation: fall linear infinite;
  user-select: none;
}
@keyframes fall {
  from { transform: translateY(0) rotate(0deg); }
  to { transform: translateY(120vh) rotate(25deg); }
}

/* ---------- Bouquet image button ---------- */
.scene-btn {
  position: relative;
  z-index: 1;
  width: min(52vw, 320px);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: block;
  animation: bloom 0.8s ease both;
  -webkit-tap-highlight-color: transparent;
}
.scene-btn img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 10px 18px rgba(120, 20, 60, 0.22));
}
.scene-btn:focus-visible {
  outline: 3px dashed #e91e63;
  outline-offset: 6px;
  border-radius: 12px;
}
@keyframes bloom {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- Letter popup ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(60, 10, 35, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
  animation: fade 0.3s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.letter {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow: hidden;
  padding: 36px 34px 24px;
  border-radius: 16px;
  background: linear-gradient(165deg, #fff3f7 0%, #fde3ec 100%);
  box-shadow: 0 18px 44px rgba(120, 20, 60, 0.3);
  color: #8e1443;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.02rem;
  line-height: 1.75;
  animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.letter::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(233, 30, 99, 0.35);
  border-radius: 10px;
  pointer-events: none;
}
@keyframes rise {
  from { transform: translateY(30px) scale(0.96); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.letter h2 {
  flex: 0 0 auto;
  margin: 0 0 14px;
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--ink);
}

/* Scrollable text area with the scrollbar hidden */
.letter-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.letter-body::-webkit-scrollbar {
  display: none;
}

.letter .typed {
  margin: 0;
}
.letter .para {
  margin: 0 0 0.9em;
}
.letter .line {
  display: block;
}

.deco {
  position: absolute;
  color: #f7a8c2;
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
}
.deco-1 { top: 14px; left: 18px; font-size: 1.6rem; }
.deco-2 { bottom: 14px; right: 22px; font-size: 2.2rem; opacity: 0.4; }

.close {
  position: absolute;
  top: 10px;
  right: 14px;
  z-index: 2;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: #9b6b7e;
  cursor: pointer;
  line-height: 1;
  padding: 6px;
}

/* Blinking cursor shown while the letter is typing */
.caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: currentColor;
  animation: blink 0.9s steps(1) infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}
