/* Entrance: a Taoist gate. The plaque reads 福禄库. */

html.gate-seen .gate { display: none !important; }
html.gate-lock,
html.gate-lock body { overflow: hidden; height: 100%; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #f4e7c4;
  background: #101820;
}

.gate-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120px 120px at 78% 16%, rgba(255, 236, 196, 0.95), rgba(255, 236, 196, 0.18) 42%, transparent 70%),
    radial-gradient(ellipse 80% 46% at 50% 108%, rgba(196, 132, 72, 0.45), transparent 62%),
    linear-gradient(180deg, #141c2e 0%, #243044 46%, #6a5344 78%, #c4a27a 100%);
}
.gate-sky::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 28% 14%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1.5px 1.5px at 46% 18%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 63% 11%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 88% 28%, rgba(255, 255, 255, 0.65), transparent),
    radial-gradient(1px 1px at 18% 38%, rgba(255, 255, 255, 0.35), transparent);
}
.gate-mist {
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: 8%;
  height: 28%;
  background: radial-gradient(ellipse at 50% 60%, rgba(244, 232, 214, 0.28), transparent 68%);
  filter: blur(2px);
  animation: mist-drift 14s ease-in-out infinite;
  pointer-events: none;
}

.gate-stage {
  position: relative;
  z-index: 1;
  width: min(440px, 92vw);
  transition: transform 0.9s ease;
}
.gate-fit {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.temple {
  position: relative;
  width: 100%;
  animation: temple-in 1.15s cubic-bezier(0.16, 0.84, 0.32, 1) both;
}

.roof {
  display: block;
  width: 108%;
  margin-left: -4%;
  height: auto;
  position: relative;
  z-index: 3;
  filter: drop-shadow(0 14px 10px rgba(0, 0, 0, 0.35));
}

.plaque {
  position: relative;
  z-index: 4;
  width: min(260px, 72%);
  margin: -22px auto 0;
  padding: 0.5rem 0.75rem 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
  background:
    linear-gradient(180deg, rgba(255, 220, 160, 0.16), transparent 28%),
    linear-gradient(180deg, #4c3226, #2a1b14 42%, #1a100c);
  border: 2px solid #d7b56a;
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.38),
    inset 0 0 0 1px rgba(90, 58, 24, 0.8),
    inset 0 0 0 4px rgba(42, 24, 14, 0.65);
  animation: plaque-in 0.8s 0.35s cubic-bezier(0.16, 0.84, 0.32, 1) both;
}
.plaque img {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 3px #e4c77a, 0 8px 16px rgba(0, 0, 0, 0.4);
}
.plaque-name {
  display: flex;
  gap: 0.42em;
  margin: 0;
  padding: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-weight: 700;
  font-size: clamp(1.85rem, 5.4vw, 2.45rem);
  letter-spacing: 0.12em;
  line-height: 1;
}
.plaque-name i {
  font-style: normal;
  background: linear-gradient(180deg, #fff6d2 0%, #e7c56a 42%, #a97828 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 rgba(80, 48, 12, 0.45));
  animation: char-in 0.55s ease both;
}
.plaque-name i:nth-child(1) { animation-delay: 0.7s; }
.plaque-name i:nth-child(2) { animation-delay: 0.86s; }
.plaque-name i:nth-child(3) { animation-delay: 1.02s; }

.hall {
  position: relative;
  z-index: 2;
  height: 132px;
  margin: 0 11% 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: linear-gradient(180deg, #4a3024, #241610 30%, #1a100e 100%);
  box-shadow: inset 0 12px 16px rgba(0, 0, 0, 0.28);
}
.pillar {
  width: 18px;
  flex: none;
  background: linear-gradient(90deg, #5c221c, #a8483e 38%, #7a3028 70%, #4a1a16);
  box-shadow: inset 0 0 0 1px rgba(255, 210, 150, 0.18);
}
.doorway {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 18px 8px 0;
  perspective: 900px;
  cursor: pointer;
  background: #120c0a;
}
.inner-light {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 80%, rgba(255, 214, 150, 0.95), rgba(196, 92, 48, 0.35) 46%, transparent 72%);
  opacity: 0;
  transition: opacity 0.7s ease 0.25s;
}
.gate-door {
  position: relative;
  z-index: 1;
  min-height: 100%;
  padding: 0;
  border: 0;
  border-radius: 2px;
  transform-style: preserve-3d;
  transition: transform 1.05s cubic-bezier(0.45, 0.05, 0.2, 1);
  background-color: #8d2e28;
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, 0.28), transparent 16%, transparent 84%, rgba(0, 0, 0, 0.25)),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.16) 0 2px, transparent 2px 11px);
  box-shadow: inset 0 0 0 3px #c6a15a;
}
.gate-door-l { transform-origin: left center; }
.gate-door-r { transform-origin: right center; }
.studs {
  position: absolute;
  inset: 12% 22%;
  background-image: radial-gradient(circle, #f4e2a8 0 3.5px, #8d6828 4.5px, transparent 5.5px);
  background-size: 33.3% 20%;
  background-repeat: round;
}
.gate.is-opening .gate-door-l { transform: rotateY(-70deg); }
.gate.is-opening .gate-door-r { transform: rotateY(70deg); }
.gate.is-opening .inner-light { opacity: 1; }

.lantern {
  position: absolute;
  top: -6px;
  width: 22px;
  height: 32px;
  border-radius: 4px 4px 8px 8px;
  background: linear-gradient(180deg, #f0d48a, #d4543a 30%, #c4342c 80%);
  box-shadow: 0 0 18px rgba(255, 170, 70, 0.75);
  transform-origin: top center;
  animation: lantern-sway 3.6s ease-in-out infinite;
}
.lantern::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -12px;
  width: 1px;
  height: 12px;
  background: #e4c77a;
}
.lantern::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: #e4c77a;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}
.lantern.left { left: 16%; animation-delay: -0.6s; }
.lantern.right { right: 16%; }

.steps {
  width: 78%;
  margin: 0 auto;
  display: grid;
  gap: 4px;
}
.steps span {
  display: block;
  height: 9px;
  margin: 0 auto;
  background: linear-gradient(180deg, #f3ecdf, #cfc4b2);
  box-shadow: 0 2px 0 rgba(60, 44, 28, 0.28);
}
.steps span:nth-child(1) { width: 78%; }
.steps span:nth-child(2) { width: 88%; }
.steps span:nth-child(3) { width: 100%; }

.gate-enter {
  margin-top: 0.75rem;
  padding: 0.55rem 1.5rem;
  border: 1px solid #e4c77a;
  border-radius: 999px;
  background: rgba(28, 16, 10, 0.78);
  color: #f4e7c4;
  letter-spacing: 0.28em;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 0.95rem;
  cursor: pointer;
  animation: hint-in 0.6s 1.15s ease both, hint-glow 2.8s 1.8s ease-in-out infinite;
}
.gate-enter:hover,
.gate-enter:focus-visible {
  background: rgba(228, 199, 122, 0.16);
  outline: none;
}
.gate.is-opening .gate-enter { opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }

.gate-film { display: none; }
html.gate-film:not(.gate-seen) .gate,
html.gate-handset:not(.gate-seen) .gate { z-index: 180; background: #070604; }
html.gate-film .gate-classic,
html.gate-handset:not(.gate-seen) .gate-classic { display: none; }
html.gate-film .gate-film,
html.gate-handset:not(.gate-seen) .gate-film {
  display: block;
  position: absolute;
  inset: 0;
  background: #070604 url("../media/opening.jpg") center / cover no-repeat;
}
@media (max-width: 900px) {
  html:not(.gate-seen) .gate { background: #070604; }
  html:not(.gate-seen) .gate-classic { display: none; }
  html:not(.gate-seen) .gate-film {
    display: block;
    position: absolute;
    inset: 0;
    background: #070604 url("../media/opening.jpg") center / cover no-repeat;
  }
}
.gate-film-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: transparent;
}
.gate-skip {
  position: absolute;
  z-index: 2;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  padding: 0.38rem 0.85rem;
  border: 1px solid rgba(244, 231, 196, 0.45);
  border-radius: 999px;
  background: rgba(12, 8, 6, 0.42);
  color: #f4e7c4;
  letter-spacing: 0.18em;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 0.82rem;
  cursor: pointer;
}
.gate-skip:focus-visible { outline: 1px solid #e4c77a; outline-offset: 2px; }
html.gate-film .gate.needs-tap .gate-film-video { cursor: pointer; }
.gate-play { display: none; }
html.gate-film .gate.needs-tap .gate-play {
  display: block;
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 0.7rem 1.4rem;
  border: 1px solid #e4c77a;
  border-radius: 999px;
  background: rgba(12, 8, 6, 0.72);
  color: #f4e7c4;
  letter-spacing: 0.22em;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 0.95rem;
  cursor: pointer;
}
.gate.is-through .gate-film {
  opacity: 0;
  transition: opacity 0.48s ease;
}
.gate.is-through .gate-skip { opacity: 0; pointer-events: none; }

.gate.is-through { pointer-events: none; }
.gate.is-through .gate-stage { transform: scale(1.22); }
.gate.is-through .gate-sky,
.gate.is-through .gate-mist,
.gate.is-through .gate-stage { opacity: 0; transition: opacity 0.55s ease 0.28s, transform 0.9s ease; }

@keyframes temple-in {
  from { opacity: 0; transform: translateY(36px); }
  to { opacity: 1; transform: none; }
}
@keyframes plaque-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: none; }
}
@keyframes char-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes lantern-sway {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(5deg); }
}
@keyframes mist-drift {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4%); }
}
@keyframes hint-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes hint-glow {
  0%, 100% { box-shadow: 0 0 0 rgba(228, 199, 122, 0); }
  50% { box-shadow: 0 0 18px rgba(228, 199, 122, 0.35); }
}

.pc-film { display: none; }
html.pc-film-on,
html.pc-film-on body { overflow: hidden; height: 100%; }
html.pc-film-on .pc-film {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #070604 url("../media/opening.jpg") center / cover no-repeat;
  opacity: 1;
}
.pc-film.is-out { opacity: 0; transition: opacity 0.42s ease; pointer-events: none; }
.pc-film-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}
.pc-film-skip { display: none; }
html.pc-film-on .pc-film-skip {
  display: block;
  position: absolute;
  z-index: 2;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  padding: 0.38rem 0.85rem;
  border: 1px solid rgba(244, 231, 196, 0.45);
  border-radius: 999px;
  background: rgba(12, 8, 6, 0.42);
  color: #f4e7c4;
  letter-spacing: 0.18em;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 0.82rem;
  cursor: pointer;
}
.gate.is-asking .gate-play { opacity: 0; pointer-events: none; }
.pc-film.is-asking .pc-film-skip,
.gate.is-asking .gate-skip {
  opacity: 1;
  pointer-events: auto;
  z-index: 250;
}
.pc-film-play { display: none; }
html.pc-film-on .pc-film.needs-tap .pc-film-play {
  display: block;
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 0.7rem 1.4rem;
  border: 1px solid #e4c77a;
  border-radius: 999px;
  background: rgba(12, 8, 6, 0.72);
  color: #f4e7c4;
  letter-spacing: 0.22em;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 0.95rem;
  cursor: pointer;
}

.five-ask {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem 1rem max(1rem, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(7, 6, 4, 0) 0%, rgba(7, 6, 4, 0.18) 42%, rgba(7, 6, 4, 0.82) 100%);
  overflow: auto;
  color: #f6ecd4;
  font-family: "Noto Serif SC", "Songti SC", serif;
  pointer-events: none;
}
.five-ask[hidden] { display: none !important; }
.five-card {
  width: min(32rem, 100%);
  margin-top: auto;
  padding: 1.05rem 1.1rem 1.1rem;
  border: 1px solid rgba(228, 199, 122, 0.45);
  border-radius: 18px;
  background: rgba(12, 8, 6, 0.8);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}
.five-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.five-eyebrow {
  margin: 0;
  letter-spacing: 0.42em;
  font-size: 0.78rem;
  color: #e4c77a;
}
.five-count {
  margin: 0;
  letter-spacing: 0.14em;
  font-size: 0.82rem;
  color: rgba(244, 231, 196, 0.72);
}
.five-kicker {
  margin: 0.8rem 0 0.2rem;
  letter-spacing: 0.28em;
  font-size: 0.78rem;
  color: rgba(244, 231, 196, 0.72);
}
.five-card h2 {
  margin: 0;
  font-size: clamp(1.35rem, 4.6vw, 1.85rem);
  font-weight: 650;
  line-height: 1.35;
  color: #f6ecd4;
}
.five-hint {
  margin: 0.4rem 0 0.85rem;
  color: rgba(246, 236, 212, 0.74);
  font-size: 0.92rem;
  line-height: 1.5;
}
.five-field { display: grid; gap: 0.55rem; }
.five-ask input,
.five-ask select {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(228, 199, 122, 0.55);
  border-radius: 12px;
  background: rgba(12, 8, 6, 0.72);
  color: #f4e7c4;
  font: inherit;
  font-size: 1rem;
  padding: 0.55rem 0.75rem;
  color-scheme: dark;
}
.five-ask input::placeholder { color: rgba(244, 231, 196, 0.45); }
.five-ask input:focus,
.five-ask select:focus,
.five-choices button:focus-visible,
.five-next:focus-visible {
  outline: 1px solid #e4c77a;
  outline-offset: 2px;
}
.five-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.five-choices button {
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(228, 199, 122, 0.55);
  background: rgba(12, 8, 6, 0.55);
  color: #f4e7c4;
  font: inherit;
  letter-spacing: 0.14em;
  cursor: pointer;
}
.five-choices button.is-on {
  background: #e4c77a;
  color: #1a120c;
  border-color: #e4c77a;
}
.five-err {
  margin: 0.55rem 0 0;
  color: #f0b4a4;
  font-size: 0.86rem;
}
.five-err[hidden] { display: none !important; }
.five-next {
  width: 100%;
  margin-top: 0.9rem;
  min-height: 48px;
  border-radius: 999px;
  border: 1px solid #e4c77a;
  background: rgba(228, 199, 122, 0.16);
  color: #f4e7c4;
  letter-spacing: 0.28em;
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}
.five-next:hover { background: rgba(228, 199, 122, 0.28); }

@media (max-width: 420px) {
  .hall { height: 150px; }
  .plaque img { width: 46px; height: 46px; }
  .plaque-name { font-size: 1.6rem; }
}
