:root {
  --bg: #050810;
  --bg-soft: #122533;
  --panel: rgba(9, 14, 24, 0.82);
  --panel-strong: rgba(11, 17, 30, 0.94);
  --stroke: rgba(210, 189, 141, 0.32);
  --accent: #d8b97a;
  --accent-strong: #f0d9ab;
  --text: #f5f0e6;
  --muted: rgba(245, 240, 230, 0.72);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  --font-body: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --font-display: "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(29, 67, 89, 0.56), transparent 42%),
    linear-gradient(160deg, #07111b, #050810 62%, #020407);
  color: var(--text);
  font-family: var(--font-body);
}

body {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

.site-shell {
  position: relative;
  min-height: 100vh;
  padding: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 12px 12px;
  mask-image: radial-gradient(circle at center, black, transparent 88%);
}

.quick-menu {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  z-index: 30;
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.menu-button,
.secondary-button,
.primary-button,
.panel-close,
.slot-button,
.choice-button {
  border: 1px solid var(--stroke);
  background: rgba(8, 13, 22, 0.72);
  color: var(--text);
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background-color 140ms ease,
    opacity 140ms ease;
}

.menu-button,
.secondary-button,
.primary-button,
.panel-close {
  border-radius: 999px;
  padding: 0.7rem 1.05rem;
  font-family: var(--font-display);
}

.menu-button:hover,
.secondary-button:hover,
.primary-button:hover,
.panel-close:hover,
.slot-button:hover,
.choice-button:hover {
  transform: translateY(-1px);
  border-color: rgba(240, 217, 171, 0.75);
}

.primary-button {
  background: linear-gradient(120deg, rgba(216, 185, 122, 0.92), rgba(111, 170, 173, 0.86));
  color: #0d1220;
  font-weight: 700;
}

.secondary-button {
  background: rgba(12, 20, 35, 0.75);
}

.vn-shell {
  position: relative;
  width: min(100%, 1320px);
  display: grid;
  gap: 1rem;
}

.stage-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  background: rgba(0, 0, 0, 0.45);
}

.stage-backdrop {
  position: relative;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(180deg, rgba(7, 14, 23, 0.14), rgba(3, 5, 10, 0.28)),
    center / cover no-repeat;
  transition: background-image 260ms ease;
}

.stage-backdrop.is-black {
  background-image: none;
  background-color: #030406;
}

.stage-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, transparent 32%, rgba(0, 0, 0, 0.34) 100%),
    linear-gradient(180deg, rgba(3, 5, 10, 0.02), rgba(3, 5, 10, 0.38));
}

.sprite-layer {
  position: absolute;
  inset: 0;
}

.sprite {
  position: absolute;
  bottom: 0;
  width: var(--sprite-width, min(22vw, 340px));
  height: var(--sprite-height, 90%);
  object-fit: var(--sprite-fit, contain);
  object-position: center bottom;
  filter: drop-shadow(0 24px 32px rgba(0, 0, 0, 0.34));
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.sprite-left {
  left: 8%;
}

.sprite-center {
  left: 50%;
  transform: translateX(-50%);
}

.sprite-right {
  right: 8%;
}

.choice-layer {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 12;
  pointer-events: none;
}

.choice-layer.hidden {
  display: none;
}

.choice-panel {
  width: min(92vw, 760px);
  padding: 1.4rem;
  border-radius: 28px;
  background: rgba(8, 12, 21, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
  pointer-events: auto;
  box-shadow: var(--shadow);
}

.choice-kicker,
.title-kicker {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-size: 0.8rem;
}

.choice-list {
  display: grid;
  gap: 0.85rem;
}

.choice-button {
  width: 100%;
  text-align: left;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  font-size: 1rem;
  line-height: 1.6;
}

.dialogue-panel {
  position: relative;
  min-height: 210px;
  padding: 1.35rem 1.55rem 1.6rem;
  border-radius: 28px;
  background:
    linear-gradient(140deg, rgba(8, 14, 24, 0.92), rgba(19, 22, 37, 0.82)),
    rgba(10, 15, 27, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dialogue-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(216, 185, 122, 0.12), transparent 34%),
    linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.02));
  pointer-events: none;
}

.dialogue-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  font-family: var(--font-display);
}

.speaker-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  padding: 0.25rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(216, 185, 122, 0.38);
  background: rgba(216, 185, 122, 0.12);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.dialogue-hint {
  color: var(--muted);
  font-size: 0.94rem;
}

.dialogue-text {
  position: relative;
  z-index: 1;
  font-size: clamp(1.08rem, 2vw, 1.44rem);
  line-height: 1.95;
  min-height: 5.4em;
  white-space: pre-wrap;
  word-break: break-word;
}

.dialogue-next {
  position: absolute;
  right: 1.3rem;
  bottom: 0.85rem;
  color: var(--accent-strong);
  font-size: 2rem;
  opacity: 0;
  transform: translateY(4px);
}

.dialogue-next.ready {
  opacity: 1;
  animation: nudge 1s ease-in-out infinite;
}

@keyframes nudge {
  0%,
  100% {
    transform: translateY(4px);
  }

  50% {
    transform: translateY(0);
  }
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  background: rgba(3, 6, 10, 0.62);
  backdrop-filter: blur(12px);
}

.overlay.overlay-active {
  display: flex;
}

.title-overlay {
  background:
    linear-gradient(160deg, rgba(5, 9, 16, 0.78), rgba(5, 9, 16, 0.94)),
    url("./图片资源/场景/3003宿舍门口晚上.png") center / cover no-repeat;
}

.title-card,
.panel-card {
  width: min(92vw, 720px);
  padding: 2rem;
  border-radius: 30px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
}

.wide-card {
  width: min(94vw, 960px);
}

.ending-card {
  width: min(92vw, 680px);
}

.title-card h1,
.panel-card h2 {
  margin: 0;
  font-family: var(--font-display);
}

.title-card h1 {
  font-size: clamp(2.8rem, 6vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: 0.04em;
}

.title-copy,
.title-note {
  margin: 1rem 0 0;
  color: var(--muted);
  line-height: 1.8;
  font-size: 1.02rem;
}

.title-actions {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.setting-row,
.toggle-row {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
}

.toggle-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.setting-row input[type="range"] {
  width: 100%;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}

.slot-button {
  padding: 1rem;
  border-radius: 20px;
  text-align: left;
}

.slot-button.empty {
  opacity: 0.75;
}

.slot-title {
  font-family: var(--font-display);
  font-weight: 700;
}

.slot-meta,
.slot-preview {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.slot-preview {
  min-height: 3.1em;
}

.backlog-list {
  max-height: min(70vh, 720px);
  overflow: auto;
  display: grid;
  gap: 0.75rem;
}

.backlog-entry {
  padding: 0.95rem 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  line-height: 1.75;
}

.backlog-entry strong {
  display: block;
  margin-bottom: 0.2rem;
  font-family: var(--font-display);
  color: var(--accent-strong);
}

.hidden {
  display: none !important;
}

@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .site-shell {
    padding: 0.8rem;
    align-items: flex-start;
  }

  .quick-menu {
    position: sticky;
    top: 0;
    right: auto;
    justify-content: flex-start;
    margin-bottom: 0.75rem;
  }

  .vn-shell {
    width: 100%;
  }

  .dialogue-panel {
    min-height: 240px;
    padding: 1rem 1rem 1.4rem;
  }

  .speaker-chip {
    min-height: 2rem;
  }

  .sprite {
    width: var(--sprite-mobile-width, var(--sprite-width, min(38vw, 320px)));
    height: var(--sprite-mobile-height, var(--sprite-height, 88%));
  }
}

@media (max-width: 640px) {
  .site-shell {
    padding: 0.65rem;
  }

  .stage-frame {
    border-radius: 22px;
  }

  .sprite-left {
    left: 0;
  }

  .sprite-right {
    right: 0;
  }

  .dialogue-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .title-card,
  .panel-card {
    padding: 1.2rem;
    border-radius: 24px;
  }

  .title-card h1 {
    font-size: 2.5rem;
  }

  .choice-panel {
    width: 100%;
    padding: 1rem;
    border-radius: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation: none !important;
  transition: none !important;
}
