:root {
  --bg-1: #040305;
  --bg-2: #15070d;
  --rose-700: #8a0f2a;
  --rose-500: #ca1b47;
  --rose-200: #ffc7d7;
  --text: #f7f3f5;
  --muted: #d7c7cd;
  --line: rgba(255, 255, 255, 0.17);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(800px 500px at 100% 0%, rgba(202, 27, 71, 0.24), transparent 55%),
    radial-gradient(700px 500px at 0% 100%, rgba(138, 15, 42, 0.3), transparent 60%),
    linear-gradient(145deg, var(--bg-1), var(--bg-2));
  overflow-x: hidden;
}

.site-wrap {
  width: min(720px, calc(100% - 2rem));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 1.2rem 0;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 480ms ease, transform 480ms ease, filter 250ms ease;
}

body.is-ready .site-wrap {
  opacity: 1;
  transform: translateY(0);
}

body.is-leaving .site-wrap {
  opacity: 0;
  transform: translateY(-10px);
  filter: blur(2px);
}

.frame-head {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.progress {
  display: inline-flex;
  align-items: baseline;
  gap: 0.24rem;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.progress-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--rose-500), var(--rose-200));
  box-shadow: 0 0 12px rgba(202, 27, 71, 0.8);
  margin-right: 0.2rem;
}

.stage {
  align-self: center;
  padding: clamp(0.4rem, 2vw, 1rem) 0;
}

h1,
h2 {
  margin: 0 0 0.8rem;
  font-family: "Bodoni Moda", "Times New Roman", serif;
  line-height: 1.08;
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(2rem, 7vw, 4rem);
}

h2 {
  font-size: clamp(1.7rem, 5.2vw, 3rem);
}

.story {
  margin: 0;
  max-width: 68ch;
  color: var(--text);
  font-size: clamp(1.02rem, 2.3vw, 1.18rem);
  line-height: 1.78;
}

.photos {
  display: flex;
  gap: 0.7rem;
  margin-top: 1.2rem;
  max-width: 540px;
}

.photos img {
  flex: 1;
  min-width: 0;
  border-radius: 14px;
  object-fit: cover;
  aspect-ratio: 4 / 5;
}

.gallery {
  columns: 2;
  column-gap: 0.7rem;
  margin-top: 0.6rem;
}

.gallery img {
  width: 100%;
  border-radius: 14px;
  margin-bottom: 0.7rem;
  display: block;
}

.scratch-shell {
  border-radius: 18px;
  border: 1px solid var(--line);
  overflow: hidden;
  position: relative;
  background: rgba(255, 255, 255, 0.03);
}

.scratch-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
  font-family: "Bodoni Moda", serif;
  font-size: clamp(1.45rem, 3.5vw, 2.5rem);
  color: var(--rose-200);
  background:
    radial-gradient(70% 80% at 50% 20%, rgba(255, 199, 215, 0.2), transparent),
    linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0));
}

#scratchCanvas {
  position: relative;
  display: block;
  width: 100%;
  height: 250px;
  touch-action: none;
}

.scratch-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.6rem;
}

.scratch-actions[hidden] {
  display: none;
}

.scratch-yes {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--rose-700), var(--rose-500));
  color: #fff;
  padding: 0.7rem 2rem;
  font: inherit;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform 180ms ease;
}

.scratch-no {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0.7rem 2rem;
  font: inherit;
  font-size: 1.05rem;
  cursor: pointer;
  transition: opacity 180ms ease;
}

.scratch-no:hover {
  opacity: 0.7;
}

.reason-wrap {
  margin-top: 1rem;
}

.reason-cta {
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background: transparent;
  color: var(--rose-200);
  padding: 0.52rem 0.9rem;
  font: inherit;
  cursor: pointer;
}

.reason-output {
  margin: 0.9rem 0 0;
  min-height: 5rem;
  color: var(--rose-200);
  font-size: clamp(1.04rem, 2.5vw, 1.28rem);
  line-height: 1.6;
}

.stage-nav {
  margin-top: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-arrow {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
  text-decoration: none;
}

.nav-arrow svg {
  width: 20px;
  height: 20px;
}

.nav-arrow:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.42);
}

.nav-arrow.next {
  background: linear-gradient(145deg, var(--rose-700), var(--rose-500));
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(202, 27, 71, 0.34);
}

.nav-arrow.next:hover {
  box-shadow: 0 16px 28px rgba(202, 27, 71, 0.42);
}

.nav-arrow.replay {
  color: var(--rose-200);
}

.nav-spacer {
  width: 54px;
  height: 54px;
}

.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(5, 3, 5, 0.8);
  backdrop-filter: blur(6px);
  z-index: 20;
}

.gate[hidden] {
  display: none;
}

.gate-card {
  width: min(500px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 22px;
  padding: 1.3rem;
  background: linear-gradient(150deg, rgba(22, 11, 16, 0.96), rgba(11, 8, 11, 0.95));
}

.gate-card h2 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.7rem, 5.2vw, 2.5rem);
}

.gate-form {
  display: flex;
  gap: 0.6rem;
}

.gate-form input {
  flex: 1;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 0.66rem 0.72rem;
  font: inherit;
}

.gate-form input:focus-visible {
  outline: 2px solid rgba(255, 199, 215, 0.8);
  outline-offset: 1px;
}

.gate-open {
  border: 0;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--rose-700), var(--rose-500));
  color: #fff;
  font: inherit;
  padding: 0.66rem 1rem;
  cursor: pointer;
}

.gate-message {
  margin: 0.5rem 0 0;
  min-height: 1rem;
  color: #ff9eb9;
  font-size: 0.88rem;
}

.shake {
  animation: shake 300ms linear;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }
}

@media (max-width: 760px) {
  .site-wrap {
    width: min(720px, calc(100% - 1.2rem));
  }

  .photos {
    flex-direction: column;
  }

  .photos img {
    aspect-ratio: 4 / 3;
  }

  .gallery {
    columns: 1;
  }

  #scratchCanvas {
    height: 220px;
  }

  .gate-form {
    flex-direction: column;
  }

  .gate-open {
    width: 100%;
  }
}
