:root {
  --pink: #ff7eb6;
  --pink-deep: #e85a9b;
  --blush: #ffe3ee;
  --blush-2: #fff0f6;
  --cream: #fff8fb;
  --rose: #d6336c;
  --ink: #5a2a43;
  --shadow: 0 14px 40px rgba(232, 90, 155, 0.18);
  --radius: 22px;
}

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

html, body { height: 100%; }

body {
  font-family: "Quicksand", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #ffd9e8 0%, transparent 60%),
    radial-gradient(1000px 700px at 110% 10%, #ffe9c7 0%, transparent 55%),
    linear-gradient(160deg, var(--blush-2), var(--cream) 60%);
  overflow: hidden;
  line-height: 1.6;
}

/* STAGE & SCENES */
#stage { position: relative; height: 100dvh; width: 100%; }
.scene {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);  /* cap the column at the viewport, not the image's intrinsic width */
  place-items: center;
  padding: 4.5rem 1.3rem 2rem;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px) scale(0.99);
  transition: opacity 0.55s ease, transform 0.55s ease, visibility 0.55s;
  overflow-x: hidden;       /* never scroll sideways */
  overflow-y: auto;
}
.scene-inner > * { max-width: 100%; width: 100%; }
.scene.active {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.scene-inner { max-width: 620px; width: 100%; margin: auto; }

/* TYPE */
.kicker {
  text-transform: lowercase;
  letter-spacing: 0.5px;
  color: var(--pink-deep);
  font-weight: 600;
  margin-bottom: 0.6rem;
}
.title {
  font-family: "Pacifico", cursive;
  font-size: clamp(2.4rem, 8vw, 4.2rem);
  color: var(--rose);
  font-weight: 400;
  line-height: 1.15;
  text-shadow: 0 4px 18px rgba(214, 51, 108, 0.18);
}
.name { display: inline-block; animation: wiggle 3s ease-in-out infinite; }
h2 {
  color: var(--rose);
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  margin-bottom: 0.5rem;
}
.lead {
  font-size: clamp(1.05rem, 2.8vw, 1.25rem);
  margin: 1.1rem auto 1.8rem;
  max-width: 540px;
}
.muted { color: #a16986; font-size: 0.98rem; margin-bottom: 1.1rem; }
.signed { font-family: "Pacifico", cursive; font-size: 1.5rem; color: var(--rose); margin-top: 1rem; }
.from { white-space: nowrap; }

/* BUTTONS */
.btn, .big-btn {
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  border: none;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(232, 90, 155, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn { padding: 0.85rem 1.8rem; font-size: 1rem; margin: 0.4rem 0.3rem; }
.big-btn { padding: 1rem 2.3rem; font-size: 1.2rem; margin: 1.4rem 0.3rem 0; }
.btn:hover, .big-btn:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 16px 30px rgba(232, 90, 155, 0.45); }
.btn:active, .big-btn:active { transform: scale(0.97); }
.big-btn.ghost {
  background: #fff;
  color: var(--pink-deep);
  border: 2px solid var(--pink);
  box-shadow: var(--shadow);
}

/* PROGRESS DOTS */
.progress {
  position: fixed;
  top: 1.1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.55rem;
  z-index: 20;
}
.progress button {
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid var(--pink);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 0.25s ease, transform 0.25s ease;
}
.progress button.on { background: var(--pink-deep); transform: scale(1.25); }

/* DISTANCE */
.distance {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 1.4rem 0 0.4rem;
}
.dpoint { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; font-weight: 600; }
.dpoint .flag { font-size: 2.4rem; }
.dpoint small { color: #a16986; font-weight: 500; }
.dpath {
  flex: 1;
  max-width: 200px;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--pink) 0 8px, transparent 8px 16px);
  position: relative;
}
.plane {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  font-size: 1.5rem;
  animation: fly 4s ease-in-out infinite;
}

/* GALLERY */
.gallery {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.2rem 0 0.4rem;
  width: 100%;
  max-width: 100%;
}
.polaroid {
  background: #fff;
  padding: 0.7rem 0.7rem 0.4rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transform: rotate(-2deg);
  transition: transform 0.3s ease;
  flex: 1 1 0;             /* size from leftover space, not the image's huge intrinsic width */
  min-width: 0;            /* allow it to shrink instead of overflowing */
  max-width: 340px;
}
.polaroid:hover { transform: rotate(0deg); }
.photo-frame {
  width: 100%;
  height: min(54vh, 380px);
  border-radius: 4px;
  overflow: hidden;
  background: var(--blush);
  display: grid;
  place-items: center;
}
.photo-frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.photo-frame img.loaded { opacity: 1; }
.caption {
  font-family: "Pacifico", cursive;
  color: var(--rose);
  font-size: 1.1rem;
  margin-top: 0.5rem;
  min-height: 1.5rem;
}
.gnav {
  font-size: 1.8rem;
  line-height: 1;
  width: 46px; height: 46px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--pink);
  background: #fff;
  color: var(--pink-deep);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background 0.15s ease;
}
.gnav:hover { transform: scale(1.1); background: var(--blush); }
.gnav:active { transform: scale(0.94); }

/* KOREAN */
.korean-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 0.8rem;
  margin: 1.2rem 0;
}
.kcard {
  background: rgba(255,255,255,0.85);
  border: 2px solid var(--pink);
  border-radius: 16px;
  padding: 1rem 0.8rem;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}
.kcard:hover { transform: translateY(-3px); background: #fff; }
.kcard .kword {
  font-size: clamp(1.05rem, 4.2vw, 1.3rem);
  color: var(--rose);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;        /* keep each word on one line */
  overflow-wrap: normal;
}
.kcard .mean { font-size: 0.86rem; color: #a16986; margin-top: 0.3rem; min-height: 1.1rem; }
.kcard.pop { animation: pop 0.4s ease; }

.hangul-big { font-size: clamp(3rem, 14vw, 5.5rem); color: var(--rose); line-height: 1; }
.romaji { color: var(--pink-deep); font-weight: 600; margin-bottom: 0.6rem; }

/* COMPLIMENT */
.compliment-box {
  background: var(--blush);
  border: 2px dashed var(--pink);
  border-radius: 18px;
  padding: 1.3rem;
  font-size: 1.18rem;
  font-weight: 600;
  margin-bottom: 1.1rem;
  min-height: 92px;
  display: grid;
  place-items: center;
}
.compliment-box.pop { animation: pop 0.4s ease; }

/* REASONS */
.reasons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.8rem;
  margin: 1.1rem 0;
}
.flip { perspective: 1000px; height: 120px; cursor: pointer; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform 0.6s; transform-style: preserve-3d; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: 16px; display: grid; place-items: center;
  text-align: center; padding: 0.7rem; font-weight: 600;
}
.flip-front { background: linear-gradient(135deg, #fff, var(--blush)); border: 2px solid var(--pink); color: var(--pink-deep); font-size: 1.7rem; }
.flip-back { background: linear-gradient(135deg, var(--pink), var(--pink-deep)); color: #fff; transform: rotateY(180deg); font-size: 0.92rem; }

/* CARE LIST */
.care-list { list-style: none; max-width: 480px; margin: 1.1rem auto 0; display: grid; gap: 0.6rem; text-align: left; }
.care-list li {
  background: var(--blush-2); border: 1px solid #ffd2e4; border-radius: 14px;
  padding: 0.75rem 1rem; display: flex; align-items: center; gap: 0.7rem;
  cursor: pointer; transition: background 0.2s ease; font-weight: 500; font-size: 0.96rem;
}
.care-list li:hover { background: var(--blush); }
.care-list li .box {
  width: 24px; height: 24px; flex: none; border: 2px solid var(--pink);
  border-radius: 7px; display: grid; place-items: center; font-size: 0.95rem; background: #fff;
}
.care-list li.checked { opacity: 0.6; }
.care-list li.checked .label { text-decoration: line-through; }
.care-list li.checked .box { background: var(--pink); color: #fff; }
.care-done { margin-top: 0.9rem; font-weight: 700; color: var(--rose); min-height: 1.3rem; }

/* FX */
.petals, .fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.petal, .heart { position: absolute; top: -40px; font-size: 1.6rem; will-change: transform; animation: fall linear forwards; }

@keyframes fall { to { transform: translateY(110vh) rotate(360deg); opacity: 0; } }
@keyframes wiggle { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes pop { 0% { transform: scale(0.9);} 60% { transform: scale(1.06);} 100% { transform: scale(1);} }
@keyframes fly { 0% { left: 0; } 50% { left: calc(100% - 1.5rem); } 50.01% { transform: translateY(-50%) scaleX(-1);} 100% { left: 0; transform: translateY(-50%) scaleX(-1);} }

/* small phones: tighter padding, smaller gallery arrows */
@media (max-width: 480px) {
  .scene { padding-left: 0.9rem; padding-right: 0.9rem; }
  .gallery { gap: 0.35rem; }
  .gnav { width: 40px; height: 40px; font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, .scene { animation: none !important; transition: opacity 0.2s ease !important; }
}
