:root {
  --bg: #060709;
  --bg-2: #0a0d11;
  --ink: #d8d9d4;
  --muted: #8d9188;
  --green: rgba(120, 150, 102, 0.55);
  --green-2: rgba(151, 191, 129, 0.28);
  --cyan: rgba(99, 171, 198, 0.22);
  --magenta: rgba(177, 69, 131, 0.18);
  --amber: rgba(163, 124, 67, 0.18);
  --line: rgba(210, 220, 210, 0.08);
  --shadow: rgba(0,0,0,0.7);
  --door-glow: rgba(132, 196, 163, 0.24);
  --door-core: rgba(8, 11, 14, 0.97);
  --maxw: 1200px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "American Typewriter", "Noto Serif SC", "Songti SC", serif;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  background:
    radial-gradient(circle at 50% 14%, rgba(80, 100, 92, 0.08), transparent 24%),
    radial-gradient(circle at 78% 30%, var(--magenta), transparent 22%),
    radial-gradient(circle at 20% 72%, var(--cyan), transparent 24%),
    linear-gradient(180deg, #050607 0%, #090b0e 42%, #050608 100%);
  position: relative;
  letter-spacing: 0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.018) 0,
      rgba(255,255,255,0.018) 1px,
      transparent 2px,
      transparent 4px
    );
  mix-blend-mode: screen;
  opacity: 0.16;
  pointer-events: none;
  z-index: 20;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, transparent 38%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
  z-index: 19;
}

#noise, #stars, #pixels, #glyphs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

#noise {
  opacity: 0.12;
  mix-blend-mode: screen;
}
#stars { opacity: 0.55; }
#pixels { opacity: 0.28; }
#glyphs { opacity: 0.24; }

.top-signal {
  position: fixed;
  top: 14px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: rgba(202, 214, 190, 0.58);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  z-index: 30;
  mix-blend-mode: screen;
  pointer-events: none;
}

.top-signal .state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(142, 190, 134, 0.58);
  box-shadow: 0 0 10px rgba(142, 190, 134, 0.45);
  animation: blink 2.4s infinite ease-in-out;
}

@keyframes blink {
  0%, 100% { opacity: 0.35; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.08); }
}

main {
  position: relative;
  z-index: 5;
}

.section {
  position: relative;
  min-height: 100svh;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 10vh 24px;
}

.inner {
  width: min(var(--maxw), 100%);
  position: relative;
}

.copy {
  width: min(700px, 100%);
  position: relative;
  z-index: 3;
  text-shadow: 0 0 24px rgba(0,0,0,0.55);
}
.copy.center { margin: 0 auto; text-align: center; }
.copy.left { margin-right: auto; text-align: left; }
.copy.right { margin-left: auto; text-align: right; }

.line {
  margin: 0.15em 0;
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  line-height: 1.45;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s ease, transform 0.9s ease;
  will-change: transform, opacity;
}

.line.small {
  font-size: clamp(0.85rem, 1.2vw, 1rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(192, 204, 186, 0.56);
}

.line.big {
  font-size: clamp(1.4rem, 3vw, 2.35rem);
  line-height: 1.3;
}
.line.dim { color: rgba(216, 217, 212, 0.72); }
.line.green { color: rgba(181, 210, 165, 0.85); }

.section.visible .line {
  opacity: 1;
  transform: translateY(0);
}
.line:nth-child(2) { transition-delay: 0.12s; }
.line:nth-child(3) { transition-delay: 0.2s; }
.line:nth-child(4) { transition-delay: 0.28s; }
.line:nth-child(5) { transition-delay: 0.36s; }
.line:nth-child(6) { transition-delay: 0.44s; }

.spacer { height: 1.25rem; }
.spacer-lg { height: 2.5rem; }

.grid-faint {
  position: absolute;
  inset: 10% 4% auto 4%;
  height: 72%;
  background-image:
    linear-gradient(rgba(194, 216, 191, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(194, 216, 191, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, rgba(0,0,0,0.92) 12%, transparent 84%);
  opacity: 0.22;
  z-index: 0;
}

.door-zone {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 9vh 20px 12vh;
}

.door-stack {
  position: relative;
  width: min(920px, 100%);
  min-height: 88svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.remain {
  font-size: 11px;
  color: rgba(190, 204, 182, 0.58);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  z-index: 4;
  position: relative;
}

.calligraphy {
  position: relative;
  z-index: 4;
  font-size: clamp(2.5rem, 7vw, 6.4rem);
  line-height: 1;
  color: rgba(228, 225, 214, 0.92);
  transform: rotate(-7deg);
  text-shadow:
    0 0 1px rgba(255,255,255,0.35),
    0 0 14px rgba(215, 223, 202, 0.12),
    0 0 28px rgba(89, 170, 164, 0.06);
  opacity: 0.94;
  user-select: none;
  pointer-events: none;
  filter: contrast(1.05) blur(0.1px);
}
.calligraphy::after {
  content: "草台秀";
  position: absolute;
  inset: 0;
  color: rgba(144, 194, 165, 0.15);
  transform: translate(8px, 6px);
  filter: blur(2px);
  z-index: -1;
}

.door {
  position: relative;
  width: min(320px, 42vw);
  aspect-ratio: 0.68 / 1;
  min-width: 220px;
  z-index: 2;
  filter: drop-shadow(0 0 26px rgba(0, 0, 0, 0.7));
}

.door-frame {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(194, 220, 202, 0.18);
  outline: 1px solid rgba(93, 168, 174, 0.08);
  outline-offset: 8px;
  background:
    linear-gradient(180deg, rgba(6,10,12,0.85), rgba(3,4,6,0.95)),
    repeating-linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.02) 1px, transparent 2px, transparent 5px);
  box-shadow:
    inset 0 0 40px rgba(0,0,0,0.78),
    inset 0 0 0 1px rgba(179, 205, 175, 0.05),
    0 0 18px rgba(95, 174, 149, 0.15),
    0 0 80px rgba(55, 89, 120, 0.12);
  overflow: hidden;
}

.door-frame::before {
  content: "";
  position: absolute;
  inset: 4.5% 7%;
  background:
    radial-gradient(circle at 50% 34%, rgba(87, 157, 138, 0.09), transparent 26%),
    radial-gradient(circle at 50% 74%, rgba(113, 92, 158, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(5,8,11,0.72), rgba(2,3,4,0.96));
  border: 1px solid rgba(182, 220, 209, 0.1);
  box-shadow: inset 0 0 32px rgba(0,0,0,0.86);
}

.door-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 14%, rgba(166, 229, 177, 0.12), transparent 20%),
    radial-gradient(circle at 52% 96%, rgba(168, 74, 136, 0.12), transparent 18%),
    linear-gradient(90deg, transparent 0%, rgba(89, 177, 197, 0.06) 46%, transparent 53%),
    linear-gradient(180deg, transparent 0%, rgba(255,255,255,0.02) 48%, transparent 100%);
  mix-blend-mode: screen;
  opacity: 0.9;
  animation: doorPulse 7s ease-in-out infinite;
}

@keyframes doorPulse {
  0%, 100% { opacity: 0.72; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.008); }
}

.door-crack {
  position: absolute;
  left: 49.8%;
  top: 8%;
  bottom: 9%;
  width: 2px;
  background: linear-gradient(180deg, transparent, rgba(202, 234, 192, 0.2), rgba(106, 176, 164, 0.6), rgba(190, 79, 139, 0.24), transparent);
  box-shadow:
    0 0 18px rgba(120, 193, 183, 0.34),
    0 0 32px rgba(72, 127, 151, 0.18);
  animation: crackShift 6.5s ease-in-out infinite;
}

@keyframes crackShift {
  0%, 100% { opacity: 0.65; transform: translateX(0) scaleY(1); }
  50% { opacity: 1; transform: translateX(1px) scaleY(1.03); }
}

.door-pixels {
  position: absolute;
  inset: -10% -18%;
  z-index: -1;
  pointer-events: none;
}

.door-pixel {
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(177, 206, 176, 0.18);
  box-shadow: 0 0 12px rgba(99, 171, 198, 0.14);
  animation: drift 10s linear infinite;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0); opacity: 0.18; }
  50% { opacity: 0.55; }
  to { transform: translate3d(var(--dx), var(--dy), 0); opacity: 0; }
}

.door-copy {
  width: min(620px, 100%);
  text-align: center;
  position: relative;
  z-index: 4;
}
.door-copy .line { font-size: clamp(1rem, 2vw, 1.4rem); }
.door-copy .line.cta { font-size: clamp(1.35rem, 2.6vw, 2rem); margin-top: 0.6em; }

.fragments-section {
  min-height: 100svh;
  display: grid;
  place-items: center;
  position: relative;
  padding: 12vh 20px;
}

.fragment-field {
  width: min(1100px, 100%);
  min-height: 72svh;
  position: relative;
  border: 1px solid rgba(255,255,255,0.02);
}

.fragment {
  position: absolute;
  font-size: clamp(0.82rem, 1vw + 0.3rem, 1.06rem);
  color: rgba(198, 204, 194, 0.48);
  letter-spacing: 0.05em;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  animation: fragmentBlink var(--dur) ease-in-out infinite;
  animation-delay: var(--delay);
  text-shadow: 0 0 16px rgba(0,0,0,0.7);
  user-select: none;
  white-space: nowrap;
}
.fragment.strong { color: rgba(187, 213, 170, 0.74); }
.fragment.warn { color: rgba(204, 170, 138, 0.56); }
.fragment.bleed { color: rgba(191, 130, 170, 0.48); }

@keyframes fragmentBlink {
  0%, 100% { opacity: 0; transform: translateY(12px) scale(0.985); }
  12%, 24% { opacity: 0.75; transform: translateY(0) scale(1); }
  27% { opacity: 0.18; }
  31%, 48% { opacity: 0.56; }
  56% { opacity: 0; }
}

.deep-section {
  min-height: 120svh;
  padding: 14vh 24px 18vh;
  position: relative;
  overflow: hidden;
}
.deep-section::before {
  content: "";
  position: absolute;
  inset: 10% -10% 0 -10%;
  background:
    linear-gradient(110deg, transparent 0 30%, rgba(255,255,255,0.03) 31%, transparent 32%),
    linear-gradient(95deg, transparent 0 52%, rgba(255,255,255,0.02) 53%, transparent 54%),
    radial-gradient(circle at 76% 28%, rgba(168, 90, 140, 0.1), transparent 22%),
    radial-gradient(circle at 20% 70%, rgba(85, 123, 139, 0.08), transparent 18%);
  opacity: 0.34;
  transform: rotate(-3deg);
  pointer-events: none;
}

.deep-structure {
  position: absolute;
  right: -4%;
  top: 8%;
  width: min(42vw, 480px);
  height: 70%;
  opacity: 0.16;
  background:
    linear-gradient(90deg, transparent 0 20%, rgba(200,210,200,0.08) 20% 21%, transparent 21% 38%, rgba(200,210,200,0.05) 38% 39%, transparent 39% 100%),
    linear-gradient(180deg, transparent 0 18%, rgba(200,210,200,0.06) 18% 19%, transparent 19% 34%, rgba(200,210,200,0.04) 34% 35%, transparent 35% 100%);
  filter: blur(0.25px);
  transform: perspective(500px) rotateY(-25deg);
  pointer-events: none;
}

.closing {
  min-height: 90svh;
  padding: 18vh 24px 16vh;
  display: grid;
  place-items: center;
  position: relative;
}
.closing::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 9vh;
  width: min(18vw, 120px);
  height: min(24vw, 180px);
  transform: translateX(-50%);
  border: 1px solid rgba(196, 224, 204, 0.12);
  background: linear-gradient(180deg, rgba(10,14,17,0.15), rgba(2,3,4,0.9));
  box-shadow: 0 0 25px rgba(105, 173, 148, 0.12), 0 0 70px rgba(64, 96, 146, 0.1), inset 0 0 30px rgba(0,0,0,0.85);
  opacity: 0.9;
  pointer-events: none;
}
.closing::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(9vh + 45px);
  width: 1px;
  height: min(16vw, 110px);
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(164, 224, 182, 0.52), rgba(83, 144, 163, 0.28), transparent);
  box-shadow: 0 0 22px rgba(139, 195, 170, 0.38);
  pointer-events: none;
}

footer {
  position: relative;
  z-index: 4;
  padding: 20px 24px 26px;
  font-size: 11px;
  color: rgba(180, 188, 176, 0.42);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.glitch-hover {
  position: relative;
  display: inline-block;
}
.glitch-hover::before,
.glitch-hover::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.glitch-hover::before { color: rgba(100, 196, 196, 0.28); transform: translate(1px, 0); }
.glitch-hover::after { color: rgba(196, 92, 152, 0.22); transform: translate(-1px, 0); }
.glitch-hover:hover::before,
.glitch-hover:hover::after { opacity: 1; }

@media (max-width: 760px) {
  .top-signal { font-size: 10px; letter-spacing: 0.12em; }
  .copy { width: min(92vw, 700px); }
  .door-stack { min-height: 84svh; gap: 22px; }
  .fragment-field { min-height: 64svh; }
  .fragment { font-size: 0.84rem; }
  footer { flex-direction: column; }
}
