:root {
  --bg: #0d0b1a;
  --ink: #f0ebe3;
  --muted: #9b95b0;
  --muted2: #6e6885;
  --rule: #2d2745;
  --accent: #d4a857;
  --accent2: #c77b8e;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC",
    "Microsoft YaHei", sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", "STSong", serif;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(123, 108, 184, 0.12), transparent 50%),
    radial-gradient(ellipse at 80% 60%, rgba(199, 123, 142, 0.08), transparent 50%);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
fieldset { border: 0; }
img, video { display: block; }

/* ---------------------------------------------------------------- 通用元件 */

.label {
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.quote {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--muted);
  border-left: 2px solid var(--accent);
  padding-left: 14px;
  max-width: 28em;
}

.muted { color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: opacity 0.2s var(--ease);
}

.btn:disabled { opacity: 0.55; cursor: default; }

.btn--gold {
  background: linear-gradient(135deg, #d4a857, #c77b8e);
  color: #1a1220;
}

.btn--ghost {
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(240, 235, 227, 0.28);
  color: var(--ink);
}

/* ------------------------------------------------------------------ 屏幕 */

.screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
}

.screen__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
  background: var(--bg);
}

.screen__video.is-landscape { object-position: center center; }
.screen__video.is-portrait { object-position: center 22%; }

@media (min-aspect-ratio: 1/1) {
  .screen__video.is-portrait { object-fit: contain; object-position: center; }
}

@media (max-aspect-ratio: 3/4) {
  .screen__video.is-landscape { object-fit: contain; object-position: center; }
}

.screen__veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(13, 11, 26, 0.25) 0%,
    rgba(13, 11, 26, 0.78) 70%,
    var(--bg) 100%
  );
}

.screen__veil--soft {
  background: linear-gradient(
    180deg,
    rgba(13, 11, 26, 0.15) 0%,
    rgba(13, 11, 26, 0.86) 68%
  );
}

.screen__content,
.universe-panel,
.home-hero__copy {
  position: relative;
  z-index: 2;
}

/* ------------------------------------------------------------------ 开场 */

.intro-copy {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 32px 22px calc(48px + env(safe-area-inset-bottom));
}

.intro-copy h1,
.home-hero__copy h1 {
  font-family: var(--font-serif);
  font-size: clamp(32px, 8vw, 52px);
  line-height: 1.2;
  margin: 8px 0 18px;
  background: linear-gradient(135deg, #d4a857, #c77b8e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.intro-actions,
.uni-nav,
.map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

/* ------------------------------------------------------------- 旅人登记 */

.screen--gate {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px calc(28px + env(safe-area-inset-bottom));
}

.card {
  width: min(460px, 100%);
  padding: 28px 22px;
  border: 1px solid rgba(212, 168, 87, 0.28);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(31, 25, 54, 0.92), rgba(13, 11, 26, 0.94));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.card h2 {
  font-family: var(--font-serif);
  font-size: 28px;
  margin-bottom: 10px;
}

.card__lead {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 22px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.field > span {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.field input,
.oracle textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: rgba(13, 11, 26, 0.7);
  color: var(--ink);
  font: inherit;
}

.field input:focus-visible,
.oracle textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  padding: 9px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.pill.is-on {
  border-color: var(--accent);
  background: rgba(212, 168, 87, 0.16);
  color: var(--accent);
}

.form-note {
  min-height: 1.4em;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--accent2);
}

/* -------------------------------------------------------------- 多元宇宙 */

.screen--map { padding: 28px 16px 40px; }
.map-head { text-align: center; }
.map-head h2 { font-family: var(--font-serif); font-size: 28px; }
.progress { color: var(--accent2); margin-top: 6px; }

.constellation {
  position: relative;
  width: min(560px, 100%);
  height: min(72vh, 620px);
  margin: 12px auto 16px;
}

.star-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 86px;
  min-height: 86px;
  padding: 8px;
  border: 1px solid rgba(212, 168, 87, 0.35);
  border-radius: 50%;
  background: rgba(22, 18, 41, 0.72);
  animation: pulse 3.2s ease-in-out infinite;
}

.node__code { font-size: 11px; letter-spacing: 0.12em; color: var(--accent); }
.node__name { font-size: 12px; }

.node.is-done {
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(212, 168, 87, 0.35);
  animation: none;
}

.node--home { min-width: 96px; min-height: 96px; opacity: 0.45; }
.node--home.is-ready { opacity: 1; animation: glow 1.6s ease-in-out infinite; }
.node:disabled { cursor: not-allowed; }

.hint {
  text-align: center;
  color: var(--muted2);
  font-size: 13px;
}

/* -------------------------------------------------------------- 宇宙详情 */

.screen--universe {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

.back-btn {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  left: 14px;
  z-index: 3;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(13, 11, 26, 0.6);
  font-size: 13px;
}

/* Mirrors .back-btn on the opposite corner, but fixed so it survives the
   scrolling home screen. Sits above the oracle sheet, below the unlock veil. */
.sound-btn {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  z-index: 35;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(13, 11, 26, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 13px;
}

.universe-panel {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 88px 20px calc(36px + env(safe-area-inset-bottom));
}

.universe-panel h2 {
  font-family: var(--font-serif);
  font-size: clamp(28px, 7vw, 42px);
  margin-bottom: 14px;
}

/* The scene line reads as a caption under the vow. */
.universe-panel .muted { margin-top: 12px; font-size: 14px; }

.uni-actions { margin-top: 24px; }
.uni-nav { margin-top: 10px; }

.oracle {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  max-height: min(72vh, 640px);
  overflow: auto;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid rgba(212, 168, 87, 0.28);
  border-radius: 22px 22px 0 0;
  background:
    linear-gradient(180deg, rgba(212, 168, 87, 0.1), transparent 28%),
    rgba(13, 11, 26, 0.96);
  transform: translateY(110%);
  visibility: hidden;
  transition: transform 0.35s var(--ease), visibility 0.35s;
}

.oracle.is-open { transform: translateY(0); visibility: visible; }

.oracle__close {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  font-size: 12px;
}

.oracle__tag {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--accent);
  margin-bottom: 8px;
}

.oracle__ask {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.oracle textarea { min-height: 84px; resize: none; margin-bottom: 12px; }

.oracle__thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.bubble {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 16px;
  white-space: pre-wrap;
  font-size: 14px;
}

.bubble--out {
  align-self: flex-end;
  background: rgba(212, 168, 87, 0.16);
  border: 1px solid rgba(212, 168, 87, 0.3);
}

.bubble--in {
  align-self: flex-start;
  background: rgba(199, 123, 142, 0.12);
  border: 1px solid rgba(199, 123, 142, 0.28);
}

.egg__meta { margin-top: 8px; font-size: 12px; color: var(--muted2); }

/* -------------------------------------------------------------- 解锁提示 */

.unlock-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: rgba(13, 11, 26, 0.88);
}

.unlock-overlay h2 {
  font-family: var(--font-serif);
  font-size: clamp(28px, 7vw, 42px);
}

.unlock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

/* -------------------------------------------------------------- 主宇宙 */

.home-hero { position: relative; min-height: 88vh; overflow: hidden; }

.home-hero__copy {
  min-height: 88vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 32px 22px 48px;
}

.home-hero__copy h2 {
  margin-top: 22px;
  font-family: var(--font-serif);
  font-size: 28px;
}

.home-meta {
  display: flex;
  gap: 16px;
  margin: 10px 0 22px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.block {
  padding: 48px 22px;
  border-top: 1px solid var(--rule);
}

.block h2 {
  font-family: var(--font-serif);
  font-size: 28px;
  margin-bottom: 10px;
}

.countdown { margin-top: 12px; color: var(--accent); }

.venue {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: rgba(22, 18, 41, 0.5);
}

.venue__kind {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--accent2);
}

.venue__name {
  margin-top: 6px;
  font-family: var(--font-serif);
  font-size: 21px;
}

.venue__time {
  margin-top: 8px;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.address { margin: 8px 0 0; font-size: 15px; color: var(--muted); }
.map-distance { min-height: 1.4em; margin-top: 12px; color: var(--accent); }

.admin-links { margin-top: 28px; color: var(--muted2); font-size: 13px; }

/* ------------------------------------------------------------------ 动画 */

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(212, 168, 87, 0); }
  50% { box-shadow: 0 0 16px rgba(212, 168, 87, 0.22); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 10px rgba(212, 168, 87, 0.3); }
  50% { box-shadow: 0 0 24px rgba(212, 168, 87, 0.7); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .node, .node--home.is-ready { animation: none; }
  .oracle { transition: none; }
}

@media (max-width: 700px) {
  .intro-actions,
  .uni-nav,
  .map-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .btn { width: 100%; min-height: 48px; }
  .node { min-width: 78px; min-height: 78px; }
}
