/* ===== 缠中说禅 · 入 (cinematic gate) — crescent moon, rotating starfield, milky way ===== */
:root {
  --ivory: #ece6d6;
  --ivory-dim: rgba(236, 230, 214, 0.62);
  --moon: #ece7d6;
  --clay: #c2623f;
  --serif: "Anthropic Serif", "Noto Serif SC", "Songti SC", "Source Han Serif SC", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body.gate {
  background: radial-gradient(ellipse 120% 90% at 68% 16%, #283652 0%, #17223a 32%, #0b1220 62%, #06090f 100%);
  color: var(--ivory);
  font-family: var(--serif);
  overflow: hidden;
  position: relative;
  min-height: 100vh;
}

/* ---------- scene layers ---------- */
.scene { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
.sky { position: absolute; inset: 0; background: radial-gradient(circle at 78% 20%, rgba(233,228,210,.08), transparent 38%); }

.art {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0.38; mix-blend-mode: screen;
  animation: kenburns 90s ease-in-out infinite alternate;
  filter: contrast(1.05) saturate(0.9);
}
@keyframes kenburns {
  0%   { transform: scale(1.06) translate3d(0, 0, 0); }
  100% { transform: scale(1.16) translate3d(-1.5%, -2%, 0); }
}

/* rotating heavens: oversized so rotation never reveals an edge */
.heavens {
  position: absolute; top: -40%; left: -40%; width: 180%; height: 180%;
  animation: rotate 280s linear infinite;
  transform-origin: 50% 50%;
}
@keyframes rotate { to { transform: rotate(360deg); } }

.galaxy {
  position: absolute; inset: 0;
  background:
    linear-gradient(102deg, transparent 38%, rgba(150,140,205,.10) 45%, rgba(210,192,235,.20) 50%, rgba(150,140,205,.10) 55%, transparent 62%),
    linear-gradient(98deg, transparent 42%, rgba(120,150,200,.08) 48%, rgba(185,210,240,.15) 51%, rgba(120,150,200,.08) 54%, transparent 58%);
  filter: blur(22px);
  opacity: 1;
}

.heavens i {
  position: absolute; background: #f4efde; border-radius: 50%;
  animation: twinkle 5s ease-in-out infinite;
}
@keyframes twinkle {
  0%,100% { opacity: 0.12; transform: scale(0.7); }
  50%     { opacity: 1; transform: scale(1.2); }
}

/* crescent moon (no full moon — 圆满则无不满) */
.moon {
  position: absolute; top: 13%; right: 17%;
  width: 86px; height: 86px; border-radius: 50%;
  background: transparent;
  box-shadow: inset 20px -8px 0 0 var(--moon);
  animation: moonglow 9s ease-in-out infinite;
}
@keyframes moonglow {
  0%,100% { filter: drop-shadow(0 0 16px rgba(236,231,214,.22)); }
  50%     { filter: drop-shadow(0 0 30px rgba(236,231,214,.38)); }
}

.meteors i {
  position: absolute; width: 130px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.95) 80%, rgba(190,210,255,.5));
  opacity: 0; transform: rotate(var(--ang, 18deg));
  filter: drop-shadow(0 0 5px rgba(200,220,255,.8));
  animation: meteor var(--dur, 8s) linear infinite;
  animation-delay: var(--delay, 0s);
}
@keyframes meteor {
  0%   { opacity: 0; transform: rotate(var(--ang, 18deg)) translateX(0); }
  4%   { opacity: 1; }
  20%  { opacity: 1; }
  30%  { opacity: 0; transform: rotate(var(--ang, 18deg)) translateX(640px); }
  100% { opacity: 0; transform: rotate(var(--ang, 18deg)) translateX(640px); }
}

.mist {
  position: absolute; left: -30%; width: 160%; height: 320px; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(150,170,210,.10), transparent 60%);
  filter: blur(40px);
}
.mist.m1 { top: 46%; animation: drift 70s linear infinite; }
.mist.m2 { top: 62%; height: 420px; opacity: .8; animation: drift 95s linear infinite reverse; }
.mist.m3 { top: 30%; height: 240px; opacity: .6; animation: drift 120s linear infinite; }
@keyframes drift { 0% { transform: translateX(-12%); } 100% { transform: translateX(12%); } }

.peaks { position: absolute; bottom: 0; left: 0; width: 100%; height: 46vh; }

.vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 92% 76% at 50% 42%, transparent 38%, rgba(4,6,11,.55) 78%, rgba(4,6,11,.93) 100%);
}

/* ---------- content ---------- */
.gate-main {
  position: relative; z-index: 2; min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8vh 24px 6vh; gap: 30px;
}
.gate-main > * { opacity: 0; transform: translateY(14px); }
.gate-main.loaded > * { animation: rise .9s cubic-bezier(.2,.7,.2,1) forwards; }
.gate-main.loaded > *:nth-child(1) { animation-delay: .2s; }
.gate-main.loaded > *:nth-child(2) { animation-delay: 1.2s; }
.gate-main.loaded > *:nth-child(3) { animation-delay: 1.7s; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* scrolling poems */
.poem-frame {
  height: 48vh; max-height: 400px; width: min(560px, 92vw);
  overflow: hidden; position: relative;
  -webkit-mask: linear-gradient(180deg, transparent, #000 15%, #000 85%, transparent);
          mask: linear-gradient(180deg, transparent, #000 15%, #000 85%, transparent);
}
.poem-track { animation: poemscroll 220s linear infinite; }
@keyframes poemscroll { 0% { transform: translateY(0); } 100% { transform: translateY(-50%); } }

.poem-set { padding: 6px 0; }
.poem {
  text-align: center; color: var(--ivory); padding: 4px 0 22px;
  text-shadow: 0 1px 18px rgba(0,0,0,.5);
}
.poem .ptitle {
  font-size: 19px; letter-spacing: .42em; padding-left: .42em; margin-bottom: 16px;
  color: #f3eede; font-weight: 600; opacity: .95;
}
.poem .ptitle::before, .poem .ptitle::after { content: "·"; opacity: .35; margin: 0 .55em; }
.poem p {
  font-size: 17px; line-height: 2.35; letter-spacing: .08em; color: var(--ivory-dim);
}
.psep {
  text-align: center; font-size: 14px; letter-spacing: .4em; color: rgba(236,230,214,.28);
  margin: 6px 0 14px;
}

/* password form */
.gate-form {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center;
}
.gpw {
  width: 240px; text-align: center; background: transparent; color: var(--ivory);
  border: none; border-bottom: 1px solid rgba(236,230,214,.35);
  font-family: var(--serif); font-size: 17px; letter-spacing: .18em;
  padding: 8px 6px; outline: none; transition: border-color .3s, width .3s;
}
.gpw::placeholder { color: rgba(236,230,214,.4); letter-spacing: .1em; }
.gpw:focus { border-color: var(--clay); width: 270px; }
.gbtn {
  width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(236,230,214,.5); background: transparent; color: var(--ivory);
  font-size: 18px; line-height: 1; transition: background .25s, color .25s, border-color .25s;
}
.gbtn:hover { background: var(--ivory); color: #0c1322; border-color: var(--ivory); }
.gerr { width: 100%; text-align: center; font-size: 13px; color: #e08a6a; letter-spacing: .1em; }

.gfoot {
  font-size: 12px; letter-spacing: .25em; color: rgba(236,230,214,.32);
  font-family: "Anthropic Mono", ui-monospace, monospace;
}

/* success transition */
.curtain { position: fixed; inset: 0; z-index: 50; background: #06090f; opacity: 0; pointer-events: none; transition: opacity .6s ease; }
body.leaving .curtain { opacity: 1; }

@media (max-width: 720px) {
  .moon { width: 60px; height: 60px; top: 10%; right: 11%; }
  .poem-frame { height: 44vh; max-height: 340px; }
  .poem .ptitle { font-size: 16px; }
  .poem p { font-size: 15px; line-height: 2.15; }
  .gpw { width: 190px; } .gpw:focus { width: 210px; }
  .peaks { height: 38vh; }
}
@media (prefers-reduced-motion: reduce) {
  .poem-track, .art, .mist, .moon, .heavens, .heavens i, .meteors i { animation: none !important; }
}
