/* =========================================================
   Happy Birthday, Wahyu — vintage maroon invitation
   ========================================================= */

:root {
  --maroon-950: #250306;
  --maroon-900: #34080c;
  --maroon-800: #450c11;
  --maroon-700: #581318;
  --maroon-600: #6e1c22;
  --cream: #f4e4c4;
  --cream-soft: #efdcb9;
  --cream-dim: #cdb695;
  --paper: #f2e6ce;
  --ink: #33090c;
  --ink-soft: #3d2419;
  --gold: #d6b183;
  --red: #c9342e;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --script: "Great Vibes", "Brush Script MT", cursive;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Oswald", "Trebuchet MS", sans-serif;
  --type: "Special Elite", "Courier New", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--serif);
  color: var(--cream);
  background: var(--maroon-900);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font: inherit;
}

img {
  max-width: 100%;
}

/* ---------- background ---------- */

.bg {
  position: fixed;
  inset: -2%;
  z-index: -2;
  background-image:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(255, 219, 178, 0.1), transparent 70%),
    radial-gradient(ellipse 110% 90% at 50% 50%, transparent 35%, rgba(20, 1, 3, 0.62) 100%),
    url("../assets/texture-maroon.jpg");
  background-size: auto, auto, cover;
  background-position: center;
  filter: saturate(1.05);
  transform: scale(1.03);
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 1, 3, 0.28), transparent 30%, transparent 72%, rgba(20, 1, 3, 0.4));
  pointer-events: none;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

/* ---------- stage / scenes ---------- */

.app {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.4rem, 4.5vw, 4rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.035);
  transition:
    opacity 0.55s ease,
    transform 0.9s var(--ease),
    visibility 0.55s;
}

.scene.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  z-index: 2;
}

.scene:focus {
  outline: none;
}

.scene.is-active .cover-inner,
.scene.is-active .portrait-stage {
  animation: rise 0.9s 0.08s var(--ease) both;
}

.scene.is-active .quiz-inner {
  animation: rise 0.8s 0.05s var(--ease) both;
}

/* ---------- shared type ---------- */

.script {
  font-family: var(--script);
  font-weight: 400;
}

.typewriter {
  font-family: var(--type);
}

.sparkle {
  position: absolute;
  z-index: 1;
  color: var(--cream);
  opacity: 0;
  font-size: clamp(0.85rem, 1.6vw, 1.35rem);
  text-shadow: 0 0 18px rgba(244, 228, 196, 0.55);
  animation: twinkle 4.5s ease-in-out infinite;
  pointer-events: none;
}

/* ---------- buttons ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7em;
  padding: 0.82em 1.75em;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(0.78rem, 1.2vw, 0.94rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.35s var(--ease),
    background-color 0.25s ease,
    color 0.25s ease,
    box-shadow 0.35s ease,
    border-color 0.25s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 4px;
}

.btn--next {
  background: var(--cream);
  color: var(--ink);
  border-color: rgba(37, 3, 6, 0.25);
  box-shadow:
    0 12px 28px -12px rgba(0, 0, 0, 0.75),
    inset 0 -2px 0 rgba(37, 3, 6, 0.16);
}

.btn--next:hover {
  background: #fff4dd;
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 18px 34px -12px rgba(0, 0, 0, 0.8),
    inset 0 -2px 0 rgba(37, 3, 6, 0.12);
}

.btn--next:active {
  transform: translateY(0) scale(0.99);
}

.btn-arrow {
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.35s var(--ease);
}

.btn:hover .btn-arrow {
  transform: translateX(3px);
}

.btn--cream {
  background: var(--cream);
  color: var(--ink);
  border-color: rgba(37, 3, 6, 0.2);
  box-shadow:
    0 14px 30px -14px rgba(0, 0, 0, 0.8),
    inset 0 -2px 0 rgba(37, 3, 6, 0.14);
}

.btn--cream:hover {
  background: #fff4dd;
  transform: translateY(-2px);
}

.btn--red {
  background: var(--red);
  color: #fff6ee;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow:
    0 5px 0 #7e1512,
    0 18px 28px -14px rgba(0, 0, 0, 0.9);
}

.btn--red:hover {
  background: #d93d36;
  transform: translateY(-2px);
  box-shadow:
    0 7px 0 #7e1512,
    0 22px 30px -14px rgba(0, 0, 0, 0.9);
}

.btn--red:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #7e1512;
}

.btn--small {
  padding: 0.55em 1.9em;
  font-size: clamp(0.82rem, 1.3vw, 0.98rem);
  letter-spacing: 0.06em;
  text-transform: none;
}

.btn--ghost {
  background: transparent;
  color: #5a1117;
  border-color: rgba(58, 9, 13, 0.35);
  font-family: var(--type);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: none;
  padding: 0.7em 1.5em;
}

.btn--ghost:hover {
  background: rgba(58, 9, 13, 0.06);
  border-color: rgba(58, 9, 13, 0.55);
}

/* =========================================================
   1. COVER
   ========================================================= */

.scene--cover {
  overflow: hidden;
}

.cover-inner {
  position: relative;
  z-index: 3;
  width: min(780px, 94vw);
  margin: auto;
  text-align: center;
}

.cover-kicker {
  margin: 0 0 clamp(2.4rem, 5.5vh, 3.4rem);
  padding-left: 0.42em;
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(0.58rem, 1vw, 0.72rem);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.cover-title {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  color: var(--cream);
  font-size: clamp(5.4rem, 15vw, 13rem);
  line-height: 0.6;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.12),
    0 26px 60px rgba(0, 0, 0, 0.4);
}

.cover-title__happy {
  transform: rotate(-5deg) translate(-0.12em, 0.03em);
  padding-right: 0.16em;
}

.cover-title__birthday {
  margin-top: 0.16em;
  transform: rotate(-2deg) translate(0.3em, 0);
  font-size: 0.92em;
  padding-right: 0.18em;
}

.cover-name {
  margin: clamp(1.2rem, 3.4vh, 2.1rem) 0 0;
  padding-left: 0.62em;
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(0.74rem, 1.4vw, 0.95rem);
  letter-spacing: 0.62em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.cover-inner .btn--next {
  margin-top: clamp(1.7rem, 4.6vh, 3rem);
}

.cover-footnote {
  margin: clamp(1.1rem, 2.8vh, 1.8rem) 0 0;
  font-family: var(--type);
  font-size: clamp(0.6rem, 0.95vw, 0.7rem);
  letter-spacing: 0.08em;
  color: var(--cream);
  opacity: 0.45;
}

/* decorations */

.cover-deco {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 22px 38px rgba(0, 0, 0, 0.45));
}

.cover-deco img {
  display: block;
  width: 100%;
  height: auto;
}

.cover-deco--envelope {
  left: clamp(2%, 8vw, 13%);
  top: 44%;
  width: clamp(100px, 13vw, 190px);
  transform: rotate(-13deg);
  animation: drift 7s ease-in-out infinite;
}

.cover-deco--cat {
  right: clamp(3%, 9vw, 15%);
  top: clamp(5%, 10vh, 13%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(104px, 14vw, 195px);
  transform: rotate(7deg);
}

.cat-hat {
  position: relative;
  z-index: 2;
  width: 55% !important;
  margin-bottom: -20%;
  transform: rotate(-7deg);
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.25));
}

.cat {
  width: 100% !important;
  transform: rotate(-2deg);
}

.sparkle--1 { top: 19%; left: 54%; animation-delay: 0.2s; }
.sparkle--2 { top: 65%; left: 24%; animation-delay: 1.1s; }
.sparkle--3 { top: 72%; left: 73%; animation-delay: 2.2s; }
.sparkle--4 { top: 38%; left: 85%; animation-delay: 3s; }

/* =========================================================
   2. PORTRAIT
   ========================================================= */

.scene--portrait {
  overflow: hidden;
  padding: 1rem;
  background: radial-gradient(ellipse 36% 65% at 50% 46%, rgba(244, 218, 205, 0.32), transparent 100%);
}

.portrait-stage {
  position: relative;
  container-type: inline-size;
  width: min(100%, calc((100svh - 2rem) * 760 / 554), 1000px);
  aspect-ratio: 760 / 554;
  flex: 0 0 auto;
  margin: auto;
  text-align: center;
}

.big-number {
  position: absolute;
  inset: 17% 29% auto 25%;
  z-index: 0;
  display: flex;
  justify-content: space-between;
  font-family: "Anton", Impact, sans-serif;
  font-size: 25cqw;
  line-height: 0.85;
  color: #e4e2dc;
  user-select: none;
}

.big-number span:first-child { transform: rotate(-11deg) scaleX(1.3); transform-origin: left center; }
.big-number span:last-child { transform: rotate(12deg) scaleX(1.25); transform-origin: right center; }

.portrait-wrap {
  position: absolute;
  top: -13%;
  left: 50%;
  z-index: 1;
  width: 34%;
  transform: translateX(-50%);
}

.portrait {
  display: block;
  width: 100%;
  height: auto;
}

.portrait-copy {
  position: absolute;
  top: 49%;
  left: 50%;
  z-index: 2;
  width: 92%;
  transform: translateX(-50%);
}

.portrait-title {
  margin: 0;
  color: #eae2d0;
  font-size: 12cqw;
  line-height: 0.95;
  white-space: nowrap;
  font-weight: 400;
}

.badge {
  display: inline-block;
  margin: 0;
  padding: 0.35em 0.45em;
  background: #e7dcb5;
  color: #080808;
  font-family: "Anton", Impact, sans-serif;
  font-weight: 400;
  font-size: 2.55cqw;
  line-height: 1.25;
  transform: rotate(-1deg);
}

.portrait-stage .btn--next {
  position: absolute;
  top: 75.3%;
  left: 50%;
  margin: 0;
  padding: 0.12em 0.55em;
  gap: 0.25em;
  border: 0;
  border-radius: 1.5cqw;
  background: #fff;
  color: #1d2434;
  box-shadow: none;
  font-family: var(--sans);
  font-size: 4.2cqw;
  font-weight: 600;
  line-height: 1.2;
  min-height: 44px;
  min-width: 96px;
  letter-spacing: 0.07em;
  transform: translateX(-50%);
}

.portrait-stage .btn--next:hover { transform: translateX(-50%) translateY(-2px); }
.portrait-stage .btn--next:active { transform: translateX(-50%); }
.portrait-stage .btn-arrow { width: 1.1em; height: 1.1em; stroke-width: 4; }

/* =========================================================
   3. QUIZ
   ========================================================= */

.quiz-inner {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(720px, 100%);
  margin: auto;
  padding-block: clamp(1rem, 2vh, 2rem);
  text-align: center;
}

.quiz-title {
  margin: 0;
  color: var(--cream);
  font-size: clamp(3.2rem, 8vw, 6.3rem);
  line-height: 0.9;
  transform: rotate(-2deg);
  text-shadow: 0 16px 44px rgba(0, 0, 0, 0.44);
}

.quiz-sub {
  display: inline-block;
  margin: clamp(-0.15rem, -0.5vh, 0rem) 0 0;
  padding: 0.42em 1.05em 0.36em;
  background-color: var(--paper);
  background-image: url("../assets/paper.png");
  background-size: 150px;
  background-blend-mode: multiply;
  color: var(--ink);
  font-size: clamp(0.62rem, 1.05vw, 0.78rem);
  letter-spacing: 0.02em;
  transform: rotate(-1.5deg);
  box-shadow: 0 9px 20px -10px rgba(0, 0, 0, 0.6);
}

.paper-card {
  position: relative;
  width: min(492px, 94%);
  margin-top: clamp(1.5rem, 4.4vh, 2.8rem);
  padding: clamp(1.5rem, 3.6vw, 2.5rem);
  background-color: var(--paper);
  background-image: url("../assets/paper.png");
  background-size: 230px;
  background-blend-mode: multiply;
  color: var(--ink);
  transform: rotate(-0.7deg);
  box-shadow:
    0 34px 64px -26px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.14);
}

.paper-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(58, 9, 13, 0.14);
  pointer-events: none;
}

.date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(0.85rem, 2.2vw, 1.4rem);
}

.date-btn {
  position: relative;
  padding: 0.85em 0.4em 0.8em;
  background-color: var(--maroon-700);
  background-image: linear-gradient(155deg, rgba(255, 255, 255, 0.11), transparent 58%);
  color: var(--cream);
  border: 1px solid rgba(37, 3, 6, 0.35);
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(0.92rem, 1.9vw, 1.12rem);
  letter-spacing: 0.1em;
  cursor: pointer;
  transform: rotate(var(--rot, 0deg));
  box-shadow:
    0 4px 0 var(--maroon-950),
    0 12px 18px -10px rgba(0, 0, 0, 0.55);
  transition:
    transform 0.35s var(--ease),
    background-color 0.25s ease,
    box-shadow 0.35s ease;
  -webkit-tap-highlight-color: transparent;
}

.date-btn:hover {
  background-color: var(--maroon-600);
  transform: rotate(0deg) translateY(-3px);
  box-shadow:
    0 6px 0 var(--maroon-950),
    0 18px 22px -10px rgba(0, 0, 0, 0.6);
}

.date-btn:active {
  transform: translateY(1px);
  box-shadow:
    0 2px 0 var(--maroon-950),
    0 8px 12px -8px rgba(0, 0, 0, 0.5);
}

.date-btn:focus-visible {
  outline: 2px solid var(--maroon-700);
  outline-offset: 3px;
}

.date-btn.is-shake {
  animation: shake 0.42s ease;
}

.quiz-hint {
  margin: clamp(1.1rem, 3vh, 1.8rem) 0 0;
  font-size: clamp(0.6rem, 1vw, 0.72rem);
  letter-spacing: 0.06em;
  color: var(--cream);
  opacity: 0.57;
}

.sparkle--q1 { top: 24%; left: 16%; animation-delay: 0.8s; }
.sparkle--q2 { top: 68%; left: 84%; animation-delay: 2.1s; }

/* result overlays */

.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.1rem, 4vw, 2rem);
  background: rgba(16, 2, 4, 0.68);
  -webkit-backdrop-filter: blur(7px) saturate(0.9);
  backdrop-filter: blur(7px) saturate(0.9);
  animation: fade-in 0.3s ease both;
}

.result-card {
  position: relative;
  width: min(430px, 100%);
  padding: clamp(1.5rem, 3.6vw, 2.3rem);
  background: linear-gradient(180deg, #2a2422 0%, #1b1614 100%);
  color: var(--cream);
  text-align: center;
  border-radius: 18px;
  box-shadow:
    0 48px 100px -28px #000,
    0 0 0 1px rgba(244, 228, 196, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: pop 0.5s var(--ease) both;
}

.result-kicker {
  margin: 0 0 0.2rem;
  font-size: clamp(0.52rem, 0.9vw, 0.64rem);
  letter-spacing: 0.12em;
  color: var(--cream);
  opacity: 0.32;
}

.result-title {
  margin: 0 0 0.2rem;
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(1.45rem, 3.2vw, 2rem);
  letter-spacing: 0.015em;
  color: var(--cream);
}

.result-face {
  display: block;
  width: clamp(100px, 17vw, 132px);
  height: auto;
  margin: clamp(0.8rem, 2vh, 1.2rem) auto 0;
  filter: invert(1) brightness(1.15);
  opacity: 0.92;
}

.result-card .btn {
  margin-top: clamp(1.1rem, 2.6vh, 1.6rem);
}

/* =========================================================
   4. THE LONG BIRTHDAY PAGE
   ========================================================= */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.scene.scene--web {
  display: block;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.scene.is-active .web-cover__inner {
  animation: rise 0.9s 0.08s var(--ease) both;
}

.web-scroll {
  position: relative;
  width: 100%;
  min-height: 100%;
  background: #230805;
}

/* ---------- web cover ---------- */

.web-cover {
  position: relative;
  display: block;
  min-height: 100vh;
  min-height: 100svh;
  padding: 0;
  overflow: hidden;
  background-color: #58160f;
  background-image: url("../assets/texture-maroon.jpg");
  background-size: cover;
  background-position: center;
  isolation: isolate;
}

.web-cover__inner {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding-inline: 1.25rem;
  text-align: center;
}

.web-cover__title {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 23.5vh 0 0;
  color: var(--cream);
  font-size: clamp(4.6rem, 13vw, 11rem);
  line-height: 0.8;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.1),
    0 26px 60px rgba(0, 0, 0, 0.42);
}

.web-cover__happy {
  padding-right: 0.14em;
  transform: translate(-0.61em, 0.1em) rotate(-6deg) scaleX(0.806) scaleY(1.175);
  transform-origin: center;
}

.web-cover__birthday {
  margin-top: 0;
  padding-right: 0.16em;
  font-size: 0.92em;
  transform: translate(0.505em, 0.29em) rotate(-2.5deg) scaleX(0.903) scaleY(1.15);
  transform-origin: center;
}

.web-cover__name {
  position: relative;
  left: 6.37vw;
  margin-top: clamp(3.2rem, 5.6vw, 4.8rem);
  padding-left: 0.32em;
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(1.3rem, 2.6vw, 2.1rem);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--cream);
}

.tap-here {
  margin-top: auto;
  margin-bottom: 9.5vh;
  padding: 0.6em 1.4em 0.7em;
  border: 0;
  border-radius: 8px;
  background: #0b0807;
  color: var(--cream);
  font-family: var(--script);
  font-size: clamp(1.05rem, 1.55vw, 1.35rem);
  line-height: 1;
  cursor: pointer;
  box-shadow:
    0 20px 40px -16px rgba(0, 0, 0, 0.9),
    inset 0 0 0 1px rgba(244, 228, 196, 0.15);
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.35s var(--ease),
    background-color 0.25s ease,
    box-shadow 0.35s ease;
}

.tap-here:hover {
  background: #181110;
  transform: translateY(-2px);
  box-shadow:
    0 26px 46px -16px rgba(0, 0, 0, 0.95),
    inset 0 0 0 1px rgba(244, 228, 196, 0.25);
}

.tap-here:active {
  transform: translateY(0);
}

.tap-here:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 4px;
}

.web-cover__deco {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.5));
}

.web-cover__deco--env {
  left: 21.7%;
  top: 49%;
  width: clamp(140px, 15.1vw, 215px);
  transform: none;
  animation: float 7s ease-in-out infinite;
}

.web-cover__deco--cat {
  right: 23.7%;
  top: 6.3%;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(145px, 16vw, 230px);
  transform: rotate(6deg);
}

.web-cover__deco img {
  display: block;
  width: 100%;
  height: auto;
}

.web-cover__hat {
  position: relative;
  z-index: 2;
  width: 52% !important;
  margin-bottom: -30%;
  transform: rotate(-8deg);
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.25));
}

.web-cover__cat {
  width: 100% !important;
  transform: rotate(-2deg) scaleY(1.19);
}

/* ---------- open letter ---------- */

.web-letter {
  --letter-w: clamp(320px, 27vw, 480px);
  --env-w: calc(var(--letter-w) * 1.465);

  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1rem;
  overflow: hidden;
  background-color: #230805;
  background-image: radial-gradient(ellipse 68% 52% at 50% 28%, rgba(86, 22, 15, 0.3), transparent 72%);
}

.web-letter__card {
  position: relative;
  z-index: 2;
  width: var(--letter-w);
  padding:
    clamp(1.7rem, 2.6vw, 2.3rem)
    clamp(1.05rem, 1.5vw, 1.5rem)
    calc(var(--env-w) * 0.37);
  background-color: #f4f1ea;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.52)),
    url("../assets/paper.png");
  background-size: auto, 170px;
  color: #171313;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.8);
}

.web-letter__body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: clamp(0.95rem, 1.18vw, 1.12rem);
  line-height: 1.34;
  letter-spacing: 0;
  overflow-wrap: break-word;
}

.web-letter__body p {
  margin: 0 0 0.52em;
  text-align: left;
}

.web-letter__body p:last-child {
  margin-bottom: 0;
}

.web-letter__env {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  width: var(--env-w);
  max-width: none;
  height: auto;
  margin-top: calc(var(--env-w) * -0.72);
  filter: drop-shadow(0 30px 45px rgba(0, 0, 0, 0.5));
  pointer-events: none;
  user-select: none;
}

/* ---------- photo collage ---------- */

.web-collage {
  position: relative;
  background-color: #58160f;
  background-image: url("../assets/texture-maroon.jpg");
  background-size: cover;
  background-position: center;
}

.web-collage__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1366 / 969;
}

.web-collage__semangatt {
  position: absolute;
  left: 67.8%;
  top: 12.8%;
  margin: 0;
  color: #f6ecdc;
  font-size: clamp(2.7rem, 5.55vw, 5rem);
  line-height: 0.9;
  text-align: left;
  text-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  transform: rotate(-5deg);
}

.web-collage__berprosess {
  position: absolute;
  left: 71.8%;
  top: 21%;
  margin: 0;
  color: #111;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(2.2rem, 4.8vw, 4.4rem);
  line-height: 1;
  transform: rotate(-1deg);
}

.web-collage__berprosess span {
  display: inline-block;
  padding: 0.06em 0.16em 0.1em;
  background: #ffe94d;
}

.web-collage__photos {
  display: contents;
}

.web-photo {
  position: absolute;
  margin: 0;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.38));
}

.web-photo img {
  display: block;
  width: 100%;
  height: auto;
}

.web-photo--1 { left: 19.2%; top: 20.9%; width: 19.95%; }
.web-photo--2 { left: 49.34%; top: 28.48%; width: 16.47%; }
.web-photo--3 { left: 59.1%; top: 44.5%; width: 20.9%; }
.web-photo--4 { left: 28.84%; top: 56.7%; width: 9.44%; }
.web-photo--5 { left: 39.35%; top: 48.86%; width: 9.59%; }
.web-photo--6 { left: 47.47%; top: 65.68%; width: 9.44%; }

.web-collage__caption {
  position: absolute;
  left: 50%;
  bottom: 5.8%;
  width: min(650px, 58%);
  margin: 0;
  color: #f6f1e9;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: clamp(1rem, 1.8vw, 1.5rem);
  line-height: 1.45;
  text-align: center;
  transform: translateX(-50%);
}

/* ---------- full-width bands ---------- */

.web-band {
  display: block;
  line-height: 0;
  background: #f3f0ea;
}

.web-band img {
  display: block;
  width: 100%;
  height: auto;
}

.web-band--lace {
  background: #230805;
}

/* ---------- closing ---------- */

.web-closing {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 65.4vw;
  padding: clamp(5rem, 10.74vw, 12rem) clamp(1.25rem, 5vw, 4rem) 0;
  overflow: hidden;
  background-color: #58160f;
  background-image: url("../assets/texture-maroon.jpg");
  background-size: cover;
  background-position: center;
  color: #faf9f6;
  text-align: center;
}

.web-closing__row {
  position: relative;
  display: flex;
  justify-content: center;
  width: auto;
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  font-size: clamp(3rem, 7.9vw, 7.9rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.web-closing__row span {
  display: block;
  transform: scaleX(0.91) scaleY(1.08);
  transform-origin: center;
}

.web-closing__row:first-child {
  left: 0.33vw;
  gap: clamp(3rem, 20.5vw, 26rem);
}

.web-closing__row--mid {
  left: 0.77vw;
  margin-top: clamp(1.8rem, 3.51vw, 4rem);
  gap: clamp(1.2rem, 3.85vw, 3rem);
}

.web-closing__row--wide {
  left: 0.37vw;
  margin-top: clamp(1.8rem, 3.56vw, 4rem);
}

.web-closing__row--wide span {
  transform: scaleY(1.08);
}

.web-closing__emoji {
  position: relative;
  left: -13.3vw;
  margin: clamp(1.9rem, 3.86vw, 4rem) 0 0;
  font-size: clamp(4rem, 10.4vw, 8.4rem);
  line-height: 0.9;
  letter-spacing: 0.08em;
}

.web-replay {
  position: absolute;
  left: 50%;
  bottom: clamp(1.6rem, 2.8vw, 2.4rem);
  margin: 0;
  padding: 0.4em 0.6em;
  border: 0;
  background: transparent;
  color: rgba(250, 249, 246, 0.5);
  font-family: var(--type);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transform: translateX(-50%);
  transition:
    color 0.25s ease,
    opacity 0.25s ease;
}

.web-replay:hover {
  color: #faf9f6;
}

.web-replay:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 4px;
}

/* ---------- sound toggle ---------- */

.sound-toggle {
  position: fixed;
  right: clamp(0.9rem, 2.4vw, 1.7rem);
  bottom: clamp(0.9rem, 2.4vw, 1.7rem);
  z-index: 60;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(244, 228, 196, 0.32);
  border-radius: 50%;
  background: rgba(30, 3, 6, 0.38);
  color: var(--cream);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition:
    background-color 0.25s ease,
    opacity 0.25s ease,
    transform 0.3s var(--ease);
}

.sound-toggle:hover {
  background: rgba(244, 228, 196, 0.14);
  transform: translateY(-1px);
}

.sound-toggle:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 3px;
}

.sound-toggle.is-muted {
  opacity: 0.55;
}

.sound-toggle.is-muted::after {
  content: "";
  position: absolute;
  width: 21px;
  height: 1.6px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(-45deg);
}

.sound-icon {
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1;
}

/* ---------- confetti ---------- */

#confetti {
  position: fixed;
  inset: 0;
  z-index: 70;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* =========================================================
   Animations
   ========================================================= */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.955);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

@keyframes drift {
  0%, 100% { transform: translateY(0) rotate(-13deg); }
  50% { transform: translateY(-8px) rotate(-11deg); }
}

@keyframes drift-soft {
  0%, 100% { transform: translateY(0) rotate(-9deg); }
  50% { transform: translateY(-8px) rotate(-7.5deg); }
}

@keyframes twinkle {
  0%, 100% {
    opacity: 0.15;
    transform: scale(0.8) rotate(0deg);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.12) rotate(18deg);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px) rotate(-1deg); }
  40% { transform: translateX(6px) rotate(1deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 900px) {
  .cover-deco--envelope {
    top: 62%;
    left: 3%;
    width: clamp(88px, 15vw, 140px);
  }

  .cover-deco--cat {
    right: 4%;
    top: 7%;
    width: clamp(92px, 16vw, 150px);
  }

  .sparkle--4 { left: 88%; }

  .web-cover__deco--env {
    left: 12%;
    top: 48%;
    width: clamp(100px, 15vw, 160px);
  }

  .web-cover__deco--cat {
    right: 10%;
    top: 5%;
    width: clamp(120px, 19vw, 190px);
  }

  .web-collage__caption {
    width: min(560px, 66%);
  }
}

@media (max-width: 760px) {
  .web-cover {
    min-height: 100vh;
    min-height: 100svh;
    padding: 0;
  }

  .web-cover__title {
    font-size: clamp(4rem, 21vw, 7rem);
    line-height: 0.78;
  }

  .web-cover__name {
    margin-top: 3rem;
    padding-left: 0.5em;
    letter-spacing: 0.5em;
  }

  .web-cover__deco--env {
    left: 7.5%;
    top: 46%;
    width: clamp(88px, 26vw, 128px);
  }

  .web-cover__deco--cat {
    right: 7%;
    top: 4%;
    width: clamp(96px, 32vw, 150px);
  }

  .tap-here {
    margin-top: auto;
    font-size: 1.3rem;
  }

  .web-letter {
    --letter-w: min(84vw, 380px);
    --env-w: min(calc(100vw - 1.25rem), calc(var(--letter-w) * 1.465));
    padding: 2.5rem 0 3rem;
  }

  .web-letter__card {
    padding-top: 1.6rem;
    padding-bottom: calc(var(--env-w) * 0.62);
  }

  .web-letter__body {
    font-size: clamp(0.9rem, 4vw, 1rem);
  }

  .web-collage__stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    aspect-ratio: auto;
    padding: 3.8rem 1.1rem 3rem;
  }

  .web-collage__semangatt {
    position: static;
    margin: 0 0 0.1em;
    font-size: clamp(2.7rem, 13vw, 3.7rem);
    text-align: center;
    transform: rotate(-4deg);
  }

  .web-collage__berprosess {
    position: static;
    margin: 0 0 2.2rem;
    font-size: clamp(2.1rem, 10vw, 2.9rem);
    transform: rotate(-1deg);
  }

  .web-collage__photos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 0.9rem;
    align-items: start;
    width: 100%;
    max-width: 430px;
  }

  .web-photo {
    position: static;
    width: 100%;
    filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.35));
  }

  .web-photo:nth-child(odd) {
    transform: rotate(-1.4deg);
  }

  .web-photo:nth-child(even) {
    margin-top: 1.6rem;
    transform: rotate(1.2deg);
  }

  .web-collage__caption {
    position: static;
    width: 100%;
    max-width: 380px;
    margin: 1.8rem 0 0;
    font-size: 1rem;
    transform: none;
  }

  .web-closing {
    padding: 4.2rem 1rem 3rem;
  }

  .web-closing__row {
    font-size: clamp(2.4rem, 12vw, 4.2rem);
  }

  .web-closing__row:first-child {
    gap: clamp(1.5rem, 10vw, 4rem);
  }

  .web-closing__row--mid {
    gap: 0.4rem;
  }

  .web-closing__row--wide {
    font-size: clamp(2.1rem, 11vw, 3.9rem);
  }

  .web-closing__emoji {
    left: -18vw;
    font-size: clamp(3rem, 15vw, 5.4rem);
  }
}

@media (max-width: 640px) {
  .scene {
    padding: 1rem;
  }

  .cover-inner {
    width: 100%;
    padding: 2.6rem 0 1rem;
  }

  .cover-title {
    font-size: clamp(4.6rem, 25vw, 7.6rem);
    line-height: 0.64;
  }

  .cover-title__birthday {
    transform: rotate(-2deg) translate(0.1em, 0);
  }

  .cover-kicker {
    letter-spacing: 0.34em;
  }

  .cover-deco--envelope {
    left: 2%;
    top: 69%;
    width: 82px;
  }

  .cover-deco--cat {
    right: 2%;
    top: 6%;
    width: 88px;
  }

  .cover-footnote {
    font-size: 0.58rem;
  }

  .cover-inner .btn--next {
    margin-top: 1.8rem;
  }





  .quiz-title {
    font-size: clamp(2.9rem, 13vw, 4.2rem);
  }

  .paper-card {
    width: 100%;
    padding: 1.4rem 1.15rem;
    margin-top: 1.4rem;
  }

  .date-grid {
    gap: 0.8rem;
  }

  .date-btn {
    font-size: 0.92rem;
    padding: 0.85em 0.2em 0.8em;
  }

  .result-card {
    border-radius: 16px;
  }

  .sound-toggle {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 380px) {
  .date-btn {
    font-size: 0.84rem;
  }

  .cover-title {
    font-size: 4.4rem;
  }
}

/* short landscape screens (phones / small laptops) */
@media (max-height: 660px) and (orientation: landscape) {
  .scene {
    padding-block: 1.1rem;
  }

  .cover-inner {
    padding-block: 0.4rem;
  }

  .cover-title {
    font-size: clamp(4rem, 11vw, 7.5rem);
  }

  .cover-name {
    margin-top: 0.8rem;
  }

  .cover-inner .btn--next {
    margin-top: 1.2rem;
  }

  .cover-footnote {
    margin-top: 0.7rem;
  }

  .cover-deco--cat {
    width: clamp(84px, 12vw, 130px);
  }

  .cover-deco--envelope {
    width: clamp(84px, 11vw, 130px);
  }






  .quiz-title {
    font-size: clamp(2.6rem, 6vw, 4rem);
  }

  .paper-card {
    margin-top: 1rem;
    padding: 1.2rem 1.6rem;
    width: min(430px, 90%);
  }

  .date-btn {
    padding: 0.62em 0.4em 0.58em;
    font-size: 0.9rem;
  }

  .quiz-hint {
    margin-top: 0.7rem;
  }

  .web-cover {
    min-height: 100vh;
    padding-block: 2.2rem 1.8rem;
  }

  .web-cover__title {
    font-size: clamp(3.4rem, 10vw, 6.5rem);
  }

  .web-cover__deco--cat {
    width: clamp(84px, 12vw, 135px);
  }

  .web-cover__deco--env {
    width: clamp(84px, 11vw, 135px);
  }

  .tap-here {
    margin-top: 1.5rem;
  }
}

/* ---------- reduced motion ---------- */

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

  .scene {
    transform: none;
  }

  .sparkle {
    opacity: 0.55;
  }
}
