:root {
  --bg: #0d1110;
  --panel: rgba(15, 20, 20, 0.76);
  --panel-soft: rgba(255, 255, 255, 0.075);
  --text: #fff8f4;
  --muted: #d5dfda;
  --rose: #ff6f9f;
  --pink: #ffb3ca;
  --mint: #81f4c8;
  --gold: #ffd166;
  --blue: #75b8ff;
  --line: rgba(255, 255, 255, 0.2);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background:
    linear-gradient(140deg, rgba(255, 111, 159, 0.2), transparent 34%),
    linear-gradient(320deg, rgba(129, 244, 200, 0.17), transparent 32%),
    linear-gradient(180deg, rgba(255, 209, 102, 0.07), transparent 50%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.026) 0 1px, transparent 1px 54px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 54px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  touch-action: manipulation;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.045), transparent),
    linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.42));
  mix-blend-mode: screen;
  opacity: 0.7;
}

button,
audio {
  font: inherit;
}

.heart-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.heart-field span {
  position: absolute;
  bottom: auto;
  color: rgba(255, 179, 202, 0.34);
  font-size: 1.45rem;
  text-shadow: 0 14px 34px rgba(255, 111, 159, 0.14);
  animation: none;
  transform: none;
}

.heart-field span:nth-child(1) {
  left: 9%;
  top: 18%;
}

.heart-field span:nth-child(2) {
  left: 22%;
  top: 62%;
}

.heart-field span:nth-child(3) {
  left: 47%;
  top: 30%;
}

.heart-field span:nth-child(4) {
  left: 64%;
  top: 72%;
}

.heart-field span:nth-child(5) {
  left: 79%;
  top: 22%;
}

.heart-field span:nth-child(6) {
  left: 91%;
  top: 52%;
}

.gate,
.story {
  position: relative;
  z-index: 1;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding: 24px;
  transition: opacity 420ms ease, transform 420ms ease, visibility 420ms ease;
}

.gate.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.025);
  visibility: hidden;
}

.unlock-card {
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 179, 202, 0.12), rgba(129, 244, 200, 0.08)),
    rgba(15, 20, 20, 0.72);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34), 0 0 0 8px rgba(255, 255, 255, 0.035);
  text-align: center;
}

.unlock-kicker {
  margin: 0 0 16px;
  color: var(--mint);
  font-size: 0.92rem;
  font-weight: 900;
}

.countdown-timer {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.countdown-timer span {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding: 12px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.countdown-timer strong {
  color: var(--text);
  font-size: 2.05rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.countdown-timer small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.unlock-date {
  margin: 16px 0 22px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.unlock-card.is-unlocked .countdown-timer {
  display: none;
}

.start-button {
  min-width: 228px;
  min-height: 60px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #ffe1ec 44%, #dcfff3);
  color: #171313;
  cursor: pointer;
  font-size: 1.06rem;
  font-weight: 900;
  box-shadow: 0 22px 64px rgba(255, 111, 159, 0.28), 0 0 0 9px rgba(255, 255, 255, 0.05);
  animation: buttonPulse 2.2s ease-in-out infinite;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.start-button:disabled {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(255, 225, 236, 0.5));
  color: rgba(23, 19, 19, 0.62);
  cursor: not-allowed;
  box-shadow: none;
  animation: none;
}

.start-button:hover,
.start-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 28px 74px rgba(129, 244, 200, 0.24), 0 0 0 9px rgba(255, 255, 255, 0.07);
  outline: none;
}

.start-button:disabled:hover,
.start-button:disabled:focus-visible {
  transform: none;
  box-shadow: none;
}

.start-button:active {
  transform: translateY(1px) scale(0.99);
}

.story {
  display: none;
  min-height: 100vh;
  min-height: 100svh;
}

.story.is-visible {
  display: block;
}

.slide-shell {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(300px, 0.76fr);
  align-items: center;
  gap: 48px;
  width: min(1120px, 100%);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: 40px;
  opacity: 0;
  transform: translateY(12px);
}

.slide-shell.is-showing {
  animation: slideIn 460ms ease forwards;
}

.media-frame {
  position: relative;
  height: min(72vh, 740px);
  height: min(72svh, 740px);
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 179, 202, 0.14), transparent 45%),
    linear-gradient(315deg, rgba(129, 244, 200, 0.12), transparent 46%),
    rgba(255, 255, 255, 0.055);
  box-shadow: var(--shadow);
}

.media-frame::before {
  content: "♡  ❤  ✨  ♡";
  position: absolute;
  inset: auto 18px 16px auto;
  z-index: 0;
  color: rgba(255, 255, 255, 0.16);
  font-size: 1.2rem;
  letter-spacing: 8px;
}

.media-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.media-frame img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 260ms ease, transform 460ms ease;
}

.media-frame img[hidden] {
  display: none;
}

.media-frame img.is-loaded {
  opacity: 1;
  transform: scale(1);
}

.audio-scene,
.text-scene {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
}

.audio-scene[hidden],
.text-scene[hidden] {
  display: none;
}

.audio-heart {
  display: grid;
  width: 90px;
  height: 90px;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.05)),
    rgba(255, 111, 159, 0.14);
  font-size: 3rem;
  box-shadow: 0 18px 50px rgba(255, 111, 159, 0.2);
  animation: softBeat 1.75s ease-in-out infinite;
}

.audio-label {
  margin: 0 0 8px;
  color: var(--mint);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.audio-caption {
  width: min(430px, 100%);
  margin: 0 0 16px;
  color: #fff;
  font-size: 1.28rem;
  font-weight: 900;
  line-height: 1.3;
  text-wrap: balance;
}

.audio-scene audio {
  width: min(430px, 100%);
  display: block;
  accent-color: var(--rose);
}

.text-scene {
  gap: 14px;
}

.text-scene-heart {
  display: grid;
  width: 104px;
  height: 104px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 179, 202, 0.26), rgba(129, 244, 200, 0.11)),
    rgba(255, 255, 255, 0.08);
  font-size: 3.45rem;
  box-shadow: 0 22px 58px rgba(255, 111, 159, 0.22);
  animation: softBeat 1.65s ease-in-out infinite;
}

.text-scene-line {
  width: min(470px, 100%);
  margin: 0;
  color: #fff8f4;
  font-size: 2.35rem;
  font-weight: 950;
  line-height: 1.05;
  text-wrap: balance;
  text-shadow: 0 12px 34px rgba(0, 0, 0, 0.36);
}

.slide-copy {
  position: relative;
  max-width: 510px;
  padding: 8px 0;
}

.slide-copy::after {
  content: "❤";
  position: absolute;
  right: 12px;
  bottom: -38px;
  color: rgba(255, 179, 202, 0.34);
  font-size: 2rem;
  animation: softBeat 2.4s ease-in-out infinite;
}

.slide-stage {
  margin: 0 0 14px;
  color: var(--mint);
  font-size: 0.86rem;
  font-weight: 900;
}

.slide-title {
  margin: 0;
  color: var(--text);
  font-size: 4rem;
  line-height: 0.98;
  text-wrap: balance;
}

.slide-text {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.62;
}

.tap-heart {
  position: fixed;
  z-index: 4;
  pointer-events: none;
  color: var(--rose);
  font-size: 1.3rem;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: heartFloat 760ms ease forwards;
}

@keyframes buttonPulse {
  0%,
  100% {
    box-shadow: 0 22px 64px rgba(255, 111, 159, 0.24), 0 0 0 8px rgba(255, 255, 255, 0.045);
  }

  50% {
    box-shadow: 0 28px 80px rgba(129, 244, 200, 0.22), 0 0 0 12px rgba(255, 179, 202, 0.075);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.992);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes heartFloat {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.78);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -112px) scale(1.55);
  }
}

@keyframes softBeat {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.045);
  }
}

@media (max-width: 780px) {
  .heart-field span {
    font-size: 1.25rem;
  }

  .slide-shell {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 16px;
    min-height: 100vh;
    min-height: 100svh;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  }

  .media-frame {
    height: 58vh;
    height: 58svh;
    min-height: 285px;
  }

  .slide-shell.is-audio-slide .media-frame,
  .slide-shell.is-text-slide .media-frame {
    height: 48vh;
    height: 48svh;
    min-height: 250px;
  }

  .audio-scene,
  .text-scene {
    padding: 20px;
  }

  .audio-heart {
    width: 68px;
    height: 68px;
    margin-bottom: 12px;
    font-size: 2.25rem;
  }

  .audio-caption {
    margin-bottom: 12px;
    font-size: 1rem;
  }

  .text-scene-heart {
    width: 72px;
    height: 72px;
    font-size: 2.3rem;
  }

  .text-scene-line {
    font-size: 1.55rem;
    line-height: 1.12;
  }

  .slide-copy {
    max-width: none;
    padding: 0;
  }

  .slide-copy::after {
    right: 8px;
    bottom: -26px;
    font-size: 1.35rem;
  }

  .slide-stage {
    margin-bottom: 8px;
    font-size: 0.78rem;
  }

  .slide-title {
    font-size: 2.05rem;
    line-height: 1.04;
  }

  .slide-text {
    margin-top: 12px;
    font-size: 1rem;
    line-height: 1.45;
  }
}

@media (max-height: 650px) and (max-width: 780px) {
  .media-frame {
    height: 48vh;
    height: 48svh;
    min-height: 215px;
  }

  .slide-shell.is-audio-slide .media-frame,
  .slide-shell.is-text-slide .media-frame {
    height: 43vh;
    height: 43svh;
    min-height: 205px;
  }

  .audio-heart {
    width: 56px;
    height: 56px;
    margin-bottom: 8px;
    font-size: 1.8rem;
  }

  .audio-label {
    margin-bottom: 5px;
    font-size: 0.68rem;
  }

  .audio-caption {
    margin-bottom: 8px;
    font-size: 0.9rem;
  }

  .text-scene-heart {
    width: 58px;
    height: 58px;
    font-size: 1.85rem;
  }

  .text-scene-line {
    font-size: 1.22rem;
  }

  .slide-title {
    font-size: 1.7rem;
  }

  .slide-text {
    font-size: 0.92rem;
    line-height: 1.36;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
