:root {
  --cream: #f5ebd8;
  --cream-soft: rgba(245, 235, 216, 0.72);
  --navy: #071725;
  --gold: #d6b56e;
  --gold-bright: #f0d79a;
}

* { box-sizing: border-box; }

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

html { background: #020508; }

body {
  color: var(--cream);
  background: #020508;
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

button { font: inherit; }

#museum {
  position: fixed;
  inset: 0;
  background: #020508;
}

#stage {
  position: absolute;
  inset: 0;
  cursor: grab;
  touch-action: none;
  background-color: #05090d;
  background-image: url("../previews/01-childhood-1777-1788.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

#stage:active { cursor: grabbing; }
#stage.is-action { cursor: pointer; }
#stage canvas { display: block; width: 100%; height: 100%; }

.cinema-vignette,
.travel-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cinema-vignette {
  z-index: 4;
  background:
    radial-gradient(circle at 50% 46%, transparent 52%, rgba(2, 5, 8, 0.23) 100%),
    linear-gradient(180deg, rgba(2, 6, 10, 0.2), transparent 18%, transparent 78%, rgba(2, 6, 10, 0.26));
}

.travel-veil {
  z-index: 7;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 50%, transparent 24%, rgba(3, 8, 12, 0.13) 62%, rgba(2, 5, 8, 0.7) 116%),
    radial-gradient(ellipse at center, rgba(240, 215, 154, 0.08), transparent 63%);
  transition: opacity 0.18s linear;
}

.travel-veil.is-active { opacity: var(--travel-opacity, 0.28); }

.enter-screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 46%, rgba(5, 17, 26, 0.18), rgba(2, 6, 10, 0.82) 80%),
    linear-gradient(180deg, rgba(2, 6, 10, 0.12), rgba(2, 6, 10, 0.68));
  backdrop-filter: blur(5px);
  transition: opacity 0.85s ease, visibility 0.85s ease;
}

.enter-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.enter-copy {
  width: min(720px, 92vw);
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid rgba(240, 215, 154, 0.36);
  border-radius: 3px;
  background: linear-gradient(145deg, rgba(4, 15, 24, 0.8), rgba(5, 11, 17, 0.63));
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.52), inset 0 0 80px rgba(214, 181, 110, 0.04);
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--gold-bright);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(10px, 1.3vw, 13px);
  letter-spacing: 0.26em;
}

.enter-copy h1 {
  margin: 0;
  font-family: "Songti SC", "SimSun", serif;
  font-size: clamp(38px, 7vw, 78px);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

.enter-copy > p:not(.eyebrow) {
  max-width: 590px;
  margin: 22px auto 0;
  color: rgba(245, 235, 216, 0.82);
  font-size: clamp(14px, 1.8vw, 18px);
  line-height: 1.9;
}

.enter-copy button {
  display: inline-flex;
  align-items: center;
  gap: 30px;
  min-width: 230px;
  margin: 34px auto 15px;
  padding: 14px 20px 14px 26px;
  color: #071725;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #f3dda7, #caa65e);
  box-shadow: 0 10px 38px rgba(214, 181, 110, 0.26);
  cursor: pointer;
  transition: transform 0.25s ease, filter 0.25s ease, opacity 0.25s ease;
}

.enter-copy button:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.06); }
.enter-copy button:disabled { cursor: wait; opacity: 0.62; }
.enter-copy button span { flex: 1; letter-spacing: 0.12em; }
.enter-copy button i { font-size: 22px; font-style: normal; }

.enter-copy small {
  display: block;
  color: rgba(245, 235, 216, 0.48);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.scene-whisper {
  position: absolute;
  z-index: 10;
  top: max(28px, env(safe-area-inset-top));
  left: max(28px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 15px;
  max-width: min(540px, calc(100vw - 56px));
  padding: 12px 17px 12px 13px;
  border-left: 2px solid var(--gold);
  border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, rgba(3, 13, 21, 0.76), rgba(3, 13, 21, 0.18));
  text-shadow: 0 2px 9px #000;
  backdrop-filter: blur(7px);
  opacity: 0;
  transform: translateX(-16px);
  pointer-events: none;
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.scene-whisper.is-visible { opacity: 1; transform: translateX(0); }
.scene-whisper > span { color: var(--gold-bright); font: 28px/1 Georgia, serif; }
.scene-whisper div { display: grid; gap: 3px; min-width: 0; }
.scene-whisper small { color: rgba(245, 235, 216, 0.64); font-size: 10px; letter-spacing: 0.18em; }
.scene-whisper strong { overflow: hidden; font-size: 14px; font-weight: 500; letter-spacing: 0.08em; text-overflow: ellipsis; white-space: nowrap; }

.action-prompt,
.travel-message,
.subtitle {
  position: absolute;
  left: 50%;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.action-prompt {
  z-index: 12;
  bottom: max(38px, calc(env(safe-area-inset-bottom) + 20px));
  padding: 9px 18px;
  color: var(--gold-bright);
  border: 1px solid rgba(240, 215, 154, 0.45);
  border-radius: 999px;
  background: rgba(3, 13, 21, 0.76);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(8px);
  font-size: 12px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.travel-message {
  z-index: 14;
  top: 50%;
  padding: 10px 18px;
  color: rgba(245, 235, 216, 0.9);
  text-shadow: 0 2px 15px #000;
  font-family: "Songti SC", "SimSun", serif;
  font-size: clamp(16px, 2vw, 24px);
  letter-spacing: 0.16em;
}

.subtitle {
  z-index: 18;
  bottom: max(31px, calc(env(safe-area-inset-bottom) + 16px));
  width: min(900px, calc(100vw - 44px));
  padding: 12px 20px;
  color: #fffaf0;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, rgba(2, 10, 16, 0.84) 18%, rgba(2, 10, 16, 0.84) 82%, transparent);
  text-align: center;
  text-shadow: 0 2px 10px #000;
  font-size: clamp(14px, 1.8vw, 19px);
  line-height: 1.75;
}

.action-prompt.is-visible,
.travel-message.is-visible,
.subtitle.is-visible { opacity: 1; transform: translate(-50%, 0); }

.guide-active .subtitle {
  bottom: max(126px, calc(env(safe-area-inset-bottom) + 116px));
}

.guide-prompt {
  position: absolute;
  z-index: 20;
  right: max(26px, env(safe-area-inset-right));
  bottom: max(28px, calc(env(safe-area-inset-bottom) + 18px));
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: min(610px, calc(100vw - 52px));
  padding: 13px 14px;
  border: 1px solid rgba(240, 215, 154, 0.48);
  border-radius: 5px;
  background: linear-gradient(125deg, rgba(3, 13, 21, 0.94), rgba(8, 30, 44, 0.88));
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.5), inset 0 0 38px rgba(214, 181, 110, 0.05);
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.guide-prompt.is-visible { opacity: 1; transform: translateY(0); }

.guide-prompt__mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(240, 215, 154, 0.56);
  border-radius: 50%;
  box-shadow: 0 0 28px rgba(214, 181, 110, 0.18);
}

.guide-prompt__mark span {
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid var(--gold-bright);
}

.guide-prompt__copy { display: grid; gap: 3px; min-width: 0; }
.guide-prompt__copy small { color: var(--gold-bright); font-size: 10px; letter-spacing: 0.18em; }
.guide-prompt__copy strong { overflow: hidden; color: #fff7e7; font-size: 14px; font-weight: 500; letter-spacing: 0.06em; text-overflow: ellipsis; white-space: nowrap; }
.guide-prompt__copy span { color: rgba(245, 235, 216, 0.6); font-size: 11px; }

.guide-prompt button {
  min-width: 98px;
  padding: 10px 15px;
  color: #071725;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #f3dda7, #caa65e);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.guide-prompt button:disabled { cursor: wait; opacity: 0.5; }

.webgl-fallback {
  position: absolute;
  z-index: 50;
  inset: auto 20px 20px;
  padding: 16px 20px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  background: rgba(80, 18, 18, 0.88);
  text-align: center;
}

@media (max-width: 720px) {
  .enter-screen { padding: 16px; }
  .enter-copy { padding: 28px 22px; }
  .enter-copy h1 { letter-spacing: 0.03em; }
  .scene-whisper { top: max(18px, env(safe-area-inset-top)); left: max(17px, env(safe-area-inset-left)); max-width: calc(100vw - 34px); }
  .scene-whisper > span { font-size: 23px; }
  .scene-whisper strong { font-size: 12px; }
  .guide-prompt {
    right: 14px;
    bottom: max(14px, calc(env(safe-area-inset-bottom) + 8px));
    grid-template-columns: auto 1fr;
    width: calc(100vw - 28px);
  }
  .guide-prompt button { grid-column: 1 / -1; width: 100%; }
  .subtitle { bottom: max(126px, calc(env(safe-area-inset-bottom) + 116px)); }
}

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