:root {
  --landing-bg: #efe8d7;
  --chrome-bg: #efe8d7;
  --landing-paper: #fff8eb;
  --landing-ink: #1d2945;
  --landing-muted: #6c634e;
  --landing-gold: #f1b72b;
  --landing-orange: #c75b20;
  --landing-cyan: #137c9c;
  --landing-display: "Silkscreen", ui-monospace, monospace;
  --landing-body: "Nunito", ui-rounded, system-ui, sans-serif;
  --landing-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--chrome-bg); scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  color: var(--landing-ink);
  background: var(--chrome-bg);
  font: 16px/1.55 var(--landing-body);
  -webkit-font-smoothing: antialiased;
}

/* The welcome screen is deliberately a quiet threshold. The shared bridge
   may add a transient connectivity badge, but it belongs on the workspaces,
   not over the artwork here. */
.landing-page [data-app-connectivity] { display: none !important; }

a { color: inherit; }
.landing-footer { padding: 16px; text-align: center; font: 14px/1.6 var(--landing-body); }
.landing-footer a { display: inline-block; padding: 10px 4px; }
button, a { -webkit-tap-highlight-color: transparent; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.welcome-shell {
  position: relative;
  width: min(100%, 1600px);
  margin: 0 auto;
  padding: calc(clamp(32px, 5.5vw, 70px) + env(safe-area-inset-top)) clamp(16px, 4vw, 56px) calc(clamp(18px, 3.4vw, 52px) + env(safe-area-inset-bottom));
}
.tour-button {
  position: absolute;
  z-index: 10;
  top: calc(14px + env(safe-area-inset-top));
  right: clamp(12px, 3.5vw, 48px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 8px;
  border: 2px solid var(--landing-ink);
  border-radius: 2px;
  color: var(--landing-ink);
  background: var(--landing-paper);
  box-shadow: 3px 3px 0 var(--landing-orange);
  font: 700 10px/1 var(--landing-mono);
  letter-spacing: .02em;
  text-decoration: none;
  text-transform: uppercase;
  transition: transform .12s steps(2, end), box-shadow .12s steps(2, end), background-color .12s linear;
}
.tour-button::before {
  content: "";
  width: 5px;
  height: 5px;
  margin-right: 5px;
  background: var(--landing-gold);
  box-shadow: 1px 1px 0 var(--landing-orange);
  image-rendering: pixelated;
}
.tour-button:hover {
  background: #fff2c9;
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--landing-orange);
}
.tour-button:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}
.tour-button:focus-visible {
  outline: 3px solid var(--landing-cyan);
  outline-offset: 4px;
}
.welcome-intro { max-width: 920px; margin: 0 auto; text-align: center; }
.welcome-kicker {
  margin: 0 0 18px;
  color: var(--landing-orange);
  font: 700 .68rem/1 var(--landing-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.welcome-intro h1 {
  margin: 0;
  color: var(--landing-ink);
  font: 400 clamp(2rem, 5.2vw, 5rem)/1.14 var(--landing-display);
  letter-spacing: .035em;
  text-wrap: balance;
}
.welcome-intro h1 em { color: var(--landing-cyan); font-style: normal; }
.welcome-subtitle {
  margin: 17px 0 0;
  color: var(--landing-muted);
  font-size: clamp(.98rem, 1.45vw, 1.18rem);
  letter-spacing: .02em;
}

.scene-section { margin: clamp(22px, 4vw, 48px) auto 0; text-align: center; }
.scene-frame {
  position: relative;
  width: min(100%, 1500px);
  margin: 0 auto;
  isolation: isolate;
  line-height: 0;
}
.scene-picture { position: relative; z-index: 1; display: block; }
.scene-art { display: block; width: 100%; height: auto; user-select: none; }
.scene-motion {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}
.scene-frame.motion-ready .scene-picture { visibility: hidden; }
.scene-frame.motion-ready .scene-motion { opacity: 1; }
.scene-frame[data-motion="loading"] .scene-motion { opacity: 0; }
.scene-actors {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}
.scene-frame.motion-ready .scene-actors { opacity: 1; }

.gate-hitbox { position: absolute; z-index: 6; left: 38%; top: 82%; width: 24%; height: 16%; display: block; border: 0; outline: 0; background: transparent; cursor: pointer; }
.gate-hitbox:focus-visible {
  outline: 4px solid #087f9d;
  outline-offset: 5px;
  border-radius: 18px;
  box-shadow: 0 0 0 4px rgba(255, 247, 214, .92), 0 0 0 8px rgba(8, 127, 157, .32);
}
.gate-hitbox::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: -8%;
  right: -8%;
  top: -62%;
  bottom: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 55%, rgba(255, 236, 143, .82) 0 12%, rgba(255, 203, 73, .52) 30%, rgba(255, 174, 36, .2) 53%, transparent 75%);
  filter: blur(12px);
  mix-blend-mode: screen;
  opacity: .2;
  transform: scale(.9);
  transform-origin: 50% 67%;
  animation: gate-bloom 1.55s ease-in-out infinite;
  pointer-events: none;
}
.gate-glow {
  position: absolute;
  z-index: 1;
  left: 29%;
  top: -3%;
  width: 41%;
  height: 55%;
  display: block;
  transform-origin: 50% 50%;
  mix-blend-mode: normal;
  pointer-events: none;
  opacity: .14;
  animation: gate-sign-pulse 1.55s ease-in-out infinite;
}
.gate-glow img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  animation: gate-sign-filter 1.55s ease-in-out infinite;
}
.gate-hitbox::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 24%;
  top: -11%;
  width: 52%;
  height: 76%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, transparent 0 38%, rgba(255, 225, 111, .72) 49%, rgba(255, 179, 31, .34) 65%, transparent 84%);
  filter: blur(9px);
  mix-blend-mode: screen;
  opacity: .22;
  transform: scale(.94);
  animation: gate-halo-pulse 1.55s ease-in-out infinite;
  pointer-events: none;
}
.gate-hitbox:hover::before,
.gate-hitbox:focus-visible::before { animation-duration: .72s; opacity: .34; }
.gate-hitbox:active::before { animation: none; opacity: .42; transform: scale(.82); }
.gate-hitbox:hover::after,
.gate-hitbox:focus-visible::after { animation-duration: .72s; }
.gate-hitbox:active::after { animation: none; opacity: .9; transform: scale(.9); }
.gate-hitbox:hover .gate-glow,
.gate-hitbox:focus-visible .gate-glow { animation-duration: .72s; opacity: .84; }
.gate-hitbox:hover .gate-glow img,
.gate-hitbox:focus-visible .gate-glow img { animation-duration: .72s; }
.gate-hitbox:active .gate-glow { animation: none; opacity: 1; transform: scale(.96); }
.gate-hitbox:active .gate-glow img { animation: none; filter: brightness(1.52) saturate(1.34) drop-shadow(0 0 11px rgba(255, 224, 105, .98)) drop-shadow(0 0 26px rgba(255, 177, 31, .78)); }
.scene-frame.is-entering .gate-hitbox::before { animation: gate-press .24s ease both; }
.scene-frame.is-entering .gate-hitbox::after { animation: gate-halo-press .24s ease both; }
.scene-frame.is-entering .gate-glow { animation: gate-sign-press .24s ease both; }
.scene-frame.is-entering { animation: scene-enter .24s ease both; }
.scene-hint { margin: 6px 0 0; color: var(--landing-muted); font: 700 .64rem/1 var(--landing-mono); letter-spacing: .08em; text-transform: uppercase; }

@keyframes gate-bloom { 0%, 100% { opacity: .1; transform: scale(.9); } 50% { opacity: .34; transform: scale(1.08); } }
@keyframes gate-halo-pulse {
  0%, 100% { opacity: .16; transform: scale(.9); }
  50% { opacity: .98; transform: scale(1.1); }
}
@keyframes gate-halo-press {
  50% { opacity: 1; transform: scale(.84); }
}
@keyframes gate-sign-pulse {
  0%, 100% {
    opacity: .12;
    transform: scale(.985);
  }
  50% {
    opacity: .78;
    transform: scale(1.045);
  }
}
@keyframes gate-sign-filter {
  0%, 100% {
    filter: brightness(1.04) saturate(1.04)
      drop-shadow(0 0 3px rgba(255, 205, 64, .32))
      drop-shadow(0 0 9px rgba(255, 177, 31, .18));
  }
  50% {
    filter: brightness(1.62) saturate(1.36)
      drop-shadow(0 0 12px rgba(255, 238, 145, 1))
      drop-shadow(0 0 30px rgba(255, 187, 42, .9))
      drop-shadow(0 0 48px rgba(255, 164, 24, .46));
  }
}
@keyframes gate-sign-press {
  50% {
    opacity: 1;
    transform: scale(.92);
  }
}
@keyframes gate-press { 50% { transform: scale(.88); filter: brightness(1.32) drop-shadow(0 0 10px #ffd34d); } }
@keyframes scene-enter { to { transform: scale(1.008); filter: brightness(1.04); } }

@media (max-width: 900px) {
  .welcome-shell { padding-top: calc(60px + env(safe-area-inset-top)); }
  .scene-frame { width: min(100%, 620px); }
}
@media (max-width: 560px) {
  .welcome-shell { padding: calc(62px + env(safe-area-inset-top)) 10px calc(12px + env(safe-area-inset-bottom)); }
  .welcome-intro h1 { font-size: clamp(1.58rem, 8.2vw, 2.55rem); }
  .welcome-subtitle { margin-top: 11px; font-size: .88rem; }
  .scene-section { margin-top: 18px; }
  .scene-hint { font-size: .56rem; }
}
/* iPads can be 1024 CSS pixels wide in portrait. Orientation, rather than a
   phone-sized width cap, is the reliable contract for the portrait artwork. */
@media (max-width: 720px), (orientation: portrait) {
  .gate-hitbox { left: 31%; top: 82.8%; width: 38%; height: 14.5%; }
  .gate-glow { left: 25%; top: 25%; width: 50%; height: 39%; }
  .gate-hitbox::after { left: 19%; top: 13%; width: 62%; height: 63%; }
  .gate-hitbox::before { top: -10%; bottom: -10%; transform-origin: 50% 50%; background: radial-gradient(ellipse at 50% 50%, rgba(255, 236, 143, .3) 0 12%, rgba(255, 203, 73, .2) 30%, rgba(255, 174, 36, .08) 53%, transparent 75%); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .scene-motion { display: none !important; }
  .scene-actors { display: none !important; }
  .scene-frame.motion-ready .scene-picture { visibility: visible; }
  .gate-hitbox::after { animation: none !important; opacity: .55; transform: scale(1); }
  .gate-glow { animation: none !important; opacity: .5; transform: none; }
  .gate-glow img { animation: none !important; filter: brightness(1.25) saturate(1.16) drop-shadow(0 0 8px rgba(255, 220, 100, .68)) drop-shadow(0 0 20px rgba(255, 177, 31, .44)); }
}
