:root {
  color-scheme: dark;
  --gold: #f2d58d;
  --gold-bright: #fff0b6;
  --deep: #100b08;
  --ink: #4b2e12;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(241, 200, 112, 0.16), transparent 30%),
    linear-gradient(180deg, #1d1510 0%, #090706 100%);
  color: #fff6d6;
  font-family:
    "Noto Serif SC", "Source Han Serif SC", "SimSun", "STSong", serif;
}

a,
button {
  font: inherit;
}

.worship-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.worship-stage {
  position: relative;
  width: min(100vw, 150vh);
  min-height: min(100vh, 66.666vw);
  aspect-ratio: 3 / 2;
  overflow: hidden;
  isolation: isolate;
  background: var(--deep);
  box-shadow:
    0 0 0 1px rgba(255, 228, 164, 0.12),
    0 28px 96px rgba(0, 0, 0, 0.54);
}

.worship-bg {
  position: absolute;
  inset: 0;
  z-index: -5;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

.page-vignette,
.hall-light,
.mist-layer,
.floating-clouds {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.page-vignette {
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(8, 10, 13, 0.5) 0%, transparent 18%, transparent 68%, rgba(10, 7, 5, 0.28) 100%),
    radial-gradient(circle at 47% 55%, rgba(255, 225, 145, 0.11), transparent 37%);
}

.hall-light {
  z-index: 1;
  opacity: 0.5;
  background: radial-gradient(ellipse at 52% 55%, rgba(255, 229, 158, 0.16), transparent 36%);
  mix-blend-mode: screen;
}

.mist-layer {
  left: -26%;
  width: 155%;
  height: 19%;
  z-index: 11;
  opacity: 0.08;
  filter: blur(22px);
  mix-blend-mode: screen;
  background:
    radial-gradient(ellipse at 14% 55%, rgba(255, 255, 255, 0.46), transparent 42%),
    radial-gradient(ellipse at 42% 50%, rgba(222, 241, 244, 0.34), transparent 43%),
    radial-gradient(ellipse at 72% 52%, rgba(255, 239, 198, 0.3), transparent 44%),
    radial-gradient(ellipse at 94% 55%, rgba(255, 255, 255, 0.36), transparent 42%);
}

.mist-a {
  top: 36%;
  animation: mist-drift 92s linear infinite;
}

.mist-b {
  top: 70%;
  opacity: 0.045;
  animation: mist-drift 124s linear infinite reverse;
}

.floating-clouds {
  z-index: 25;
  overflow: hidden;
}

.floating-cloud {
  position: absolute;
  left: -34%;
  top: var(--top);
  width: var(--width);
  opacity: var(--opacity);
  filter: blur(var(--blur)) brightness(1.08);
  animation: cloud-pass var(--duration) linear infinite;
  animation-delay: var(--delay);
  will-change: transform;
}

.cloud-a {
  --top: 17%;
  --width: 38%;
  --opacity: 0.18;
  --blur: 1.3px;
  --duration: 78s;
  --delay: -20s;
}

.cloud-b {
  --top: 42%;
  --width: 46%;
  --opacity: 0.14;
  --blur: 1.8px;
  --duration: 96s;
  --delay: -58s;
}

.cloud-c {
  --top: 68%;
  --width: 34%;
  --opacity: 0.15;
  --blur: 1.5px;
  --duration: 88s;
  --delay: -10s;
}

.site-header {
  position: relative;
  z-index: 30;
  height: 8%;
  min-height: 66px;
}

.brand {
  position: absolute;
  left: 2.2%;
  top: 18%;
  width: 12.5%;
  min-width: 150px;
  line-height: 0;
}

.brand img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.32));
}

.primary-nav {
  position: absolute;
  left: 22.2%;
  top: 17%;
  width: 52%;
  display: flex;
  justify-content: space-between;
  gap: 1.2vw;
}

.utility-nav {
  position: absolute;
  right: 2.4%;
  top: 17%;
  display: flex;
  gap: 1.2vw;
}

.nav-link,
.utility-link {
  position: relative;
  color: rgba(255, 232, 174, 0.88);
  text-decoration: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.46);
  transition:
    color 220ms ease,
    text-shadow 220ms ease;
}

.nav-link {
  padding: 0.3rem 0.18rem 0.68rem;
  font-size: clamp(0.95rem, 1.28vw, 1.28rem);
  white-space: nowrap;
}

.utility-link {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  padding: 0.3rem 0.1rem;
  font-size: clamp(0.82rem, 1vw, 1rem);
}

.utility-icon {
  width: 1.32em;
  height: 1.32em;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 226, 151, 0.58);
  border-radius: 999px;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.28rem;
  width: 0;
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
  box-shadow: 0 0 12px rgba(255, 235, 170, 0.9);
  opacity: 0;
  transition:
    width 220ms ease,
    opacity 220ms ease;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.is-active,
.utility-link:hover,
.utility-link:focus-visible {
  color: #fff3c2;
  text-shadow:
    0 0 10px rgba(255, 229, 158, 0.76),
    0 2px 12px rgba(0, 0, 0, 0.48);
}

.nav-link:hover::after,
.nav-link:focus-visible::after {
  width: 86%;
  opacity: 1;
}

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

.memorial-photo-canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: max(100%, 150vh);
  aspect-ratio: 3 / 2;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.memorial-photo-slot {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 27.9%;
  width: 15%;
  height: 31.5%;
  margin: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 280ms ease;
}

.memorial-photo-slot.has-photo {
  opacity: 1;
  background: linear-gradient(180deg, #f3e7cf, #e8d7b7);
  box-shadow:
    inset 0 0 28px rgba(255, 239, 195, 0.28),
    inset 0 0 0 1px rgba(255, 222, 145, 0.18);
}

.memorial-photo {
  position: relative;
  z-index: 1;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 1;
  filter: sepia(0.14) saturate(0.82) brightness(1.03) contrast(0.96);
  user-select: none;
}

.memorial-photo-fill {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: fill;
  object-position: center;
  opacity: 1;
  filter: sepia(0.14) saturate(0.82) brightness(1.03) contrast(0.96);
  user-select: none;
}

.memorial-photo-slot.has-photo .memorial-photo,
.memorial-photo-slot.has-photo .memorial-photo-fill {
  display: block;
}

.memorial-photo-slot.has-extended-photo .memorial-photo {
  opacity: 0;
}

.memorial-photo-slot::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(112, 58, 19, 0.08) 100%),
    linear-gradient(180deg, rgba(255, 245, 212, 0.03), rgba(91, 47, 16, 0.04));
  pointer-events: none;
}

.memorial-photo-slot.has-photo::after {
  opacity: 1;
}

.memorial-frame-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  pointer-events: none;
}

.offering-display {
  position: absolute;
  left: 29.4%;
  top: 58.25%;
  z-index: 7;
  width: 41.2%;
  margin: 0;
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  transform-origin: 50% 100%;
  pointer-events: none;
  transition:
    opacity 650ms ease,
    transform 800ms cubic-bezier(0.18, 0.72, 0.18, 1);
}

.offering-display img {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  filter:
    drop-shadow(0 8px 8px rgba(25, 8, 2, 0.5))
    drop-shadow(0 0 11px rgba(255, 193, 91, 0.14));
  user-select: none;
}

.offering-halo {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -4%;
  height: 35%;
  z-index: 1;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(ellipse, rgba(255, 212, 117, 0.34), transparent 72%);
  mix-blend-mode: screen;
  transition: opacity 700ms ease 180ms;
}

.worship-stage.is-offered .offering-display {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.worship-stage.is-offered .offering-halo {
  opacity: 1;
}

.furnace-effects {
  position: absolute;
  left: 43.35%;
  top: 20%;
  z-index: 8;
  width: 13.3%;
  height: 58.5%;
  pointer-events: none;
}

.paper-stream {
  position: absolute;
  left: 22%;
  top: 82%;
  bottom: 0;
  width: 56%;
  overflow: hidden;
}

.paper-money {
  position: absolute;
  left: var(--x);
  top: -8%;
  width: clamp(12px, 1.35vw, 22px);
  aspect-ratio: 0.72;
  border: 1px solid rgba(137, 80, 18, 0.8);
  border-radius: 1px;
  opacity: 0;
  background:
    radial-gradient(circle, transparent 0 17%, rgba(110, 55, 10, 0.82) 19% 25%, transparent 27%),
    linear-gradient(135deg, #fff0a1 0%, #eebd42 46%, #fff1a8 100%);
  box-shadow:
    inset 0 0 0 2px rgba(113, 58, 13, 0.18),
    0 0 7px rgba(255, 205, 82, 0.32);
  transform: rotate(var(--turn));
}

.worship-stage.is-burning .paper-money {
  animation: paper-fall var(--duration) linear var(--delay) infinite;
}

.furnace-fire {
  position: absolute;
  left: 50%;
  bottom: -1.5%;
  z-index: 4;
  width: 78%;
  height: 13%;
  opacity: 0;
  overflow: hidden;
  transform: translateX(-50%) scale(0.82, 0.34);
  transform-origin: 50% 100%;
  transition:
    opacity 380ms ease,
    transform 480ms ease;
  mix-blend-mode: screen;
}

.furnace-flame-image {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100%;
  height: auto;
  max-width: none;
  transform: translateX(-50%);
  transform-origin: 50% 100%;
  filter:
    brightness(1.08)
    saturate(1.04)
    drop-shadow(0 0 8px rgba(255, 122, 28, 0.72));
  mix-blend-mode: screen;
  user-select: none;
}

.furnace-glow {
  position: absolute;
  left: 50%;
  bottom: -5%;
  z-index: 2;
  width: 115%;
  aspect-ratio: 2.6;
  border-radius: 50%;
  opacity: 0;
  transform: translateX(-50%) scale(0.7);
  background: radial-gradient(ellipse, rgba(255, 142, 47, 0.6), rgba(255, 190, 73, 0.18) 42%, transparent 72%);
  mix-blend-mode: screen;
  transition:
    opacity 450ms ease,
    transform 600ms ease;
}

.furnace-smoke {
  position: absolute;
  left: 50%;
  bottom: 2%;
  z-index: 3;
  width: 100%;
  height: 62%;
  transform: translateX(-50%);
}

.furnace-smoke::before,
.furnace-smoke::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8%;
  width: 88%;
  height: 72%;
  border-radius: 50%;
  opacity: 0;
  transform: translateX(-50%) translateY(14px) scale(0.62);
  background:
    radial-gradient(ellipse at 38% 74%, rgba(188, 220, 211, 0.28), transparent 48%),
    radial-gradient(ellipse at 67% 58%, rgba(220, 236, 229, 0.22), transparent 52%),
    radial-gradient(ellipse at 50% 28%, rgba(171, 207, 200, 0.2), transparent 48%);
  filter: blur(8px);
  mix-blend-mode: screen;
}

.furnace-smoke::after {
  bottom: 17%;
  width: 72%;
  height: 62%;
  filter: blur(12px);
}

.smoke {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 48px;
  height: 128px;
  opacity: 0;
  transform: translateX(-50%) scale(0.45);
  transform-origin: 50% 100%;
  filter: blur(1px);
}

.smoke::before,
.smoke::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border-left: 3px solid rgba(190, 224, 216, 0.43);
  border-top: 1px solid rgba(226, 243, 237, 0.14);
  transform: rotate(18deg);
}

.smoke::after {
  inset: 14px 8px 0 10px;
  border-left-color: rgba(216, 236, 229, 0.3);
  transform: rotate(-23deg);
}

.smoke-a {
  margin-left: -42px;
}

.smoke-b {
  margin-left: -18px;
  height: 146px;
}

.smoke-c {
  margin-left: 7px;
  width: 56px;
  height: 136px;
}

.smoke-d {
  margin-left: 30px;
  height: 152px;
}

.smoke-e {
  margin-left: 50px;
  width: 42px;
  height: 116px;
}

.worship-stage.is-burning .furnace-fire {
  opacity: 0.94;
  transform: translateX(-50%) scale(1);
}

.worship-stage.is-burning .furnace-flame-image {
  animation: fire-flicker 0.72s ease-in-out infinite alternate;
}

.worship-stage.is-burning .furnace-glow {
  opacity: 0.9;
  transform: translateX(-50%) scale(1);
}

.worship-stage.is-burning .smoke-a {
  animation: furnace-smoke 6.4s ease-in-out 0s infinite;
}

.worship-stage.is-burning .smoke-b {
  animation: furnace-smoke 7.8s ease-in-out 0.7s infinite;
}

.worship-stage.is-burning .smoke-c {
  animation: furnace-smoke 6.9s ease-in-out 1.4s infinite;
}

.worship-stage.is-burning .smoke-d {
  animation: furnace-smoke 8.3s ease-in-out 2s infinite;
}

.worship-stage.is-burning .smoke-e {
  animation: furnace-smoke 7.2s ease-in-out 2.7s infinite;
}

.worship-stage.is-burning .furnace-smoke::before {
  animation: furnace-haze 7.6s ease-in-out 0.4s infinite;
}

.worship-stage.is-burning .furnace-smoke::after {
  animation: furnace-haze 9.2s ease-in-out 2.1s infinite;
}

.ritual-actions {
  position: absolute;
  left: 50%;
  bottom: 3.3%;
  z-index: 30;
  width: 54%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  transform: translateX(-50%);
}

.ritual-button {
  min-width: 170px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.58rem;
  border: 1px solid rgba(196, 135, 42, 0.62);
  border-radius: 999px;
  color: #56340f;
  cursor: pointer;
  background: linear-gradient(180deg, #fff4c0, #dfab43);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.76),
    0 0 18px rgba(255, 195, 75, 0.42),
    0 7px 17px rgba(30, 10, 2, 0.28);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    filter 180ms ease;
}

.ritual-button:hover,
.ritual-button:focus-visible,
.ritual-button.is-active {
  transform: translateY(-2px);
  border-color: rgba(255, 235, 166, 0.98);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 0 28px rgba(255, 211, 105, 0.78),
    0 8px 18px rgba(30, 10, 2, 0.32);
}

.ritual-button:disabled {
  cursor: wait;
  filter: saturate(0.82);
}

.button-mark {
  position: relative;
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
}

.offering-mark {
  border: 1px solid #8d581b;
  border-radius: 50% 50% 44% 44%;
}

.offering-mark::before {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 17%;
  height: 32%;
  border-radius: 0 0 999px 999px;
  background: #9d621c;
}

.fire-mark {
  border-radius: 72% 72% 62% 62% / 88% 88% 48% 48%;
  background: linear-gradient(180deg, #fff0a1, #dc6e22 68%, #933912);
  box-shadow: 0 0 8px rgba(235, 112, 35, 0.44);
  transform: scale(0.78);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 10.5%;
  z-index: 40;
  min-width: 260px;
  margin: 0;
  padding: 0.64rem 1rem;
  border: 1px solid rgba(255, 226, 151, 0.45);
  border-radius: 999px;
  color: #fff4c4;
  text-align: center;
  background: rgba(29, 19, 12, 0.82);
  box-shadow: 0 0 20px rgba(255, 202, 81, 0.24);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.ritual-glow {
  position: absolute;
  z-index: 6;
  border-radius: 50%;
  pointer-events: none;
  mix-blend-mode: screen;
  animation: ritual-glow 1250ms ease-out forwards;
}

.offering-glow {
  left: 50%;
  top: 65%;
  width: 44%;
  aspect-ratio: 3.8;
  background: radial-gradient(ellipse, rgba(255, 241, 181, 0.62), rgba(255, 173, 64, 0.18) 43%, transparent 72%);
}

.furnace-ritual-glow {
  left: 50%;
  top: 79%;
  width: 18%;
  aspect-ratio: 1.5;
  background: radial-gradient(ellipse, rgba(255, 212, 119, 0.6), rgba(255, 113, 32, 0.2) 44%, transparent 72%);
}

@keyframes mist-drift {
  from {
    transform: translate3d(-5%, 0, 0);
  }

  to {
    transform: translate3d(5%, 0, 0);
  }
}

@keyframes cloud-pass {
  from {
    transform: translate3d(-5vw, 0, 0);
  }

  to {
    transform: translate3d(150vw, 0, 0);
  }
}

@keyframes paper-fall {
  0% {
    top: -8%;
    opacity: 0;
    transform: translateX(0) rotate(var(--turn)) scale(0.92);
  }

  10% {
    opacity: 0.94;
  }

  52% {
    transform: translateX(var(--drift)) rotate(calc(var(--turn) + 190deg)) scale(1);
  }

  86% {
    opacity: 0.88;
  }

  100% {
    top: 98%;
    opacity: 0;
    transform: translateX(-10px) rotate(calc(var(--turn) + 410deg)) scale(0.62);
  }
}

@keyframes fire-flicker {
  from {
    transform: translateX(-50%) translateX(-1px) scale(1, 0.95);
    filter:
      brightness(1)
      saturate(1.02)
      drop-shadow(0 0 7px rgba(255, 112, 24, 0.7));
  }

  to {
    transform: translateX(-50%) translateX(1px) scale(1.015, 1.04);
    filter:
      brightness(1.16)
      saturate(1.08)
      drop-shadow(0 0 12px rgba(255, 182, 62, 0.9));
  }
}

@keyframes furnace-smoke {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(8px) translateX(0) scale(0.42);
  }

  18% {
    opacity: 0.58;
  }

  64% {
    opacity: 0.32;
    transform: translateX(-50%) translateY(-82px) translateX(18px) scale(0.9);
  }

  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-180px) translateX(-14px) scale(1.22);
  }
}

@keyframes furnace-haze {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(14px) translateX(0) scale(0.62);
  }

  20% {
    opacity: 0.68;
  }

  68% {
    opacity: 0.34;
    transform: translateX(-50%) translateY(-74px) translateX(-12px) scale(1.02);
  }

  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-142px) translateX(18px) scale(1.28);
  }
}

@keyframes ritual-glow {
  from {
    opacity: 0.94;
    transform: translate(-50%, -50%) scale(0.62);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.28);
  }
}

@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .worship-page {
    display: block;
  }

  .worship-stage {
    width: 100%;
    min-height: 100vh;
    aspect-ratio: auto;
    overflow: hidden;
  }

  .worship-bg {
    object-position: center;
  }

  .site-header {
    height: auto;
    min-height: 0;
    padding: 0.85rem 1rem 0;
  }

  .brand,
  .primary-nav,
  .utility-nav {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    width: auto;
  }

  .brand {
    display: block;
    width: 170px;
    min-width: 0;
    margin-bottom: 0.7rem;
  }

  .primary-nav,
  .utility-nav {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .utility-nav {
    margin-top: 0.35rem;
  }

  .offering-display {
    left: 22%;
    top: 58%;
    width: 56%;
  }

  .furnace-effects {
    left: 40%;
    width: 20%;
  }

  .ritual-actions {
    width: calc(100% - 2rem);
    justify-content: center;
    gap: 0.55rem;
  }

  .ritual-button {
    min-width: 0;
    flex: 1 1 0;
    max-width: 190px;
    padding-inline: 0.7rem;
  }
}

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

  .worship-stage.is-burning .paper-money {
    top: 76%;
    opacity: 0.78;
  }

  .worship-stage.is-burning .smoke {
    opacity: 0.28;
    transform: translateX(-50%) translateY(-72px) scale(0.9);
  }

  .floating-cloud {
    animation: none !important;
  }
}
