/* “午夜密语”独立样式：gate 前缀避免影响原站的南瓜灯、弹窗和解谜游戏。 */
body.gate-locked { overflow: hidden; }
.gate {
  position: fixed; inset: 0; z-index: 100; overflow-x: hidden; overflow-y: auto;
  background: #0b0911; color: #eee2d5; isolation: isolate;
  transition: opacity .45s ease;
}
.gate-scenery {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: radial-gradient(ellipse at 75% 16%, #3a2d4d55, transparent 42%),
    radial-gradient(ellipse at 50% 70%, #35203c66, transparent 60%),
    linear-gradient(165deg, #0c0a14, #181020 58%, #08070d);
}
.gate-scenery::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 25%, #06050b99);
}
.gate-moon {
  position: absolute; width: clamp(95px, 12vw, 174px); aspect-ratio: 1;
  top: 11%; right: 15%; border-radius: 50%; opacity: .64;
  background: radial-gradient(circle at 33% 37%, #bdb4c555 0 6%, transparent 7%),
    radial-gradient(circle at 65% 65%, #91859955 0 15%, transparent 17%),
    radial-gradient(circle at 35% 28%, #eee7db, #bdb3c4 65%, #6f647e);
  box-shadow: 0 0 50px #d8c8ee20, 0 0 150px #c4afe51c, 0 0 290px #a995d515;
}
.gate-stars { position: absolute; inset: 0; }
.gate-stars i {
  position: absolute; left: var(--x); top: var(--y); width: var(--size); height: var(--size);
  border-radius: 50%; background: #dfc7a3; opacity: .4; box-shadow: 0 0 9px #eed3a877;
  animation: gate-drift var(--duration) ease-in-out var(--delay) infinite alternate;
}
.gate-horizon {
  position: absolute; bottom: 0; left: 0; width: 100%; height: 27%; background: #07060c;
  clip-path: polygon(0 56%, 10% 66%, 18% 53%, 18% 37%, 19% 37%, 19% 24%, 20% 10%, 21% 24%, 21% 37%, 22% 37%, 22% 47%, 26% 47%, 26% 32%, 27% 17%, 28% 32%, 28% 53%, 34% 68%, 50% 84%, 70% 71%, 86% 56%, 100% 68%, 100% 100%, 0 100%);
}
.gate-fog {
  position: absolute; width: 140%; height: 36%; left: -20%; bottom: -10%; opacity: .2;
  background: radial-gradient(ellipse at 30% 50%, #a998b680, transparent 45%),
    radial-gradient(ellipse at 78% 60%, #baacc465, transparent 45%);
  filter: blur(30px); animation: gate-fog 25s ease-in-out infinite alternate;
}
.gate-fog-two { bottom: 13%; opacity: .09; animation-delay: -13s; animation-direction: alternate-reverse; }
.gate-content {
  width: min(100%, 660px); min-height: 100vh; min-height: 100svh;
  margin: 0 auto; padding: 22px 24px 18px; display: flex; flex-direction: column;
  justify-content: center; align-items: center; text-align: center;
  animation: gate-arrive 1.1s ease both;
}
.gate-dedication { margin: 0 0 14px; display: flex; align-items: center; gap: 18px; font-size: 12px; letter-spacing: .3em; color: #c2a57d; }
.gate-dedication span { height: 1px; width: 32px; background: linear-gradient(90deg, transparent, #c6a27366); }
.gate-dedication span:last-child { transform: rotate(180deg); }
.gate-chapter { margin: 0 0 8px; font-size: 11px; letter-spacing: .42em; color: #a995b4; }
.gate h1 { margin: 0; padding-left: .18em; font-size: clamp(32px, 4.2vw, 46px); font-weight: 400; line-height: 1.3; letter-spacing: .18em; text-shadow: 0 4px 35px #ceabe524; }
.gate-subtitle { margin: 10px 0 0; font-size: 14px; line-height: 1.8; letter-spacing: .08em; color: #b1a2b7; }
.gate-lantern { position: relative; width: 108px; height: 86px; margin: 5px 0 0; flex-shrink: 0; }
.gate-lantern svg { position: relative; width: 100%; height: 100%; overflow: visible; transition: filter 1.1s ease; }
.gate-lantern-glow {
  position: absolute; inset: -65px; opacity: .08; border-radius: 50%;
  background: radial-gradient(ellipse, #ffb54688, #e98b2933 30%, transparent 68%);
  transition: opacity 1.2s ease, transform 1.5s ease; transform: scale(.7);
}
.gate-lantern-face { fill: #160c13; transition: fill 1.1s ease, filter 1.1s ease; }
.gate-whisper-panel { width: min(100%, 330px); margin-top: 14px; }
.gate-form { margin: 0; }
.gate-fields { margin: 0; padding: 0; border: 0; min-width: 0; }
.gate-question { display: block; margin-bottom: 14px; color: #d3c1be; font-size: 14px; line-height: 1.7; letter-spacing: .04em; }
.gate-answer { display: block; width: 100%; box-sizing: border-box; min-height: 50px; padding: 12px 16px; border: 1px solid #bea68270; border-radius: 3px; background: #15101c9e; color: #f3e5d5; font: inherit; font-size: 16px; letter-spacing: .12em; text-align: center; outline: none; transition: border-color .25s ease, box-shadow .25s ease, background .25s ease; }
.gate-answer::placeholder { color: #988899; font-size: 13px; letter-spacing: .12em; }
.gate-answer:focus { border-color: #d3b98f; background: #1d1425c9; box-shadow: 0 0 0 3px #d1ad7515; }
.gate-submit { width: 100%; min-height: 48px; margin-top: 14px; padding: 10px 16px; border: 1px solid #c8a46f82; border-radius: 3px; background: linear-gradient(110deg, #8e6a4030, #3a273439); color: #ead3b0; font: inherit; font-size: 14px; letter-spacing: .16em; cursor: pointer; touch-action: manipulation; transition: background .25s ease, border-color .25s ease, transform .2s ease; }
.gate-submit span { margin-left: 8px; }
.gate-submit:hover { border-color: #e3c497b3; background: #a37a4440; }
.gate-submit:active { transform: translateY(1px); }
.gate-submit:focus-visible { outline: 2px solid #e6be85; outline-offset: 3px; }
.gate-fields:disabled .gate-submit { cursor: wait; opacity: .65; }
.gate-feedback { min-height: 22px; margin: 10px 0 0; color: #dbaf97; font-size: 12px; line-height: 1.8; }
.gate-footnote { margin: 3px 0 0; color: #84768e; font-size: 11px; letter-spacing: .12em; line-height: 1.8; }
.gate-footnote span { color: #ae9168; margin-right: 6px; }
.gate-noscript { font-size: 13px; color: #e6be85; }
.gate-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.gate.is-wrong .gate-form { animation: gate-shake .38s ease; }
.gate.is-wrong .gate-answer { border-color: #d79580; }
.gate.is-unlocking .gate-lantern-glow { opacity: 1; transform: scale(1.25); }
.gate.is-unlocking .gate-lantern-face { fill: #ffe1a0; filter: drop-shadow(0 0 7px #ffb039); }
.gate.is-unlocking .gate-lantern svg { filter: brightness(1.35) drop-shadow(0 0 18px #fca63844); }
.gate.is-unlocking .gate-feedback { color: #f0ce94; }
.gate.is-leaving { opacity: 0; pointer-events: none; }
.gate-sparks { position: absolute; left: 50%; top: 60%; pointer-events: none; }
.gate-sparks i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #ffe3a3; opacity: 0; box-shadow: 0 0 8px #ffb84a; animation: gate-spark 1.5s cubic-bezier(.1,.5,.3,1) var(--delay) both; }
@keyframes gate-drift { from { opacity: .2; transform: translateY(12px); } to { opacity: .7; transform: translate(10px, -20px); } }
@keyframes gate-fog { to { transform: translateX(10%); } }
@keyframes gate-arrive { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gate-shake { 0%, 100% { transform: translateX(0); } 25%, 65% { transform: translateX(-7px); } 45%, 85% { transform: translateX(7px); } }
@keyframes gate-spark { 0% { opacity: 0; transform: translate(0, 0) scale(.2); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.3); } }
@media (max-width: 600px) {
  .gate-content { padding: 22px 20px 18px; }
  .gate-moon { top: 6%; right: -24px; opacity: .35; }
  .gate-dedication { margin-bottom: 14px; }
  .gate-subtitle { font-size: 12px; }
  .gate-horizon { height: 22%; }
}
@media (max-height: 650px) {
  .gate-content { padding-top: 12px; padding-bottom: 12px; }
  .gate-dedication { margin-bottom: 6px; }
  .gate-chapter { margin-bottom: 4px; }
  .gate h1 { font-size: 30px; }
  .gate-subtitle { margin-top: 4px; }
  .gate-lantern { width: 80px; height: 64px; margin: 0; }
  .gate-whisper-panel { margin-top: 6px; }
  .gate-question { margin-bottom: 8px; }
  .gate-answer { min-height: 44px; }
  .gate-submit { min-height: 44px; margin-top: 9px; }
  .gate-feedback { margin-top: 5px; }
  .gate-footnote { margin: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .gate, .gate *, .gate *::before, .gate *::after { animation: none !important; transition: none !important; }
}
