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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #111;
  color: #f0f0f0;
  user-select: none;
}

.bg {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #111;
  opacity: 0;
  transition: opacity 1s ease-in-out;
  z-index: 1;
}

.bg.active { opacity: 1; }

#overlay {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 24px;
  padding: 40px 8vw 6vh;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.55) 50%, rgba(0,0,0,0.15) 100%);
  cursor: pointer;
  overflow-y: auto;
}

#text-box {
  font-size: clamp(18px, 2.4vw, 26px);
  line-height: 1.8;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  white-space: pre-wrap;
  color: #f5f5f0;
  background: rgba(10, 10, 12, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 20px 28px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  flex-shrink: 0;
}

#text-box .caret {
  display: inline-block;
  width: 0.5em;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

#choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
  flex-shrink: 0;
}

.choice {
  padding: 14px 22px;
  font-size: clamp(15px, 1.8vw, 19px);
  font-family: inherit;
  color: #f0f0f0;
  background: rgba(20, 20, 30, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease, background 0.2s, border-color 0.2s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.choice.show {
  opacity: 1;
  transform: translateY(0);
}

.choice:hover {
  background: rgba(60, 60, 90, 0.9);
  border-color: rgba(255, 255, 255, 0.7);
}

.choice.restart {
  text-align: center;
  background: rgba(80, 30, 30, 0.78);
}

.choice.restart:hover {
  background: rgba(120, 40, 40, 0.9);
}

#text-box.error {
  color: #ff8080;
}

/* 窄屏/低分辨率：文字更紧凑、间距减小，避免和选项叠加 */
@media (max-width: 720px), (max-height: 640px) {
  #overlay {
    padding: 24px 4vw 4vh;
    gap: 16px;
  }
  #text-box {
    font-size: 16px;
    line-height: 1.7;
    padding: 14px 18px;
  }
  .choice {
    padding: 10px 14px;
    font-size: 14px;
  }
}
