:root {
  --cream: #fff8f0;
  --blush: #f6c8c7;
  --rose: #d56b7a;
  --berry: #943f58;
  --cocoa: #72504a;
  --linen: #efe1d4;
  --mint: #d7eadf;
  --ink: #3b2d2d;
  font-family: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 15%, rgba(246, 200, 199, .5), transparent 28rem),
    linear-gradient(135deg, #fffaf4, #f7eee9 45%, #efe1d4);
  overflow: hidden;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 1.4rem;
  padding: max(1.25rem, env(safe-area-inset-top)) 1.25rem max(1.4rem, env(safe-area-inset-bottom));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(1.2rem) scale(.985);
  transition: opacity .7s ease, transform .7s ease, visibility 0s linear .7s;
}

.screen.is-active {
  z-index: 1;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition-delay: 0s;
}

.hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .56;
  filter: saturate(.9) contrast(.95);
  pointer-events: none;
}

.screen--intro::after,
.screen--proposal::after,
.screen--yes::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255, 250, 244, .5), rgba(255, 248, 240, .9));
  pointer-events: none;
}

.intro-copy,
.proposal-copy,
.panel,
.dialog,
.video-box {
  position: relative;
  z-index: 1;
  width: min(100%, 35rem);
  text-align: center;
}

.video-box {
  width: min(100%, 42rem);
}

.intro-copy {
  align-self: end;
  padding-bottom: 8vh;
}

.intro-copy h1 {
  width: min(100%, 20rem);
  margin: 0 auto;
  font-size: clamp(1.75rem, 8vw, 3.6rem);
}

.kicker {
  margin: 0 0 .55rem;
  color: var(--berry);
  font: 700 .78rem/1.2 system-ui, -apple-system, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  max-width: 100%;
  color: #402e2d;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(2rem, 9.5vw, 4.2rem);
}

h2 {
  font-size: clamp(2rem, 9vw, 3.8rem);
}

p {
  font-size: clamp(1.05rem, 4vw, 1.35rem);
  line-height: 1.55;
}

.primary-btn,
.yes-btn {
  position: relative;
  margin-top: 10px;
  z-index: 2;
  min-width: 10.5rem;
  min-height: 3.35rem;
  padding: .9rem 1.4rem;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #c85568, #91405a);
  box-shadow: 0 1rem 2.2rem rgba(148, 63, 88, .24);
  font: 800 1rem/1.1 system-ui, -apple-system, sans-serif;
  transition: transform .2s ease, box-shadow .2s ease;
}

.primary-btn:active,
.yes-btn:active {
  transform: scale(.97);
}

.primary-btn:disabled,
.yes-btn:disabled,
.primary-btn.is-disabled,
.yes-btn.is-disabled {
  cursor: default;
  opacity: .48;
  transform: none;
  box-shadow: 0 .5rem 1.2rem rgba(148, 63, 88, .12);
}

.bear-stage {
  position: relative;
  width: min(84vw, 20rem);
  aspect-ratio: 1402 / 1122;
  z-index: 1;
}

.rive-bear {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity .35s ease;
}

.bear-stage.has-rive .rive-bear {
  opacity: 1;
}

.bear-stage.has-rive .rive-fallback {
  opacity: 0;
}

.real-bear {
  position: absolute;
  inset: 0;
  animation: bearEnter 1.2s cubic-bezier(.2, .8, .2, 1) both, realBearBob 3.2s ease-in-out 1.3s infinite;
  transform-origin: 50% 80%;
  transition: opacity .35s ease;
}

.bear-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.bear-img--base {
  transform-origin: 50% 76%;
  animation: realGesture 3.4s ease-in-out infinite;
  filter: drop-shadow(.2rem .55rem .55rem rgba(114, 80, 74, .12));
}

.bear-shadow {
  position: absolute;
  left: 23%;
  right: 23%;
  bottom: 1%;
  height: 7%;
  border-radius: 50%;
  background: rgba(114, 80, 74, .18);
  filter: blur(.45rem);
  transform: scaleX(1.18);
}

.dialog {
  min-height: 8.8rem;
  padding: 1.4rem 1.2rem;
  border-radius: .5rem;
  background: rgba(255, 250, 244, .78);
  box-shadow: 0 1rem 3rem rgba(114, 80, 74, .12);
  backdrop-filter: blur(12px);
}

.dialog--center {
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.line {
  display: none;
  margin: 0;
}

.line.is-visible {
  display: block;
  animation: typeIn .6s ease both;
}

.panel {
  padding: 1rem 0;
}

.screen--gallery {
  align-content: center;
  padding-top: max(2rem, env(safe-area-inset-top));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.polaroids {
  position: relative;
  width: min(82vw, 23rem);
  aspect-ratio: .78;
  overflow: visible;
  touch-action: pan-y;
}

.polaroid {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: .55rem .55rem .8rem;
  border-radius: .35rem;
  background: #fffdf9;
  box-shadow: 0 1rem 2rem rgba(114, 80, 74, .16);
  opacity: 0;
  pointer-events: none;
  transform: rotate(52deg) translateY(1.1rem) scale(.78);
  transform-origin: 50% 115%;
  transition: opacity .34s ease, transform .55s cubic-bezier(.2, .82, .2, 1);
}

.polaroids.is-prev .polaroid {
  transform: rotate(-52deg) translateY(1.1rem) scale(.78);
}

.polaroid:first-child,
.polaroid.is-active {
  z-index: 2;
  opacity: 1;
  pointer-events: auto;
  transform: rotate(var(--tilt, -2deg)) translateY(0) scale(1);
}

.polaroid:first-child:not(.is-active) {
  pointer-events: none;
}

.polaroids.is-ready .polaroid:first-child:not(.is-active) {
  opacity: 0;
}

.polaroid:nth-child(2n) { --tilt: 2deg; }
.polaroid:nth-child(3n) { --tilt: -1deg; }

.memory-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: .2rem;
  object-fit: cover;
  object-position: center;
  background: #efe1d4;
}

.memory-photo--one { object-position: center 28%; }
.memory-photo--two { object-position: center 34%; }
.memory-photo--three { object-position: center 24%; }
.memory-photo--four { object-position: center center; }

figcaption {
  margin-top: .55rem;
  text-align: center;
  color: var(--cocoa);
  font: 700 .88rem/1.2 system-ui, sans-serif;
}

.gallery-dots {
  display: flex;
  gap: .45rem;
  justify-content: center;
  align-items: center;
  min-height: .65rem;
}

.gallery-dots span {
  width: .45rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(148, 63, 88, .28);
  transition: transform .2s ease, background .2s ease;
}

.gallery-dots span.is-active {
  transform: scale(1.35);
  background: var(--berry);
}

.gallery-controls {
  display: flex;
  justify-content: center;
  gap: .8rem;
}

.gallery-arrow {
  width: 3rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #c85568, #91405a);
  box-shadow: 0 .8rem 1.6rem rgba(148, 63, 88, .2);
  font: 800 2rem/.8 Georgia, "Times New Roman", serif;
  transition: transform .2s ease, box-shadow .2s ease;
}

.gallery-arrow:active {
  transform: scale(.94);
}

.mini-bear {
  width: min(70vw, 16rem);
  aspect-ratio: 1448 / 1086;
  object-fit: contain;
  border-radius: .45rem;
  filter: drop-shadow(0 .9rem 1.5rem rgba(114, 80, 74, .16));
  animation: bob 2.6s ease-in-out infinite;
}

.video-box video {
  width: min(100%, 42rem);
  aspect-ratio: 720 / 550;
  height: auto;
  display: block;
  border-radius: .5rem;
  object-fit: contain;
  background: #2d2424;
  box-shadow: 0 1rem 3rem rgba(114, 80, 74, .18);
}

.final-bear {
  position: relative;
  z-index: 1;
  width: min(72vw, 17rem);
  aspect-ratio: 1448 / 1086;
  object-fit: contain;
  border-radius: .45rem;
  filter: drop-shadow(0 .9rem 1.5rem rgba(114, 80, 74, .14));
  animation: bob 2.8s ease-in-out infinite;
}

.yes-copy {
  position: relative;
  z-index: 2;
  width: min(100%, 32rem);
  margin: 0 auto;
  text-align: center;
}

.yes-copy h2 {
  color: #3b2d2d;
  text-align: center;
  text-shadow: 0 .12rem .65rem rgba(255, 248, 240, .95);
}

.yes-copy p {
  margin: .65rem 0 0;
  color: var(--cocoa);
  font-weight: 700;
  text-align: center;
}

.count {
  width: 6.5rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #c85568;
  box-shadow: 0 1rem 2rem rgba(200, 85, 104, .24);
  font: 800 3.6rem/1 system-ui, sans-serif;
}

.screen--countdown {
  text-align: center;
}

.screen--countdown h2 {
  width: min(100%, 22rem);
  margin: 0 auto;
}

.birthday {
  color: var(--berry);
  font-weight: 800;
}

.answer-row {
  position: relative;
  z-index: 2;
  width: min(100%, 38rem);
  min-height: 9rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: .8rem;
}

.no-btn {
  position: relative;
  min-width: 7rem;
  min-height: 3.35rem;
  padding: .9rem 1.25rem;
  border-radius: 999px;
  color: var(--berry);
  background: rgba(255, 255, 255, .72);
  box-shadow: inset 0 0 0 1px rgba(148, 63, 88, .2);
  font: 800 1rem/1 system-ui, sans-serif;
}

.ring {
  position: relative;
  z-index: 1;
  width: min(35vw, 8rem);
  aspect-ratio: 1;
  border: .8rem solid #e5c45b;
  border-radius: 50%;
  box-shadow: inset 0 0 0 .25rem rgba(255,255,255,.45), 0 1rem 2rem rgba(114, 80, 74, .18);
  animation: ringPop .9s cubic-bezier(.2, .8, .2, 1) both;
}

.ring::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -2rem;
  width: 2.4rem;
  height: 2.4rem;
  transform: translateX(-50%) rotate(45deg);
  border-radius: .35rem;
  background: linear-gradient(135deg, #fff, #d8f5ff 55%, #9bdbe7);
  box-shadow: 0 .2rem .7rem rgba(155, 219, 231, .45);
}

.music-btn {
  position: fixed;
  right: 1rem;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 10;
  width: 3rem;
  aspect-ratio: 1;
  border-radius: 50%;
  color: #fff;
  background: rgba(148, 63, 88, .82);
  box-shadow: 0 .7rem 1.4rem rgba(114, 80, 74, .18);
  font: 900 1.15rem/1 system-ui, sans-serif;
}

.music-btn.is-on {
  background: #4c8a70;
}

.ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
}

.ambient span {
  position: absolute;
  top: -3rem;
  width: .95rem;
  height: 1.4rem;
  border-radius: 80% 0 80% 0;
  background: rgba(213, 107, 122, .45);
  animation: fall 12s linear infinite;
}

.ambient span:nth-child(1) { left: 8%; animation-delay: 0s; }
.ambient span:nth-child(2) { left: 24%; animation-delay: 2s; }
.ambient span:nth-child(3) { left: 41%; animation-delay: 5s; }
.ambient span:nth-child(4) { left: 58%; animation-delay: 1s; }
.ambient span:nth-child(5) { left: 73%; animation-delay: 4s; }
.ambient span:nth-child(6) { left: 89%; animation-delay: 7s; }

.confetti {
  position: fixed;
  top: -1rem;
  width: .65rem;
  height: .95rem;
  z-index: 20;
  pointer-events: none;
  animation: confetti 2.4s ease-in forwards;
}

@keyframes fall {
  to { transform: translate3d(4rem, 110vh, 0) rotate(420deg); }
}

@keyframes confetti {
  to { transform: translate3d(var(--x), 105vh, 0) rotate(620deg); opacity: 0; }
}

@keyframes bearEnter {
  from { transform: translateX(-80vw) rotate(-8deg); opacity: 0; }
  to { transform: translateX(0) rotate(0); opacity: 1; }
}

@keyframes realBearBob {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  50% { translate: 0 -.45rem; rotate: -.7deg; }
}

@keyframes realGesture {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  35% { transform: rotate(-1.3deg) translateY(-.15rem); }
  62% { transform: rotate(.9deg) translateY(.05rem); }
}

@keyframes bob {
  50% { transform: translateY(-.45rem); }
}

@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(.08); }
}

@keyframes talk {
  50% { height: 22%; }
}

@keyframes wave {
  50% { transform: rotate(24deg); }
}

@keyframes typeIn {
  from { opacity: 0; transform: translateY(.5rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes ringPop {
  from { opacity: 0; transform: scale(.4) rotate(-18deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

@media (max-width: 440px) {
  .screen {
    gap: 1rem;
  }

  .polaroids {
    width: min(82vw, 21rem);
  }

  .primary-btn,
  .yes-btn,
  .no-btn {
    min-width: 8.5rem;
  }

  .dialog {
    min-height: 7.5rem;
  }
}
