* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
  overscroll-behavior-x: none;
}

:root {
  --brand-primary: #ae5431; /* R174 G84 B49 */
  --brand-primary-dark: #7f3b22;
  --brand-ink: #2f2018;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: "Helvetica Neue", Arial, sans-serif;
  background: #0b0b0b;
  overflow: hidden;
  overscroll-behavior-x: none;
  padding:
    calc(12px + env(safe-area-inset-top))
    calc(10px + env(safe-area-inset-right))
    calc(12px + env(safe-area-inset-bottom))
    calc(10px + env(safe-area-inset-left));
}

button,
input,
select,
textarea {
  font-family: inherit;
}

body.end-active {
  background: #0b0b0b;
}

.scene {
  --env-width: 460px;
  --env-half-w: 230px;
  --env-half-h: 150px;
  position: relative;
  width: min(100%, 520px);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  transition: opacity 1.6s ease-out, transform 1.6s ease-out;
}

body.end-active .scene {
  opacity: 0;
  transform: scale(0.98);
  pointer-events: none;
}

body.card-burning .scene {
  pointer-events: none;
}

.end-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 20;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.04), transparent 32%),
    #0b0b0b;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
  overflow: hidden;
}

body.end-active .end-screen {
  opacity: 1;
  pointer-events: auto;
}

.cinematic-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  isolation: isolate;
  overflow: hidden;
}

.cinematic-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 6% 12%, rgba(255, 255, 255, 0.92) 0 1px, transparent 1.8px),
    radial-gradient(circle at 14% 68%, rgba(255, 255, 255, 0.82) 0 1px, transparent 1.8px),
    radial-gradient(circle at 22% 26%, rgba(255, 255, 255, 0.88) 0 1.1px, transparent 2px),
    radial-gradient(circle at 30% 84%, rgba(255, 255, 255, 0.76) 0 1px, transparent 1.8px),
    radial-gradient(circle at 38% 18%, rgba(255, 255, 255, 0.9) 0 1px, transparent 1.8px),
    radial-gradient(circle at 46% 56%, rgba(255, 255, 255, 0.72) 0 1px, transparent 1.8px),
    radial-gradient(circle at 54% 8%, rgba(255, 255, 255, 0.84) 0 1px, transparent 1.8px),
    radial-gradient(circle at 62% 72%, rgba(255, 255, 255, 0.86) 0 1.1px, transparent 2px),
    radial-gradient(circle at 70% 24%, rgba(255, 255, 255, 0.78) 0 1px, transparent 1.8px),
    radial-gradient(circle at 78% 88%, rgba(255, 255, 255, 0.9) 0 1px, transparent 1.8px),
    radial-gradient(circle at 86% 42%, rgba(255, 255, 255, 0.8) 0 1px, transparent 1.8px),
    radial-gradient(circle at 94% 14%, rgba(255, 255, 255, 0.76) 0 1px, transparent 1.8px),
    radial-gradient(circle at 8% 92%, rgba(255, 255, 255, 0.7) 0 1px, transparent 1.8px),
    radial-gradient(circle at 18% 44%, rgba(255, 255, 255, 0.74) 0 1px, transparent 1.8px),
    radial-gradient(circle at 27% 6%, rgba(255, 255, 255, 0.68) 0 1px, transparent 1.8px),
    radial-gradient(circle at 35% 64%, rgba(255, 255, 255, 0.82) 0 1px, transparent 1.8px),
    radial-gradient(circle at 43% 36%, rgba(255, 255, 255, 0.76) 0 1px, transparent 1.8px),
    radial-gradient(circle at 51% 94%, rgba(255, 255, 255, 0.7) 0 1px, transparent 1.8px),
    radial-gradient(circle at 59% 48%, rgba(255, 255, 255, 0.86) 0 1.1px, transparent 2px),
    radial-gradient(circle at 68% 82%, rgba(255, 255, 255, 0.72) 0 1px, transparent 1.8px),
    radial-gradient(circle at 76% 52%, rgba(255, 255, 255, 0.76) 0 1px, transparent 1.8px),
    radial-gradient(circle at 84% 6%, rgba(255, 255, 255, 0.72) 0 1px, transparent 1.8px),
    radial-gradient(circle at 92% 76%, rgba(255, 255, 255, 0.84) 0 1px, transparent 1.8px);
  opacity: 0.82;
  animation: starDrift 32s linear infinite;
  z-index: 0;
}

.quote-layer,
.identity-panel,
.event-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
  overflow: hidden;
}

.quote-layer {
  padding: 24px;
  pointer-events: none;
  z-index: 2;
}

.quote-write-stage {
  position: relative;
  width: 100%;
  max-width: min(90vw, 860px);
  margin: 0 auto;
  text-align: center;
}

.quill-writer {
  --quill-x: 0px;
  --quill-y: 0px;
  --quill-tilt: -14deg;
  position: absolute;
  left: var(--quill-x);
  top: var(--quill-y);
  width: clamp(104px, 15vw, 152px);
  transform: translate(-5%, -93%) rotate(var(--quill-tilt));
  transform-origin: 5% 93%;
  opacity: 0;
  z-index: 3;
  pointer-events: none;
  transition: left 90ms ease-in-out, top 90ms ease-in-out, transform 80ms ease, opacity 0.2s ease;
}

.quill-writer.active {
  opacity: 1;
}

.quill-feather-image {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  filter:
    drop-shadow(0 0 1px rgba(255, 231, 195, 0.4))
    drop-shadow(0 0 10px rgba(0, 0, 0, 0.55));
}

.quote-particle-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.quote-particle-field.active {
  display: block;
}

.quote-particle {
  position: absolute;
  width: var(--size, 4px);
  height: var(--size, 4px);
  left: var(--left, 50%);
  top: var(--top, 50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(237, 222, 194, 0.35) 45%, rgba(255, 255, 255, 0) 100%);
  filter: blur(0.15px);
  opacity: 0;
  animation: quoteParticleDrift var(--duration, 16s) ease-in-out var(--delay, -8s) infinite;
}

.event-stage .quote-particle {
  mix-blend-mode: normal;
}

.quote-particle-field.hidden {
  display: none;
}

.cinematic-quote {
  width: 100%;
  margin: 0 auto;
  text-align: center;
  color: #f1e6d3;
  font-size: clamp(1.3rem, 2.6vw, 2.6rem);
  line-height: 1.35;
  letter-spacing: 0.04em;
  text-transform: none;
  opacity: 0;
  text-shadow: 0 0 18px rgba(206, 180, 140, 0.12);
}

.cinematic-quote.quill-feather {
  font-family: "Tangerine", "Times New Roman", serif;
  font-size: clamp(2.4rem, 6.2vw, 5rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.05;
  color: #ffe7bf;
  text-shadow:
    0 0 10px rgba(255, 228, 179, 0.8),
    0 0 24px rgba(226, 173, 88, 0.38);
  transform: rotate(-2deg);
}

.cinematic-quote.quill-feather .quill-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(6px) scale(0.94);
  will-change: opacity, transform;
}

.cinematic-quote.quill-feather .quill-char.revealed {
  animation: quillInkIn 250ms ease forwards;
}

.cinematic-quote.quill-feather .quill-space {
  display: inline-block;
}

.cinematic-quote.windsong {
  font-family: "WindSong", "Tangerine", "Brush Script MT", cursive;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.18;
}

.cinematic-quote.typewriter .type-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(4px);
  will-change: opacity, transform;
}

.cinematic-quote.typewriter .type-char.revealed {
  animation: typewriterInkIn 180ms ease forwards;
}

.cinematic-quote.typewriter .type-space {
  display: inline-block;
}

.cinematic-quote.glow {
  color: #fff3dc;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  text-shadow:
    0 0 12px rgba(255, 233, 194, 0.95),
    0 0 28px rgba(244, 211, 153, 0.75),
    0 0 52px rgba(230, 175, 95, 0.52),
    0 0 90px rgba(223, 165, 87, 0.32);
  filter: drop-shadow(0 0 24px rgba(255, 212, 148, 0.55));
}

.cinematic-quote.windsong.glow {
  text-transform: none;
}

.cinematic-quote.play {
  animation-duration: var(--quote-play-ms, 4.8s);
  animation-timing-function: cubic-bezier(0.2, 0.9, 0.22, 1);
  animation-fill-mode: forwards;
}

.cinematic-quote.from-center.play {
  animation-name: quoteCenterFade;
}

/* quill-written quotes: fade in only — the quill controls visibility per letter */
.cinematic-quote.quill-feather.play {
  animation-name: quillQuoteFadeIn;
  animation-duration: 600ms;
  animation-fill-mode: forwards;
}

.cinematic-quote.from-top-left.play {
  animation-name: quoteTopLeft;
}

.cinematic-quote.from-bottom-right.play {
  animation-name: quoteBottomRight;
}

.cinematic-quote.from-bottom.play {
  animation-name: quoteBottom;
}

.cinematic-quote.from-top.play {
  animation-name: quoteTop;
}

.identity-panel {
  place-items: center;
  gap: 22px;
  padding: 24px;
  text-align: center;
  justify-content: center;
}

.identity-panel.hidden,
.key-panel.hidden,
.event-stage.hidden {
  display: none;
}

.identity-panel.visible {
  display: grid;
  animation: fadeInSoft 1.2s ease forwards;
}

.identity-title {
  height: clamp(205px, 37vh, 430px);
  width: min(clamp(700px, 94vw, 1360px), 98vw);
  max-width: 98vw;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(227, 204, 168, 0.14))
    drop-shadow(0 0 34px rgba(184, 144, 102, 0.1));
}

.lock-panel,
.key-panel {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.lock-button,
.enter-button {
  font: inherit;
  border: none;
  cursor: pointer;
}

.lock-button {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(244, 229, 202, 0.14), rgba(44, 34, 27, 0.95));
  box-shadow:
    inset 0 0 0 1px rgba(232, 213, 186, 0.12),
    0 0 26px rgba(0, 0, 0, 0.45);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.lock-button:hover {
  transform: scale(1.05);
  box-shadow:
    inset 0 0 0 1px rgba(232, 213, 186, 0.22),
    0 0 32px rgba(170, 128, 90, 0.14);
}

.lock-button:disabled {
  cursor: default;
  opacity: 0.82;
}

.lock-icon,
.key-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
}

.lock-copy,
.key-status {
  color: rgba(241, 230, 211, 0.82);
  font-size: clamp(0.9rem, 1.8vw, 1.05rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.key-panel.visible {
  display: grid;
  animation: fadeInSoft 0.8s ease forwards;
}

.key-icon {
  color: #c96d48;
  filter: drop-shadow(0 0 12px rgba(201, 109, 72, 0.38));
  animation: keyRotate 4s linear infinite;
}

.key-status.visible,
.enter-button.visible {
  display: block;
}

.event-stage.visible {
  display: grid;
}

.enter-button {
  padding: 12px 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e5d2b9 0%, #b89972 100%);
  color: #140f0c;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.88rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34);
  transition: transform 0.28s ease, box-shadow 0.28s ease, opacity 0.28s ease;
}

.enter-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.42);
}

.event-stage {
  display: none;
  position: relative;
  width: 100%;
  max-width: 100%;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  overflow-x: clip;
  background: #0b0b0b;
  touch-action: pan-y;
}

.event-stage::before,
.event-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.event-stage::before {
  background-image:
    radial-gradient(circle at 10% 16%, rgba(255, 255, 255, 0.95) 0 1px, transparent 1.8px),
    radial-gradient(circle at 20% 70%, rgba(255, 255, 255, 0.76) 0 1px, transparent 1.8px),
    radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.88) 0 1.2px, transparent 2px),
    radial-gradient(circle at 48% 12%, rgba(255, 255, 255, 0.74) 0 1px, transparent 1.8px),
    radial-gradient(circle at 60% 66%, rgba(255, 255, 255, 0.9) 0 1.2px, transparent 2px),
    radial-gradient(circle at 72% 20%, rgba(255, 255, 255, 0.8) 0 1px, transparent 1.8px),
    radial-gradient(circle at 84% 54%, rgba(255, 255, 255, 0.9) 0 1.1px, transparent 2px),
    radial-gradient(circle at 92% 10%, rgba(255, 255, 255, 0.68) 0 1px, transparent 1.7px),
    radial-gradient(circle at 8% 86%, rgba(255, 255, 255, 0.76) 0 1px, transparent 1.8px),
    radial-gradient(circle at 56% 88%, rgba(255, 255, 255, 0.84) 0 1.1px, transparent 1.9px),
    radial-gradient(circle at 16% 34%, rgba(255, 255, 255, 0.78) 0 1px, transparent 1.8px),
    radial-gradient(circle at 28% 52%, rgba(255, 255, 255, 0.7) 0 1px, transparent 1.8px),
    radial-gradient(circle at 40% 24%, rgba(255, 255, 255, 0.8) 0 1px, transparent 1.8px),
    radial-gradient(circle at 52% 44%, rgba(255, 255, 255, 0.76) 0 1px, transparent 1.8px),
    radial-gradient(circle at 64% 78%, rgba(255, 255, 255, 0.86) 0 1px, transparent 1.8px),
    radial-gradient(circle at 76% 36%, rgba(255, 255, 255, 0.72) 0 1px, transparent 1.8px),
    radial-gradient(circle at 88% 68%, rgba(255, 255, 255, 0.82) 0 1.1px, transparent 2px);
  opacity: 0.72;
  animation: starDriftAlt 24s linear infinite;
  z-index: 0;
}

.event-stage::after {
  background: none;
  filter: none;
  opacity: 0;
  z-index: 0;
}

.particle-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.particle {
  position: absolute;
  width: var(--size, 4px);
  height: var(--size, 4px);
  left: var(--left, 50%);
  top: var(--top, 50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.98), rgba(255, 239, 203, 0.54), rgba(255, 255, 255, 0));
  opacity: 0;
  filter: blur(0.16px);
  mix-blend-mode: screen;
  animation: particleChaos var(--duration, 8.4s) cubic-bezier(0.24, 0.76, 0.29, 1) var(--delay, -4s) infinite;
}

.event-card {
  position: relative;
  z-index: 3;
  width: min(100%, 720px);
  max-width: 100%;
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 0;
  border-radius: 0;
  background: none;
  border: 0;
  color: #241813;
  text-align: center;
  box-shadow: none;
  opacity: 0;
  transform: translateY(34px) scale(0.94);
  animation: cardArrival 1.2s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

.event-card::before,
.event-card::after {
  content: none;
}

.event-card > * {
  position: relative;
  z-index: 2;
}

.event-key {
  width: clamp(72px, 15vw, 120px);
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  font-size: clamp(2.8rem, 7vw, 4.2rem);
  color: #c69253;
  filter: drop-shadow(0 10px 18px rgba(173, 124, 61, 0.25));
  animation: keyEnter 780ms ease;
}

.accepted-copy {
  margin: 0 0 24px;
  font-size: clamp(1.2rem, 4vw, 2rem);
  line-height: 1.2;
  color: #2f2018;
}

.event-image-card {
  position: relative;
  width: min(100%, 680px);
  max-width: 100%;
  margin-inline: auto;
  transform-origin: center;
  animation: scrollCardZoomIn 8.2s cubic-bezier(0.18, 0.8, 0.24, 1) forwards;
}

.event-image {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 30px 70px rgba(0, 0, 0, 0.52));
}

.event-image-details {
  position: absolute;
  inset: 24% 12% 16%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(6px, 1.4vw, 12px);
  text-align: center;
}

.event-detail-line {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.label {
  color: #ffe2c2;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: clamp(0.78rem, 1.7vw, 1.02rem);
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(58, 24, 12, 0.7);
}

.value {
  color: #fff6ea;
  font-size: clamp(0.94rem, 2.3vw, 1.36rem);
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(52, 20, 10, 0.75);
}

.invitation-text .value {
  font-family: "Great Vibes", cursive;
  font-size: clamp(1.12rem, 2.7vw, 1.7rem);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: 0.01em;
  text-align: center;
  display: block;
  padding-top: 0.8em;
}

.invitation-text .invite-brand {
  display: block;
  text-align: center;
  margin-top: 1.2em;
}

.invitation-text .invite-brand-logo {
  display: block;
  width: clamp(195px, 50%, 285px);
  height: auto;
  margin: 0 auto;
}

.event-meta-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(8px, 1.8vw, 16px);
  align-items: center;
  justify-items: center;
  transform: translateY(-20px);
}

.event-meta-footer .event-detail-line {
  gap: 3px;
}

.event-meta-footer .value {
  font-size: clamp(0.8rem, 1.7vw, 1.02rem);
}

.location-detail-line {
  align-items: center;
  justify-items: center;
  text-align: center;
}

.location-map-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: inherit;
}

.location-map-link .label,
.location-map-link .value {
  pointer-events: none;
}

.view-map-hint {
  font-size: clamp(0.52rem, 1.2vw, 0.68rem);
  color: rgba(255, 226, 194, 0.7);
  letter-spacing: 0.08em;
  text-transform: none;
  transition: color 0.2s ease;
}

.location-map-link:hover .view-map-hint {
  color: #ffe2c2;
}

.location-castle-icon {
  width: clamp(58px, 8.5vw, 82px);
  height: auto;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
  transition: transform 0.2s ease, filter 0.2s ease;
}

.location-map-link:hover .location-castle-icon {
  transform: translateY(-1px) scale(1.05);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.42));
}

.rsvp-row {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 6px;
  max-width: 100%;
}

.rsvp-button {
  border: 1px solid var(--brand-primary);
  padding: 10px 30px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(230, 214, 190, 0.95) 0%, rgba(190, 170, 142, 0.95) 100%);
  color: var(--brand-primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.45),
    0 12px 24px rgba(45, 29, 18, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  max-width: 100%;
}

.rsvp-button:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.6),
    0 16px 28px rgba(45, 29, 18, 0.28);
  filter: brightness(1.03);
}

.rsvp-panel {
  position: absolute;
  inset: 11% 12% 12%;
  margin-top: 0;
  padding: 16px 14px 14px;
  border-radius: 16px;
  border: 1px solid rgba(174, 84, 49, 0.35);
  background: linear-gradient(180deg, rgba(244, 236, 226, 0.95) 0%, rgba(225, 209, 190, 0.94) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 16px 32px rgba(26, 18, 12, 0.22);
  overflow: auto;
  z-index: 4;
}

.rsvp-panel.hidden {
  display: none;
}

.rsvp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.rsvp-title {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.95rem;
  color: #8b4326;
  margin-bottom: 0;
}

.rsvp-close {
  border: 1px solid rgba(143, 66, 38, 0.3);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 248, 240, 0.82);
  color: #8b4326;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.63rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 8px 16px rgba(76, 48, 30, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.rsvp-close:hover {
  transform: translateY(-1px);
  background: rgba(255, 250, 244, 0.95);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 10px 18px rgba(76, 48, 30, 0.12);
}

.rsvp-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  text-align: left;
}

.rsvp-field {
  display: grid;
  gap: 4px;
  font-size: 0.74rem;
  color: #2f2018;
  letter-spacing: 0.05em;
}

.rsvp-field span {
  display: block;
}

.rsvp-field input,
.rsvp-field select,
.rsvp-field textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(174, 84, 49, 0.35);
  background: rgba(248, 239, 226, 0.95);
  font-size: 0.85rem;
  color: #2f2018;
  resize: vertical;
  box-shadow:
    inset 0 2px 4px rgba(76, 48, 30, 0.16),
    inset 0 -1px 0 rgba(255, 255, 255, 0.7);
}

.rsvp-date-picker,
.rsvp-time-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rsvp-date-picker select,
.rsvp-time-picker select {
  border-radius: 999px;
  text-align: center;
  text-align-last: center;
  appearance: none;
  min-height: 42px;
  padding-inline: 14px;
  background:
    linear-gradient(180deg, rgba(251, 245, 235, 0.98) 0%, rgba(232, 215, 194, 0.96) 100%);
  box-shadow:
    inset 0 2px 4px rgba(76, 48, 30, 0.16),
    inset 0 -1px 0 rgba(255, 255, 255, 0.7),
    0 8px 18px rgba(76, 48, 30, 0.12);
}

.rsvp-submit {
  border: none;
  padding: 10px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #c86a43 0%, #8f4226 100%);
  color: #fff3e6;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(26, 18, 12, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.event-image-card.show-rsvp .event-image-details {
  opacity: 0;
  pointer-events: none;
}

.event-image-card.show-rsvp .rsvp-panel {
  display: block;
}

.rsvp-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(26, 18, 12, 0.35);
  filter: brightness(1.05);
}

@keyframes quoteCenterFade {
  0% { opacity: 0; transform: translateY(18px) scale(0.98); }
  16% { opacity: 1; transform: translateY(0) scale(1); }
  70% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-18px) scale(1.01); }
}

@keyframes quillQuoteFadeIn {
  0% { opacity: 0; transform: translateY(12px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes quoteTopLeft {
  0% { opacity: 0; transform: translate(-18vw, -16vh) scale(0.96); }
  18% { opacity: 1; transform: translate(0, 0) scale(1); }
  72% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(2vw, -2vh) scale(1.01); }
}

@keyframes quoteBottomRight {
  0% { opacity: 0; transform: translate(18vw, 16vh) scale(0.96); }
  18% { opacity: 1; transform: translate(0, 0) scale(1); }
  72% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(-2vw, 2vh) scale(1.01); }
}

@keyframes quoteBottom {
  0% { opacity: 0; transform: translateY(18vh) scale(0.96); }
  18% { opacity: 1; transform: translateY(0) scale(1); }
  72% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-2vh) scale(1.01); }
}

@keyframes quoteTop {
  0% { opacity: 0; transform: translateY(-18vh) scale(0.96); }
  18% { opacity: 1; transform: translateY(0) scale(1); }
  72% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(2vh) scale(1.01); }
}

@keyframes quillInkIn {
  0% { opacity: 0; transform: translateY(6px) scale(0.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes typewriterInkIn {
  0% { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInSoft {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes keyRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes quoteParticleDrift {
  0% {
    transform: translate3d(0, 0, 0) scale(var(--start-scale, 0.7));
    opacity: 0;
  }
  18% {
    opacity: var(--peak-opacity, 0.55);
  }
  45% {
    transform: translate3d(var(--x-mid, 20px), var(--y-mid, -60px), 0) scale(var(--mid-scale, 1.04));
    opacity: calc(var(--peak-opacity, 0.55) * 0.86);
  }
  100% {
    transform: translate3d(var(--x-end, -28px), var(--y-end, -180px), 0) scale(var(--end-scale, 0.66));
    opacity: 0;
  }
}

@keyframes particleFloat {
  0% { transform: translate3d(0, 0, 0) scale(0.72); opacity: 0.08; }
  20% { transform: translate3d(24px, -22px, 0) scale(0.96); opacity: 0.34; }
  40% { transform: translate3d(-18px, -58px, 0) scale(1.08); opacity: 0.54; }
  60% { transform: translate3d(30px, -96px, 0) scale(0.92); opacity: 0.4; }
  80% { transform: translate3d(-22px, -142px, 0) scale(0.82); opacity: 0.22; }
  100% { transform: translate3d(14px, -196px, 0) scale(0.68); opacity: 0.04; }
}

@keyframes particleFloatAlt {
  0% { transform: translate3d(0, 0, 0) scale(0.7); opacity: 0.1; }
  25% { transform: translate3d(-28px, -18px, 0) scale(0.96); opacity: 0.3; }
  50% { transform: translate3d(22px, -72px, 0) scale(1.12); opacity: 0.56; }
  75% { transform: translate3d(-30px, -126px, 0) scale(0.88); opacity: 0.24; }
  100% { transform: translate3d(18px, -188px, 0) scale(0.66); opacity: 0.05; }
}

@keyframes particleFloatSlow {
  0% { transform: translate3d(0, 0, 0) scale(0.78); opacity: 0.12; }
  30% { transform: translate3d(16px, -30px, 0) scale(0.94); opacity: 0.28; }
  60% { transform: translate3d(-12px, -92px, 0) scale(1.04); opacity: 0.44; }
  100% { transform: translate3d(10px, -164px, 0) scale(0.74); opacity: 0.06; }
}

@keyframes particleChaos {
  0% {
    transform: translate3d(0, 0, 0) scale(var(--start-scale, 0.62));
    opacity: 0;
  }
  12% {
    opacity: var(--peak-opacity, 0.68);
  }
  30% {
    transform: translate3d(var(--x-one, 60px), var(--y-one, -80px), 0) scale(var(--scale-one, 1.16));
    opacity: calc(var(--peak-opacity, 0.68) * 0.9);
  }
  55% {
    transform: translate3d(var(--x-two, -90px), var(--y-two, -30px), 0) scale(var(--scale-two, 0.8));
    opacity: calc(var(--peak-opacity, 0.68) * 0.58);
  }
  78% {
    transform: translate3d(var(--x-three, 44px), var(--y-three, -160px), 0) scale(var(--scale-three, 1.02));
    opacity: calc(var(--peak-opacity, 0.68) * 0.34);
  }
  100% {
    transform: translate3d(var(--x-end, -70px), var(--y-end, -220px), 0) scale(var(--end-scale, 0.5));
    opacity: 0;
  }
}

@keyframes starDrift {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-10px, 14px, 0); }
  100% { transform: translate3d(0, 28px, 0); }
}

@keyframes starDriftAlt {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(12px, -10px, 0); }
  100% { transform: translate3d(-6px, 24px, 0); }
}

@keyframes cardArrival {
  0% { opacity: 0; transform: translateY(34px) scale(0.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes scrollCardZoomIn {
  0% {
    opacity: 0;
    transform: scale(0.9);
    filter: blur(0.8px);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes keyEnter {
  0% { opacity: 0; transform: translateY(14px) scale(0.85) rotate(-12deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

@keyframes borderPulse {
  0%, 100% {
    box-shadow:
      0 30px 70px rgba(0, 0, 0, 0.52),
      0 0 0 rgba(214, 195, 166, 0);
  }
  50% {
    box-shadow:
      0 34px 78px rgba(0, 0, 0, 0.58),
      0 0 28px rgba(214, 195, 166, 0.14);
  }
}

.light {
  position: absolute;
  top: 40%;
  left: 50%;
  width: min(640px, 140vw);
  height: min(640px, 140vw);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 240, 215, 0.26) 0%, rgba(255, 240, 215, 0.12) 36%, rgba(0, 0, 0, 0) 72%);
  opacity: 0;
  filter: blur(3px);
  pointer-events: none;
  overflow: hidden;
  border-radius: 50%;
  transition: opacity 4.2s ease;
}

.light-dot {
  position: absolute;
  left: var(--left, 50%);
  top: var(--top, 50%);
  width: var(--size, 2px);
  height: var(--size, 2px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 252, 245, 0.95), rgba(255, 229, 183, 0.42), rgba(255, 255, 255, 0));
  opacity: 0;
  animation: lightDotDrift var(--duration, 12s) ease-in-out var(--delay, -4s) infinite;
}

body.revealed .light {
  opacity: 1;
}

.wrapper {
  height: calc(var(--env-half-h) * 2);
  width: var(--env-width);
  max-width: 100%;
  position: relative;
  display: flex;
  justify-content: center;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transition: opacity 4s ease, transform 4s ease;
}

body.revealed .wrapper {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.wrapper.floating {
  animation: float 3.4s ease-in-out infinite;
}

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

@keyframes lightDotDrift {
  0% {
    transform: translate3d(0, 0, 0) scale(var(--start-scale, 0.7));
    opacity: 0;
  }
  22% {
    opacity: var(--peak-opacity, 0.4);
  }
  50% {
    transform: translate3d(var(--x-mid, 40px), var(--y-mid, -40px), 0) scale(var(--mid-scale, 1));
    opacity: calc(var(--peak-opacity, 0.4) * 0.84);
  }
  100% {
    transform: translate3d(var(--x-end, -60px), var(--y-end, 60px), 0) scale(var(--end-scale, 0.7));
    opacity: 0;
  }
}

.lid {
  position: absolute;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  border-right: var(--env-half-w) solid transparent;
  border-bottom: var(--env-half-h) solid transparent;
  border-left: var(--env-half-w) solid transparent;
  transform-origin: top;
  transition: transform 0.35s linear, opacity 0.5s ease;
}

.lid.one {
  border-top: var(--env-half-h) solid #181818;
  transform: rotateX(0deg);
  z-index: 3;
  transition-delay: 0.45s;
}

.lid.two {
  border-top: var(--env-half-h) solid #0b0b0b;
  transform: rotateX(90deg);
  z-index: 1;
  transition-delay: 0.2s;
}

.envelope {
  position: absolute;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  border-top: var(--env-half-h) solid transparent;
  border-right: var(--env-half-w) solid #111;
  border-bottom: var(--env-half-h) solid #111;
  border-left: var(--env-half-w) solid #1d1d1d;
  z-index: 3;
  transition: opacity 0.5s ease;
}

.seal {
  position: absolute;
  width: 180px;
  height: 180px;
  top: 58%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  transition: opacity 0.45s ease, transform 0.45s ease;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

.seal-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.46s ease, transform 0.52s ease, filter 0.52s ease;
  will-change: opacity, transform, filter;
}

.seal-intact {
  opacity: 1;
  transform: scale(1);
}

.seal-broken {
  opacity: 0;
  transform: scale(0.9) rotate(-7deg);
  filter: blur(0.4px);
}

.seal:focus-visible {
  outline: 2px solid #f2d4a9;
  outline-offset: 3px;
  border-radius: 50%;
}

.letter {
  position: absolute;
  top: 0;
  width: 86%;
  min-height: 88%;
  height: 88%;
  background-color: #e6b39c;
  border-radius: 15px;
  z-index: 2;
  transition: transform 0.9s ease, height 1.25s cubic-bezier(0.18, 0.82, 0.2, 1);
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  isolation: isolate;
  --letter-torn-edge: polygon(
    2% 2.5%,
    8% 1.2%,
    16% 2.1%,
    26% 0.9%,
    37% 2.2%,
    49% 1.1%,
    61% 2.3%,
    72% 1.4%,
    84% 2.5%,
    92% 1.4%,
    98% 3.6%,
    99% 12%,
    97.8% 21%,
    99% 32%,
    97.6% 44%,
    98.9% 56%,
    97.5% 68%,
    98.6% 79%,
    96.8% 90%,
    98% 97%,
    90% 98.6%,
    79% 97.2%,
    68% 98.7%,
    56% 97.3%,
    44% 98.6%,
    33% 97.1%,
    22% 98.3%,
    11% 97.2%,
    3% 98.5%,
    1.2% 90%,
    2.4% 79%,
    1.1% 67%,
    2.3% 56%,
    0.9% 44%,
    2.1% 32%,
    0.8% 20%,
    2.2% 11%
  );
  /* Slightly irregular silhouette for a torn vintage paper feel. */
  clip-path: var(--letter-torn-edge);
  box-shadow:
    0 18px 28px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(96, 52, 37, 0.12);
}

.letter h1 {
  text-align: center;
  font-size: 20px;
  font-family: "Dancing Script", cursive;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #000;
  line-height: 1.2;
}

.riddle {
  text-align: center;
  font-size: 13px;
  font-family: "Dancing Script", cursive;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.35;
  color: #000;
}

.letter > * {
  position: relative;
  z-index: 2;
}

.letter::before,
.letter::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.letter::before {
  z-index: 3;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E"),
    linear-gradient(
      180deg,
      #fff 0%,
      #fff3c9 12%,
      #ffc54d 28%,
      #ff7c1f 46%,
      #ae2300 72%,
      #220402 100%
    );
  background-size: 260% 320%, 220% 300%, 100% 100%;
  background-position: 1536px 9216px, 0 7168px, 0 0;
  background-repeat: repeat, repeat, no-repeat;
  background-blend-mode: difference, difference, normal;
  filter: sepia(1) contrast(6) saturate(2.2) brightness(1.05);
  transform: translateY(100%);
  mask-image: linear-gradient(
    to top,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 22%,
    rgba(0, 0, 0, 0.92) 34%,
    rgba(0, 0, 0, 0.55) 48%,
    rgba(0, 0, 0, 0.16) 64%,
    rgba(0, 0, 0, 0) 78%
  );
}

.letter::after {
  z-index: 4;
  background:
    radial-gradient(circle at 14% 100%, rgba(255, 236, 173, 0.92) 0%, rgba(255, 236, 173, 0) 26%),
    radial-gradient(circle at 52% 100%, rgba(255, 208, 120, 0.9) 0%, rgba(255, 208, 120, 0) 32%),
    radial-gradient(circle at 82% 100%, rgba(255, 163, 88, 0.86) 0%, rgba(255, 163, 88, 0) 28%),
    linear-gradient(
      to top,
      rgba(10, 4, 2, 0.98) 0%,
      rgba(23, 9, 4, 0.96) 14%,
      rgba(49, 15, 4, 0.82) 28%,
      rgba(77, 27, 7, 0.48) 42%,
      rgba(45, 20, 12, 0.12) 60%,
      rgba(45, 20, 12, 0) 76%
    );
  mix-blend-mode: multiply;
  transform-origin: bottom center;
  transform: scaleY(0);
  filter: blur(1.2px) saturate(1.2);
}

.answer-form {
  display: flex;
  gap: 6px;
  width: 100%;
  flex-shrink: 0;
}

.answer-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid #000;
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  color: #000;
  background: #f3d1c2;
}

.answer-form button {
  flex-shrink: 0;
  white-space: nowrap;
  border: 1px solid #000;
  border-radius: 8px;
  padding: 8px 10px;
  background: #d99b80;
  color: #000;
  font-size: 12px;
  cursor: pointer;
}

.answer-form input:disabled,
.answer-form button:disabled {
  opacity: 0.72;
  cursor: default;
}

.hint,
.result {
  text-align: center;
  font-size: 11px;
  color: #000;
}

.hint {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 84px;
  flex-shrink: 0;
  margin-top: 6px;
}

.hint-bottle {
  position: relative;
  width: 52px;
  height: 78px;
  border-radius: 12px 12px 16px 16px;
  border: 1px solid #7f4f3f;
  background: linear-gradient(180deg, #ffc7a5 0%, #e9885f 100%);
  box-shadow:
    inset 1px 0 0 rgba(255, 255, 255, 0.55),
    inset -1px -3px 0 rgba(120, 60, 35, 0.28),
    0 2px 4px rgba(0, 0, 0, 0.3);
  transform-origin: 20% 80%;
  cursor: pointer;
}

.hint-bottle::before {
  content: "";
  position: absolute;
  inset: 8px 6px 10px;
  border-radius: 10px 10px 12px 12px;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(122, 65, 42, 0.18) 0 2px,
      rgba(255, 255, 255, 0.08) 2px 6px
    );
  pointer-events: none;
}

.hint.spill .hint-bottle {
  animation: bottleTilt 0.72s ease forwards;
}

.hint-bottle-cap {
  position: absolute;
  top: -14px;
  left: 1px;
  width: 50px;
  height: 14px;
  border-radius: 7px 7px 4px 4px;
  border: 1px solid #4e6270;
  background: linear-gradient(180deg, #cde8ff 0%, #8bb0c7 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transform-origin: 8% 88%;
}

.hint-bottle-cap::before {
  content: "";
  position: absolute;
  inset: 2px 3px;
  border-radius: 5px 5px 3px 3px;
  background:
    linear-gradient(
      to bottom,
      rgba(208, 230, 245, 0.45) 0,
      rgba(208, 230, 245, 0.45) 45%,
      rgba(67, 92, 110, 0.6) 45%,
      rgba(67, 92, 110, 0.6) 58%,
      rgba(208, 230, 245, 0.45) 58%,
      rgba(208, 230, 245, 0.45) 100%
    );
  pointer-events: none;
}

.hint.spill .hint-bottle-cap {
  animation: capOpen 0.44s cubic-bezier(0.2, 0.9, 0.2, 1) 0.08s forwards;
}

.hint-bottle-label {
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 36px;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid #b36a51;
  background: #ffe7da;
  color: #7a351f;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.hint-pills {
  display: none;
  position: relative;
  width: 178px;
  height: 44px;
}

.hint.spill .hint-pills {
  display: block;
}

.hint-pill {
  position: absolute;
  left: 4px;
  bottom: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #7b5a4e;
  background: linear-gradient(180deg, #ffe2d4 0%, #efb79f 55%, #de987f 100%);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #2b1c16;
  line-height: 1;
  text-transform: lowercase;
  min-width: 54px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -2px 0 rgba(118, 66, 49, 0.32),
    0 2px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  opacity: 0;
  cursor: pointer;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.hint.spill .hint-pill:nth-child(1) {
  animation: roll1 1.5s 0.2s forwards;
}

.hint.spill .hint-pill:nth-child(2) {
  animation: roll2 1.7s 0.24s forwards;
}

.hint.spill .hint-pill:nth-child(3) {
  animation: roll3 1.9s 0.28s forwards;
}

.hint-pill:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -2px 0 rgba(118, 66, 49, 0.34),
    0 4px 6px rgba(0, 0, 0, 0.28);
}

.hint-pill:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 2px rgba(118, 66, 49, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.2);
}

@keyframes roll1 {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: translate(70px, 8px) rotate(360deg);
  }
}

@keyframes roll2 {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: translate(116px, 14px) rotate(450deg);
  }
}

@keyframes roll3 {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: translate(154px, 18px) rotate(520deg);
  }
}

@keyframes bottleTilt {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(86deg);
  }
}

@keyframes capOpen {
  0% {
    transform: rotate(0deg) translate(0, 0);
  }
  65% {
    transform: rotate(-120deg) translate(-8px, -10px);
  }
  100% {
    transform: rotate(-104deg) translate(-7px, -8px);
  }
}

.hidden {
  display: none !important;
}

.result {
  min-height: 16px;
  font-weight: 700;
}

.tap-open {
  border: none;
  background: transparent;
  color: var(--brand-primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
  transition: opacity 0.4s ease;
}

body.ready .tap-open {
  opacity: 1;
  pointer-events: auto;
  animation: promptZoom 2.2s ease-in-out infinite;
}

@keyframes promptZoom {
  0% { transform: scale(0.94); }
  50% { transform: scale(1.05); }
  100% { transform: scale(0.94); }
}

.wrapper.open .lid.one {
  transform: rotateX(90deg);
  transition-delay: 0s;
}

.wrapper.open .lid.two {
  transform: rotateX(180deg);
  transition-delay: 0.2s;
}

.wrapper.open .letter {
  transform: translateY(-110%);
  height: 118%;
  transition-delay: 0.32s;
}

.wrapper.open.drop .letter {
  transform: translateY(-8%);
  height: 124%;
  transition-delay: 0s;
  transition-duration: 0.8s;
  z-index: 5;
  animation: settleZoom 1.6s ease-out 0.8s forwards;
}

.wrapper.open .seal {
  opacity: 1;
}

.wrapper.cracked .seal-intact,
.wrapper.open .seal-intact,
.wrapper.envelope-gone .seal-intact {
  opacity: 0;
  transform: scale(0.86) rotate(9deg);
  filter: blur(0.5px);
}

.wrapper.cracked .seal-broken,
.wrapper.open .seal-broken {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  filter: blur(0);
}

.wrapper.cracked .seal {
  animation: sealBreakPulse 0.45s ease;
}

.wrapper.envelope-gone .lid,
.wrapper.envelope-gone .envelope {
  opacity: 0;
}

.wrapper.envelope-gone .seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.06);
  transition: opacity 1.3s ease, transform 1.3s ease;
}

.wrapper.success-burning .letter {
  transform: translateY(-8%) scale(1.05);
  animation: letterFadeAway 5.4s ease-out forwards;
}

.wrapper.success-burning .letter::before {
  opacity: 0;
  animation: none;
}

.wrapper.success-burning .letter::after {
  opacity: 0;
  animation: none;
}

.wrapper.success-burning .letter > * {
  animation: none;
}

@keyframes sealBreakPulse {
  0% { transform: translate(-50%, -50%) scale(1); }
  45% { transform: translate(-50%, -50%) scale(1.08); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes settleZoom {
  0% { transform: translateY(-8%) scale(1); }
  100% { transform: translateY(-8%) scale(1.05); }
}

@keyframes fireNoise {
  from {
    background-position: 1536px 9216px, 0 7168px, 0 0;
  }
  to {
    background-position: 512px 0, 1024px 0, 0 0;
  }
}

@keyframes fireRise {
  0% {
    opacity: 0;
    transform: translateY(100%);
  }
  8% {
    opacity: 0.82;
    transform: translateY(84%) scaleY(1.03);
  }
  14% {
    opacity: 1;
    transform: translateY(74%) scaleY(1.06);
  }
  42% {
    opacity: 1;
    transform: translateY(26%) scaleY(1.14);
  }
  70% {
    opacity: 0.78;
    transform: translateY(6%) scaleY(1.1);
  }
  86% {
    opacity: 0.18;
    transform: translateY(-4%) scaleY(1.04);
  }
  100% {
    opacity: 0;
    transform: translateY(-16%) scaleY(1.02);
  }
}

@keyframes charSpread {
  0% {
    opacity: 0.65;
    transform: scaleY(0.08);
  }
  12% {
    opacity: 0.94;
    transform: scaleY(0.26);
  }
  46% {
    opacity: 1;
    transform: scaleY(0.78);
  }
  72% {
    opacity: 1;
    transform: scaleY(0.88);
  }
  100% {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes contentScorch {
  0% {
    opacity: 1;
    filter: none;
  }
  32% {
    opacity: 0.95;
    filter: none;
  }
  100% {
    opacity: 0;
    filter: blur(2px);
  }
}

@keyframes letterFadeAway {
  0% {
    transform: translateY(-8%) scale(1.05);
    opacity: 1;
    filter: none;
  }
  80% {
    transform: translateY(-12%) scale(1.02);
    opacity: 0.18;
    filter: none;
  }
  100% {
    transform: translateY(-13%) scale(1);
    opacity: 0;
    filter: none;
  }
}

@keyframes settleZoomMobile {
  0% { transform: translateY(-14%) scale(1); }
  100% { transform: translateY(-14%) scale(1.02); }
}

@keyframes roll1Mobile {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: translate(40px, 4px) rotate(280deg);
  }
}

@keyframes roll2Mobile {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: translate(78px, 7px) rotate(320deg);
  }
}

@keyframes roll3Mobile {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: translate(112px, 9px) rotate(360deg);
  }
}

body.opened .tap-open {
  opacity: 0;
  pointer-events: none;
  animation: none;
}

@media (max-width: 560px) {
  .scene {
    --env-width: 340px;
    --env-half-w: 170px;
    --env-half-h: 120px;
    width: min(100%, 360px);
    gap: 14px;
  }

  .seal {
    width: 160px;
    height: 160px;
  }

  .letter {
    top: 4%;
    min-height: 0;
    height: 90%;
    padding: 9px 9px 8px;
    gap: 4px;
    overflow: hidden;
    --letter-torn-edge: polygon(
      3% 3%,
      11% 1.8%,
      23% 2.9%,
      36% 1.6%,
      50% 2.9%,
      64% 1.8%,
      77% 2.8%,
      89% 1.9%,
      97% 3.8%,
      98.5% 14%,
      97% 28%,
      98.4% 43%,
      96.9% 58%,
      98.2% 73%,
      96.6% 88%,
      97.6% 97%,
      87% 98.3%,
      73% 96.9%,
      59% 98.3%,
      45% 96.8%,
      31% 98.1%,
      17% 96.9%,
      4% 98.2%,
      1.5% 87%,
      3.2% 73%,
      1.6% 58%,
      3% 43%,
      1.7% 28%,
      3.1% 14%
    );
    clip-path: var(--letter-torn-edge);
  }

  .hint {
    min-height: 48px;
    gap: 4px;
  }

  .wrapper.open .letter {
    height: 110%;
  }

  .wrapper.open.drop .letter {
    transform: translateY(-10%);
    height: 116%;
    animation: settleZoomMobile 1.2s ease-out 0.8s forwards;
  }

  .wrapper.success-burning .letter {
    transform: translateY(-14%) scale(1.02);
    animation: letterFadeAwayMobile 5.4s ease-out forwards;
  }

  .letter h1 {
    font-size: 14px;
  }

  /* .riddle {
    font-size: clamp(15px, 4.4vw, 18px);
    line-height: 1.35;
  } */

  .answer-form input,
  .answer-form button {
    padding: 6px 7px;
    font-size: 12px;
  }

  .hint-bottle {
    width: 38px;
    height: 58px;
  }

  .hint-bottle-cap {
    top: -10px;
    width: 36px;
    height: 10px;
  }

  .hint-bottle-label {
    top: 19px;
    font-size: 8px;
    padding: 2px 4px;
  }

  .hint-pills {
    width: 144px;
    height: 32px;
  }

  .hint-pill {
    min-width: 42px;
    font-size: 9px;
    padding: 2px 7px;
  }

  .hint.spill .hint-pill:nth-child(1) {
    animation: roll1Mobile 1.35s 0.16s forwards;
  }

  .hint.spill .hint-pill:nth-child(2) {
    animation: roll2Mobile 1.5s 0.2s forwards;
  }

  .hint.spill .hint-pill:nth-child(3) {
    animation: roll3Mobile 1.65s 0.24s forwards;
  }

  .result {
    min-height: 12px;
    font-size: 10px;
    line-height: 1.1;
  }

  .tap-open {
    font-size: 15px;
  }

  .cinematic-quote {
    font-size: clamp(1.1rem, 5vw, 1.6rem);
    letter-spacing: 0.03em;
    text-align: center;
    margin-inline: auto;
    width: 100%;
    max-width: 92vw;
  }

  .quote-layer {
    padding: 16px 10px;
  }

  .quote-write-stage {
    width: 100%;
    max-width: min(94vw, 860px);
    display: grid;
    justify-items: center;
  }

  .cinematic-quote.from-top-left.play,
  .cinematic-quote.from-bottom-right.play,
  .cinematic-quote.from-bottom.play,
  .cinematic-quote.from-top.play {
    animation-name: quoteCenterFade;
  }

  .cinematic-quote.quill-feather {
    font-size: clamp(2rem, 10vw, 3.4rem);
    line-height: 1.08;
  }

  .quill-writer {
    width: clamp(84px, 24vw, 122px);
  }

  .cinematic-quote.glow {
    letter-spacing: 0.1em;
  }

  .lock-button {
    width: 74px;
    height: 74px;
  }

  .identity-panel {
    gap: 14px;
    padding: 16px 12px 24px;
    align-content: center;
  }

  .identity-title {
    width: min(96vw, 560px);
    height: clamp(130px, 26vh, 210px);
    max-width: 96vw;
    margin-inline: auto;
    object-position: center;
  }

  .lock-copy,
  .key-status {
    font-size: clamp(0.76rem, 3vw, 0.9rem);
    letter-spacing: 0.09em;
  }

  .lock-panel,
  .key-panel {
    width: 100%;
    justify-items: center;
    text-align: center;
    margin-inline: auto;
  }

  .lock-copy,
  .key-status {
    width: 100%;
    text-align: center;
  }

  .enter-button {
    margin-inline: auto;
    justify-self: center;
  }

  .event-card {
    width: min(100%, 420px);
  }

  .event-image-details {
    inset: 22% 11% 14%;
    gap: 7px;
  }

  .invitation-text .value {
    font-size: clamp(1.04rem, 4.1vw, 1.34rem);
  }

  .event-meta-footer {
    gap: 8px;
    transform: translateY(-15px);
  }

  .rsvp-panel {
    inset: 10% 9% 11%;
    padding: 14px 12px;
  }

  .rsvp-form {
    gap: 10px;
  }

  .rsvp-time-picker {
    grid-template-columns: 1fr;
  }

  .rsvp-date-picker {
    grid-template-columns: 1fr;
  }

  .label {
    font-size: clamp(0.68rem, 2.7vw, 0.84rem);
    letter-spacing: 0.09em;
  }

  .value {
    font-size: clamp(0.84rem, 3.4vw, 1.08rem);
  }

  .event-meta-footer .value {
    font-size: clamp(0.73rem, 2.8vw, 0.9rem);
  }
}

@media (max-width: 768px) {
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

@media (max-height: 760px) and (max-width: 560px) {
  .scene {
    --env-width: 312px;
    --env-half-w: 156px;
    --env-half-h: 108px;
    gap: 10px;
    width: min(100%, 326px);
  }

  .seal {
    width: 146px;
    height: 146px;
  }

  .letter h1 {
    font-size: 13px;
  }

  /* .riddle {
    font-size: clamp(14px, 4.2vw, 16px);
    line-height: 1.3;
  } */

  .tap-open {
    font-size: 13px;
  }

  .event-image-card {
    width: min(100%, 390px);
  }

  .identity-panel {
    gap: 10px;
    padding: 12px 10px 20px;
  }

  .identity-title {
    height: clamp(108px, 23vh, 170px);
  }

  .lock-button {
    width: 64px;
    height: 64px;
  }

  .lock-copy,
  .key-status {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
  }

  .lock-panel,
  .key-panel {
    width: 100%;
    justify-items: center;
    text-align: center;
    margin-inline: auto;
  }

  .lock-copy,
  .key-status {
    width: 100%;
    text-align: center;
  }

  .enter-button {
    margin-inline: auto;
    justify-self: center;
  }
}

@media (max-width: 400px) {
  .scene {
    --env-width: 300px;
    --env-half-w: 150px;
    --env-half-h: 105px;
    width: min(100%, 320px);
  }

  .letter {
    top: 4%;
    height: 90%;
  }

  .hint {
    min-height: 44px;
  }

  .answer-form {
    flex-direction: row;
  }

  .answer-form button {
    width: auto;
  }
}

@keyframes letterFadeAwayMobile {
  0% {
    transform: translateY(-14%) scale(1.02);
    opacity: 1;
    filter: none;
  }
  80% {
    transform: translateY(-16.5%) scale(1);
    opacity: 0.18;
    filter: none;
  }
  100% {
    transform: translateY(-17.2%) scale(0.98);
    opacity: 0;
    filter: none;
  }
}
