* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; overflow: hidden; }
body {
  min-height: 100%; height: 100%; height: 100dvh; max-width: 100vw;
  display: flex; justify-content: center; align-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  font-family: 'Nunito', system-ui, sans-serif; color: #62233f;
  background: linear-gradient(135deg, #ff758c, #ff7eb3);
  overflow: hidden; overscroll-behavior: none;
}
.container {
  position: relative; z-index: 2; width: 100%; max-width: 420px;
  max-height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  background: rgba(255, 255, 255, .3); border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 24px; padding: 2rem 1.5rem; text-align: center;
  box-shadow: 0 18px 42px rgba(122, 35, 66, .2);
}
h1 { font-size: clamp(1.55rem, 5.2vw, 1.9rem); font-weight: 700; line-height: 1.22; margin-bottom: 1rem; min-height: 2.5em; }
p { font-size: 1.02rem; line-height: 1.5; margin-bottom: 1.4rem; }
h1, p, button, .polaroid-note, .polaroid-caption { overflow-wrap: anywhere; }
.buttons { display: flex; justify-content: center; align-items: center; gap: 1.2rem; flex-wrap: wrap; padding: .8rem .25rem; }
button {
  max-width: 100%; border: 0; padding: .75rem 1.3rem; border-radius: 999px;
  font: inherit; font-size: 1rem; font-weight: 700; line-height: 1.3; cursor: pointer;
  min-height: 46px; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform .22s ease, background-color .2s ease, box-shadow .2s ease;
}
button:focus-visible { outline: 3px solid #62233f; outline-offset: 5px; }
#yesBtn { background: #a32154; color: #fff; box-shadow: 0 5px 12px #87234326; }
#yesBtn:hover, #yesBtn.is-inviting { transform: scale(1.06); background: #8f1847; }
#yesBtn:active { transform: scale(.98); }
#noBtn { position: relative; background: #fff7fa; color: #8f214c; }
.choice-hint { font-size: .82rem; min-height: 2.8em; margin: 1rem 0 0; line-height: 1.4; }
#heartLayer { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; contain: strict; }
.heart {
  position: absolute; bottom: -40px; color: #c12560; font-size: 22px;
  animation: floatUp 8s linear infinite; opacity: 0;
}
@keyframes floatUp {
  0% { transform: translate3d(0, 0, 0) scale(.7); opacity: 0; }
  15% { opacity: .6; }
  80% { opacity: .5; }
  100% { transform: translate3d(18px, calc(-100dvh - 60px), 0) scale(1.2); opacity: 0; }
}
.mec-paused *, .mec-paused *::before, .mec-paused *::after { animation-play-state: paused !important; }
.pola-hint { font-size: .92rem; margin-bottom: 1.1rem; }
.is-accepted h1 { min-height: 0; }
.polaroid {
  --pola-w: min(220px, 68vw); display: block; width: var(--pola-w); max-width: 100%;
  margin: .3rem auto 0; padding: 0; border: 0; border-radius: 4px; background: transparent;
  perspective: 1100px; transform: rotate(-2deg);
  animation: polaPop .48s cubic-bezier(.22, 1, .36, 1) backwards;
}
.polaroid-inner {
  display: block; position: relative; width: 100%; aspect-ratio: 5 / 6.15;
  transform-style: preserve-3d; transition: transform .55s cubic-bezier(.22, 1, .36, 1);
}
.polaroid.is-flipped { transform: rotate(2deg); }
.polaroid.is-flipped .polaroid-inner { transform: rotateY(180deg); }
.polaroid-face {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 4px; box-shadow: 0 12px 28px rgba(80, 20, 40, .23); overflow: hidden;
}
.polaroid-front { background: #fffaf8; padding: 10px 10px 12px; color: #7a3a4d; }
.polaroid-photo { flex: 1; min-height: 0; border-radius: 2px; overflow: hidden; background: linear-gradient(145deg, #ff8fb3, #ff5d8f 55%, #ff9ec4); }
.polaroid-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.polaroid-placeholder { display: grid; place-items: center; width: 100%; height: 100%; font-size: 3rem; }
.polaroid-caption { display: block; margin-top: 10px; font-size: .86rem; line-height: 1.2; font-weight: 700; letter-spacing: .02em; color: #893b55; }
.polaroid-back {
  transform: rotateY(180deg); background: linear-gradient(160deg, #fff5f8, #ffdce8 55%, #ffcadc);
  padding: 1.1rem 1rem; align-items: center; justify-content: center; color: #62233f;
}
.polaroid-note {
  display: block; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  margin: 0; font-size: .98rem; line-height: 1.5; font-weight: 400;
  white-space: pre-wrap; overflow-wrap: anywhere; touch-action: pan-y;
}
.replay { display: block; margin: 1.1rem auto 0; padding: .6rem 1rem; min-height: 44px; background: transparent; color: #70213f; font-size: .88rem; }
.replay:hover { background: #fff5; }
@keyframes polaPop { from { opacity: 0; transform: translateY(16px) rotate(-2deg) scale(.95); } to { opacity: 1; transform: translateY(0) rotate(-2deg) scale(1); } }
.mec-music-toggle { position: fixed; right: 16px; bottom: 16px; width: 44px; height: 44px; padding: 0; background: #62233f; color: white; z-index: 5; }
@media (max-width: 360px) { .container { padding: 1.5rem 1rem; } }
@media (max-height: 520px) { body { padding-top: 12px; padding-bottom: 12px; } .container { padding: 1.2rem; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
