:root {
  --ink: #fbf7f2;
  --ink-dim: rgba(251, 247, 242, 0.72);
  --glass: rgba(255, 255, 255, 0.14);
  --glass-line: rgba(255, 255, 255, 0.34);
  --bg: #0b0a10;
  --pad: clamp(16px, 2.2vw, 30px);
  --mag-bottom: 72vh;
  --mag-top: 28vh;
  --mag-half-w: 10vw;
  --intro: 0;
  --font: "Helvetica Neue", Helvetica, "Inter", Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden;
  overscroll-behavior: none; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  cursor: default;
}
@media (hover: hover) and (pointer: fine) { body.ready, body.ready a, body.ready button { cursor: none; } }

#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
a, button { touch-action: manipulation; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; }

/* ── chrome ─────────────────────────────────────────────────────────────── */
.top, .bottom, .cta {
  opacity: 0;
  transition: opacity 1.2s cubic-bezier(.19, 1, .22, 1), transform 1.2s cubic-bezier(.19, 1, .22, 1);
}
body.loaded .top, body.loaded .bottom { opacity: 1; transition-delay: 1.6s; }
body.loaded .cta { opacity: 1; transform: translate(-50%, 0); transition-delay: 2.1s; }

.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(var(--pad), env(safe-area-inset-top)) max(var(--pad), env(safe-area-inset-right)) var(--pad) max(var(--pad), env(safe-area-inset-left));
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.32), 0 0 18px rgba(0, 0, 0, 0.3);
}
/* a faint scrim keeps the nav legible over street lights and bright sky */
.top::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 150%; pointer-events: none; z-index: -1;
  background: linear-gradient(rgba(10, 8, 16, 0.2), rgba(10, 8, 16, 0)); }
.brand { font-size: clamp(19px, 1.65vw, 25px); font-weight: 500; letter-spacing: -0.035em; }
.brand sup { font-size: 0.42em; margin-left: 1px; vertical-align: 1.1em; }
.nav { display: flex; align-items: center; gap: clamp(14px, 1.6vw, 26px); font-size: 14px; letter-spacing: -0.01em; }
.nav a { position: relative; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right; transition: transform .5s cubic-bezier(.19, 1, .22, 1); }
.nav a:hover::after { transform: scaleX(1); transform-origin: left; }

.round-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  transition: transform .4s cubic-bezier(.19, 1, .22, 1);
}
.round-btn:hover { transform: scale(1.08); }
.round-btn i { width: 4px; height: 4px; border-radius: 50%; display: block; }
.round-btn.light { background: var(--ink); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18); }
.round-btn.light i { background: #15131a; }
.round-btn.dark { background: #16141c; border: 1px solid rgba(255, 255, 255, 0.12); }
.round-btn.dark i { background: var(--ink); width: 3px; height: 3px; }

/* CTA under the magazine (position from JS: --mag-bottom) */
.cta {
  position: fixed; z-index: 10; left: 50%; top: calc(var(--mag-bottom) + clamp(14px, 2.2vh, 26px));
  transform: translate(-50%, 8px);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px 9px 18px; border-radius: 999px;
  background: rgba(251, 247, 242, 0.94); color: #141218;
  font-size: 13px; letter-spacing: -0.01em; white-space: nowrap;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
}
.cta svg { width: 10px; height: 10px; transition: transform .5s cubic-bezier(.19, 1, .22, 1); }
.cta:hover svg { transform: translate(2px, 2px); }

.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: var(--pad) max(var(--pad), env(safe-area-inset-right)) max(var(--pad), env(safe-area-inset-bottom)) max(var(--pad), env(safe-area-inset-left));
  font-size: 12px; letter-spacing: 0.02em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.3);
}
.b-left { display: flex; align-items: center; gap: 10px; }
.pill {
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--glass-line);
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 12.5px; letter-spacing: -0.005em; white-space: nowrap;
}
.b-center { display: flex; align-items: center; gap: 10px; text-transform: uppercase; font-size: 11px; letter-spacing: 0.08em;
  position: relative; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.32), 0 0 18px rgba(0, 0, 0, 0.3); }
/* ZELDA sits on the bright sand path (3.1:1): a soft shade behind the label lifts it to ~4.6:1 (the shadow alone: 3.4:1) */
.b-center::before { content: ""; position: absolute; inset: -14px -30px; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(10, 8, 16, 0.2) 45%, rgba(10, 8, 16, 0)); }
.b-right { justify-self: end; font-size: 12px; color: var(--ink-dim); }

.portal-icon {
  width: 30px; height: 30px; border-radius: 50%; position: relative; display: inline-block;
  background: #16141c; border: 1px solid rgba(255, 255, 255, 0.14);
}
.portal-icon b {
  position: absolute; left: 50%; top: 6px; bottom: 6px; width: 2px; margin-left: -1px; border-radius: 2px;
  background: linear-gradient(to bottom, rgb(140, 255, 220), rgb(255, 133, 209));
  box-shadow: 0 0 8px rgba(255, 160, 220, 0.8), 0 0 4px rgba(140, 255, 220, 0.8);
  animation: seam 3.2s ease-in-out infinite;
}
@keyframes seam { 0%, 100% { transform: scaleY(0.82); } 50% { transform: scaleY(1); } }

/* custom cursor */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 30; pointer-events: none;
  width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  opacity: 0; transition: opacity .3s, width .35s cubic-bezier(.19, 1, .22, 1), height .35s cubic-bezier(.19, 1, .22, 1), margin .35s cubic-bezier(.19, 1, .22, 1);
  mix-blend-mode: difference;
}
.cursor.on { opacity: 1; }
.cursor.hover { width: 54px; height: 54px; margin: -27px 0 0 -27px; }
/* over the issue: the ring reads "drag" (magazine.js); smaller while it is held */
.cursor::after { content: 'Drag'; position: absolute; inset: 0; display: grid; place-items: center;
  font: 500 9px/1 var(--font); letter-spacing: 0.14em; text-transform: uppercase; color: #fff;
  opacity: 0; transition: opacity .25s; }
.cursor.drag { width: 66px; height: 66px; margin: -33px 0 0 -33px; }
.cursor.drag::after { opacity: 1; }
.cursor.drag.grabbing { width: 50px; height: 50px; margin: -25px 0 0 -25px; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* loader */
.loader {
  position: fixed; inset: 0; z-index: 40; background: var(--bg);
  display: grid; place-items: center;
  transition: opacity 0.45s ease, visibility 0.45s;
}
body.loaded .loader { opacity: 0; visibility: hidden; }
.loader-inner { width: min(220px, 50vw); text-align: center; }
.loader-title { font-size: 13px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 16px; }
.loader-line { height: 1px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.loader-line i { display: block; height: 100%; background: linear-gradient(90deg, rgb(140, 255, 220), rgb(255, 133, 209));
  transform: scaleX(0); transform-origin: left; transition: transform 0.4s ease; }
.loader-pct { margin-top: 10px; font-size: 11px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }

.stats {
  position: fixed; right: 8px; top: 64px; z-index: 50; margin: 0; padding: 8px 10px;
  font: 11px/1.45 ui-monospace, Menlo, monospace; color: #9f9; background: rgba(0, 0, 0, 0.66); border-radius: 6px;
  pointer-events: none; white-space: pre;
}
.noscript { position: fixed; inset: 0; display: grid; place-items: center; font-size: 14px; }

/* QA stills (?t=…): no transitions; ?noui / ?world=…: no chrome */
body.qa *, body.qa *::before, body.qa *::after { transition: none !important; animation: none !important; }
body.noui .top, body.noui .bottom, body.noui .cta, body.noui .cursor { display: none !important; }

/* no WebGL / the renderer died: the chrome stays usable over a static two-world backdrop */
body.gl-failed #gl { display: none; }
body.gl-failed { background: linear-gradient(90deg, #3d5a3a 0%, #8fae7a 49.8%, #fbf7f2 50%, #c2477f 50.2%, #3a1838 100%); }
body.gl-failed .top, body.gl-failed .bottom, body.gl-failed .cta { opacity: 1; }
body.gl-failed .cursor { display: none; }    /* nothing moves the ring: the system cursor is back (main.js fail()) */
body.gl-failed .b-center::before { display: none; }   /* the shade reads as a smudge on the flat backdrop… */
body.gl-failed .b-center { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 0 6px rgba(0, 0, 0, 0.42), 0 0 18px rgba(0, 0, 0, 0.3); }   /* …a deeper shadow carries the label instead (≈ 4.5:1 on the light green) */

/* ── small screens ──────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  :root { --pad: 16px; }
  .nav a { display: none; }
  .round-btn { width: 40px; height: 40px; }
  .cta { top: min(calc(var(--mag-bottom) + 16px), calc(100vh - 128px - env(safe-area-inset-bottom))); font-size: 13.5px; padding: 11px 18px 11px 20px; }
  @supports (height: 100dvh) { .cta { top: min(calc(var(--mag-bottom) + 16px), calc(100dvh - 128px - env(safe-area-inset-bottom))); } }   /* dvh only where it exists */
  .bottom { grid-template-columns: auto 1fr auto; gap: 10px; }
  .b-left .pill { display: none; }
  .b-center { justify-self: center; }
}
/* landscape phones: no room under the issue, so the pill sits beside its lower-right corner, below the city's
   hero car where there is room, and never closer than 12 px to the footer row */
@media (max-height: 500px) and (orientation: landscape) {
  .cta { top: min(calc(var(--mag-bottom) + 6px), calc(100vh - 85px - max(16px, env(safe-area-inset-bottom)))); left: calc(50% + var(--mag-half-w) + 14px); transform: translate(0, 8px); }
  /* var() + a unit the browser lacks makes the whole value invalid (top: auto, the pill jumps to the top): dvh only where it exists */
  @supports (height: 100dvh) { .cta { top: min(calc(var(--mag-bottom) + 6px), calc(100dvh - 85px - max(16px, env(safe-area-inset-bottom)))); } }
  body.loaded .cta { transform: translate(0, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .portal-icon b { animation: none; }
}
