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

body {
  min-height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: Georgia, "Times New Roman", serif;
  background: #0b0b0b;
  overflow: hidden;
  padding: 16px 10px;
}

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 0.35s ease, transform 0.35s ease;
}

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

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

.end-screen {
  position: fixed;
  inset: 0;
  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: 24px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

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

.cinematic-stage {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.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;
}

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

.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: min(90vw, 860px);
  margin: 0 auto;
  text-align: center;
  color: #f1e6d3;
  font-size: clamp(1.3rem, 2.6vw, 2.6rem);
  color: #d6c8a0;
  font-size: clamp(18px, 2.6vw, 30px);
  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.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.play {
  animation-duration: 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;
}

.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;
}

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

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

.identity-title {
  color: #f5ead8;
  font-size: clamp(2rem, 5vw, 4.3rem);
  letter-spacing: 0.16em;
  line-height: 1.1;
  text-transform: uppercase;
  text-shadow:
    0 0 18px rgba(227, 204, 168, 0.14),
    0 0 46px 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;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background: #0b0b0b;
}

.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(92vw, 680px);
  padding: 30px 26px;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.96), rgba(244, 235, 221, 0.92));
  border: 1px solid #d6c3a6;
  color: #241813;
  text-align: center;
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.52),
    0 0 34px rgba(255, 244, 224, 0.08);
  opacity: 0;
  transform: translateY(34px) scale(0.94);
  animation: cardArrival 1.2s cubic-bezier(0.2, 0.9, 0.2, 1) forwards, borderPulse 3s ease-in-out infinite;
}

.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;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  text-align: left;
}

.detail {
  background: #f4ebdd;
  border: 1px solid #d6c3a6;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 6px 18px rgba(59, 37, 20, 0.08);
}

.label {
  color: #8b7557;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

.value {
  color: #1f1511;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

@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 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 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 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: 64px;
  height: 64px;
  top: 58%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

.seal-core,
.seal-half {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #cc8b72 0%, #b66344 55%, #8d3a27 100%);
  border: 2px solid #6f2718;
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.45);
}

.seal-core {
  opacity: 1;
}

.seal-half {
  opacity: 1;
}

.seal-half.left {
  clip-path: polygon(0 0, 55% 0, 47% 24%, 57% 50%, 46% 76%, 53% 100%, 0 100%);
  transform-origin: 75% 50%;
  opacity: 0;
}

.seal-half.right {
  clip-path: polygon(45% 0, 100% 0, 100% 100%, 47% 100%, 54% 76%, 44% 50%, 53% 24%);
  transform-origin: 25% 50%;
  opacity: 0;
}

.letter {
  position: absolute;
  top: 0;
  width: 86%;
  min-height: 88%;
  background-color: #e6b39c;
  border-radius: 15px;
  z-index: 2;
  transition: transform 0.9s ease;
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  isolation: isolate;
  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: 19px;
  color: #000;
  line-height: 1.2;
}

.riddle {
  text-align: center;
  font-size: 15px;
  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("noise.jpg"),
    url("noise.jpg"),
    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;
}

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

.answer-form button {
  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;
}

.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: #d6c8a0;
  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%);
  transition-delay: 0.32s;
}

.wrapper.open.drop .letter {
  transform: translateY(-8%);
  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-core {
  animation: coreFade 0.16s linear forwards;
}

.wrapper.cracked .seal-half.left {
  animation: splitLeft 0.62s ease 0.14s forwards;
}

.wrapper.cracked .seal-half.right {
  animation: splitRight 0.62s ease 0.14s forwards;
}

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

.wrapper.success-burning .letter {
  transform: translateY(-8%) scale(1.05);
  animation: letterBurnAway 5.4s cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
  clip-path: inset(0 0 0 0 round 15px);
  background-image: linear-gradient(
    to top,
    rgba(12, 5, 2, 0.88) 0%,
    rgba(30, 11, 5, 0.82) 10%,
    rgba(64, 24, 10, 0.66) 22%,
    rgba(122, 54, 21, 0.34) 36%,
    rgba(230, 179, 156, 0) 62%
  ),
  radial-gradient(
    120% 42% at 50% 100%,
    rgba(255, 132, 36, 0.34) 0%,
    rgba(185, 72, 18, 0.18) 26%,
    rgba(24, 8, 2, 0.12) 48%,
    rgba(24, 8, 2, 0) 72%
  );
  background-repeat: no-repeat;
  background-size: 100% 0%, 140% 0%;
  background-position: bottom center, center bottom;
  background-blend-mode: normal, screen;
  box-shadow:
    0 18px 28px rgba(0, 0, 0, 0.28),
    0 0 26px rgba(255, 146, 39, 0.48),
    0 0 58px rgba(255, 90, 0, 0.18);
}

.wrapper.success-burning .letter::before {
  opacity: 1;
  animation:
    fireNoise 5.4s linear infinite,
    fireRise 5.2s ease forwards;
}

.wrapper.success-burning .letter::after {
  opacity: 1;
  animation: charSpread 5.4s ease forwards;
}

.wrapper.success-burning .letter > * {
  animation: contentScorch 4s ease forwards;
}

@keyframes splitLeft {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate(-14px, 22px) rotate(-20deg); }
}

@keyframes splitRight {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate(14px, 22px) rotate(20deg); }
}

@keyframes coreFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

@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 letterBurnAway {
  0% {
    transform: translateY(-8%) scale(1.05);
    opacity: 1;
    filter: brightness(1);
    clip-path: inset(0 0 0 0 round 15px);
    background-size: 100% 0%, 140% 0%;
  }
  8% {
    transform: translateY(-8.2%) scale(1.055);
    opacity: 0.95;
    filter: brightness(1.02);
    clip-path: inset(0 0 0 0 round 15px);
    background-size: 100% 14%, 140% 12%;
  }
  24% {
    transform: translateY(-9%) scale(1.06);
    opacity: 0.88;
    filter: brightness(1);
    clip-path: inset(0 0 0 0 round 15px);
    background-size: 100% 34%, 140% 24%;
  }
  58% {
    transform: translateY(-11%) scale(1.03);
    opacity: 0.74;
    filter: brightness(0.78);
    clip-path: inset(0 0 0 0 round 15px);
    background-size: 100% 62%, 140% 40%;
  }
  62% {
    transform: translateY(-12%) scale(1);
    opacity: 0.22;
    filter: brightness(0.14);
    clip-path: inset(0 0 22% 0 round 15px);
    background-size: 100% 104%, 140% 6%;
  }
  80% {
    transform: translateY(-14%) scale(0.95);
    opacity: 0.08;
    filter: brightness(0.05);
    clip-path: inset(0 0 72% 0 round 15px);
    background-size: 100% 120%, 140% 0%;
  }
  100% {
    transform: translateY(-16%) scale(0.9);
    opacity: 0;
    filter: brightness(0);
    clip-path: inset(0 0 100% 0 round 15px);
    background-size: 100% 120%, 140% 0%;
  }
}

@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: 56px;
    height: 56px;
  }

  .letter {
    top: 4%;
    min-height: 0;
    height: 90%;
    padding: 9px 9px 8px;
    gap: 4px;
    overflow: hidden;
  }

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

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

  .wrapper.success-burning .letter {
    transform: translateY(-14%) scale(1.02);
    animation: letterBurnAwayMobile 5.4s cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
  }

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

  .riddle {
    font-size: 9px;
    line-height: 1.2;
  }

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

  .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;
  }

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

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

  .event-card {
    width: min(92vw, 420px);
  }

  .event-card {
    padding: 24px 18px;
  }

  .details-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@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 letterBurnAwayMobile {
  0% {
    transform: translateY(-14%) scale(1.02);
    opacity: 1;
    filter: brightness(1);
    clip-path: inset(0 0 0 0 round 15px);
    background-size: 100% 0%, 140% 0%;
  }
  8% {
    transform: translateY(-14.2%) scale(1.025);
    opacity: 0.95;
    filter: brightness(1.02);
    clip-path: inset(0 0 0 0 round 15px);
    background-size: 100% 14%, 140% 12%;
  }
  24% {
    transform: translateY(-15%) scale(1.03);
    opacity: 0.88;
    filter: brightness(1);
    clip-path: inset(0 0 0 0 round 15px);
    background-size: 100% 34%, 140% 24%;
  }
  58% {
    transform: translateY(-17%) scale(1);
    opacity: 0.74;
    filter: brightness(0.78);
    clip-path: inset(0 0 0 0 round 15px);
    background-size: 100% 62%, 140% 40%;
  }
  62% {
    transform: translateY(-18.4%) scale(0.96);
    opacity: 0.22;
    filter: brightness(0.14);
    clip-path: inset(0 0 22% 0 round 15px);
    background-size: 100% 104%, 140% 6%;
  }
  80% {
    transform: translateY(-19.6%) scale(0.92);
    opacity: 0.08;
    filter: brightness(0.05);
    clip-path: inset(0 0 72% 0 round 15px);
    background-size: 100% 120%, 140% 0%;
  }
  100% {
    transform: translateY(-21%) scale(0.88);
    opacity: 0;
    filter: brightness(0);
    clip-path: inset(0 0 100% 0 round 15px);
    background-size: 100% 120%, 140% 0%;
  }
}
