/* ============================================================
   MARV DESIGN SYSTEM v2 — black · white · luxury technology.

   One monochrome world; the green Marvs are the only colour.
   Recurring language: oversized type, hairline rules, technical
   grids, micro labels, numbered sections, film grain, circular
   trackers. Nothing decorative without intent; no cards unless
   a surface genuinely needs to be an object.

   MOTION PERSONALITIES (use these, never generic `ease`):
     text/data   --e-snap   fast, precise
     characters  --e-cine   smooth, weighty, long tail
     machinery   --e-heavy  slow start, decisive settle
     ambient     linear/slow, barely perceptible
   ============================================================ */

/* ---------- tokens ----------
   BLACK IS THE WORLD. WHITE IS THE INTERFACE. MARV IS THE COLOUR.
   Dark is the persistent environment; html[data-theme="light"] is a
   rare cinematic register (winner flash, lock-in impact, archive
   reveals). Every component reads tokens, so moments re-theme by
   attribute without touching markup. */
:root {
  --void: #050505;
  --bg: #090909;
  --bg-2: #0E0E0E;
  --bg-3: #151515;
  --ink: #F4F4F2;
  --ink-soft: #909090;
  --ink-faint: #5E5E60;
  --ink-ghost: #2A2A2E;
  --white: #FFFFFF;
  --paper: #0E0E0E;
  --line: rgba(244, 244, 242, 0.09);
  --line-strong: rgba(216, 216, 212, 0.24);
  --line-ghost: rgba(244, 244, 242, 0.045);
  --danger: #C96A5A;
  --machine-hi: #1C1C1C;   /* wheel materials — black metal */
  --machine-lo: #0A0A0A;
  --shadow-soft: 0 30px 70px rgba(0, 0, 0, 0.7);
  --halo: rgba(255, 255, 255, 0.05);
}
html[data-theme="light"] {
  --void: #FFFFFF;
  --bg: #F7F7F4;
  --bg-2: #EFEFEB;
  --bg-3: #E5E5E0;
  --ink: #111113;
  --ink-soft: #63636A;
  --ink-faint: #9C9CA2;
  --ink-ghost: #D9D9D4;
  --white: #111113;
  --paper: #FFFFFF;
  --line: rgba(17, 17, 19, 0.10);
  --line-strong: rgba(17, 17, 19, 0.26);
  --line-ghost: rgba(17, 17, 19, 0.05);
  --machine-hi: #FFFFFF;
  --machine-lo: #E8E8E3;
  --shadow-soft: 0 24px 60px rgba(17, 17, 19, 0.12);
  --halo: rgba(17, 17, 19, 0.05);
}

:root {
  --e-cine: cubic-bezier(0.16, 1, 0.3, 1);
  --e-heavy: cubic-bezier(0.65, 0, 0.15, 1);
  --e-snap: cubic-bezier(0.3, 0.9, 0.2, 1);
  --e-spring: cubic-bezier(0.34, 1.4, 0.44, 1);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;

  --nav-h: 68px;
  --gx: 0; --gy: 0;        /* cursor-driven world offset, set by JS */
}

/* ---------- reset ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--void); }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--ink); color: var(--void); }
:focus-visible { outline: 1px solid var(--line-strong); outline-offset: 3px; }

@media (pointer: fine) {
  body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: none; }
}

/* ---------- world layers (fixed, behind everything) ---------- */
html, body { scrollbar-width: none; }          /* the scroll rail replaces it */
body::-webkit-scrollbar, html::-webkit-scrollbar { width: 0; height: 0; display: none; }

#world {
  position: fixed; inset: -4%; z-index: -3; pointer-events: none;
  transform: translate3d(calc(var(--gx) * 14px), calc(var(--gy) * 10px), 0);
  transition: transform 600ms var(--e-cine), background 800ms;
  background:
    radial-gradient(120% 90% at 50% -10%, var(--bg-2) 0%, transparent 55%),
    radial-gradient(90% 70% at 85% 105%, var(--bg-3) 0%, transparent 60%),
    var(--bg);
}
#world::before {                       /* technical grid */
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line-ghost) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-ghost) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(85% 80% at 50% 45%, rgba(0,0,0,0.9), transparent 78%);
  animation: gridDrift 90s linear infinite;
}
#world::after {                        /* slow light sweep */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(242,241,236,0.016) 46%, rgba(242,241,236,0.03) 50%, rgba(242,241,236,0.016) 54%, transparent 70%);
  background-size: 300% 100%;
  animation: lightSweep 17s var(--e-cine) infinite;
}
@keyframes gridDrift { to { background-position: 72px 144px, 144px 72px; } }
@keyframes lightSweep { 0% { background-position: 120% 0 } 55% { background-position: -60% 0 } 100% { background-position: -60% 0 } }

#grain {
  position: fixed; inset: -100px; z-index: 200; pointer-events: none;
  opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainJump 0.62s steps(5) infinite;
}
@keyframes grainJump {
  0% { transform: translate(0, 0) } 20% { transform: translate(-32px, 18px) }
  40% { transform: translate(24px, -40px) } 60% { transform: translate(-18px, -26px) }
  80% { transform: translate(30px, 34px) } 100% { transform: translate(0, 0) }
}

/* ---------- custom cursor ---------- */
/* difference blend keeps the cursor visible on white AND black; the
   ring becomes the MARV badge when /img/logo.png exists */
#cur, #curRing { position: fixed; top: 0; left: 0; z-index: 400; pointer-events: none; will-change: transform; }
#cur {
  width: 6px; height: 6px; border-radius: 50%;
  background: #FFF; mix-blend-mode: difference; margin: -3px 0 0 -3px;
}
#curRing {
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 1px solid rgba(255,255,255,0.65); border-radius: 50%;
  mix-blend-mode: difference;
  display: grid; place-items: center;
  transition: width 300ms var(--e-snap), height 300ms var(--e-snap),
              margin 300ms var(--e-snap), border-color 300ms, background 300ms;
}
#curRing.logo { border: 0; mix-blend-mode: normal; background-size: contain; background-repeat: no-repeat; background-position: center; }
#curRing .cl {
  font-size: 9px; font-weight: 750; letter-spacing: 0.22em;
  color: #000; opacity: 0; transform: scale(0.6);
  transition: opacity 200ms, transform 300ms var(--e-snap);
}
#curRing.labeled {
  width: 64px; height: 64px; margin: -32px 0 0 -32px;
  background: #FFF; border-color: #FFF;
}
#curRing.logo.labeled { background-color: transparent; }
#curRing.sleepy { animation: curSleep 2.4s ease-in-out infinite; }
@keyframes curSleep { 0%,100% { transform: translateY(0) scale(1) } 50% { transform: translateY(3px) scale(0.94) } }
#curRing.labeled .cl { opacity: 1; transform: none; }
#curRing.down { transform: scale(0.82); }
body:not(.has-cursor) #cur, body:not(.has-cursor) #curRing { display: none; }

/* ---------- typography ---------- */
.t-giant {
  font-size: clamp(80px, 11vw, 220px);
  font-weight: 800; line-height: 0.86; letter-spacing: -0.045em;
  text-transform: uppercase;
}
.t-display {
  font-size: clamp(44px, 6.5vw, 104px);
  font-weight: 800; line-height: 0.92; letter-spacing: -0.04em;
  text-transform: uppercase;
}
.t-big { font-size: clamp(26px, 3.4vw, 44px); font-weight: 750; letter-spacing: -0.03em; line-height: 1; text-transform: uppercase; }
.t-body { font-size: 15px; line-height: 1.65; color: var(--ink-soft); font-weight: 450; }
.label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--ink-faint);
}
.label-lit { color: var(--ink-soft); }
.mono { font-family: var(--mono); font-size: 0.86em; letter-spacing: 0.02em; }
.num { font-variant-numeric: tabular-nums; }
.soft { color: var(--ink-soft); } .faint { color: var(--ink-faint); }

/* enormous background/outline text */
.ghost {
  color: transparent;
  -webkit-text-stroke: 1px rgba(242, 241, 236, 0.13);
  user-select: none; pointer-events: none;
}
.ghost-fill { color: var(--ink-ghost); user-select: none; pointer-events: none; }
.t-vert { writing-mode: vertical-rl; text-orientation: mixed; }

/* ---------- technical furniture ---------- */
.rule { border: 0; border-top: 1px solid var(--line); }
.rule-strong { border-top-color: var(--line-strong); }

.sec-num {
  font-size: clamp(64px, 8vw, 150px); font-weight: 800; line-height: 0.8;
  color: transparent; -webkit-text-stroke: 1px var(--line-strong);
  letter-spacing: -0.04em;
}

.readout { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; color: var(--ink-faint); text-transform: uppercase; }
.readout .pip { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-soft); animation: pipPulse 2.6s ease-in-out infinite; }
.readout .pip.live { background: #86E3A0; }
@keyframes pipPulse { 0%, 100% { opacity: 0.35 } 50% { opacity: 1 } }

.corners { position: relative; }
.corners::before, .corners::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none;
  border: 1px solid var(--line-strong);
}
.corners::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.corners::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.crosshair { position: relative; width: 34px; height: 34px; opacity: 0.5; }
.crosshair::before, .crosshair::after { content: ""; position: absolute; background: var(--line-strong); }
.crosshair::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.crosshair::after { top: 50%; left: 0; right: 0; height: 1px; }
.crosshair .c-ring { position: absolute; inset: 6px; border: 1px solid var(--line); border-radius: 50%; animation: spinSlow 14s linear infinite; border-top-color: var(--line-strong); }
@keyframes spinSlow { to { transform: rotate(360deg) } }

/* system bar — one fixed strip: status left, round centre, dev right */
#sysbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px clamp(14px, 3vw, 28px);
  pointer-events: none;
  transition: opacity 500ms var(--e-cine);
}
#sysbar > * { pointer-events: auto; }
#sysbar .readout { background: color-mix(in srgb, var(--bg) 72%, transparent); padding: 4px 8px; }
body:has(.s-hub) #sysbar .sb-mid, body:has(.intro) #sysbar { opacity: 0; pointer-events: none; }

/* scroll rail — replaces the browser scrollbar */
#scrollRail {
  position: fixed; right: 8px; top: 50%; transform: translateY(-50%);
  height: 34vh; width: 1px; background: var(--line); z-index: 70;
  opacity: 0; transition: opacity 400ms;
}
#scrollRail.on { opacity: 1; }
#scrollRail i {
  position: absolute; left: -3.5px; top: 0;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink);
}

/* grounded characters — soft floor shadow + per-marv halo */
.char-ground { position: relative; }
.char-ground::before {
  content: ""; position: absolute; left: 50%; top: 55%;
  transform: translate(-50%, -50%);
  width: 105%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, var(--m-halo, var(--halo)) 0%, transparent 62%);
  z-index: -1;
}
.char-ground::after {
  content: ""; position: absolute; left: 50%; bottom: -2%;
  transform: translateX(-50%);
  width: 62%; height: 6%; border-radius: 50%;
  background: radial-gradient(50% 100% at 50% 50%, rgba(17,17,19,0.28), transparent 70%);
  filter: blur(3px);
}
html[data-theme="dark"] .char-ground::after { background: radial-gradient(50% 100% at 50% 50%, rgba(0,0,0,0.8), transparent 70%); }

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  padding: 17px 34px; overflow: hidden;
  border: 1px solid var(--line-strong);
  font-size: 12px; font-weight: 750; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--ink); background: transparent;
  transition: color 320ms var(--e-snap), border-color 320ms, transform 180ms var(--e-snap);
  will-change: transform;
}
.btn::before {
  content: ""; position: absolute; inset: 0; background: var(--ink);
  transform: scaleX(0); transform-origin: left;
  transition: transform 380ms var(--e-cine);
  z-index: -1;
}
.btn:hover { color: var(--void); border-color: var(--ink); }
.btn:hover::before { transform: scaleX(1); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.3; pointer-events: none; }
.btn-primary { background: var(--ink); color: var(--void); border-color: var(--ink); }
.btn-primary::before { background: var(--void); }
.btn-primary:hover { color: var(--ink); }
.btn-quiet { border-color: transparent; color: var(--ink-soft); padding: 12px 18px; }
.btn-quiet:hover { color: var(--void); }

/* ---------- navigation ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(18px, 3vw, 44px);
  transition: opacity 600ms var(--e-cine), transform 600ms var(--e-cine);
}
.nav.hidden { opacity: 0; transform: translateY(-14px); pointer-events: none; }
.nav.scrolled { background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.nav::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line) 18%, var(--line) 82%, transparent);
}
.brand { display: flex; align-items: baseline; gap: 10px; font-weight: 800; letter-spacing: 0.06em; font-size: 15px; }
.brand .brand-mark {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border: 1px solid var(--line-strong);
  font-size: 13px; font-weight: 800; transform: translateY(6px);
  transition: background 300ms, color 300ms;
}
.brand:hover .brand-mark { background: var(--ink); color: var(--void); }

.nav-core { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 36px); }
.nav-link {
  position: relative; display: flex; align-items: baseline; gap: 8px;
  padding: 8px 2px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.26em; color: var(--ink-faint);
  transition: color 260ms var(--e-snap);
}
.nav-link .n-num { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--ink-ghost); transition: color 260ms; }
.nav-link::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 2px; height: 1px;
  background: var(--ink); transition: right 340ms var(--e-cine);
}
.nav-link:hover { color: var(--ink-soft); }
.nav-link.active { color: var(--ink); }
.nav-link.active .n-num { color: var(--ink-soft); }
.nav-link.active::after { right: 0; }

.nav-right { display: flex; align-items: center; gap: 18px; }
.wallet-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px; border: 1px solid var(--line-strong);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  transition: background 300ms, color 300ms, border-color 300ms;
}
.wallet-chip:hover { background: var(--ink); color: var(--void); border-color: var(--ink); }
.wallet-chip .avatar { width: 20px; height: 20px; border-radius: 50%; overflow: hidden; background: var(--bg-3); }
.wallet-chip .avatar img { width: 100%; height: 100%; object-fit: cover; object-position: top; transform: scale(1.7); transform-origin: top center; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); color: var(--ink-faint);
  transition: color 260ms, border-color 260ms;
}
.audio-btn {
  width: auto; padding: 0 14px; display: inline-flex; align-items: center; gap: 9px;
}
.audio-btn .audio-label { font-size: 9px; font-weight: 750; letter-spacing: 0.24em; }
.audio-btn.audio-on { color: var(--ink); border-color: var(--line-strong); }
@media (max-width: 760px) { .audio-btn .audio-label { display: none; } .audio-btn { width: 38px; padding: 0; display: grid; } }
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.eq { display: inline-flex; align-items: flex-end; gap: 2.5px; height: 12px; }
.eq i { width: 2px; background: currentColor; height: 30%; }
.audio-on .eq i { animation: eqDance 1.1s ease-in-out infinite; }
.audio-on .eq i:nth-child(2) { animation-delay: -0.3s } .audio-on .eq i:nth-child(3) { animation-delay: -0.7s }
@keyframes eqDance { 0%, 100% { height: 25% } 50% { height: 100% } }

/* page counter (nav right of links) */
#pageCounter { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; color: var(--ink-ghost); overflow: hidden; height: 14px; }
#pageCounter .pc-roll { display: flex; flex-direction: column; transition: transform 460ms var(--e-cine); }
#pageCounter .pc-roll span { height: 14px; line-height: 14px; }

/* ---------- stage & transitions ---------- */
#stage { position: relative; min-height: 100vh; }
.scene { min-height: 100vh; display: flex; flex-direction: column; position: relative; }

/* iris veil — circle mask morph, never a plain fade */
.veil {
  position: fixed; inset: 0; z-index: 150; pointer-events: none;
  background: var(--void);
  clip-path: circle(0% at 50% 50%);
  transition: clip-path 640ms var(--e-heavy);
}
.veil.on { clip-path: circle(75% at 50% 50%); pointer-events: all; }

.scene-enter { animation: sceneIn 900ms var(--e-cine) both; }
@keyframes sceneIn { from { opacity: 0; transform: translateY(26px) scale(0.992); } to { opacity: 1; transform: none; } }

.stagger > * { opacity: 0; transform: translateY(22px); animation: riseIn 800ms var(--e-cine) forwards; }
.stagger > *:nth-child(1) { animation-delay: 0.05s } .stagger > *:nth-child(2) { animation-delay: 0.14s }
.stagger > *:nth-child(3) { animation-delay: 0.23s } .stagger > *:nth-child(4) { animation-delay: 0.32s }
.stagger > *:nth-child(5) { animation-delay: 0.41s } .stagger > *:nth-child(6) { animation-delay: 0.5s }
.stagger > *:nth-child(7) { animation-delay: 0.59s } .stagger > *:nth-child(8) { animation-delay: 0.68s }
@keyframes riseIn { to { opacity: 1; transform: none } }

/* masked text reveal — wrap lines in .mask > .mask-line */
.mask { overflow: hidden; display: block; }
.mask .mask-line { display: block; transform: translateY(110%); animation: maskUp 900ms var(--e-cine) forwards; }
@keyframes maskUp { to { transform: none } }

/* ---------- character presentation ---------- */
.char-stage { position: relative; display: grid; place-items: end center; }
.char-stage img {
  position: relative; z-index: 2; height: 100%; width: auto; max-width: none;
  
  will-change: transform;
}
.char-shadow {
  position: absolute; bottom: -2%; left: 50%; transform: translateX(-50%);
  width: 68%; height: 7%; border-radius: 50%;
  background: radial-gradient(50% 100% at 50% 50%, rgba(0,0,0,0.75), transparent 70%);
  z-index: 1;
}
.breathe { animation: breathe 5.2s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-9px) } }

/* ---------- line-list rows (no cards) ---------- */
.line-list { display: flex; flex-direction: column; }
.line-row {
  display: grid; align-items: center; gap: 18px;
  padding: 18px 6px; border-bottom: 1px solid var(--line);
  transition: background 200ms, padding 300ms var(--e-snap);
}
.line-row:hover { background: rgba(242, 241, 236, 0.025); }

.stat-float b { display: block; font-size: clamp(28px, 3.6vw, 52px); font-weight: 800; letter-spacing: -0.03em; line-height: 0.95; font-variant-numeric: tabular-nums; }
.stat-float span { display: block; margin-top: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink-faint); }

.side-badge { display: inline-block; padding: 4px 10px; font-size: 10px; font-weight: 750; letter-spacing: 0.18em; border: 1px solid var(--line-strong); }
.side-buy { color: #9BD8AC; border-color: rgba(155, 216, 172, 0.35); }
.side-sell { color: #D89B9B; border-color: rgba(216, 155, 155, 0.35); }

.feed-item { animation: feedIn 560ms var(--e-snap) both; }
.feed-item.big { animation: feedInBig 720ms var(--e-cine) both; }
@keyframes feedIn { from { opacity: 0; transform: translateY(-12px) } to { opacity: 1; transform: none } }
@keyframes feedInBig { 0% { opacity: 0; transform: translateY(-16px) scale(0.985) } 55% { transform: scale(1.012) } 100% { opacity: 1; transform: none } }

/* ---------- states ---------- */
.state-block { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 70px 24px; color: var(--ink-soft); }
.scan-line { position: relative; width: min(300px, 60vw); height: 1px; background: var(--line); overflow: visible; }
.scan-line::after {
  content: ""; position: absolute; top: -1px; left: 0; width: 34%; height: 3px;
  background: linear-gradient(90deg, transparent, var(--ink));
  animation: scanX 1.6s var(--e-cine) infinite;
}
@keyframes scanX { 0% { left: -34% } 100% { left: 100% } }
.loader-m {
  width: 46px; height: 46px; border: 1px solid var(--line-strong);
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
  animation: loaderTilt 1.6s var(--e-cine) infinite;
}
@keyframes loaderTilt { 0%, 100% { transform: rotate(0) } 25% { transform: rotate(-6deg) } 75% { transform: rotate(6deg) } }

.toast-stack { position: fixed; top: calc(var(--nav-h) + 12px); right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 14px 20px; max-width: 340px;
  background: var(--bg-2); border: 1px solid var(--line-strong);
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; color: var(--ink-soft);
  animation: feedIn 380ms var(--e-snap) both;
}
.toast.err { border-color: rgba(201, 106, 90, 0.5); color: var(--ink); }

/* ---------- intro ---------- */
.intro { position: fixed; inset: 0; z-index: 250; background: var(--void); display: grid; place-items: center; overflow: hidden; }
.intro .i-point { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: var(--white); box-shadow: 0 0 18px 2px rgba(255,255,255,0.8); }
.intro .i-line { position: absolute; height: 1px; background: var(--white); width: 0; }
.intro .i-readout { position: absolute; font-family: var(--mono); font-size: 10px; letter-spacing: 0.22em; color: var(--ink-faint); text-transform: uppercase; opacity: 0; }
.intro .i-sil { position: absolute; bottom: 0; height: 42vh; opacity: 0; filter: brightness(0); }
.intro .i-marv { position: absolute; display: flex; }
.intro .i-marv span {
  font-size: clamp(90px, 17vw, 300px); font-weight: 800; letter-spacing: -0.04em; line-height: 0.9;
  display: inline-block; overflow: hidden;
}
.intro .i-marv span i { display: inline-block; font-style: normal; transform: translateY(110%); }
.intro .i-words { position: absolute; text-align: center; }
.intro .i-skip { position: absolute; bottom: 34px; right: 40px; }

/* ---------- select scene ---------- */
.sel { overflow: hidden; height: 100vh; }
.sel-worlds { position: absolute; inset: 0; z-index: 0; opacity: 0.55; }
.sel-name-giant {
  position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%);
  z-index: 1; white-space: nowrap;
  font-size: clamp(90px, 15vw, 280px); font-weight: 800; letter-spacing: -0.04em; line-height: 1;
  color: transparent; -webkit-text-stroke: 1px rgba(242,241,236,0.16);
  text-transform: uppercase; pointer-events: none;
}
.sel-countnum {
  position: absolute; right: 4vw; top: 50%; transform: translateY(-50%);
  z-index: 1; font-size: clamp(160px, 30vh, 420px); font-weight: 800; line-height: 1;
  color: transparent; -webkit-text-stroke: 1.5px rgba(242,241,236,0.22);
  opacity: 0; pointer-events: none; font-variant-numeric: tabular-nums;
}
.sel-stage { position: absolute; inset: 0; z-index: 2; display: grid; place-items: end center; }
.sel-char {
  position: absolute; bottom: 0; left: 50%;
  height: min(62vh, 640px);
  transform: translateX(-50%);
  transition: transform 700ms var(--e-cine), filter 700ms var(--e-cine), opacity 700ms var(--e-cine), height 700ms var(--e-cine);
  will-change: transform, filter;
}
.sel-char img { height: 100%; width: auto;  }
.sel-char.off-l { transform: translateX(calc(-50% - 30vw)) scale(0.55); filter: blur(5px) brightness(0.28); opacity: 0.7; z-index: -1; }
.sel-char.off-r { transform: translateX(calc(-50% + 30vw)) scale(0.55); filter: blur(5px) brightness(0.28); opacity: 0.7; z-index: -1; }
.sel-char.off-far { transform: translateX(-50%) scale(0.3); filter: blur(9px) brightness(0.12); opacity: 0; }
.sel-char.center { z-index: 3; }

.sel-head { position: absolute; top: calc(var(--nav-h) + 18px); left: clamp(18px, 4vw, 60px); z-index: 5; display: flex; flex-direction: column; gap: 10px; }
.sel-info {
  position: absolute; right: clamp(18px, 4vw, 60px); top: 50%; transform: translateY(-50%);
  z-index: 5; max-width: 300px; display: flex; flex-direction: column; gap: 14px; text-align: right; align-items: flex-end;
}
.sel-timerbar { position: absolute; left: 0; top: 0; height: 2px; background: var(--white); z-index: 8; width: 100%; transform-origin: left; }

.sel-dock {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 6; display: flex; gap: 10px; align-items: flex-end;
}
.dock-item { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px; transition: transform 300ms var(--e-snap); }
.dock-item .d-port {
  width: 58px; height: 58px; border: 1px solid var(--line-strong);
  overflow: hidden; position: relative; background: var(--bg-2);
  transition: border-color 300ms, transform 340ms var(--e-spring);
}
.dock-item .d-port img { width: 100%; height: 100%; object-fit: cover; object-position: top; transform: scale(1.9); transform-origin: top center; filter: grayscale(0.9) brightness(0.8); transition: filter 300ms; }
.dock-item .d-name { font-size: 8.5px; font-weight: 750; letter-spacing: 0.22em; color: var(--ink-ghost); transition: color 300ms; }
.dock-item:hover .d-port { border-color: var(--ink-soft); transform: translateY(-4px); }
.dock-item:hover .d-port img { filter: grayscale(0.3) brightness(1); }
.dock-item.on .d-port { border-color: var(--white); transform: translateY(-6px); }
.dock-item.on .d-port img { filter: none; }
.dock-item.on .d-name { color: var(--ink); }

/* lock-in */
.lockin {
  position: fixed; inset: 0; z-index: 160; background: rgba(5, 5, 6, 0.94);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  opacity: 0; pointer-events: none; transition: opacity 600ms var(--e-cine);
  overflow: hidden;
}
.lockin.on { opacity: 1; pointer-events: all; }
.lockin .lk-ghost { position: absolute; top: 12%; left: 50%; transform: translateX(-50%); z-index: 0; font-size: clamp(90px, 16vw, 280px); }
.lockin .lk-char { position: relative; z-index: 2; height: min(52vh, 540px); }
.lockin .lk-char img { height: 100%; width: auto;  }
.lockin .lk-scanner {
  position: absolute; left: 50%; transform: translateX(-50%);
  width: min(420px, 80vw); height: 2px; z-index: 3;
  background: linear-gradient(90deg, transparent, var(--white), transparent);
  box-shadow: 0 0 24px 3px rgba(255,255,255,0.35);
  opacity: 0;
}
.lockin .lk-term { min-height: 60px; display: flex; flex-direction: column; gap: 6px; align-items: center; z-index: 2; }
.lockin .lk-term .lt-line { font-family: var(--mono); font-size: 11px; letter-spacing: 0.24em; color: var(--ink-faint); text-transform: uppercase; }
.lockin .lk-term .lt-line.done::after { content: " ·  OK"; color: var(--ink-soft); }
.lockin .lk-actions { display: flex; gap: 14px; z-index: 2; }

.glitch { animation: glitch 0.22s steps(2) 1; }
@keyframes glitch {
  0% { transform: translate(0); filter: none }
  25% { transform: translate(-6px, 2px); filter: invert(0.9) }
  50% { transform: translate(5px, -3px); filter: none }
  75% { transform: translate(-3px, -2px); filter: invert(0.9) }
  100% { transform: translate(0); filter: none }
}

/* ---------- hub / wheel ---------- */
.hub { height: 100vh; overflow: hidden; }
.hub-wheelzone {
  position: absolute; inset: 0; display: grid; place-items: center;
  transition: transform 1200ms var(--e-heavy);
}
.wheel-wrap { position: relative; width: min(78vh, 92vw, 860px); aspect-ratio: 1; }
#wheelCanvas { width: 100%; height: 100%; display: block; }
.wheel-hub-btn {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 24%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, var(--machine-hi), var(--machine-lo) 70%);
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--bg) 60%, transparent), var(--shadow-soft), inset 0 1px 0 var(--halo);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  transition: transform 200ms var(--e-snap), box-shadow 300ms;
  z-index: 4;
}
.wheel-hub-btn .w-main { font-size: clamp(11px, 1.5vw, 16px); font-weight: 800; letter-spacing: 0.3em; text-indent: 0.3em; }
.wheel-hub-btn .w-sub { font-size: 8px; font-weight: 700; letter-spacing: 0.3em; color: var(--ink-faint); }
.wheel-hub-btn::after {
  content: ""; position: absolute; inset: -9px; border-radius: 50%;
  border: 1px dashed var(--line); animation: spinSlow 26s linear infinite;
}
.wheel-hub-btn:not([disabled]):hover { transform: translate(-50%, -50%) scale(1.045); box-shadow: 0 0 0 6px rgba(5,5,6,0.6), 0 26px 70px rgba(0,0,0,0.85), inset 0 1px 0 rgba(242,241,236,0.22); }
.wheel-hub-btn:not([disabled]):active { transform: translate(-50%, -50%) scale(0.94); }
.wheel-hub-btn[disabled] { color: var(--ink-faint); }

.hub-side {
  position: absolute; left: clamp(16px, 3.4vw, 56px); top: 50%; transform: translateY(-50%);
  z-index: 5; display: flex; flex-direction: column; gap: 26px; max-width: 250px;
  transition: opacity 700ms var(--e-cine), transform 700ms var(--e-cine);
}
.hub.ui-retract .hub-side, .hub.ui-retract .hub-foot, .hub.ui-retract .nav { opacity: 0; transform: translate(-30px, -50%); pointer-events: none; }
.hub-side .hs-char { height: 190px; position: relative; }
.hub-side .hs-char img { height: 100%; width: auto;  }
.hub-side .hs-vert { position: absolute; right: -10px; top: 0; font-size: 44px; font-weight: 800; letter-spacing: 0.02em; color: transparent; -webkit-text-stroke: 1px var(--line-strong); }
.hub-stats { display: flex; flex-direction: column; gap: 16px; }
.hub-stats .hstat { display: flex; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.hub-stats .hstat b { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; min-width: 78px; }
.hub-stats .hstat span { font-size: 9px; font-weight: 700; letter-spacing: 0.26em; color: var(--ink-faint); text-transform: uppercase; }

.hub-foot {
  position: absolute; bottom: 22px; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: center; gap: 26px; align-items: center;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; color: var(--ink-faint); text-transform: uppercase;
  transition: opacity 700ms var(--e-cine);
}
.hub-foot a { border-bottom: 1px solid var(--line-strong); padding-bottom: 2px; transition: color 240ms; }
.hub-foot a:hover { color: var(--ink); }

/* winner overlay */
.winner-overlay {
  position: fixed; inset: 0; z-index: 170; background: rgba(4, 4, 5, 0.96);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  opacity: 0; pointer-events: none; transition: opacity 700ms var(--e-cine);
  overflow: hidden; text-align: center;
}
.winner-overlay.on { opacity: 1; pointer-events: all; }
.winner-overlay .wo-ghost { position: absolute; top: 8%; left: 50%; transform: translateX(-50%); font-size: clamp(100px, 18vw, 320px); z-index: 0; }
.winner-overlay .wo-char { position: relative; z-index: 2; height: min(44vh, 460px); }
.winner-overlay .wo-char img { height: 100%; width: auto;  animation: winPop 1s var(--e-cine) both; }
@keyframes winPop { 0% { transform: scale(0.6) translateY(80px); opacity: 0 } 100% { transform: none; opacity: 1 } }
.winner-overlay .wo-wins { z-index: 2; }
.winner-overlay .wo-stats { display: flex; align-items: center; gap: clamp(12px, 3vw, 30px); z-index: 2; font-variant-numeric: tabular-nums; }
.winner-overlay .wo-stats .arrow { color: var(--ink-faint); font-size: 18px; }
.winner-overlay .wo-stat b { display: block; font-size: clamp(20px, 3.4vw, 38px); font-weight: 800; letter-spacing: -0.02em; }
.winner-overlay .wo-stat span { font-size: 9px; font-weight: 700; letter-spacing: 0.28em; color: var(--ink-faint); text-transform: uppercase; }
.payout-bar { width: min(400px, 78vw); height: 2px; background: var(--bg-3); overflow: hidden; z-index: 2; }
.payout-bar i { display: block; height: 100%; width: 0%; background: var(--white); transition: width 500ms var(--e-cine); }
.your-result { font-weight: 800; font-size: clamp(18px, 3vw, 30px); letter-spacing: 0.04em; text-transform: uppercase; z-index: 2; }

/* ---------- page scaffolding (stats/trades/tokenomics/roster) ---------- */
.page { padding: calc(var(--nav-h) + 40px) clamp(18px, 4.5vw, 64px) 120px; max-width: 1500px; margin: 0 auto; width: 100%; }
.page-head { margin-bottom: clamp(30px, 6vh, 70px); }
.sect { position: relative; padding: clamp(40px, 8vh, 100px) 0; border-top: 1px solid var(--line); }
.sect:first-child { border-top: 0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hub-side { position: absolute; left: 16px; right: 16px; top: auto; bottom: 74px; transform: none; flex-direction: row; align-items: flex-end; gap: 18px; max-width: none; }
  .hub-side .hs-char { height: 110px; }
  .hub-stats { flex-direction: row; flex-wrap: wrap; gap: 12px 20px; }
  .hub-stats .hstat { border-bottom: 0; padding-bottom: 0; }
  .hub-stats .hstat b { font-size: 18px; min-width: 0; }
  .sel-info { right: 16px; top: auto; bottom: 150px; transform: none; max-width: 220px; }
  .sel-countnum { right: 2vw; }
}
@media (max-width: 760px) {
  :root { --nav-h: 58px; }
  .nav-core { display: none; }
  #mobileNavBtn { display: grid; }
  .sel-char { height: min(52vh, 480px); }
  .sel-dock { gap: 6px; bottom: 18px; }
  .dock-item .d-port { width: 44px; height: 44px; }
  .dock-item .d-name { display: none; }
  .sel-head { left: 16px; }
  .sel-info { text-align: left; align-items: flex-start; bottom: 120px; }
  .winner-overlay .wo-char { height: 32vh; }
  #statusSys, #coords { display: none; }
  .wheel-wrap { width: min(94vw, 70vh); }
}
#mobileNavBtn { display: none; }
.mobile-menu {
  position: fixed; inset: 0; z-index: 140; background: var(--void);
  display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 0 28px;
  clip-path: circle(0% at calc(100% - 46px) 34px);
  transition: clip-path 560ms var(--e-heavy);
}
.mobile-menu.on { clip-path: circle(150% at calc(100% - 46px) 34px); }
.mobile-menu a { display: flex; align-items: baseline; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 30px; font-weight: 800; letter-spacing: -0.02em; text-transform: uppercase; }
.mobile-menu a .n-num { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  #grain, .breathe { animation: none !important; }
  #world { transform: none; }
  html { scroll-behavior: auto; }
}
