:root {
  --bg-deep: #0c0c10;
  --surface: #15151c;
  --surface-strong: rgba(10, 10, 16, 0.9);
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.28);
  --text: #f2f2f2;
  --text-soft: rgba(255, 255, 255, 0.64);
  --text-faint: rgba(255, 255, 255, 0.38);
  --gold: #ffd479;
  --pink: #ff4d8f;
  --mint: #5eead4;
  --blue: #91bdf2;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --mono: "DM Mono", "SFMono-Regular", Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
}

body {
  color: var(--text);
  font-family: var(--serif);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  background: none;
  cursor: pointer;
}

#game-container {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000;
}

.scene,
.void-space,
.heart-lobby,
.world-sea {
  position: absolute;
  inset: 0;
}

.scene {
  background: #000;
  transition: filter 600ms var(--ease);
}

.void-space,
.heart-lobby,
.world-sea,
.world-route,
.contract-file,
.mission-brief,
.memory-stream,
.zero-bot,
.siyan-portrait {
  opacity: 0;
  pointer-events: none;
  transition: opacity 480ms var(--ease), transform 720ms var(--ease), filter 720ms var(--ease);
}

/* 空白意识空间 */
.void-space {
  overflow: hidden;
  background:
    linear-gradient(rgba(120, 154, 196, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 154, 196, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, #101923 0%, #070b10 42%, #000 76%);
  background-size: 48px 48px, 48px 48px, auto;
}

.void-space::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(151, 194, 235, 0.1), transparent);
  opacity: 0.45;
  transform: translateX(-100%);
  animation: scan 4.8s ease-in-out infinite;
}

.scan-ring,
.scan-core,
.signal-line {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.scan-ring {
  border: 1px solid rgba(151, 194, 235, 0.24);
}

.ring-a {
  width: min(42vw, 420px);
  aspect-ratio: 1;
  animation: pulseRing 3.6s ease-in-out infinite;
}

.ring-b {
  width: min(22vw, 220px);
  aspect-ratio: 1;
  border-color: rgba(255, 212, 121, 0.32);
  animation: pulseRing 3.6s 0.5s ease-in-out infinite reverse;
}

.scan-core {
  width: 10px;
  height: 10px;
  background: #d9eeff;
  box-shadow: 0 0 18px #8ac8ff, 0 0 44px rgba(138, 200, 255, 0.5);
}

.signal-line {
  width: min(70vw, 820px);
  height: 1px;
  border-radius: 0;
  background: linear-gradient(90deg, transparent, rgba(145, 189, 242, 0.36), var(--gold), rgba(145, 189, 242, 0.36), transparent);
}

#game-container[data-scene="void"] .void-space,
#game-container[data-scene="scan"] .void-space {
  opacity: 1;
}

#game-container[data-scene="scan"] .void-space {
  filter: brightness(1.28);
}

/* 心域大厅 */
.heart-lobby {
  overflow: hidden;
  transform: scale(1.025);
}

.hall-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.78) contrast(1.02) brightness(0.86);
}

.heart-lobby::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 51% 45%, transparent 0 24%, rgba(4, 5, 8, 0.18) 55%, rgba(4, 5, 8, 0.72) 100%),
    linear-gradient(180deg, rgba(2, 2, 4, 0.16), transparent 38%, rgba(2, 2, 4, 0.72));
}

#game-container[data-scene="lobby"] .heart-lobby,
#game-container[data-scene="contract"] .heart-lobby,
#game-container[data-scene="contract-auth"] .heart-lobby,
#game-container[data-scene="siyan"] .heart-lobby,
#game-container[data-scene="mission"] .heart-lobby,
#game-container[data-scene="inject"] .heart-lobby {
  opacity: 1;
  transform: scale(1);
}

#game-container[data-scene="contract"] .heart-lobby,
#game-container[data-scene="contract-auth"] .heart-lobby,
#game-container[data-scene="mission"] .heart-lobby {
  filter: brightness(0.56) blur(1px);
}

/* 世界海 */
.world-sea {
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(23, 34, 59, 0.3), transparent 44%),
    radial-gradient(ellipse at 50% 44%, #101b32 0%, #060b16 48%, #020408 100%);
}

.world-sea::before {
  position: absolute;
  inset: 0;
  content: "";
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.88) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255, 212, 121, 0.72) 0 1px, transparent 1.5px);
  background-position: 0 0, 39px 31px;
  background-size: 86px 76px, 128px 110px;
  opacity: 0.45;
}

.continuum-line {
  position: absolute;
  left: -8%;
  top: 55%;
  width: 116%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(145, 189, 242, 0.45), rgba(255, 212, 121, 0.85), rgba(145, 189, 242, 0.45), transparent);
  transform: rotate(-8deg);
  box-shadow: 0 0 18px rgba(145, 189, 242, 0.3);
}

.world-orb {
  position: absolute;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.72), transparent 10%),
    radial-gradient(circle at 50% 60%, rgba(255, 212, 121, 0.22), transparent 58%),
    rgba(78, 112, 157, 0.12);
  box-shadow: inset 0 0 28px rgba(255, 255, 255, 0.12), 0 0 28px rgba(92, 143, 211, 0.2);
  animation: drift 5s ease-in-out infinite;
}

.world-orb i {
  width: 46%;
  height: 46%;
  border: 1px solid rgba(255, 212, 121, 0.42);
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(255, 212, 121, 0.2);
}

.orb-a { left: 8%; bottom: 8%; width: clamp(120px, 24vw, 340px); }
.orb-b { left: 42%; top: 30%; width: clamp(92px, 15vw, 230px); animation-delay: -1s; }
.orb-c { right: 18%; top: 15%; width: clamp(74px, 11vw, 170px); animation-delay: -2s; }
.orb-d { right: 5%; top: 8%; width: clamp(48px, 6vw, 94px); animation-delay: -3s; }
.orb-e { left: 28%; top: 13%; width: clamp(38px, 4.5vw, 70px); animation-delay: -4s; }

.entropy-rift {
  position: absolute;
  left: 48%;
  top: 13%;
  width: 2px;
  height: 66%;
  background: linear-gradient(transparent, rgba(255, 142, 156, 0.8), rgba(145, 189, 242, 0.5), transparent);
  box-shadow: 0 0 18px rgba(255, 142, 156, 0.5);
  transform: rotate(17deg) scaleY(0);
  transform-origin: top;
  transition: transform 900ms var(--ease);
}

.heart-stone {
  position: absolute;
  left: 50%;
  top: 46%;
  width: clamp(28px, 4.2vw, 62px);
  aspect-ratio: 0.82;
  opacity: 0;
  clip-path: polygon(50% 0, 88% 28%, 74% 78%, 50% 100%, 25% 78%, 12% 28%);
  background: linear-gradient(145deg, #f9ffff 0 16%, #91bdf2 38%, #5eead4 58%, #fff0b8 82%);
  box-shadow: 0 0 18px rgba(145, 189, 242, 0.72), 0 0 54px rgba(255, 212, 121, 0.38);
  transform: translate(-50%, -50%) scale(0.3);
  transition: opacity 420ms var(--ease), transform 720ms var(--ease);
}

#game-container[data-scene="world-sea"] .world-sea {
  opacity: 1;
}

#game-container[data-scene="world-sea"][data-world-effect="rift"] .entropy-rift {
  transform: rotate(17deg) scaleY(1);
}

#game-container[data-scene="world-sea"][data-world-effect="stone"] .entropy-rift {
  transform: rotate(17deg) scaleY(0);
}

#game-container[data-scene="world-sea"][data-world-effect="stone"] .heart-stone {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* 零号 */
.zero-bot {
  position: absolute;
  z-index: 12;
  right: clamp(0%, 3vw, 7%);
  top: 2%;
  width: clamp(304px, 36vw, 540px);
  height: clamp(420px, 58vw, 820px);
  animation: float 3.6s ease-in-out infinite;
}

.zero-image {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.52));
}

.zero-glow {
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 2%;
  height: 12%;
  border-radius: 50%;
  background: rgba(88, 177, 255, 0.52);
  filter: blur(12px);
}

#game-container[data-scene="lobby"] .zero-bot,
#game-container[data-scene="world-sea"] .zero-bot,
#game-container[data-scene="contract"] .zero-bot,
#game-container[data-scene="mission"] .zero-bot,
#game-container[data-scene="inject"] .zero-bot {
  opacity: 1;
}

#game-container[data-scene="world-sea"] .zero-bot {
  right: -2%;
  top: 0;
  width: clamp(256px, 28vw, 410px);
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.42));
}

/* 司言首次出场：复用心域大厅，只增加角色视觉层。 */
.siyan-portrait {
  position: absolute;
  z-index: 14;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(64vw, 960px);
  overflow: hidden;
  pointer-events: none;
}

.siyan-portrait::after {
  display: none;
}

.siyan-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: right bottom;
  transform: translateX(clamp(-180px, -8vw, -58px));
  filter: saturate(0.72) contrast(1.04) brightness(0.76);
}

.siyan-portrait > span {
  position: absolute;
  z-index: 2;
  top: max(58px, calc(env(safe-area-inset-top) + 52px));
  right: max(20px, calc(env(safe-area-inset-right) + 16px));
  color: rgba(255, 255, 255, 0.34);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  writing-mode: vertical-rl;
}

#game-container[data-scene="siyan"] .siyan-portrait {
  opacity: 1;
}

#game-container[data-scene="siyan"] .heart-lobby {
  filter: brightness(0.54) saturate(0.72);
}

#game-container[data-scene="contract"] .zero-bot {
  right: 8%;
  top: 25%;
  width: clamp(94px, 10.5vw, 156px);
}

#game-container[data-scene="mission"] .zero-bot {
  right: 4%;
  top: 30%;
  width: clamp(78px, 8.5vw, 126px);
}

#game-container[data-scene="inject"] .zero-bot {
  right: 50%;
  top: 24%;
  transform: translateX(50%);
}

/* 契约 */
.contract-file {
  position: absolute;
  z-index: 10;
  left: clamp(18px, 5vw, 76px);
  top: clamp(62px, 10vh, 98px);
  width: min(720px, 66vw);
  max-height: calc(100vh - 150px);
  padding: clamp(16px, 2.2vw, 28px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(10, 10, 16, 0.9);
  backdrop-filter: blur(12px);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.48);
  transform: translateY(12px);
}

#game-container[data-scene="contract"] .contract-file {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

#game-container[data-scene="contract-auth"] .contract-file {
  opacity: 0.42;
  pointer-events: none;
  transform: none;
  filter: brightness(0.55);
}

#game-container[data-scene="contract"][data-mode="action"] .contract-file {
  max-height: calc(100vh - 124px - env(safe-area-inset-bottom));
}

#game-container[data-scene="contract"][data-mode="narration"] .contract-file,
#game-container[data-scene="contract"][data-mode="dialogue"] .contract-file {
  max-height: calc(100vh - 176px - env(safe-area-inset-bottom));
}

.panel-kicker,
.route-head span {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: clamp(8px, 0.75vw, 11px);
  letter-spacing: 0.36em;
}

.contract-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--line);
}

.contract-title-row span {
  color: var(--gold);
  font-size: clamp(10px, 1vw, 13px);
  letter-spacing: 0.18em;
}

.contract-title-row h2 {
  margin: 4px 0 0;
  font-size: clamp(20px, 2.4vw, 34px);
  letter-spacing: 0.1em;
}

.contract-title-row > b {
  flex-shrink: 0;
  padding: 5px 10px;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.14em;
  border: 1px solid rgba(255, 212, 121, 0.42);
  border-radius: 6px;
}

.contract-clauses {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding: 0;
  list-style: none;
}

.contract-clauses li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  color: var(--text-soft);
  font-size: clamp(11px, 1.08vw, 15px);
  line-height: 1.65;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.contract-clauses li b {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 11px;
}

.name-registration {
  display: none;
  margin-top: 18px;
  padding: clamp(14px, 1.8vw, 22px);
  border: 1px solid rgba(255, 212, 121, 0.24);
  border-radius: 10px;
  background: rgba(255, 212, 121, 0.035);
}

.contract-signature-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.025);
}

.contract-signature-slot span {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.24em;
}

.contract-signature-slot b {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 400;
}

.contract-file.is-name-entry .contract-signature-slot,
.contract-file.is-signing .contract-signature-slot {
  display: none;
}

.contract-file.is-name-entry .name-registration,
.contract-file.is-signing .name-registration {
  display: block;
}

.contract-file.is-name-entry .contract-clauses,
.contract-file.is-signing .contract-clauses {
  display: none;
}

.contract-file.is-signing .name-input-row {
  border-color: rgba(94, 234, 212, 0.42);
  background: rgba(94, 234, 212, 0.04);
}

.contract-file.is-signing .name-input-row > span,
.contract-file.is-signing #walker-name {
  color: var(--mint);
}

.name-registration > label {
  display: block;
  margin-bottom: 14px;
  color: #fff;
  font-size: clamp(15px, 1.55vw, 21px);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.name-input-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.name-input-row:focus-within {
  border-color: rgba(255, 212, 121, 0.72);
  box-shadow: 0 0 0 2px rgba(255, 212, 121, 0.08);
}

.name-input-row > span {
  color: var(--gold);
  font-family: var(--mono);
  font-size: clamp(8px, 0.75vw, 10px);
  letter-spacing: 0.18em;
  white-space: nowrap;
}

#walker-name {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0;
  border: 0;
  outline: 0;
  color: #fff;
  font-family: var(--serif);
  font-size: clamp(16px, 1.8vw, 24px);
  letter-spacing: 0.12em;
  background: transparent;
  user-select: text;
}

#walker-name::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

#name-note {
  margin: 9px 0 0;
  color: var(--text-faint);
  font-size: clamp(9px, 0.85vw, 11px);
  letter-spacing: 0.05em;
}

.registration-meta {
  display: flex;
  gap: 18px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.registration-meta span {
  color: var(--text-faint);
  font-size: clamp(9px, 0.9vw, 12px);
}

.registration-meta b {
  margin-left: 5px;
  color: var(--gold);
  font-family: var(--mono);
  font-weight: 400;
}

.chair-seal {
  position: absolute;
  right: 22px;
  bottom: 18px;
  display: none;
  place-items: center;
  width: 92px;
  aspect-ratio: 1;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.08em;
  border: 1px solid rgba(255, 212, 121, 0.55);
  border-radius: 50%;
  transform: rotate(-10deg);
  animation: sealIn 480ms var(--ease) both;
}

.chair-seal small {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.16em;
}

.contract-file.is-signed .chair-seal {
  display: grid;
}

.contract-file.is-signed .contract-title-row > b {
  color: var(--mint);
  border-color: rgba(94, 234, 212, 0.5);
}

/* 位面链 */
.world-route {
  position: absolute;
  z-index: 8;
  left: max(24px, calc(env(safe-area-inset-left) + 18px));
  right: max(24px, calc(env(safe-area-inset-right) + 18px));
  top: max(18px, calc(env(safe-area-inset-top) + 12px));
  bottom: max(16px, calc(env(safe-area-inset-bottom) + 10px));
  display: flex;
  flex-direction: column;
  min-height: 0;
  transform: translateY(8px);
}

#game-container[data-scene="world-route"] .world-route {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

#game-container[data-scene="world-route"][data-mode="dialogue"] .world-route,
#game-container[data-scene="world-route"][data-mode="narration"] .world-route {
  bottom: max(122px, calc(env(safe-area-inset-bottom) + 112px));
}

.world-route-action {
  align-self: flex-end;
  width: clamp(190px, 23vw, 320px);
  min-height: 48px;
  margin-top: clamp(10px, 1.6vh, 18px);
  color: #201a10;
  font-size: clamp(16px, 1.7vw, 25px);
  font-weight: 700;
  letter-spacing: 0.28em;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  background: linear-gradient(135deg, #f5f7fb, #e9e4df 46%, #f8f4ef);
  box-shadow: 0 0 0 1px rgba(255, 212, 121, 0.18), 0 0 24px rgba(207, 220, 255, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease, box-shadow 240ms ease, transform 180ms ease;
}

.world-route-action.show {
  opacity: 1;
  pointer-events: auto;
}

.world-route-action:hover,
.world-route-action:focus-visible {
  box-shadow: 0 0 0 1px rgba(255, 212, 121, 0.42), 0 0 32px rgba(255, 224, 166, 0.48);
  outline: none;
}

#game-container[data-scene="world-route"] .scene::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 50% 110%, rgba(77, 107, 157, 0.2), transparent 42%),
    radial-gradient(circle at 50% 42%, rgba(70, 96, 138, 0.12), transparent 52%),
    linear-gradient(180deg, #08111f 0%, #060c16 52%, #04070d 100%);
}

#game-container[data-scene="world-route"] .scene::after {
  position: absolute;
  z-index: 0;
  inset: 0;
  content: "";
  opacity: 0.62;
  background:
    radial-gradient(circle at 12% 20%, rgba(255,255,255,.72) 0 1px, transparent 1.5px),
    radial-gradient(circle at 28% 10%, rgba(255,212,121,.56) 0 1px, transparent 1.5px),
    radial-gradient(circle at 48% 17%, rgba(255,255,255,.52) 0 1px, transparent 1.5px),
    radial-gradient(circle at 68% 8%, rgba(255,212,121,.48) 0 1px, transparent 1.5px),
    radial-gradient(circle at 86% 24%, rgba(255,255,255,.62) 0 1px, transparent 1.5px);
  background-size: 220px 170px, 260px 190px, 310px 210px, 280px 180px, 240px 200px;
}

.route-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  gap: 3px;
  margin-bottom: clamp(8px, 1.5vh, 16px);
  text-align: center;
}

.route-head > span {
  color: rgba(255, 255, 255, 0.36);
  font-size: clamp(7px, 0.7vw, 10px);
  letter-spacing: 0.52em;
}

.route-title {
  display: grid;
  grid-template-columns: minmax(42px, 10vw) auto minmax(42px, 10vw);
  align-items: center;
  gap: clamp(10px, 1.5vw, 22px);
}

.route-title i {
  display: block;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 239, 203, 0.68));
}

.route-title i:last-child {
  transform: scaleX(-1);
}

.route-head h2 {
  margin: 0;
  color: #f2eee8;
  font-size: clamp(24px, 3.3vw, 48px);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-shadow: 0 0 20px rgba(255, 239, 203, 0.24);
}

.route-head p {
  margin: 0;
  color: rgba(255, 255, 255, 0.42);
  font-family: var(--mono);
  font-size: clamp(8px, 0.78vw, 11px);
  letter-spacing: 0.18em;
}

.route-head p b {
  margin-left: 10px;
  color: var(--gold);
  font-weight: 400;
}

.route-list {
  display: grid;
  grid-template-columns: 1.2fr repeat(5, minmax(0, 1fr));
  gap: clamp(7px, 1.1vw, 18px);
  min-height: 0;
  flex: 1;
  width: min(1180px, 92vw);
  margin: 0 auto;
}

.route-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(205, 218, 240, 0.38);
  border-radius: clamp(9px, 1vw, 15px);
  background: rgba(10, 15, 25, 0.82);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 18px 40px rgba(0, 0, 0, 0.42);
}

.route-visual {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0.94;
}

.route-visual::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(3, 7, 14, 0.08) 10%, rgba(4, 7, 13, 0.14) 47%, rgba(3, 5, 10, 0.96) 90%);
}

.entertainment {
  background:
    radial-gradient(ellipse at 70% 16%, rgba(255, 245, 205, 0.92), transparent 8%),
    conic-gradient(from 194deg at 70% 15%, transparent 0 17deg, rgba(255, 227, 155, 0.5) 20deg 36deg, transparent 40deg),
    linear-gradient(150deg, #0d1423 5%, #493416 48%, #321316 74%, #090c13);
}
.entertainment::before {
  position: absolute;
  left: 50%;
  bottom: 22%;
  width: 34%;
  aspect-ratio: 1.15;
  content: "";
  border: 2px solid rgba(8, 8, 10, 0.82);
  background: #090a0d;
  box-shadow: -18px -22px 0 -13px #090a0d, 19px -28px 0 -14px #090a0d;
  transform: translateX(-50%);
}
.palace {
  background:
    radial-gradient(circle at 52% 48%, transparent 0 17%, rgba(210, 154, 91, 0.3) 18% 19%, transparent 20%),
    linear-gradient(115deg, rgba(15, 7, 9, .2) 0 37%, rgba(78, 34, 24, .55) 38% 42%, transparent 43%),
    linear-gradient(145deg, #1e0d10, #4a271a 54%, #0d090d);
}
.fantasy {
  background:
    radial-gradient(circle at 66% 18%, #d9e5ef 0 7%, rgba(190, 211, 234, .2) 8% 12%, transparent 13%),
    linear-gradient(160deg, transparent 0 48%, rgba(104, 139, 179, .28) 49% 52%, transparent 53%),
    linear-gradient(145deg, #081126, #24416a 56%, #080b17);
}
.republic {
  background:
    linear-gradient(78deg, transparent 0 42%, rgba(213, 174, 120, .32) 43% 44%, transparent 45%),
    linear-gradient(103deg, transparent 0 57%, rgba(213, 174, 120, .24) 58% 59%, transparent 60%),
    linear-gradient(145deg, #111820, #3b3028 55%, #090d12);
}
.immortal {
  background:
    linear-gradient(145deg, transparent 0 35%, rgba(77, 118, 124, .42) 36% 48%, transparent 49%),
    linear-gradient(220deg, transparent 0 46%, rgba(83, 139, 141, .36) 47% 58%, transparent 59%),
    linear-gradient(145deg, #071517, #234846 54%, #070d12);
}
.doomsday {
  background:
    linear-gradient(90deg, transparent 0 18%, rgba(13, 16, 20, .9) 19% 29%, transparent 30% 42%, rgba(10, 13, 17, .86) 43% 57%, transparent 58% 68%, rgba(12, 14, 18, .8) 69% 79%, transparent 80%),
    radial-gradient(circle at 76% 28%, rgba(247, 190, 119, .62), transparent 15%),
    linear-gradient(145deg, #17202a, #303a40 52%, #080c11);
}

.route-card > i,
.route-card > b,
.route-card > em,
.route-card > small {
  position: absolute;
  z-index: 2;
  left: clamp(10px, 1vw, 15px);
  right: clamp(10px, 1vw, 15px);
}

.route-card > i {
  top: clamp(8px, 1.2vh, 14px);
  color: var(--gold);
  font-family: var(--mono);
  font-size: clamp(8px, 0.75vw, 10px);
  font-style: normal;
  letter-spacing: 0.2em;
}

.route-card > b {
  top: 16%;
  right: auto;
  color: rgba(247, 244, 238, 0.9);
  font-size: clamp(20px, 2.3vw, 36px);
  letter-spacing: 0.12em;
  writing-mode: vertical-rl;
  text-shadow: 0 2px 12px rgba(0,0,0,.72);
}

.route-card > em {
  bottom: clamp(50px, 8vh, 74px);
  color: rgba(255, 255, 255, 0.48);
  font-size: clamp(8px, 0.75vw, 11px);
  font-style: normal;
  line-height: 1.5;
}

.route-card > small {
  bottom: clamp(7px, 1vh, 12px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: clamp(34px, 6vh, 54px);
  padding: 5px 7px 5px clamp(28px, 3vw, 42px);
  color: rgba(255, 255, 255, 0.56);
  font-size: clamp(7px, 0.7vw, 10px);
  text-align: left;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  background: rgba(3, 5, 9, 0.72);
  backdrop-filter: blur(8px);
}

.route-card > small::before {
  position: absolute;
  left: clamp(8px, .8vw, 12px);
  top: 50%;
  width: clamp(12px, 1.3vw, 19px);
  aspect-ratio: 1;
  content: "";
  border: 1px solid rgba(255, 232, 182, .62);
  border-radius: 50%;
  transform: translateY(-50%);
}

.route-card > small::after {
  position: absolute;
  left: clamp(8px, .8vw, 12px);
  top: 50%;
  display: grid;
  place-items: center;
  width: clamp(12px, 1.3vw, 19px);
  aspect-ratio: 1;
  content: "·";
  color: #ffe4a9;
  font-family: var(--mono);
  font-size: clamp(11px, 1.1vw, 16px);
  line-height: 1;
  transform: translateY(-52%);
}

.route-card > small strong,
.route-card > small span {
  display: block;
}

.route-card > small strong {
  color: rgba(255,255,255,.74);
  font-weight: 500;
}

.route-card > small span {
  margin-top: 1px;
  color: rgba(255,255,255,.38);
  white-space: nowrap;
}

.route-tags {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.route-tags span {
  padding: 2px 7px;
  color: #f6e9ce;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 3px;
  background: rgba(45, 51, 92, .78);
}

.route-tags span:nth-child(2) {
  background: rgba(95, 54, 112, .8);
}

.route-tags span:nth-child(3) {
  background: rgba(125, 73, 36, .82);
}

.route-card.is-open {
  border-color: rgba(255, 225, 164, 0.84);
  box-shadow: 0 0 0 1px rgba(157, 203, 255, 0.34), 0 0 25px rgba(255, 212, 121, .18), 0 18px 48px rgba(0, 0, 0, 0.46);
}

.route-card.is-open > small {
  border-color: rgba(255, 230, 180, .5);
  background: rgba(7, 9, 17, .78);
}

.route-card.is-open > small strong {
  color: #fff0cb;
}

.route-card.is-locked {
  opacity: 0.7;
  filter: saturate(0.62);
}

.route-card.is-locked > small::before {
  top: 56%;
  width: clamp(11px, 1.1vw, 16px);
  height: clamp(9px, .9vw, 13px);
  aspect-ratio: auto;
  border-color: rgba(255, 232, 182, .68);
  border-radius: 2px;
  background: rgba(255, 212, 121, .08);
}

.route-card.is-locked > small::after {
  top: 41%;
  width: clamp(7px, .7vw, 11px);
  height: clamp(7px, .7vw, 11px);
  aspect-ratio: auto;
  margin-left: clamp(2px, .2vw, 3px);
  content: "";
  border: 1px solid rgba(255, 232, 182, .68);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  transform: translateY(-50%);
}

#game-container[data-scene="world-route"][data-mode="action"] .route-list {
  min-height: 0;
}

/* 任务简报 */
.mission-brief {
  position: absolute;
  z-index: 10;
  left: 50%;
  top: 50%;
  width: min(760px, 78vw);
  padding: clamp(16px, 2vw, 26px);
  border: 1px solid rgba(255, 212, 121, 0.28);
  border-radius: 12px;
  background: rgba(10, 10, 16, 0.9);
  backdrop-filter: blur(14px);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.56);
  transform: translate(-50%, -46%);
}

#game-container[data-scene="mission"] .mission-brief {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.mission-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: clamp(16px, 2.4vw, 30px);
  margin-top: 12px;
}

.mission-main {
  padding-right: clamp(12px, 2vw, 28px);
  border-right: 1px solid var(--line);
}

.mission-main > span {
  color: var(--gold);
  font-size: clamp(9px, 0.9vw, 12px);
  letter-spacing: 0.18em;
}

.mission-main h2 {
  margin: 8px 0 12px;
  font-size: clamp(22px, 2.6vw, 36px);
  line-height: 1.35;
  letter-spacing: 0.08em;
}

.mission-main p {
  margin: 0;
  color: var(--text-soft);
  font-size: clamp(11px, 1.05vw, 14px);
  line-height: 1.9;
}

.mission-brief dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.mission-brief dl div {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mission-brief dt {
  color: var(--text-faint);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.mission-brief dd {
  margin: 3px 0 0;
  color: #fff;
  font-size: clamp(11px, 1.05vw, 14px);
}

.memory-stream {
  position: absolute;
  z-index: 9;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 5vw, 74px);
  background: rgba(4, 6, 12, 0.58);
  backdrop-filter: blur(4px);
}

.memory-stream span {
  color: rgba(255, 255, 255, 0.3);
  font-size: clamp(18px, 3vw, 42px);
  letter-spacing: 0.18em;
  animation: memoryFlash 2.2s ease-in-out infinite;
}

.memory-stream span:nth-child(2) { animation-delay: -0.45s; }
.memory-stream span:nth-child(3) { animation-delay: -0.9s; }
.memory-stream span:nth-child(4) { animation-delay: -1.35s; color: rgba(255, 212, 121, 0.52); }

#game-container[data-scene="inject"] .memory-stream {
  opacity: 1;
}

/* HUD */
#hud {
  position: absolute;
  z-index: 60;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: calc(7px + env(safe-area-inset-top)) max(14px, calc(env(safe-area-inset-right) + 10px)) 7px max(14px, calc(env(safe-area-inset-left) + 10px));
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.66), transparent);
  transition: opacity 260ms ease;
}

#hud.hide {
  opacity: 0;
  pointer-events: none;
}

.hud-left {
  display: flex;
  align-items: center;
}

.hud-left {
  gap: 9px;
  flex-shrink: 0;
}

.hday {
  color: #fff;
  font-size: clamp(11px, 1.15vw, 15px);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 4px #000;
}

.hphase {
  padding: 3px 10px;
  color: var(--gold);
  font-size: clamp(9px, 0.9vw, 12px);
  letter-spacing: 0.1em;
  white-space: nowrap;
  border: 1px solid rgba(255, 212, 121, 0.42);
  border-radius: 10px;
}

.hud-spacer {
  flex: 1;
}

#toasts {
  position: absolute;
  z-index: 86;
  top: calc(50px + env(safe-area-inset-top));
  right: max(14px, calc(env(safe-area-inset-right) + 10px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  pointer-events: none;
}

.toast {
  padding: 4px 12px;
  color: var(--gold);
  font-size: 9px;
  letter-spacing: 0.1em;
  border: 1px solid rgba(255, 212, 121, 0.45);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.72);
  animation: toastUp 2.2s ease forwards;
}

/* 系统信号 */
.system-panel {
  position: absolute;
  z-index: 52;
  left: max(24px, calc(env(safe-area-inset-left) + 18px));
  top: 50%;
  display: grid;
  gap: 8px;
  width: min(520px, 72vw);
  padding-left: 22px;
  opacity: 0;
  transform: translateY(-45%);
  transition: opacity 300ms var(--ease), transform 400ms var(--ease);
}

.system-panel[hidden] {
  display: none !important;
}

.system-panel::before {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  content: "";
  background: linear-gradient(transparent, var(--gold), var(--blue), transparent);
  box-shadow: 0 0 10px rgba(145, 189, 242, 0.46);
}

.system-panel.show {
  opacity: 1;
  transform: translateY(-50%);
}

#game-container[data-scene="contract"] .system-panel {
  display: none !important;
  visibility: hidden;
}


#game-container[data-scene="contract-auth"] .system-panel {
  left: 50%;
  top: 50%;
  width: min(580px, 76vw);
  padding: 22px 24px 22px 32px;
  border: 1px solid rgba(255, 212, 121, 0.24);
  border-radius: 10px;
  background: rgba(7, 9, 14, 0.92);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.56);
  transform: translate(-50%, -50%);
}

#game-container[data-scene="contract-auth"] .system-panel.show {
  transform: translate(-50%, -50%);
}

.system-kicker {
  color: var(--blue);
  font-family: var(--mono);
  font-size: clamp(8px, 0.8vw, 11px);
  letter-spacing: 0.34em;
}

.system-panel strong {
  font-size: clamp(22px, 3.1vw, 42px);
  line-height: 1.35;
  letter-spacing: 0.08em;
}

.system-panel p {
  margin: 0;
  color: var(--text-soft);
  font-size: clamp(11px, 1.2vw, 16px);
  line-height: 1.8;
  letter-spacing: 0.06em;
}

/* ADV，与娱乐圈 Demo 同构 */
.adv-wrap {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 max(16px, calc(env(safe-area-inset-right) + 12px)) max(12px, calc(env(safe-area-inset-bottom) + 8px)) max(16px, calc(env(safe-area-inset-left) + 12px));
  transition: opacity 260ms ease, transform 260ms ease;
}

.adv-wrap.hide {
  display: none;
}

.adv-wrap[hidden],
.choices[hidden],
.transition-card[hidden],
.primary-action[hidden] {
  display: none !important;
}

.speaker-tab {
  display: inline-block;
  min-width: 82px;
  margin-left: 10px;
  padding: 4px 16px;
  color: #111;
  font-size: clamp(11px, 1vw, 13px);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-align: center;
  border-radius: 7px 7px 0 0;
  background: var(--gold);
}

.adv-wrap.narration .speaker-tab {
  visibility: hidden;
}

.adv-wrap.zero .speaker-tab {
  color: #071323;
  background: var(--blue);
}

.adv-wrap.hero .speaker-tab {
  color: #111;
  background: #f1f1f1;
}

.adv-wrap.siyan .speaker-tab {
  color: #14110b;
  background: linear-gradient(135deg, #e7d5a3, var(--gold));
}

#adv-box {
  position: relative;
  min-height: 96px;
  padding: 14px 18px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 10, 16, 0.84);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

#line-text {
  min-height: 54px;
  margin: 0;
  color: var(--text);
  font-size: clamp(13px, 1.25vw, 16px);
  line-height: 1.9;
  letter-spacing: 0.04em;
}

.line-emphasis {
  color: var(--gold);
  font-weight: 600;
  text-shadow: 0 0 14px rgba(255, 212, 121, 0.16);
}

.adv-wrap.narration #line-text {
  color: rgba(255, 255, 255, 0.72);
  font-style: italic;
}

#line-text em {
  color: var(--gold);
  font-style: normal;
}

.continue-caret {
  position: absolute;
  right: 14px;
  bottom: 8px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  animation: cue 1.2s infinite;
}

.adv-wrap.is-typing .continue-caret {
  opacity: 0;
  animation: none;
}

/* 选项 */
.choices {
  position: absolute;
  z-index: 64;
  left: 50%;
  top: max(70px, calc(env(safe-area-inset-top) + 62px));
  bottom: max(28px, calc(env(safe-area-inset-bottom) + 18px));
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  gap: 8px;
  width: min(560px, 88vw);
  overflow-y: auto;
  padding: 4px 2px;
  transform: translateX(-50%);
}

.choices.hide {
  opacity: 0;
  pointer-events: none;
}

.choice-prompt {
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: clamp(11px, 1.1vw, 14px);
  letter-spacing: 0.12em;
  text-align: center;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 10px;
  background: rgba(10, 10, 16, 0.9);
  backdrop-filter: blur(10px);
  animation: choiceIn 320ms var(--ease) backwards;
}

.choice-card:nth-of-type(2) { animation-delay: 50ms; }
.choice-card:nth-of-type(3) { animation-delay: 100ms; }
.choice-card:nth-of-type(4) { animation-delay: 150ms; }

.choice-card:active,
.choice-card:hover {
  color: var(--gold);
  border-color: rgba(255, 212, 121, 0.72);
  background: rgba(28, 24, 14, 0.92);
}

.choice-card.is-viewed,
.choice-card.is-viewed:hover {
  color: rgba(255, 255, 255, 0.7);
  border-color: rgba(94, 234, 212, 0.38);
  background: rgba(10, 25, 25, 0.86);
  cursor: default;
}

.choice-card.is-viewed .choice-index {
  color: var(--mint);
}

.choice-index {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 10px;
}

.choice-copy {
  flex: 1;
}

.choice-copy b {
  display: block;
  font-size: clamp(12px, 1.18vw, 15px);
  letter-spacing: 0.08em;
}

.choice-copy small {
  display: block;
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 9px;
  line-height: 1.5;
}

.choice-tag {
  flex-shrink: 0;
  padding: 2px 6px;
  color: var(--mint);
  font-size: 8px;
  border: 1px solid rgba(94, 234, 212, 0.42);
  border-radius: 4px;
}

.required-choice {
  width: min(620px, 88vw);
}

.choice-complete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  margin-top: 4px;
  padding: 9px 15px;
  color: rgba(255, 255, 255, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: rgba(8, 8, 13, 0.72);
  cursor: default;
}

.choice-complete span {
  font-size: clamp(9px, .9vw, 12px);
  letter-spacing: .08em;
}

.choice-complete b {
  font-size: clamp(12px, 1.1vw, 15px);
  font-weight: 500;
  letter-spacing: .16em;
}

.choice-complete.is-ready {
  color: #17130a;
  border-color: var(--gold);
  background: var(--gold);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .34);
  cursor: pointer;
  animation: choiceIn 280ms var(--ease) both;
}

.choice-complete.is-ready:hover,
.choice-complete.is-ready:active {
  background: #ffe09a;
}

/* 纯黑转场 */
.transition-card {
  position: absolute;
  z-index: 100;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px;
  color: #fff;
  text-align: center;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 520ms ease;
}

.transition-card.show {
  opacity: 1;
  pointer-events: auto;
}

.transition-card span {
  color: rgba(255, 255, 255, 0.4);
  font-family: var(--mono);
  font-size: clamp(8px, 0.8vw, 10px);
  letter-spacing: 0.58em;
}

.transition-card strong {
  font-size: clamp(22px, 3vw, 34px);
  letter-spacing: 0.3em;
}

.transition-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: clamp(10px, 1vw, 12px);
  line-height: 1.8;
  letter-spacing: 0.2em;
  white-space: pre-line;
}

.primary-action {
  position: absolute;
  z-index: 68;
  right: max(20px, calc(env(safe-area-inset-right) + 16px));
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
  display: none;
  min-width: 174px;
  min-height: 46px;
  padding: 10px 20px;
  color: #15120b;
  font-size: clamp(12px, 1.2vw, 15px);
  font-weight: 700;
  letter-spacing: 0.18em;
  border-radius: 9px;
  background: var(--gold);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
}

.primary-action.show {
  display: block;
}

.primary-action:active {
  transform: scale(0.97);
}

@media (max-width: 900px) {
  #hud {
    gap: 7px;
  }

  .world-route {
    top: max(10px, calc(env(safe-area-inset-top) + 8px));
  }

  .route-head {
    margin-bottom: 6px;
  }

  .route-head h2 {
    font-size: 20px;
  }

  .route-list {
    gap: 6px;
  }

  .route-card > b {
    top: 18%;
    font-size: clamp(18px, 3vw, 24px);
  }

  .contract-file {
    width: min(650px, 76vw);
  }

  #game-container[data-scene="contract"][data-mode="action"] .contract-file {
    max-height: calc(100vh - 112px - env(safe-area-inset-bottom));
  }

  #game-container[data-scene="contract"][data-mode="narration"] .contract-file,
  #game-container[data-scene="contract"][data-mode="dialogue"] .contract-file {
    max-height: calc(100vh - 154px - env(safe-area-inset-bottom));
  }
}

@media (max-height: 520px) {
  .heart-lobby::after {
    background: linear-gradient(180deg, rgba(2, 2, 4, 0.12), transparent 32%, rgba(2, 2, 4, 0.62));
  }

  .zero-bot {
    top: -5%;
    width: clamp(284px, 38vw, 400px);
    height: clamp(404px, 56vw, 584px);
  }

  .siyan-portrait {
    width: 48vw;
  }

  .siyan-portrait img {
    object-position: right bottom;
  }

  .contract-file {
    top: max(50px, calc(env(safe-area-inset-top) + 46px));
    max-height: calc(100vh - 58px - env(safe-area-inset-bottom));
    padding: 12px 16px;
  }

  #game-container[data-scene="contract"][data-mode="action"] .contract-file {
    max-height: calc(100vh - 112px - env(safe-area-inset-bottom));
  }

  #game-container[data-scene="contract"][data-mode="narration"] .contract-file,
  #game-container[data-scene="contract"][data-mode="dialogue"] .contract-file {
    max-height: calc(100vh - 154px - env(safe-area-inset-bottom));
  }

  .contract-title-row {
    padding: 6px 0 8px;
  }

  .contract-title-row h2 {
    font-size: 18px;
  }

  .contract-clauses {
    gap: 5px;
    margin: 8px 0;
  }

  .contract-clauses li {
    grid-template-columns: 28px 1fr;
    padding: 5px 8px;
    font-size: 10px;
    line-height: 1.45;
  }

  .name-registration {
    margin-top: 8px;
    padding: 10px 12px;
  }

  .name-registration > label {
    margin-bottom: 8px;
    font-size: 13px;
  }

  #walker-name {
    height: 38px;
    font-size: 15px;
  }

  .registration-meta {
    margin-top: 8px;
    padding-top: 7px;
  }

  .chair-seal {
    right: 16px;
    bottom: 12px;
    width: 68px;
    font-size: 10px;
  }

  .route-head span,
  .route-head p {
    display: none;
  }

  .route-card > i {
    top: 7px;
  }

  .route-card > b {
    top: 21%;
  }

  .route-card > em {
    bottom: 39px;
    font-size: 8px;
  }

  .route-card > small {
    bottom: 7px;
    min-height: 30px;
    padding: 4px 3px 4px 24px;
    font-size: 8px;
  }

  .route-card > small::before {
    left: 7px;
  }

  .route-card > small::after {
    left: 7px;
  }

  .route-card.is-open > small span {
    display: none;
  }

  .mission-brief {
    width: min(700px, 84vw);
    padding: 14px 18px;
  }

  .mission-grid {
    gap: 18px;
    margin-top: 6px;
  }

  .mission-main h2 {
    margin: 4px 0 7px;
    font-size: 21px;
  }

  .mission-main p {
    font-size: 10px;
    line-height: 1.6;
  }

  .mission-brief dl {
    gap: 5px;
  }

  .mission-brief dl div {
    padding-bottom: 4px;
  }

  .mission-brief dd {
    font-size: 10px;
  }

  .adv-wrap {
    padding-bottom: max(8px, calc(env(safe-area-inset-bottom) + 5px));
  }

  .speaker-tab {
    padding: 3px 14px;
    font-size: 11px;
  }

  #adv-box {
    min-height: 82px;
    padding: 10px 15px 8px;
  }

  #line-text {
    min-height: 45px;
    font-size: clamp(12px, 1.85vw, 14px);
    line-height: 1.72;
  }

  .choices {
    top: max(54px, calc(env(safe-area-inset-top) + 50px));
    bottom: max(12px, calc(env(safe-area-inset-bottom) + 8px));
    width: min(540px, 76vw);
  }

  .choice-prompt {
    margin-bottom: 1px;
    font-size: 10px;
  }

  .choice-card {
    min-height: 46px;
    padding: 7px 12px;
  }

  .choice-copy b {
    font-size: 11px;
  }

  .choice-copy small {
    font-size: 8px;
  }
}

@media (max-width: 760px) and (max-height: 420px) {
  .hphase {
    display: none;
  }

  .route-list {
    grid-template-columns: repeat(6, minmax(76px, 1fr));
    overflow-x: auto;
    scrollbar-width: none;
  }

  .route-card > em {
    display: none;
  }

  .contract-file {
    left: max(12px, calc(env(safe-area-inset-left) + 8px));
    width: calc(100vw - 214px);
  }

  .zero-bot {
    right: -2%;
  }


  .siyan-portrait {
    width: 52vw;
  }

  .mission-brief {
    width: 88vw;
  }
}

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

@keyframes scan {
  0%, 25% { transform: translateX(-100%); }
  70%, 100% { transform: translateX(100%); }
}

@keyframes pulseRing {
  0%, 100% { opacity: 0.34; transform: translate(-50%, -50%) scale(0.94); }
  50% { opacity: 0.9; transform: translate(-50%, -50%) scale(1.04); }
}

@keyframes drift {
  0%, 100% { transform: translateY(-5px); }
  50% { transform: translateY(7px); }
}

@keyframes float {
  0%, 100% { margin-top: -4px; }
  50% { margin-top: 6px; }
}

@keyframes memoryFlash {
  0%, 100% { opacity: 0.15; filter: blur(2px); transform: translateY(5px); }
  45%, 62% { opacity: 0.88; filter: none; transform: none; }
}

@keyframes sealIn {
  from { opacity: 0; transform: rotate(-10deg) scale(1.45); }
  to { opacity: 1; transform: rotate(-10deg) scale(1); }
}

@keyframes choiceIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes cue {
  0%, 100% { opacity: 0.4; transform: translateY(0); }
  50% { opacity: 0.9; transform: translateY(3px); }
}

@keyframes toastUp {
  0% { opacity: 0; transform: translateY(8px); }
  12%, 78% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-10px); }
}
