* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: #000;
  color: #e8e4dc;
  font-family: "Songti SC", "Noto Serif SC", "SimSun", serif;
  overflow: hidden;
}

.screen { height: 100vh; width: 100vw; position: relative; }
.hidden { display: none !important; }

/* ---------- 开始界面 ---------- */
#start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(30, 60, 80, 0.5), transparent 60%),
    linear-gradient(180deg, #05070c 0%, #0a1220 100%);
}
#game-title {
  font-size: 72px;
  letter-spacing: 24px;
  text-indent: 24px;
  font-weight: 600;
  color: #d8cfc0;
  text-shadow: 0 0 40px rgba(120, 160, 200, 0.4);
}
#game-subtitle { color: #6b7280; letter-spacing: 6px; font-size: 15px; }
#btn-start {
  margin-top: 32px;
  background: transparent;
  border: 1px solid #8a7f6a;
  color: #c9bfa8;
  font-size: 18px;
  letter-spacing: 8px;
  text-indent: 8px;
  padding: 12px 48px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.4s;
}
#btn-start:hover { background: rgba(200, 180, 140, 0.12); box-shadow: 0 0 24px rgba(200, 180, 140, 0.25); }

/* ---------- 开场图片序列 ---------- */
#intro-layer {
  position: absolute; inset: 0;
  z-index: 5;
  cursor: pointer;
  background-color: #000;
  animation: introFade 1.2s ease;
}
@keyframes introFade { from { opacity: 0; } to { opacity: 1; } }
#intro-layer::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, transparent 35%, transparent 55%, rgba(0,0,0,0.85) 100%);
}
#intro-caption {
  position: absolute;
  left: 50%; bottom: 96px;
  transform: translateX(-50%);
  width: min(680px, 88vw);
  font-size: 18px;
  line-height: 1.9;
  color: #e8e2d5;
  text-shadow: 0 1px 8px #000;
  z-index: 1;
  animation: fadeUp 1s ease 0.4s both;
}
#intro-hint {
  position: absolute;
  left: 50%; bottom: 40px;
  transform: translateX(-50%);
  font-size: 13px;
  letter-spacing: 4px;
  color: rgba(232, 228, 220, 0.4);
  z-index: 1;
  animation: hintPulse 2s ease-in-out infinite;
}
@keyframes hintPulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.8; } }

/* ---------- 背景 ---------- */
#bg {
  position: absolute; inset: 0;
  transition: background 1.2s ease;
}
#vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.75) 100%);
  pointer-events: none;
}

/* ---------- 正文 ---------- */
#content {
  position: absolute;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: min(760px, 92vw);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 24px 8px max(48px, env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(184, 173, 151, 0.35) transparent;
  z-index: 2;
  mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 100%);
}
#node-title {
  font-size: 22px;
  letter-spacing: 10px;
  color: #b8ad97;
  margin-bottom: 18px;
  text-shadow: 0 2px 8px #000;
}
#node-title.ending-true  { color: #e8c87a; }
#node-title.ending-death { color: #b04848; }
#node-title.ending-bad   { color: #a06a6a; }
#node-title.ending-normal { color: #7fa3b8; }
#node-title.ending-core { color: #79a9b8; }
#node-title.ending-justice { color: #e8c87a; }
#node-title.ending-witness { color: #93b7c2; }
#node-title.ending-loss { color: #8f8794; }

#node-text p {
  font-size: 17px;
  line-height: 1.9;
  margin-bottom: 12px;
  color: #ddd6c9;
  text-shadow: 0 1px 6px #000, 0 0 20px rgba(0, 0, 0, 0.8);
  opacity: 0;
  animation: fadeUp 0.8s ease forwards;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 选项 ---------- */
#choices { margin-top: 28px; display: flex; flex-direction: column; gap: 12px; }
.choice {
  background: rgba(10, 12, 18, 0.72);
  border: 1px solid rgba(184, 173, 151, 0.35);
  border-left: 3px solid rgba(184, 173, 151, 0.7);
  color: #d8d2c4;
  font-size: 15px;
  line-height: 1.6;
  text-align: left;
  padding: 12px 18px;
  cursor: pointer;
  font-family: inherit;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
  transition: all 0.25s;
}
.choice:hover {
  background: rgba(60, 52, 38, 0.6);
  border-left-color: #e8c87a;
  transform: translateX(6px);
}
.choice:disabled {
  cursor: default;
  opacity: 0.45;
  transform: none;
}

#btn-continue {
  margin-top: 32px;
  background: transparent;
  border: none;
  color: rgba(216, 207, 192, 0.6);
  font-size: 15px;
  letter-spacing: 4px;
  cursor: pointer;
  font-family: inherit;
  opacity: 0;
  animation: fadeUp 1s ease 1s forwards;
}
#btn-continue:hover { color: #e8c87a; }

@media (max-width: 700px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: auto;
  }
  .screen {
    width: 100%;
    height: auto;
    min-height: 100svh;
  }
  #start-screen { gap: 18px; padding: 24px; text-align: center; }
  #game-title {
    font-size: clamp(46px, 16vw, 64px);
    letter-spacing: 16px;
    text-indent: 16px;
  }
  #game-subtitle {
    max-width: 90vw;
    font-size: 13px;
    line-height: 1.8;
    letter-spacing: 3px;
  }
  #btn-start { margin-top: 20px; padding: 11px 36px; }

  #intro-layer {
    position: fixed;
    width: 100%;
    height: 100svh;
    inset: 0 auto auto 0;
  }
  #intro-caption {
    bottom: calc(76px + env(safe-area-inset-bottom));
    font-size: 16px;
    line-height: 1.75;
  }
  #intro-hint { bottom: calc(24px + env(safe-area-inset-bottom)); }

  #game-screen { overflow: visible; }
  #bg,
  #vignette {
    position: fixed;
    width: 100%;
    height: 100svh;
    inset: 0 auto auto 0;
  }
  #vignette {
    background:
      linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.2) 32%, rgba(0,0,0,0.88) 72%, rgba(0,0,0,0.96) 100%),
      radial-gradient(ellipse at center, transparent 35%, rgba(0,0,0,0.6) 100%);
  }
  #content {
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    width: 100%;
    min-height: 100svh;
    max-height: none;
    padding: 48svh 18px max(40px, calc(24px + env(safe-area-inset-bottom)));
    overflow: visible;
    overscroll-behavior: auto;
    mask-image: none;
    -webkit-mask-image: none;
    background: linear-gradient(
      180deg,
      transparent 0,
      rgba(0, 0, 0, 0.18) 34svh,
      rgba(0, 0, 0, 0.9) 56svh,
      rgba(0, 0, 0, 0.97) 100%
    );
  }
  #node-title {
    margin-bottom: 14px;
    font-size: 19px;
    letter-spacing: 6px;
  }
  #node-text p {
    font-size: 15px;
    line-height: 1.75;
    margin-bottom: 10px;
  }
  #choices {
    margin-top: 20px;
    gap: 10px;
  }
  .choice {
    padding: 11px 14px;
    font-size: 14px;
  }
}

@media (max-height: 680px) {
  #content { padding-top: 36px; }
  #node-title { margin-bottom: 10px; }
  #node-text p { line-height: 1.65; margin-bottom: 8px; }
  #choices { margin-top: 16px; }
}

@media (max-width: 700px) and (max-height: 680px) {
  #content { padding-top: 38svh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}
