/* =========================================================
   SGA 食堂 · 湖畔食光
   基础界面 / 标题 / 地图 HUD / 对话 / 弹窗
   ========================================================= */

:root {
  --cream: #f7f0e2;
  --paper: #fcf8ef;
  --paper-deep: #f1e6d1;
  --cream-dark: #e6d6bb;
  --ink: #1d2a3a;
  --ink-soft: #4e5763;
  --muted: #797369;
  --navy: #12263f;
  --navy-2: #1d3a5c;
  --navy-3: #2b4f74;
  --terracotta: #c25743;
  --terracotta-dark: #9d3f30;
  --gold: #e0a63c;
  --gold-soft: #f0cf8a;
  --teal: #2f6f73;
  --teal-deep: #245c60;
  --sage: #7a9e7e;
  --rose: #c67b8a;
  --line: rgba(29, 42, 58, 0.13);
  --line-strong: rgba(29, 42, 58, 0.24);
  --shadow-sm: 0 2px 8px rgba(18, 38, 63, 0.08);
  --shadow: 0 12px 32px rgba(18, 38, 63, 0.16);
  --shadow-lg: 0 26px 70px rgba(7, 18, 32, 0.32);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  --en: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 28px;
  --hud-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background: #0b1624;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--teal-deep);
}

h1, h2, h3, h4, p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.no-scroll {
  overflow: hidden;
}

::selection {
  background: rgba(224, 166, 60, 0.35);
}

:focus-visible {
  outline: 3px solid rgba(224, 166, 60, 0.8);
  outline-offset: 3px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(29, 42, 58, 0.2);
  border-radius: 8px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(29, 42, 58, 0.35);
  background-clip: content-box;
  border: 2px solid transparent;
}

/* ---------- 通用控件 ---------- */
.btn {
  --btn-bg: var(--navy);
  --btn-fg: var(--cream);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, opacity 0.16s;
  box-shadow: 0 6px 16px rgba(18, 38, 63, 0.16);
  user-select: none;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(18, 38, 63, 0.2);
}
.btn:active {
  transform: translateY(0) scale(0.985);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-primary {
  --btn-bg: var(--navy);
}
.btn-accent {
  --btn-bg: var(--terracotta);
}
.btn-teal {
  --btn-bg: var(--teal);
}
.btn-gold {
  --btn-bg: var(--gold);
  --btn-fg: var(--navy);
}
.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--navy);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}
.btn-ghost:hover {
  background: rgba(29, 42, 58, 0.05);
  box-shadow: none;
}
.btn-soft {
  --btn-bg: var(--paper-deep);
  --btn-fg: var(--navy);
  box-shadow: none;
}
.btn-danger {
  --btn-bg: #a53a32;
}
.btn-sm {
  min-height: 34px;
  padding: 7px 14px;
  font-size: 12.5px;
}
.btn-lg {
  min-height: 54px;
  padding: 14px 30px;
  font-size: 16px;
}
.btn-block {
  width: 100%;
}
.text-btn {
  color: var(--teal-deep);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 0;
  border-bottom: 1px dashed currentColor;
}
.text-btn:hover {
  color: var(--navy);
}
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(29, 42, 58, 0.07);
  color: var(--navy);
  font-size: 16px;
  transition: background 0.16s, transform 0.16s;
}
.icon-btn:hover {
  background: rgba(29, 42, 58, 0.13);
}
.icon-btn:active {
  transform: scale(0.94);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(29, 42, 58, 0.07);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}
.chip-gold {
  background: rgba(224, 166, 60, 0.16);
  color: #7d5a19;
}
.chip-teal {
  background: rgba(47, 111, 115, 0.12);
  color: var(--teal-deep);
}
.chip-terra {
  background: rgba(194, 87, 67, 0.12);
  color: var(--terracotta-dark);
}
.kbd {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  align-items: center;
  justify-content: center;
  font-family: var(--en);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--paper);
}

/* ---------- 全屏通用 ---------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
}
.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

/* ---------- 启动画面 ---------- */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(160deg, rgba(9, 20, 33, 0.82), rgba(9, 20, 33, 0.58) 45%, rgba(18, 38, 63, 0.85)),
    url("../assets/gen/scenes/campus.webp") center/cover no-repeat;
  color: var(--cream);
  transition: opacity 0.6s ease, visibility 0.6s;
}
.boot-screen.leaving {
  opacity: 0;
  visibility: hidden;
}
.boot-shade {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, transparent 0%, rgba(7, 16, 28, 0.6) 70%);
}
.boot-inner {
  position: relative;
  width: min(430px, 84vw);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.boot-logo-wrap {
  position: relative;
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
}
.boot-logo {
  width: 84px;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.35));
  animation: logoFloat 3.6s ease-in-out infinite;
}
.boot-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(240, 207, 138, 0.36);
  animation: ringPulse 2.8s ease-out infinite;
}
.boot-ring::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 1px dashed rgba(247, 240, 226, 0.18);
}
.boot-title {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
}
.boot-sub {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(247, 240, 226, 0.68);
  letter-spacing: 0.34em;
  text-indent: 0.34em;
}
.boot-bar {
  width: 220px;
  height: 3px;
  margin-top: 34px;
  border-radius: 3px;
  background: rgba(247, 240, 226, 0.18);
  overflow: hidden;
}
.boot-bar span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold), var(--cream));
  transition: width 0.5s ease;
}
.boot-status {
  margin-top: 12px;
  font-size: 11.5px;
  color: rgba(247, 240, 226, 0.55);
  letter-spacing: 0.08em;
}
.boot-note {
  margin-top: 46px;
  font-family: var(--en);
  font-size: 10px;
  color: rgba(247, 240, 226, 0.34);
  letter-spacing: 0.12em;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes ringPulse {
  0% { transform: scale(0.9); opacity: 0.9; }
  70% { transform: scale(1.12); opacity: 0; }
  100% { transform: scale(1.12); opacity: 0; }
}

/* ---------- 标题页 ---------- */
.title-screen {
  background: #0d1a29;
}
.title-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(100deg, rgba(9, 20, 34, 0.94) 0%, rgba(9, 20, 34, 0.76) 32%, rgba(9, 20, 34, 0.18) 62%, rgba(9, 20, 34, 0.35) 100%),
    linear-gradient(0deg, rgba(9, 20, 34, 0.92), transparent 55%),
    url("../assets/gen/scenes/campus.webp") center/cover no-repeat;
  transform: scale(1.03);
  animation: titleDrift 24s ease-in-out infinite alternate;
}
.title-screen::after {
  background-image:
    radial-gradient(circle at 82% 18%, rgba(240, 207, 138, 0.12), transparent 25%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  opacity: 0.06;
}
@keyframes titleDrift {
  0% { transform: scale(1.03) translate(0, 0); }
  100% { transform: scale(1.08) translate(-1.5%, -1%); }
}
.title-panel {
  position: relative;
  z-index: 2;
  height: 100%;
  width: min(640px, 60vw);
  padding: clamp(28px, 6vh, 70px) 0 40px clamp(24px, 7vw, 110px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--cream);
}
.title-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--en);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-soft);
}
.title-eyebrow::before {
  content: "";
  width: 34px;
  height: 1px;
  background: rgba(240, 207, 138, 0.7);
}
.title-logo {
  width: 92px;
  margin: 26px 0 20px;
  filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.35));
}
.title-h1 {
  font-family: var(--serif);
  font-size: clamp(54px, 7vw, 92px);
  line-height: 0.98;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.28);
}
.title-h1 span {
  color: var(--gold-soft);
}
.title-en {
  margin-top: 10px;
  font-family: var(--en);
  font-size: 12px;
  letter-spacing: 0.42em;
  color: rgba(247, 240, 226, 0.62);
  text-transform: uppercase;
}
.title-tagline {
  margin-top: 24px;
  font-family: var(--serif);
  font-size: clamp(17px, 2vw, 22px);
  letter-spacing: 0.18em;
  color: var(--gold-soft);
}
.title-lead {
  margin-top: 14px;
  max-width: 460px;
  font-size: 14px;
  line-height: 1.9;
  color: rgba(247, 240, 226, 0.76);
}
.title-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 34px;
}
.title-actions .btn {
  min-width: 148px;
}
.title-mini-actions {
  display: flex;
  gap: 18px;
  margin-top: 22px;
}
.title-link {
  color: rgba(247, 240, 226, 0.62);
  font-size: 12px;
  border-bottom: 1px solid rgba(247, 240, 226, 0.22);
  padding-bottom: 3px;
  transition: color 0.16s;
}
.title-link:hover {
  color: var(--gold-soft);
}
.title-features {
  display: flex;
  gap: 22px;
  margin-top: 30px;
}
.title-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: rgba(247, 240, 226, 0.55);
}
.title-feature b {
  color: var(--gold-soft);
  font-family: var(--en);
  font-weight: 600;
}
.title-photos {
  position: absolute;
  right: clamp(30px, 5vw, 90px);
  bottom: clamp(40px, 8vh, 100px);
  z-index: 3;
  width: min(430px, 38vw);
  height: 340px;
  pointer-events: none;
}
.title-photo {
  position: absolute;
  padding: 8px 8px 30px;
  background: var(--paper);
  border-radius: 2px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  transform-origin: 50% 80%;
  animation: photoFloat 7s ease-in-out infinite;
}
.title-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1px;
}
.title-photo::after {
  content: attr(data-caption);
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9px;
  text-align: center;
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: #6e6457;
}
.title-photo.p1 {
  width: 210px;
  height: 230px;
  right: 170px;
  top: 0;
  transform: rotate(-6deg);
}
.title-photo.p2 {
  width: 170px;
  height: 190px;
  right: 0;
  top: 70px;
  transform: rotate(5deg);
  animation-delay: -2s;
}
.title-photo.p3 {
  width: 150px;
  height: 160px;
  right: 70px;
  top: 170px;
  transform: rotate(-2deg);
  animation-delay: -4s;
}
@keyframes photoFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -7px; }
}
.title-credit {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  align-self: flex-start;
  margin-top: 18px;
  padding: 8px 16px 8px 13px;
  border: 1px solid rgba(240, 207, 138, 0.38);
  border-left: 3px solid var(--gold-soft);
  border-radius: 4px 11px 11px 4px;
  background: linear-gradient(135deg, rgba(16, 31, 49, 0.86), rgba(9, 20, 34, 0.66));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  font-family: var(--en);
  font-size: clamp(13px, 1.1vw, 16px);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(247, 240, 226, 0.86);
}
.title-credit-name {
  font-size: 1.25em;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold-soft);
}
.title-credit-meta {
  color: rgba(247, 240, 226, 0.7);
}
.title-credit-note {
  font-family: var(--sans);
  font-size: 0.92em;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: rgba(247, 240, 226, 0.92);
}
.title-seal {
  position: absolute;
  top: clamp(26px, 5vh, 50px);
  right: clamp(26px, 4vw, 56px);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(247, 240, 226, 0.2);
  background: rgba(10, 21, 35, 0.35);
  backdrop-filter: blur(10px);
  color: rgba(247, 240, 226, 0.72);
  font-size: 10.5px;
  letter-spacing: 0.08em;
}
.title-seal span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8fcb9b;
  box-shadow: 0 0 0 3px rgba(143, 203, 155, 0.18);
}

/* ---------- 角色创建 ---------- */
.character-screen {
  z-index: 110;
  background:
    linear-gradient(120deg, rgba(9, 20, 34, 0.94), rgba(13, 28, 48, 0.7)),
    url("../assets/gen/scenes/cafeteria.webp") center/cover no-repeat;
  color: var(--cream);
  overflow-y: auto;
}
.character-shell {
  position: relative;
  z-index: 2;
  min-height: 100%;
  width: min(1150px, 92vw);
  margin: 0 auto;
  padding: clamp(30px, 6vh, 70px) 0;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(28px, 5vw, 70px);
  align-items: center;
}
.character-visual {
  position: relative;
}
.character-frame {
  position: relative;
  aspect-ratio: 4 / 4.7;
  max-height: 62vh;
  border-radius: 220px 220px 28px 28px;
  overflow: hidden;
  background: rgba(247, 240, 226, 0.08);
  border: 1px solid rgba(247, 240, 226, 0.16);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
}
.character-frame::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(240, 207, 138, 0.28);
  border-radius: inherit;
  z-index: 2;
  pointer-events: none;
}
.character-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  transition: opacity 0.25s, transform 0.4s;
}
.character-frame:hover .character-preview {
  transform: scale(1.015);
}
.character-frame-tag {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 3;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(10, 21, 35, 0.65);
  border: 1px solid rgba(247, 240, 226, 0.18);
  backdrop-filter: blur(8px);
  font-size: 11px;
  letter-spacing: 0.12em;
  white-space: nowrap;
}
.character-caption {
  margin-top: 16px;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: rgba(247, 240, 226, 0.6);
  text-align: center;
}
.character-form {
  max-width: 480px;
}
.character-kicker {
  font-family: var(--en);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--gold-soft);
  text-transform: uppercase;
}
.character-title {
  margin-top: 14px;
  font-family: var(--serif);
  font-size: clamp(32px, 4vw, 46px);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
}
.character-desc {
  margin-top: 12px;
  font-size: 13.5px;
  line-height: 1.9;
  color: rgba(247, 240, 226, 0.66);
}
.form-field {
  margin-top: 28px;
}
.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(247, 240, 226, 0.56);
  margin-bottom: 9px;
}
.name-input {
  width: 100%;
  height: 50px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid rgba(247, 240, 226, 0.22);
  background: rgba(247, 240, 226, 0.08);
  color: var(--cream);
  font-size: 17px;
  letter-spacing: 0.04em;
  outline: none;
  transition: border 0.16s, background 0.16s;
}
.name-input::placeholder {
  color: rgba(247, 240, 226, 0.32);
}
.name-input:focus {
  border-color: var(--gold);
  background: rgba(247, 240, 226, 0.12);
}
.gender-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.gender-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid rgba(247, 240, 226, 0.18);
  background: rgba(247, 240, 226, 0.06);
  color: rgba(247, 240, 226, 0.72);
  text-align: left;
  transition: all 0.16s;
}
.gender-btn .g-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(247, 240, 226, 0.09);
  font-size: 16px;
}
.gender-btn b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--cream);
}
.gender-btn small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: rgba(247, 240, 226, 0.42);
}
.gender-btn:hover {
  border-color: rgba(240, 207, 138, 0.45);
}
.gender-btn.active {
  border-color: var(--gold);
  background: rgba(240, 207, 138, 0.12);
  box-shadow: 0 0 0 1px rgba(240, 207, 138, 0.25) inset;
}
.character-actions {
  display: flex;
  gap: 12px;
  margin-top: 30px;
}
.character-hint {
  margin-top: 16px;
  font-size: 11px;
  color: rgba(247, 240, 226, 0.4);
  line-height: 1.7;
}
.character-back {
  position: absolute;
  top: 22px;
  left: 22px;
  z-index: 4;
}

/* ---------- 开场 ---------- */
.intro-screen {
  z-index: 120;
  color: var(--cream);
  background: #0b1624;
}
.intro-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: opacity 0.7s ease, transform 8s ease;
  transform: scale(1.02);
}
.intro-bg.switching {
  opacity: 0;
}
.intro-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 18, 31, 0.9) 0%, rgba(8, 18, 31, 0.62) 42%, rgba(8, 18, 31, 0.16) 75%),
    linear-gradient(0deg, rgba(8, 18, 31, 0.94), transparent 55%);
}
.intro-top {
  position: absolute;
  top: 28px;
  left: clamp(24px, 6vw, 80px);
  right: clamp(24px, 6vw, 80px);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.intro-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--en);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(247, 240, 226, 0.55);
}
.intro-brand img {
  width: 30px;
}
.intro-skip {
  color: rgba(247, 240, 226, 0.55);
  font-size: 12px;
  border-bottom: 1px solid rgba(247, 240, 226, 0.22);
  padding-bottom: 2px;
}
.intro-skip:hover {
  color: var(--gold-soft);
}
.intro-content {
  position: absolute;
  left: clamp(24px, 8vw, 130px);
  bottom: clamp(60px, 13vh, 150px);
  z-index: 2;
  width: min(620px, 78vw);
}
.intro-tag {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: var(--gold-soft);
  margin-bottom: 20px;
}
.intro-tag::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
}
.intro-title {
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 60px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: 0.04em;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.35);
}
.intro-text {
  margin-top: 22px;
  min-height: 96px;
  font-size: 15px;
  line-height: 2.05;
  color: rgba(247, 240, 226, 0.82);
  max-width: 560px;
}
.intro-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 26px;
}
.intro-progress {
  display: flex;
  gap: 7px;
  align-items: center;
}
.intro-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(247, 240, 226, 0.28);
  transition: all 0.25s;
}
.intro-dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--gold-soft);
}
.intro-next {
  min-width: 140px;
}
.intro-chapter {
  position: absolute;
  right: clamp(24px, 6vw, 80px);
  bottom: clamp(30px, 6vh, 70px);
  z-index: 2;
  font-family: var(--en);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: rgba(247, 240, 226, 0.32);
}

/* ---------- 固定署名 ---------- */
.credit {
  position: fixed;
  right: 14px;
  bottom: 6px;
  z-index: 6000;
  pointer-events: none;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(8, 18, 31, 0.55);
  border: 1px solid rgba(247, 240, 226, 0.12);
  color: rgba(247, 240, 226, 0.72);
  font-family: var(--en);
  font-size: 10px;
  letter-spacing: 0.05em;
  backdrop-filter: blur(6px);
  white-space: nowrap;
}

/* ---------- 游戏层 ---------- */
.game-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #173a2e;
}
#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.screen-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 45%, rgba(7, 16, 28, 0.18) 100%),
    linear-gradient(0deg, rgba(7, 16, 28, 0.28), transparent 18%);
  z-index: 2;
}
.screen-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  z-index: 3;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}
.scene-fade {
  position: absolute;
  inset: 0;
  z-index: 80;
  background: #0b1624;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}
.scene-fade.show {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px clamp(12px, 2.4vw, 26px);
  pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 18, 31, 0.5), rgba(8, 18, 31, 0.14) 55%, transparent);
}
.hud-left,
.hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}
.hud-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 8px;
  border-radius: 999px;
  background: rgba(247, 240, 226, 0.92);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}
.hud-logo {
  width: 34px;
  height: 40px;
  object-fit: contain;
}
.hud-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.hud-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--navy);
}
.hud-location {
  margin-top: 2px;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.hud-stat {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  background: rgba(247, 240, 226, 0.92);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  transition: transform 0.16s, background 0.16s;
}
.hud-stat:hover {
  transform: translateY(-1px);
  background: rgba(252, 248, 239, 0.98);
}
.hud-stat-icon {
  font-size: 13px;
}
.hud-stat-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.hud-stat strong {
  font-family: var(--en);
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}
.hud-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(18, 38, 63, 0.62);
  border: 1px solid rgba(247, 240, 226, 0.2);
  color: var(--cream);
  font-size: 15px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  transition: background 0.16s, transform 0.16s;
}
.hud-icon:hover {
  background: rgba(18, 38, 63, 0.82);
  transform: translateY(-1px);
}
.hud-icon.muted {
  opacity: 0.5;
}

/* ---------- 目标卡 ---------- */
.objective-card {
  position: absolute;
  left: clamp(12px, 2.4vw, 26px);
  bottom: clamp(16px, 3vh, 28px);
  z-index: 55;
  width: min(330px, calc(100vw - 28px));
  padding: 15px 17px 13px;
  border-radius: 16px;
  background: rgba(252, 248, 239, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 10px 30px rgba(8, 18, 31, 0.22);
  backdrop-filter: blur(12px);
  border-left: 4px solid var(--terracotta);
  transition: transform 0.25s, opacity 0.25s;
}
.objective-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--terracotta-dark);
  text-transform: uppercase;
}
.objective-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--terracotta);
  animation: dotPulse 1.8s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.7); }
}
.objective-title {
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--navy);
}
.objective-sub {
  margin-top: 4px;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--muted);
}
.objective-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 10px;
  color: var(--muted);
}
.objective-foot #objective-progress {
  font-family: var(--en);
  letter-spacing: 0.04em;
}

/* ---------- 交互提示 ---------- */
.interact-prompt {
  position: absolute;
  left: 50%;
  bottom: clamp(80px, 12vh, 120px);
  transform: translateX(-50%);
  z-index: 58;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 15px 8px 9px;
  border-radius: 999px;
  background: rgba(18, 38, 63, 0.88);
  border: 1px solid rgba(247, 240, 226, 0.24);
  color: var(--cream);
  font-size: 12px;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
  animation: promptIn 0.22s ease-out;
}
.interact-prompt.hidden {
  display: none !important;
}
@keyframes promptIn {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.key-chip {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--cream);
  color: var(--navy);
  font-family: var(--en);
  font-size: 11px;
  font-weight: 800;
}

/* ---------- 触屏控制 ---------- */
.mobile-controls {
  position: absolute;
  inset: 0;
  z-index: 57;
  pointer-events: none;
}
.joystick {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(26px, env(safe-area-inset-bottom));
  width: 118px;
  height: 118px;
  border-radius: 50%;
  border: 1px solid rgba(247, 240, 226, 0.3);
  background: rgba(18, 38, 63, 0.24);
  backdrop-filter: blur(5px);
  pointer-events: auto;
  touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(247, 240, 226, 0.08);
}
.joystick::after {
  content: "";
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  border: 1px dashed rgba(247, 240, 226, 0.16);
  pointer-events: none;
}
.joystick-stick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  background: rgba(247, 240, 226, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.joystick.is-guiding {
  border-color: rgba(240, 207, 138, 0.8);
  animation: joystickGlow 1.6s ease-in-out infinite;
}
.joystick.is-guiding::before {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 2px solid rgba(240, 207, 138, 0.9);
  box-shadow: 0 0 22px rgba(240, 207, 138, 0.45);
  animation: joystickRing 1.6s ease-out infinite;
  pointer-events: none;
}
.joystick.is-guiding .joystick-stick {
  background: var(--gold-soft);
  border-color: rgba(255, 255, 255, 0.92);
  animation: joystickStickGlow 1.6s ease-in-out infinite;
}
.joystick-hint {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: calc(max(26px, env(safe-area-inset-bottom)) + 132px);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 36px);
  padding: 10px 14px 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(240, 207, 138, 0.48);
  background: rgba(10, 21, 35, 0.86);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(10px);
  color: var(--cream);
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: 0.02em;
  pointer-events: none;
  animation: joystickHintIn 0.32s ease-out;
}
.joystick-hint-arrow {
  flex: none;
  font-size: 30px;
  line-height: 1;
  color: var(--gold-soft);
  text-shadow: 0 0 14px rgba(240, 207, 138, 0.75);
  animation: joystickArrowNudge 1.1s ease-in-out infinite;
}
.joystick-hint-text {
  display: block;
}
@keyframes joystickGlow {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(247, 240, 226, 0.08), 0 0 16px rgba(240, 207, 138, 0.28); }
  50% { box-shadow: inset 0 0 0 1px rgba(247, 240, 226, 0.16), 0 0 36px rgba(240, 207, 138, 0.72); }
}
@keyframes joystickRing {
  0% { transform: scale(0.92); opacity: 0.95; }
  72%, 100% { transform: scale(1.2); opacity: 0; }
}
@keyframes joystickStickGlow {
  0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25), 0 0 0 0 rgba(240, 207, 138, 0.45); }
  50% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25), 0 0 24px 7px rgba(240, 207, 138, 0.42); }
}
@keyframes joystickHintIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes joystickArrowNudge {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(0, 5px); }
}
.action-btn {
  position: absolute;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(34px, env(safe-area-inset-bottom));
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: var(--terracotta);
  color: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  box-shadow: 0 10px 28px rgba(120, 40, 30, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  pointer-events: auto;
  touch-action: manipulation;
  transition: transform 0.12s;
}
.action-btn:active {
  transform: scale(0.93);
}
.action-icon {
  font-size: 21px;
  line-height: 1;
}
.action-label {
  margin-top: 3px;
  font-size: 10px;
  letter-spacing: 0.1em;
}

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2vw, 26px);
  background: rgba(7, 16, 28, 0.62);
  backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.modal-overlay.show {
  opacity: 1;
}
.modal-panel {
  position: relative;
  width: min(760px, 96vw);
  max-height: min(92dvh, 900px);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(14px) scale(0.985);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.6);
}
.modal-overlay.show .modal-panel {
  transform: translateY(0) scale(1);
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px 12px;
  flex: none;
}
.modal-head-text {
  min-width: 0;
}
.modal-title {
  font-family: var(--serif);
  font-size: clamp(22px, 2.6vw, 29px);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: var(--navy);
}
.modal-subtitle {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}
.modal-close {
  flex: none;
  background: rgba(29, 42, 58, 0.07);
}
.modal-body {
  padding: 6px 26px 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal-footer {
  flex: none;
  padding: 14px 26px 22px;
  border-top: 1px solid var(--line);
  background: rgba(247, 240, 226, 0.75);
}
.modal-footer-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.modal-wide .modal-panel {
  width: min(1000px, 96vw);
}
.modal-xl .modal-panel {
  width: min(1160px, 97vw);
}
.confirm-modal .modal-panel {
  width: min(460px, 92vw);
}
.confirm-message {
  padding: 4px 0 8px;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--ink-soft);
  white-space: pre-line;
}
.modal-overlay.no-pad .modal-panel {
  max-height: 96dvh;
}
.modal-overlay.no-pad .modal-body {
  padding: 0;
}

/* ---------- 对话 ---------- */
.dialogue-layer {
  position: fixed;
  inset: 0;
  z-index: 280;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2vw, 28px);
  background: rgba(6, 14, 25, 0.58);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.22s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.dialogue-shell {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  width: min(1120px, 97vw);
  height: min(730px, 90dvh);
  border-radius: 26px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.4);
  animation: dialogueIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes dialogueIn {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.dialogue-side {
  position: relative;
  background: var(--navy);
  overflow: hidden;
  min-height: 0;
}
.dialogue-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--npc-accent, var(--terracotta));
  opacity: 0.18;
  z-index: 1;
}
.dialogue-portrait {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  filter: saturate(0.95);
}
.dialogue-side::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(0deg, rgba(9, 20, 34, 0.95) 0%, rgba(9, 20, 34, 0.32) 42%, rgba(9, 20, 34, 0.05) 72%),
    linear-gradient(180deg, rgba(9, 20, 34, 0.24), transparent 30%);
}
.dialogue-side-info {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 24px;
  z-index: 3;
  color: var(--cream);
}
.dialogue-side-kicker {
  font-family: var(--en);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--gold-soft);
  text-transform: uppercase;
}
.dialogue-side-name {
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
}
.dialogue-side-title {
  margin-top: 5px;
  font-size: 11px;
  color: rgba(247, 240, 226, 0.64);
  line-height: 1.5;
}
.dialogue-side-note {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(247, 240, 226, 0.16);
  font-size: 10.5px;
  line-height: 1.7;
  color: rgba(247, 240, 226, 0.46);
}
.dialogue-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(circle at 95% 0%, rgba(224, 166, 60, 0.08), transparent 36%),
    var(--paper);
}
.dialogue-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(252, 248, 239, 0.8);
}
.dialogue-head-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.dialogue-head-avatar {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-sm);
}
.dialogue-head-name {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}
.dialogue-head-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
  font-size: 10px;
  color: var(--muted);
}
.ai-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 0 3px rgba(122, 158, 126, 0.15);
  flex: none;
}
.ai-dot.offline {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(224, 166, 60, 0.15);
}
.dialogue-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dialogue-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px clamp(16px, 3vw, 30px) 10px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  scroll-behavior: smooth;
}
.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: msgIn 0.22s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.msg-row.npc {
  align-self: flex-start;
}
.msg-row.me {
  align-self: flex-end;
  align-items: flex-end;
}
.msg-speaker {
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  padding-left: 4px;
}
.msg-bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.78;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-row.npc .msg-bubble {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-left: 3px solid var(--npc-accent, var(--terracotta));
  border-top-left-radius: 5px;
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(29, 42, 58, 0.04);
}
.msg-row.me .msg-bubble {
  background: var(--navy);
  color: var(--cream);
  border-top-right-radius: 5px;
}
.msg-system {
  align-self: center;
  max-width: 90%;
  text-align: center;
  font-size: 10.5px;
  color: var(--muted);
  background: rgba(29, 42, 58, 0.05);
  padding: 5px 12px;
  border-radius: 999px;
}
.msg-source {
  align-self: flex-start;
  margin-top: 4px;
  padding-left: 4px;
  font-size: 9px;
  color: rgba(29, 42, 58, 0.35);
  font-family: var(--en);
  letter-spacing: 0.04em;
}
.typing-cursor::after {
  content: "▍";
  color: var(--terracotta);
  animation: blink 1s step-end infinite;
  margin-left: 1px;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.thinking {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 2px;
}
.thinking span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--npc-accent, var(--terracotta));
  opacity: 0.35;
  animation: think 1.2s ease-in-out infinite;
}
.thinking span:nth-child(2) { animation-delay: 0.15s; }
.thinking span:nth-child(3) { animation-delay: 0.3s; }
@keyframes think {
  0%, 100% { transform: translateY(0); opacity: 0.3; }
  50% { transform: translateY(-4px); opacity: 0.95; }
}
.dialogue-quick {
  flex: none;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 clamp(16px, 3vw, 30px) 10px;
  scrollbar-width: none;
}
.dialogue-quick::-webkit-scrollbar {
  display: none;
}
.quick-chip {
  flex: none;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.85);
  color: var(--ink-soft);
  font-size: 11px;
  white-space: nowrap;
  transition: all 0.15s;
}
.quick-chip:hover {
  border-color: var(--terracotta);
  color: var(--terracotta-dark);
  background: #fff9ee;
}
.dialogue-actions {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 clamp(16px, 3vw, 30px) 10px;
}
.dialogue-input {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 10px clamp(16px, 3vw, 30px) max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(247, 240, 226, 0.55);
}
.dialogue-input input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fffdf8;
  padding: 0 17px;
  font-size: 12.5px;
  outline: none;
  transition: border 0.16s;
}
.dialogue-input input:focus {
  border-color: var(--teal);
}
.dialogue-send {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: var(--cream);
  font-size: 15px;
  transition: background 0.16s, transform 0.12s;
}
.dialogue-send:hover {
  background: var(--navy-2);
}
.dialogue-send:active {
  transform: scale(0.92);
}
.dialogue-send:disabled {
  opacity: 0.45;
}
.dialogue-hint {
  padding: 0 clamp(16px, 3vw, 30px) 8px;
  font-size: 9px;
  color: rgba(29, 42, 58, 0.36);
  text-align: right;
}

/* ---------- 载入提示 / Toast / 彩纸 ---------- */
.loading-layer {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  background: rgba(7, 16, 28, 0.55);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.2s;
}
.loading-layer.show {
  opacity: 1;
}
.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 40px;
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
}
.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(29, 42, 58, 0.12);
  border-top-color: var(--terracotta);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-text {
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
}
.toast-root {
  position: fixed;
  top: calc(var(--hud-h) + 16px);
  right: 18px;
  z-index: 5500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 28px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 15px;
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  border-left: 3px solid var(--terracotta);
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.toast-success { border-left-color: var(--sage); }
.toast-warn { border-left-color: var(--gold); }
.toast-error { border-left-color: #a53a32; }
.toast-icon {
  font-size: 15px;
  line-height: 1.4;
}
.toast-msg {
  font-size: 12px;
  line-height: 1.6;
}
.confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 4500;
  pointer-events: none;
}
.noscript {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: var(--cream);
  font-size: 15px;
  padding: 30px;
  text-align: center;
}

/* ---------- 通用内容元素 ---------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  margin: 22px 0 12px;
}
.section-title:first-child {
  margin-top: 4px;
}
.section-title::before {
  content: "";
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: var(--terracotta);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 11px;
}
.stars {
  display: inline-flex;
  gap: 2px;
  color: rgba(29, 42, 58, 0.16);
  letter-spacing: 0.02em;
}
.stars .star.filled {
  color: var(--gold);
  text-shadow: 0 1px 4px rgba(224, 166, 60, 0.35);
}
.stars-small { font-size: 12px; }
.stars-normal { font-size: 18px; }
.stars-large { font-size: 30px; }
.bar {
  display: block;
  height: 8px;
  border-radius: 8px;
  background: rgba(29, 42, 58, 0.08);
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  border-radius: 8px;
  transition: width 0.4s ease;
}
.paper-card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fffdf8;
  box-shadow: var(--shadow-sm);
}
.empty-note {
  padding: 26px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

/* ---------- 响应式 ---------- */
@media (max-height: 820px) and (min-width: 901px) {
  .title-logo {
    width: 78px;
    margin: 18px 0 14px;
  }
  .title-tagline {
    margin-top: 16px;
  }
  .title-actions {
    margin-top: 24px;
  }
  .title-mini-actions {
    margin-top: 16px;
  }
  .title-features {
    margin-top: 20px;
  }
  .title-credit {
    margin-top: 14px;
    padding: 7px 14px 7px 12px;
  }
}

@media (max-width: 1100px) {
  .title-photos {
    opacity: 0.55;
    right: 18px;
    transform: scale(0.88);
    transform-origin: bottom right;
  }
  .title-panel {
    width: 66vw;
  }
}

@media (max-width: 900px) {
  :root {
    --hud-h: 56px;
  }
  .title-panel {
    width: min(600px, 82vw);
    padding-left: clamp(20px, 6vw, 50px);
    padding-right: 20px;
  }
  .title-photos {
    display: none;
  }
  .title-h1 {
    font-size: clamp(48px, 12vw, 76px);
  }
  .title-lead {
    max-width: 92%;
  }
  .title-features {
    display: none;
  }
  .title-seal {
    display: none;
  }
  .character-shell {
    grid-template-columns: 1fr;
    width: min(620px, 90vw);
    gap: 24px;
    padding-top: 60px;
  }
  .character-visual {
    display: flex;
    align-items: center;
    gap: 18px;
  }
  .character-frame {
    width: 140px;
    height: 170px;
    border-radius: 70px 70px 18px 18px;
    flex: none;
    aspect-ratio: auto;
  }
  .character-caption {
    text-align: left;
    margin-top: 0;
  }
  .character-form {
    max-width: none;
  }
  .character-desc {
    font-size: 12.5px;
  }
  .character-actions .btn {
    flex: 1;
  }
  .hud-stat-label {
    display: none;
  }
  .hud-stat {
    padding: 0 11px;
  }
  .hud-location {
    display: none;
  }
  .hud-brand {
    padding-right: 10px;
  }
  .objective-card {
    top: calc(var(--hud-h) + 8px);
    bottom: auto;
    width: min(290px, calc(100vw - 24px));
    padding: 10px 13px;
  }
  .objective-title {
    font-size: 13px;
  }
  .objective-sub {
    display: none;
  }
  .objective-foot {
    margin-top: 6px;
    padding-top: 6px;
  }
  .dialogue-layer {
    padding: 0;
  }
  .dialogue-shell {
    grid-template-columns: 1fr;
    width: 100vw;
    height: calc(100dvh - 26px);
    border-radius: 0;
    margin-bottom: 26px;
  }
  .dialogue-side {
    display: none;
  }
  .dialogue-head-avatar {
    display: block;
  }
  .dialogue-head {
    padding: 12px 16px;
  }
  .dialogue-log {
    padding: 16px 14px 8px;
  }
  .msg-row {
    max-width: 92%;
  }
  .dialogue-actions {
    padding: 0 14px 8px;
  }
  .dialogue-quick {
    padding: 0 14px 8px;
  }
  .dialogue-input {
    padding: 8px 14px 12px;
  }
  .modal-panel {
    max-height: 94dvh;
  }
  .modal-head {
    padding: 18px 18px 10px;
  }
  .modal-body {
    padding: 4px 18px 20px;
  }
  .modal-footer {
    padding: 12px 18px 18px;
  }
  .toast-root {
    top: auto;
    bottom: 96px;
    right: 12px;
  }
}

@media (max-width: 600px) {
  .credit {
    right: 8px;
    bottom: 3px;
    font-size: 8.5px;
    padding: 3px 7px;
    opacity: 0.82;
  }
  .title-panel {
    width: 100%;
    padding: 26px 22px 40px;
    justify-content: flex-end;
  }
  .title-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(8, 18, 31, 0.94) 15%, rgba(8, 18, 31, 0.38) 65%, rgba(8, 18, 31, 0.58));
    z-index: -1;
  }
  .title-logo {
    width: 64px;
    margin: 18px 0 14px;
  }
  .title-h1 {
    font-size: clamp(46px, 16vw, 64px);
  }
  .title-en {
    font-size: 10px;
    letter-spacing: 0.28em;
  }
  .title-tagline {
    margin-top: 16px;
    font-size: 16px;
  }
  .title-lead {
    font-size: 12.5px;
    line-height: 1.85;
    margin-top: 10px;
  }
  .title-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
    margin-top: 24px;
  }
  .title-actions .btn {
    width: 100%;
  }
  .title-mini-actions {
    justify-content: center;
    margin-top: 16px;
  }
  .title-credit {
    margin-top: 14px;
    gap: 6px;
    padding: 6px 11px 6px 9px;
    border-left-width: 2px;
    font-size: 11.5px;
    letter-spacing: 0.06em;
  }
  .title-credit-name {
    font-size: 1.2em;
  }
  .title-credit-note {
    font-size: 0.95em;
  }
  .character-shell {
    width: calc(100vw - 36px);
    padding: 62px 0 40px;
    gap: 20px;
  }
  .character-frame {
    width: 112px;
    height: 136px;
  }
  .character-title {
    font-size: 30px;
  }
  .form-field {
    margin-top: 20px;
  }
  .intro-content {
    left: 20px;
    right: 20px;
    bottom: 80px;
    width: auto;
  }
  .intro-title {
    font-size: 32px;
  }
  .intro-text {
    font-size: 13.5px;
    line-height: 1.9;
    min-height: 116px;
  }
  .intro-actions {
    flex-wrap: wrap;
    gap: 12px;
  }
  .intro-actions .btn {
    min-width: 0;
  }
  .intro-top {
    top: 18px;
    left: 18px;
    right: 18px;
  }
  .intro-chapter {
    display: none;
  }
  .hud {
    padding: 9px 10px;
  }
  .hud-brand {
    gap: 7px;
    padding: 5px 9px 5px 6px;
  }
  .hud-logo {
    width: 26px;
    height: 32px;
  }
  .hud-title {
    font-size: 12px;
  }
  .hud-right {
    gap: 5px;
  }
  .hud-stat {
    height: 32px;
    padding: 0 9px;
    gap: 4px;
  }
  .hud-stat-icon {
    font-size: 11px;
  }
  .hud-stat strong {
    font-size: 13px;
  }
  .hud-icon {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }
  .objective-card {
    top: calc(var(--hud-h) + 4px);
    left: 10px;
    padding: 9px 11px;
    border-radius: 13px;
    width: calc(100vw - 20px);
    border-left-width: 3px;
  }
  .objective-kicker {
    font-size: 8px;
  }
  .objective-title {
    font-size: 12.5px;
    margin-top: 4px;
  }
  .objective-foot {
    font-size: 9px;
  }
  .objective-foot .text-btn {
    font-size: 9px;
  }
  .interact-prompt {
    bottom: 122px;
  }
  .joystick {
    width: 104px;
    height: 104px;
  }
  .joystick-stick {
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
  }
  .joystick-hint {
    bottom: calc(max(26px, env(safe-area-inset-bottom)) + 118px);
    font-size: 12.5px;
  }
  .action-btn {
    width: 72px;
    height: 72px;
  }
  .dialogue-head-meta {
    font-size: 9px;
  }
  .dialogue-head-name {
    font-size: 15px;
  }
  .msg-bubble {
    font-size: 13px;
    line-height: 1.72;
  }
  .quick-chip {
    font-size: 10.5px;
    padding: 6px 10px;
  }
  .modal-title {
    font-size: 21px;
  }
  .modal-subtitle {
    font-size: 11px;
  }
  .modal-head {
    padding: 16px 15px 8px;
  }
  .modal-body {
    padding: 2px 15px 16px;
  }
  .modal-footer {
    padding: 12px 15px 15px;
  }
  .btn {
    padding: 10px 18px;
    min-height: 42px;
  }
}

@media (max-height: 640px) and (min-width: 900px) {
  .title-h1 { font-size: 58px; }
  .title-logo { width: 68px; margin: 14px 0 12px; }
  .title-actions { margin-top: 20px; }
  .title-features { display: none; }
  .title-photos { transform: scale(0.8); transform-origin: bottom right; }
  .dialogue-shell { height: 94dvh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
