:root {
  color-scheme: dark;
  --gold: #ffd46b;
  --amber: #c98a2e;
  --night: #160d28;
  --ink: #24160a;
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color: #fff7df;
  background: #180f25;
}

.background-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-position: center;
  background-size: cover;
  opacity: 0;
  filter: saturate(1.18) contrast(1.08) brightness(.92);
  transform: scale(1.04);
  transition: opacity 1.2s ease, transform 8s ease;
  pointer-events: none;
}

.background-layer.is-active {
  opacity: 1;
  transform: scale(1.09);
}

.background-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 5, 19, .08), rgba(8, 4, 12, .45)),
    radial-gradient(circle at 50% 15%, rgba(255, 212, 107, .26), transparent 34%),
    linear-gradient(135deg, rgba(22, 13, 40, .24), rgba(112, 57, 14, .12));
}

.sand {
  position: fixed;
  inset: auto -20% 0;
  height: 28vh;
  z-index: 1;
  background:
    radial-gradient(ellipse at 20% 100%, rgba(255, 214, 121, .45), transparent 55%),
    radial-gradient(ellipse at 70% 110%, rgba(177, 104, 28, .7), transparent 62%),
    linear-gradient(180deg, transparent, rgba(117, 67, 20, .85));
  animation: desertBreath 8s ease-in-out infinite alternate;
}

main {
  position: relative;
  z-index: 2;
  width: min(980px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: max(32px, env(safe-area-inset-top)) 0 36px;
  display: grid;
  align-content: center;
  gap: 18px;
  text-align: center;
}

.eyebrow {
  margin: 0;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: #ffe8a3;
  font-weight: 800;
  text-shadow: 0 2px 12px rgba(0,0,0,.55);
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.7rem, 12vw, 6.2rem);
  line-height: .9;
  color: var(--gold);
  text-shadow: 0 5px 0 rgba(66, 35, 7, .65), 0 0 36px rgba(255, 203, 89, .52);
}

.subtitle {
  margin: 0;
  font-size: clamp(1rem, 3.5vw, 1.45rem);
  font-weight: 700;
  text-shadow: 0 2px 12px rgba(0,0,0,.65);
}

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

.countdown article {
  min-height: 118px;
  padding: 18px 10px;
  border: 1px solid rgba(255, 226, 153, .45);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(80, 39, 8, .72), rgba(20, 12, 38, .78));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 20px 40px rgba(0,0,0,.32);
  backdrop-filter: blur(10px);
  animation: tileFloat 3.8s ease-in-out infinite;
}

.countdown article:nth-child(2) { animation-delay: .18s; }
.countdown article:nth-child(3) { animation-delay: .36s; }
.countdown article:nth-child(4) { animation-delay: .54s; }

.countdown strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 8vw, 4.5rem);
  color: #fff2ba;
}

.countdown span {
  display: block;
  margin-top: 4px;
  font-size: .88rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #f5c05c;
}

.stage {
  min-height: 190px;
  border-radius: 34px;
  border: 1px solid rgba(255, 226, 153, .35);
  background: rgba(18, 11, 32, .58);
  box-shadow: 0 25px 60px rgba(0,0,0,.35);
  overflow: hidden;
  position: relative;
  backdrop-filter: blur(9px);
}

.stage.action {
  animation: stageShake .44s ease-in-out 2;
}

.scene {
  position: relative;
  min-height: 190px;
  display: grid;
  place-items: end center;
  padding: 26px;
}

.runway {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 36px;
  height: 7px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, rgba(255, 230, 151, .18), rgba(255, 230, 151, .18) 20px, transparent 20px, transparent 34px);
  box-shadow: 0 16px 30px rgba(0,0,0,.22);
}

.sceneText, #sceneText {
  margin: 0;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(17, 9, 27, .65);
  color: #fff0b8;
  font-weight: 800;
}

.sceneText.is-hidden {
  display: none;
}

.sun {
  position: absolute;
  top: 16px;
  right: 28px;
  color: #ffe17c;
  font-size: 3rem;
  filter: drop-shadow(0 0 22px rgba(255, 218, 98, .8));
  animation: pulseSun 2.5s ease-in-out infinite alternate;
}

.pyramid {
  position: absolute;
  left: 22px;
  bottom: -12px;
  font-size: 8rem;
  color: rgba(255, 207, 116, .74);
  text-shadow: 0 12px 22px rgba(0,0,0,.35);
}

.actor {
  position: absolute;
  bottom: 54px;
  left: -90px;
  font-size: 3rem;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.45));
  will-change: left, bottom, transform, opacity;
}

.mummy {
  animation: mummyChaseRight 3.8s cubic-bezier(.12,.75,.15,1) forwards, mummyWobble .22s ease-in-out infinite;
  font-size: clamp(3.6rem, 10vw, 5.7rem);
  z-index: 4;
}

.tourist {
  animation: touristEscapeRight 3.8s cubic-bezier(.12,.75,.15,1) forwards, touristPanic .16s ease-in-out infinite;
  animation-delay: .12s, 0s;
  font-size: clamp(3.3rem, 9vw, 5.1rem);
  z-index: 5;
}

.tourist-back {
  left: calc(100% + 120px);
  animation: touristEscapeLeft 4.2s cubic-bezier(.12,.75,.15,1) forwards, touristPanic .14s ease-in-out infinite;
  font-size: clamp(3.3rem, 9vw, 5.1rem);
  z-index: 6;
}

.horde {
  left: calc(100% + 180px);
  animation: hordeChaseLeft 4.2s cubic-bezier(.12,.75,.15,1) forwards, hordeWobble .2s ease-in-out infinite;
  font-size: clamp(3.4rem, 9.5vw, 5.3rem);
  z-index: 5;
}

.horde.two {
  bottom: 72px;
  animation-delay: .12s, 0s;
}

.horde.three {
  bottom: 36px;
  animation-delay: .22s, 0s;
}

.horde.four {
  bottom: 92px;
  animation-delay: .32s, 0s;
}

.dust {
  bottom: 42px;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  opacity: 0;
  animation: dustTrail 6.2s ease-out forwards;
}

.panic {
  bottom: 132px;
  left: 22%;
  font-size: clamp(1.8rem, 6vw, 3rem);
  animation: panicPop 1.8s ease-out forwards;
}

.panic.back {
  left: auto;
  right: 18%;
  animation-delay: 4.15s;
}

.plane {
  animation: planeFly 7.2s cubic-bezier(.12,.74,.08,1) forwards, planeTilt .45s ease-in-out infinite;
  bottom: 88px;
  font-size: clamp(5.4rem, 18vw, 9.2rem);
  z-index: 8;
}

.cloud {
  font-size: clamp(2rem, 7vw, 3.8rem);
  opacity: 0;
  animation: cloudDrift 6.4s ease-out forwards;
}

.spark {
  bottom: 116px;
  font-size: clamp(1.8rem, 6vw, 3.1rem);
  opacity: 0;
  animation: sparklePop 6.4s ease-out forwards;
}

.contrail {
  bottom: 96px;
  width: 170px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.92), rgba(255, 219, 115, .55));
  box-shadow: 0 0 20px rgba(255,255,255,.5);
  animation: contrailFly 7.2s ease-out forwards;
  opacity: 0;
}

.takeoff-light {
  bottom: 40px;
  left: 8%;
  width: 84%;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 218, 101, .45), transparent 68%);
  animation: takeoffGlow 7.2s ease-out forwards;
  opacity: 0;
}

.boarding {
  left: 16%;
  bottom: 52px;
  font-size: clamp(2rem, 7vw, 3.4rem);
  animation: boardingWave 3.2s ease-in-out forwards;
  z-index: 7;
}

.scarab { animation: scarabTreasure 5.4s ease-in-out forwards; bottom: 78px; font-size: 3.4rem; }
.treasure { animation: treasurePop 5.4s ease-in-out forwards; left: 50%; bottom: 58px; transform: translateX(-50%) scale(.2); font-size: 4rem; }

.soul-orb {
  left: 50%;
  bottom: 58px;
  width: 84px;
  height: 84px;
  border-radius: 999px;
  background: radial-gradient(circle at 32% 28%, #fffef1, #ffd46b 28%, #d9872b 64%, transparent 70%);
  box-shadow: 0 0 28px rgba(255, 223, 111, .9), 0 0 70px rgba(255, 166, 69, .65);
  animation: soulFloat 5.8s ease-in-out forwards;
  z-index: 6;
}

.lotus {
  left: 48%;
  bottom: 40px;
  font-size: clamp(3.4rem, 11vw, 5.6rem);
  animation: lotusOpen 5.8s ease-in-out forwards;
  z-index: 7;
}

.hieroglyph {
  bottom: 112px;
  font-size: clamp(2rem, 6vw, 3.2rem);
  opacity: 0;
  animation: hieroglyphRain 5.8s ease-in-out forwards;
  z-index: 5;
}

.hieroglyph.two {
  left: 72%;
  animation-delay: .35s;
}

.hieroglyph.three {
  left: 18%;
  animation-delay: .72s;
}

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

button {
  border: 0;
  border-radius: 999px;
  padding: 15px 14px;
  color: #281704;
  background: linear-gradient(135deg, #fff0a6, #e09b35);
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(0,0,0,.34);
}

button:active {
  transform: translateY(2px) scale(.99);
}

details {
  width: min(620px, 100%);
  justify-self: center;
  border-radius: 22px;
  padding: 12px 16px;
  background: rgba(18, 11, 32, .56);
  color: #ffeab0;
  backdrop-filter: blur(8px);
}

summary {
  cursor: pointer;
  font-weight: 900;
}

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

@keyframes desertBreath {
  from { transform: translateX(-2%); }
  to { transform: translateX(2%); }
}

@keyframes pulseSun {
  from { transform: scale(.96); }
  to { transform: scale(1.08); }
}

@keyframes stageShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-.3deg); }
  50% { transform: translateX(4px) rotate(.3deg); }
  75% { transform: translateX(-2px); }
}

@keyframes mummyChaseRight {
  0% { left: -130px; bottom: 48px; }
  10% { bottom: 84px; }
  20% { bottom: 44px; }
  32% { bottom: 90px; }
  50% { bottom: 46px; }
  68% { bottom: 86px; }
  84% { bottom: 46px; }
  100% { left: calc(100% + 120px); bottom: 50px; }
}

@keyframes touristEscapeRight {
  0% { left: -2px; bottom: 54px; }
  12% { bottom: 96px; }
  24% { bottom: 46px; }
  38% { bottom: 94px; }
  54% { bottom: 48px; }
  70% { bottom: 92px; }
  86% { bottom: 50px; }
  100% { left: calc(100% + 175px); bottom: 56px; }
}

@keyframes touristEscapeLeft {
  0% { left: calc(100% + 120px); bottom: 58px; transform: scaleX(-1) rotate(12deg); }
  12% { bottom: 98px; }
  25% { bottom: 46px; }
  40% { bottom: 96px; }
  55% { bottom: 48px; }
  72% { bottom: 94px; }
  88% { bottom: 48px; }
  100% { left: -170px; bottom: 58px; transform: scaleX(-1) rotate(-10deg); }
}

@keyframes hordeChaseLeft {
  0% { left: calc(100% + 190px); transform: scaleX(-1) rotate(-8deg); }
  14% { bottom: 88px; }
  28% { bottom: 44px; }
  42% { bottom: 92px; }
  58% { bottom: 48px; }
  74% { bottom: 90px; }
  90% { bottom: 48px; }
  100% { left: -210px; transform: scaleX(-1) rotate(8deg); }
}

@keyframes mummyWobble {
  0%, 100% { transform: rotate(-12deg) scaleX(1); }
  50% { transform: rotate(10deg) scaleX(1.06); }
}

@keyframes hordeWobble {
  0%, 100% { transform: scaleX(-1) rotate(-10deg) translateY(0); }
  50% { transform: scaleX(-1) rotate(12deg) translateY(-6px); }
}

@keyframes touristPanic {
  0%, 100% { transform: rotate(12deg) translateY(0); }
  50% { transform: rotate(-13deg) translateY(-5px); }
}

@keyframes dustTrail {
  0% { left: -20px; opacity: 0; transform: scale(.6) rotate(0deg); }
  15%, 82% { opacity: .82; }
  100% { left: calc(100% + 90px); opacity: 0; transform: scale(1.55) rotate(30deg); }
}

@keyframes panicPop {
  0% { opacity: 0; transform: translateY(20px) scale(.2) rotate(-20deg); }
  18% { opacity: 1; transform: translateY(0) scale(1.2) rotate(8deg); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-46px) scale(.7) rotate(-10deg); }
}

@keyframes planeFly {
  0% { left: -210px; transform: translateY(92px) rotate(-7deg) scale(.72); }
  18% { left: 12%; transform: translateY(54px) rotate(1deg) scale(1.03); }
  34% { left: 28%; transform: translateY(10px) rotate(-2deg) scale(1.22); }
  52% { left: 44%; transform: translateY(-48px) rotate(10deg) scale(1.36); }
  70% { left: 63%; transform: translateY(-118px) rotate(-4deg) scale(1.17); }
  100% { left: calc(100% + 220px); transform: translateY(-245px) rotate(21deg) scale(.88); }
}

@keyframes planeTilt {
  0%, 100% { filter: drop-shadow(0 8px 10px rgba(0,0,0,.45)); }
  50% { filter: drop-shadow(0 12px 18px rgba(255, 221, 119, .45)); }
}

@keyframes cloudDrift {
  0% { left: -70px; bottom: 96px; opacity: 0; transform: scale(.7); }
  18%, 72% { opacity: .7; }
  100% { left: 78%; bottom: 196px; opacity: 0; transform: scale(1.35); }
}

@keyframes sparklePop {
  0%, 16% { left: 10%; opacity: 0; transform: scale(.2) rotate(0deg); }
  28% { opacity: 1; transform: scale(1.2) rotate(80deg); }
  58% { left: 52%; opacity: .9; transform: scale(.9) rotate(210deg); }
  100% { left: 88%; opacity: 0; transform: scale(.25) rotate(360deg); }
}

@keyframes contrailFly {
  0% { left: -230px; opacity: 0; transform: translateY(96px) rotate(-8deg) scaleX(.45); }
  18%, 70% { opacity: .78; }
  100% { left: calc(100% + 70px); opacity: 0; transform: translateY(-205px) rotate(16deg) scaleX(2.1); }
}

@keyframes takeoffGlow {
  0% { opacity: 0; transform: scale(.5); }
  12% { opacity: .85; transform: scale(1); }
  68% { opacity: .45; transform: scale(1.25); }
  100% { opacity: 0; transform: scale(1.6); }
}

@keyframes boardingWave {
  0% { opacity: 0; transform: translateY(22px) rotate(-8deg) scale(.55); }
  15%, 70% { opacity: 1; }
  38% { transform: translateY(-18px) rotate(8deg) scale(1.08); }
  100% { opacity: 0; transform: translateY(-44px) rotate(-4deg) scale(.8); }
}

@keyframes scarabTreasure {
  0% { left: -80px; transform: rotate(0deg); }
  50% { left: 44%; transform: rotate(12deg) scale(1.15); }
  100% { left: calc(100% + 80px); transform: rotate(-10deg); }
}

@keyframes treasurePop {
  0%, 34% { opacity: 0; transform: translateX(-50%) scale(.15); }
  58% { opacity: 1; transform: translateX(-50%) scale(1.2); }
  100% { opacity: 1; transform: translateX(-50%) scale(1); }
}

@keyframes soulFloat {
  0% { opacity: 0; transform: translateX(-50%) translateY(38px) scale(.2); }
  22% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.1); }
  48% { transform: translateX(-50%) translateY(-58px) scale(.92); }
  72% { transform: translateX(-50%) translateY(-24px) scale(1.18); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-138px) scale(.42); }
}

@keyframes lotusOpen {
  0% { opacity: 0; transform: translateX(-50%) scale(.15) rotate(-12deg); }
  22% { opacity: 1; transform: translateX(-50%) scale(1.15) rotate(4deg); }
  60% { opacity: 1; transform: translateX(-50%) scale(1) rotate(-3deg); }
  100% { opacity: 0; transform: translateX(-50%) scale(.78) rotate(8deg); }
}

@keyframes hieroglyphRain {
  0% { opacity: 0; transform: translateY(-35px) rotate(-10deg) scale(.4); }
  18% { opacity: 1; }
  58% { opacity: .92; transform: translateY(18px) rotate(8deg) scale(1.1); }
  100% { opacity: 0; transform: translateY(95px) rotate(-18deg) scale(.55); }
}

@media (max-width: 720px) {
  main {
    align-content: start;
    padding-top: max(24px, env(safe-area-inset-top));
  }

  .countdown {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .buttons {
    grid-template-columns: 1fr;
  }
}
