:root {
  font-family: Arial, Helvetica, sans-serif;
  color-scheme: dark;
  background: #091323;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
html {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  scrollbar-width: none;
}
html::-webkit-scrollbar {
  display: none;
}
body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100dvh;
  overflow-x: clip;
  background: #091323;
}
#experience {
  position: fixed;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: #081323;
}
#world {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}
#world.look-enabled {
  touch-action: pan-y pinch-zoom;
  cursor: grab;
}
#world.look-enabled:active {
  cursor: grabbing;
}
#world:focus-visible {
  outline: 2px solid #f2bd79;
  outline-offset: -4px;
}
.touch-hint {
  display: none;
}
@media (pointer: coarse) {
  .touch-hint {
    display: inline;
  }
  #look-hint { display:none; }
}
#scroll-track {
  height: 950vh;
  height: 950dvh;
  width: 1px;
  pointer-events: none;
}
/* Foreground veil: six independently staggered columns, behind the HUD. */
.opening-wipe {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  pointer-events: none;
  overflow: hidden;
}
.opening-wipe span {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  background: rgba(11, 22, 37, 0.242);
  will-change: transform;
  border: 1px solid #ffffff10;
  backdrop-filter: blur(10px);
}
/* Blur the city silhouettes while leaving the upper sky's stars legible. */
.opening-wipe span::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  backdrop-filter: blur(13px);
  -webkit-backdrop-filter: blur(13px);
  mask-image: linear-gradient(to bottom, transparent 15%, black 44%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 15%, black 44%);
}
@media (prefers-reduced-motion: reduce) {
  .opening-wipe {
    display: none;
  }
}
.experience-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(2, 8, 18, 0.27),
    transparent 28%,
    transparent 63%,
    rgba(2, 8, 18, 0.51)
  );
}
.hud {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  padding-left: max(25px, env(safe-area-inset-left) + 16px);
  padding-right: max(25px, env(safe-area-inset-right) + 16px);
}
.hud-top {
  top: max(20px, env(safe-area-inset-top) + 13px);
}
.hud-bottom {
  bottom: max(21px, env(safe-area-inset-bottom) + 13px);
}
.brand {
  font-size: 11px;
  letter-spacing: 0.21em;
  font-weight: 700;
  white-space: nowrap;
}
.brand-sub {
  font-size: 9px;
  color: rgba(220, 231, 242, 0.55);
  font-weight: 400;
  letter-spacing: 0.12em;
}
.beat-label {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: #b2cbda;
  text-align: right;
}
.micro-note {
  font-size: 9px;
  letter-spacing: 0.15em;
  color: rgba(220, 231, 242, 0.62);
}
.progress-readout {
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.14em;
  white-space: nowrap;
}
.progress-track {
  width: 76px;
  height: 2px;
  background: rgba(255, 255, 255, 0.25);
  display: inline-block;
  overflow: hidden;
}
#progress-fill {
  width: 100%;
  height: 100%;
  background: #f2bd79;
  display: block;
  transform: scaleX(0);
  transform-origin: left;
}
.narration {
  position: absolute;
  z-index: 3;
  left: 9%;
  right: 9%;
  top: 38%;
  transform: translateY(-20%);
  pointer-events: none;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.86);
  text-align: left;
}
.narration h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 7vw, 104px);
  font-weight: 400;
  line-height: 0.94;
  letter-spacing: -0.05em;
  margin: 0 0 22px;
}
.narration p {
  font-size: clamp(14px, 1.35vw, 19px);
  line-height: 1.55;
  font-weight: 300;
  margin: 0;
}
.narration small {
  display: block;
  font-size: 10px;
  letter-spacing: 0.23em;
  margin-top: 29px;
}
.narration .overline {
  font-size: 12px;
  letter-spacing: 0.35em;
}
.narration .poetic {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(29px, 4.1vw, 66px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}
/* Localized contrast support for the sky reveal; never a full-screen dark overlay. */
.narration.reveal-copy {
  color: #fffaf4;
  text-shadow:
    0 3px 14px rgba(0, 4, 14, 0.98),
    0 7px 32px rgba(0, 5, 15, 0.91),
    0 0 44px rgba(0, 5, 15, 0.6);
}
.narration.reveal-copy::before {
  content: "";
  position: absolute;
  inset: -34px -32px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 24% 48%,
    rgba(5, 13, 28, 0.32),
    transparent 65%
  );
}
.controls {
  position: absolute;
  right: max(24px, env(safe-area-inset-right) + 16px);
  top: max(62px, env(safe-area-inset-top) + 53px);
  z-index: 10;
  display: flex;
  gap: 8px;
}
button {
  color: #f4f0e8;
  border: 1px solid rgba(214, 231, 243, 0.45);
  background: rgba(7, 20, 35, 0.58);
  border-radius: 3px;
  padding: 12px 14px;
  font-size: 10px;
  letter-spacing: 0.12em;
  cursor: pointer;
  touch-action: manipulation;
}
button:hover {
  background: rgba(33, 61, 83, 0.86);
}
button:focus-visible {
  outline: 2px solid #f2bd79;
  outline-offset: 3px;
}
.ghost-button {
  letter-spacing: 0.15em;
}
.explore-legacy {
  position: absolute;
  z-index: 8;
  bottom: max(79px, env(safe-area-inset-bottom) + 75px);
  left: max(24px, env(safe-area-inset-left) + 16px);
  background: rgba(6, 19, 33, 0.73);
  border: 1px solid rgba(215, 233, 248, 0.24);
  padding: 14px 16px;
  max-width: calc(100% - 48px);
}
.explore-legacy p {
  letter-spacing: 0.14em;
  font-size: 11px;
  margin: 0 0 10px;
}
.star-actions-legacy {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.prototype-label {
  font-size: 8px;
  opacity: 0.55;
}

.status {
  position: absolute;
  z-index: 4;
  top: max(93px, env(safe-area-inset-top) + 86px);
  left: max(24px, env(safe-area-inset-left) + 16px);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #ecd5ae;
}
[hidden] {
  display: none !important;
}
/* Static no-WebGL path stays in the SAME full-viewport surface. */
.fallback {
  position: absolute;
  inset: 0;
  overflow: hidden;
  --power: 1;
  --stars: 0;
  --skyglow: 1;
  background: linear-gradient(to bottom, #0a1322, rgb(calc(8 + 20 * var(--skyglow)) calc(15 + 35 * var(--skyglow)) calc(27 + 45 * var(--skyglow))));
}
.fallback-sky {
  position: absolute;
  inset: 0;
  opacity: calc(var(--stars) * 0.96);
  background-image:
    radial-gradient(1px 1px at 12% 18%, #e9f2ff 98%, transparent),
    radial-gradient(2px 2px at 63% 14%, #e9f2ff 98%, transparent),
    radial-gradient(2px 2px at 83% 36%, #e9f2ff 98%, transparent),
    radial-gradient(1px 1px at 43% 29%, #e9f2ff 98%, transparent),
    radial-gradient(1px 1px at 71% 61%, #e9f2ff 98%, transparent),
    radial-gradient(1px 1px at 22% 48%, #e9f2ff 98%, transparent);
  background-size: 280px 240px;
}
.fallback-horizon {
  position: absolute;
  bottom: 25%;
  left: -20%;
  right: -20%;
  height: 34%;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 18px,
    rgba(22, 40, 60, 0.85) 19px 38px,
    transparent 39px 46px
  );
  clip-path: polygon(
    0 64%,
    10% 48%,
    19% 64%,
    27% 16%,
    35% 46%,
    44% 22%,
    55% 60%,
    63% 10%,
    72% 57%,
    82% 27%,
    92% 55%,
    100% 39%,
    100% 100%,
    0 100%
  );
}
.fallback-buildings {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 43%;
  background: linear-gradient(
    90deg,
    transparent 0 4%,
    #1c3047 4% 18%,
    transparent 18% 23%,
    #263d55 23% 37%,
    transparent 37% 57%,
    #182a41 57% 67%,
    transparent 67% 73%,
    #1d3148 73% 92%,
    transparent 92%
  );
  opacity: calc(0.6 + 0.4 * var(--power));
}
.fallback-lights {
  position: absolute;
  bottom: 9%;
  height: 30%;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent 0 15px,
      rgba(247, 191, 116, 0.96) 16px 19px,
      transparent 20px 28px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0 12px,
      rgba(247, 191, 116, 0.77) 13px 17px,
      transparent 18px 25px
    );
  background-blend-mode: multiply;
  filter: drop-shadow(0 0 7px rgba(244, 174, 97, 0.45));
}
.light-a {
  left: 4%;
  width: 13%;
  opacity: var(--power-0);
}
.light-b {
  left: 23%;
  width: 14%;
  opacity: var(--power-1);
}
.light-c {
  left: 57%;
  width: 10%;
  opacity: var(--power-2);
}
.light-d {
  left: 73%;
  width: 17%;
  opacity: var(--power-3);
}
.fallback.sky-facing .fallback-lights {
  bottom: 3%;
  height: 13%;
}
.fallback-road {
  position: absolute;
  bottom: -10%;
  left: 41%;
  height: 44%;
  width: 24%;
  background: linear-gradient(90deg, #3d5369, #182a3d 15% 85%, #3d5369);
  clip-path: polygon(43% 0, 55% 0, 100% 100%, 0 100%);
}
.fallback.sky-facing .fallback-buildings {
  height: 21%;
}
.fallback.sky-facing .fallback-horizon {
  height: 19%;
  bottom: 16%;
}
.fallback.sky-facing .fallback-road {
  opacity: 0.15;
}
@media (max-width: 700px) {
  .brand {
    font-size: 10px;
    letter-spacing: 0.13em;
  }
  .brand-sub {
    display: none;
  }
  .beat-label {
    font-size: 8px;
    max-width: 48%;
    line-height: 1.4;
  }
  .hud {
    padding-left: max(16px, env(safe-area-inset-left) + 12px);
    padding-right: max(16px, env(safe-area-inset-right) + 12px);
  }
  .micro-note {
    font-size: 8px;
    max-width: 58%;
    line-height: 1.5;
  }
  .progress-track {
    width: 43px;
  }
  .narration {
    left: 8%;
    right: 8%;
    top: 42%;
  }
  .narration h1 {
    font-size: clamp(40px, 13vw, 72px);
  }
  .narration .poetic {
    font-size: clamp(29px, 8vw, 45px);
  }
  .controls {
    right: max(16px, env(safe-area-inset-right) + 12px);
    top: max(65px, env(safe-area-inset-top) + 52px);
  }
  button {
    padding: 12px 12px;
    font-size: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* Phase 2: overlays stay inside the same fixed fullscreen surface. */
.explore-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}
.star-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.star-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 2;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  border-radius: 50%;
  padding: 0;
  pointer-events: auto;
  color: #fff7e9;
  touch-action: manipulation;
}
.star-hotspot:hover,
.star-hotspot[aria-pressed="true"] {
  background: rgba(161, 199, 222, 0.1);
}
.star-hotspot::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(222, 239, 251, 0.45);
  border-radius: 50%;
  opacity: 0.65;
}
.star-hotspot:hover::before,
.star-hotspot:focus-visible::before,
.star-hotspot[aria-pressed="true"]::before {
  border-color: #f2d6a5;
  opacity: 1;
}
.hotspot-dot {
  display: block;
  width: 6px;
  height: 6px;
  background: #eef6ff;
  border-radius: 50%;
  box-shadow: 0 0 9px 2px rgba(230, 240, 255, 0.65);
}
.star-hotspot[aria-pressed="true"] .hotspot-dot {
  background: #fff7de;
  box-shadow: 0 0 8px 3px #ffe5ad, 0 0 22px 8px rgba(255, 213, 143, 0.6);
}
.star-hotspot[aria-pressed="true"] .hotspot-label {
  color: #ffe5ad;
}
.hotspot-label {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 9px;
  letter-spacing: 0.12em;
  line-height: 1.5;
  text-shadow: 0 2px 12px #000;
  color: #e8eef5;
}
.explore-guide {
  position: absolute;
  z-index: 4;
  left: max(24px, env(safe-area-inset-left) + 16px);
  bottom: max(73px, env(safe-area-inset-bottom) + 69px);
  max-width: min(320px, calc(100vw - 45px));
  border: 1px solid rgba(225, 238, 251, 0.24);
  background: rgba(6, 19, 33, 0.78);
  padding: 12px 15px;
  pointer-events: auto;
  backdrop-filter: blur(5px);
}
.explore-guide p {
  font-size: 11px;
  margin: 0 0 7px;
  letter-spacing: 0.16em;
}
.explore-guide .guide-detail {
  font-size: 12px;
  letter-spacing: 0;
  line-height: 1.4;
  color: #cbd8e5;
}
.explore-guide button {
  margin-top: 5px;
  min-height: 40px;
}
.star-detail-panel {
  position: absolute;
  right: max(24px, env(safe-area-inset-right) + 16px);
  bottom: max(73px, env(safe-area-inset-bottom) + 69px);
  width: min(310px, calc(100vw - 48px));
  z-index: 5;
  pointer-events: auto;
  background: rgba(6, 19, 33, 0.92);
  border: 1px solid rgba(225, 238, 251, 0.34);
  padding: 15px 17px;
  backdrop-filter: blur(7px);
}
.star-info {
  font-size: 12px;
  line-height: 1.55;
  color: #dce8f2;
}
.star-info strong {
  font-size: 15px;
  color: #fff5e5;
  letter-spacing: 0.04em;
}
.star-info p {
  margin: 8px 0 14px;
}
.star-close {
  min-height: 39px;
}
.narration.return-copy {
  color: #f4f0e8;
  text-shadow: 0 3px 25px rgba(0, 5, 15, 0.97);
}
@media (max-width: 700px) {
  .explore-guide {
    bottom: max(52px, env(safe-area-inset-bottom) + 44px);
    padding: 10px 12px;
  }
  .star-detail-panel {
    top: max(112px, env(safe-area-inset-top) + 104px);
    bottom: auto;
    left: max(16px, env(safe-area-inset-left) + 12px);
    right: auto;
    width: min(320px, calc(100vw - 32px));
  }
  .hotspot-label {
    font-size: 8px;
  }
}

/* Constellation is projected from the same world points as the star buttons. */
.sky-triangle { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; opacity:0; transition:opacity .5s ease; }
.sky-triangle.is-open { opacity:1; }
.sky-triangle path { fill:none; stroke:rgba(207, 222, 235, .52); stroke-width:1; stroke-dasharray:1; stroke-dashoffset:1; transition:stroke-dashoffset 1.8s ease-in-out; }
.sky-triangle.is-open path { stroke-dashoffset:0; }
.star-hotspot, .star-hotspot::before, .hotspot-dot, .hotspot-label { transition:background-color .4s ease, box-shadow .4s ease, color .4s ease, border-color .4s ease, opacity .4s ease; }
.star-hotspot[aria-pressed="true"] .hotspot-dot { box-shadow:0 0 8px 2px rgba(255, 225, 177, .7); }
.star-detail-panel { opacity:0; transform:translateY(6px); transition:opacity .3s ease, transform .3s ease; pointer-events:none; }
.star-detail-panel.is-open { opacity:1; transform:translateY(0); pointer-events:auto; }
.sky-narrative { opacity:0; max-height:0; overflow:hidden; margin:0 !important; color:#e4d9c8; font-family: Georgia, serif; font-style:italic; letter-spacing:0 !important; font-size:13px !important; line-height:1.45; transition:opacity .6s ease, max-height .6s ease, margin .6s ease; }
.sky-narrative.is-visible { opacity:1; max-height:60px; margin:0 0 9px !important; }
@media (prefers-reduced-motion: reduce) {
  .sky-triangle, .sky-triangle path, .star-hotspot, .star-hotspot::before, .hotspot-dot, .hotspot-label, .star-detail-panel, .sky-narrative { transition:none; }
}

/* Closing copy and actions form one measured group. */
#closing-layout { display:contents; }
#closing-layout.is-final { display:block; position:absolute; z-index:10; top:38%; left:9%; width:82%; }
#closing-layout.is-final .narration { position:static; transform:translateY(-20%); text-align:left; }
.ending { margin-top:24px; }
.ending[hidden] { display:none; }
.ending-actions { display:flex; flex-wrap:wrap; gap:10px; }
.ending-actions button { min-height:44px; }
#share-status { display:block; margin-top:8px; color:#f0e8da; font-size:12px; line-height:1.4; text-shadow:0 2px 10px #000; }
#share-status:empty { display:none; }
@media (max-width:700px) {
 #closing-layout.is-final { top:42%; left:8%; width:84%; }
 .ending { margin-top:20px; }
}
@media (max-height:600px) {
 .ending { margin-top:12px; }
}

/* Supporting facts stay readable without competing with the world. */
.narration .story-detail { max-width:46rem; margin-top:14px; font-size:clamp(15px,1.25vw,18px); line-height:1.5; color:#f0ede8; }
.narration .story-note { font-size:clamp(13px,1vw,15px); color:#d9e1e7; }
#closing-layout.is-final { top:20%; width:min(700px,82%); }
#closing-layout.is-final .narration { transform:none; }
#closing-layout.is-final .narration .poetic { font-size:clamp(29px,3.5vw,54px); }
.explore-guide .guide-detail { font-size:13px; line-height:1.45; }
.explore-guide button { min-height:44px; }
@media (max-width:700px) {
 #closing-layout.is-final { top:12%; width:84%; }
 #closing-layout.is-final .narration .poetic { font-size:clamp(28px,7vw,38px); }
 .narration .story-detail { margin-top:10px; font-size:15px; line-height:1.4; }
 .narration .story-note { font-size:13px; }
 .explore-guide { max-width:min(320px,calc(100vw - 32px)); }
}
@media (max-height:600px) {
 #closing-layout.is-final { top:10%; }
 #closing-layout.is-final .narration .poetic { font-size:clamp(25px,3vw,38px); }
 #closing-layout.is-final .story-detail { margin-top:6px; font-size:14px; line-height:1.3; }
 #closing-layout.is-final .story-note { font-size:12px; }
}

/* Words arrive in reading order; controls follow the same quiet motion. */
@media (prefers-reduced-motion: no-preference) {
  .narration-word { display:inline-block; animation:word-arrive .55s cubic-bezier(.22,1,.36,1) both; animation-delay:var(--word-delay); }
  .ending-actions button, .explore-guide button { animation:control-arrive .6s cubic-bezier(.22,1,.36,1) both; }
  .ending-actions button:first-child { animation-delay:.25s; }
  .ending-actions button:nth-child(2) { animation-delay:.38s; }
  @keyframes word-arrive { from { opacity:0; transform:translateY(.35em); filter:blur(3px); } to { opacity:1; transform:translateY(0); filter:blur(0); } }
  @keyframes control-arrive { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
}
