/* INUTELLIGENCE — 3D world layer: the WebGL scene sits behind the whole page, the UI floats on glass. */

#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 0; background: #03050a; touch-action: pan-y; }
body.coin-hover #scene { cursor: pointer; }
.page, .footer { position: relative; z-index: 2; }
body.no-webgl #scene, body.no-webgl .stage, body.no-webgl .pins, body.no-webgl .hud { display: none !important; }

/* let clicks fall through the empty parts of the page to the 3D world */
body:not(.no-webgl) .page, body:not(.no-webgl) .page > section, body:not(.no-webgl) .module-head, body:not(.no-webgl) .radar-top,
body:not(.no-webgl) .stat-row, body:not(.no-webgl) .cols, body:not(.no-webgl) .token-grid, body:not(.no-webgl) .road,
body:not(.no-webgl) .filter-row, body:not(.no-webgl) .hero, body:not(.no-webgl) .hero-visual, body:not(.no-webgl) .stage-copy { pointer-events: none; }
body:not(.no-webgl) .page :is(.card, .btn, a, button, input, form, label, p, h1, h2, h3, .spot, .seg, .toggles, .eyebrow, .ca-row, .live-card, .module-tools, #xrayOut > *, .try-row) { pointer-events: auto; }
body:not(.no-webgl) .hero.card, body:not(.no-webgl) .hero-copy { pointer-events: auto; }

/* ---------- glass ---------- */
body:not(.no-webgl) .top { background: rgba(5, 8, 13, .9); }
body:not(.no-webgl) .card { background: rgba(12, 17, 24, .74); border-color: rgba(140, 220, 255, .09); box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 20px 50px rgba(0, 0, 0, .35); }
body:not(.no-webgl) .col, body:not(.no-webgl) #xrayOut .card, body:not(.no-webgl) .radar-card { background: rgba(10, 14, 20, .88); }
@media (min-width: 721px) {
  body.glass .stat, body.glass .road-step, body.glass .token-grid > .card, body.glass .xr-search { background: rgba(12, 17, 24, .84); }
}
body:not(.no-webgl) .xr-search { background: rgba(12, 17, 24, .8); }
body:not(.no-webgl) .footer { border-top-color: rgba(140, 220, 255, .08); background: linear-gradient(transparent, rgba(3, 5, 10, .85) 40%); }
body:not(.no-webgl) .module-head h2 { text-shadow: 0 0 2px rgba(0, 0, 0, .9), 0 2px 30px rgba(0, 0, 0, .95); }
body:not(.no-webgl) .module-head p { text-shadow: 0 0 2px rgba(0, 0, 0, 1), 0 1px 14px rgba(0, 0, 0, 1); }

/* ---------- hero = cinematic stage ---------- */
body:not(.no-webgl) .hero { background: transparent; border-color: transparent; box-shadow: none; min-height: min(80vh, 760px); overflow: visible; }
body:not(.no-webgl) .hero::before { display: none; }
body:not(.no-webgl) .hero-copy::before { content: ""; position: absolute; inset: -40px -120px -40px -200px; z-index: -1; pointer-events: none; background: radial-gradient(closest-side, rgba(3, 5, 10, .78), rgba(3, 5, 10, .35) 60%, transparent); }
body:not(.no-webgl) .hero-glow { opacity: .55; }
body:not(.no-webgl) .hero h1 { font-size: clamp(40px, 5.4vw, 76px); text-shadow: 0 4px 40px rgba(0, 0, 0, .6); }
body:not(.no-webgl) .hero .grad-text { filter: drop-shadow(0 0 24px rgba(63, 216, 240, .35)); }
body:not(.no-webgl) .live-card { background: rgba(10, 14, 20, .92); }
body:not(.no-webgl) .module { padding-top: 110px; }

/* the big 3D radar interlude */
.stage { position: relative; min-height: 92vh; display: flex; align-items: flex-end; padding: 0 0 7vh; }
.stage-copy { max-width: 470px; padding: 26px 28px; border-radius: 22px; background: linear-gradient(135deg, rgba(5, 9, 14, .78), rgba(5, 9, 14, .45)); border: 1px solid rgba(140, 220, 255, .12); box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
.stage-copy h2 { margin: 14px 0 10px; font-size: clamp(30px, 3.6vw, 48px); line-height: 1.04; font-weight: 800; letter-spacing: -0.035em; }
.stage-copy p { margin: 0 0 18px; color: var(--text-2); font-size: 15px; }
.stage-legend { display: flex; flex-wrap: wrap; gap: 12px 16px; margin-bottom: 18px; font-size: 12.5px; color: var(--text-2); }
.stage-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; box-shadow: 0 0 10px currentColor; }
.stage-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- coin pins ---------- */
.pins { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.pin { position: absolute; left: 0; top: 0; padding: 0; border: 0; background: none; color: var(--text); cursor: pointer; opacity: 0; transition: opacity .3s; pointer-events: none; will-change: transform; }
.pin.on { opacity: 1; pointer-events: auto; }
.pin-dot { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--pc, var(--acc)); box-shadow: 0 0 12px var(--pc, var(--acc)); }
.pin-card { position: absolute; left: 0; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 9px; white-space: nowrap; font-size: 11.5px; background: rgba(5, 9, 14, .82); border: 1px solid color-mix(in srgb, var(--pc, var(--acc)) 45%, transparent); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); transition: transform .2s; }
.pin-card::after { content: ""; position: absolute; left: 50%; bottom: -10px; width: 1px; height: 10px; background: linear-gradient(var(--pc, var(--acc)), transparent); }
.pin b { font-weight: 700; }
.pin-mc { color: var(--text-2); font-variant-numeric: tabular-nums; }
.pin-sc { font: 600 10.5px var(--mono); color: var(--pc, var(--acc)); }
.pin[data-k="good"] { --pc: var(--green); }
.pin[data-k="warn"] { --pc: var(--amber); }
.pin[data-k="bad"] { --pc: var(--red); }
.pin[data-k="grad"] { --pc: var(--acc); }
.pin:hover .pin-card, .pin.sel .pin-card { transform: translateX(-50%) scale(1.08); }
.pin.sel .pin-card { border-color: var(--pc); box-shadow: 0 0 0 2px color-mix(in srgb, var(--pc) 30%, transparent), 0 8px 24px rgba(0, 0, 0, .5); }

/* ---------- boot ---------- */
.boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, #07121a, #020306 70%); transition: opacity .8s ease, transform .9s cubic-bezier(.2, .8, .2, 1), filter .8s; cursor: pointer; }
.boot.out { opacity: 0; transform: scale(1.12); filter: blur(8px); pointer-events: none; }
.boot-in { width: min(420px, 86vw); display: grid; justify-items: center; gap: 16px; }
.boot-in img { width: 74px; height: 74px; filter: drop-shadow(0 0 26px rgba(63, 216, 240, .55)); animation: bootPulse 1.4s ease-in-out infinite; }
@keyframes bootPulse { 50% { transform: scale(1.06); filter: drop-shadow(0 0 40px rgba(63, 216, 240, .9)); } }
.boot-title { font-weight: 800; font-size: 26px; letter-spacing: .14em; }
.boot-title b { color: var(--acc); }
.boot-lines { width: 100%; min-height: 128px; font: 12.5px/1.75 var(--mono); color: rgba(160, 225, 245, .7); }
.boot-lines div { animation: bootLine .25s ease-out; }
.boot-lines .hot { color: var(--acc); text-shadow: 0 0 12px rgba(63, 216, 240, .7); font-weight: 600; }
@keyframes bootLine { from { opacity: 0; transform: translateX(-8px); } }
.boot-bar { width: 100%; height: 2px; background: rgba(63, 216, 240, .12); border-radius: 2px; overflow: hidden; }
.boot-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc), var(--brand)); transform: scaleX(0); transform-origin: left; transition: transform .25s; box-shadow: 0 0 12px var(--acc); }

/* ---------- section HUD + sound ---------- */
.hud { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 25; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; border-radius: 999px; background: rgba(5, 9, 14, .88); border: 1px solid rgba(140, 220, 255, .12); font: 600 11px var(--mono); letter-spacing: .14em; color: var(--text-2); }
.hud-n { color: var(--acc); }
.hud-sep { width: 22px; height: 1px; background: rgba(140, 220, 255, .3); }
.hud.flash .hud-name { animation: hudFlash .6s steps(6); }
@keyframes hudFlash { 0%, 40%, 80% { opacity: .2; } 20%, 60%, 100% { opacity: 1; } }
.hud-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 28px; min-width: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid rgba(140, 220, 255, .14); background: rgba(255, 255, 255, .03); color: var(--text-2); font: 600 10.5px var(--mono); letter-spacing: .1em; cursor: pointer; transition: .15s; }
.hud-btn:hover { color: var(--text); border-color: rgba(63, 216, 240, .45); }
.hud-btn.on { color: var(--acc); border-color: rgba(63, 216, 240, .5); background: var(--acc-soft); }
.sound-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.sound-bars i { width: 2px; height: 30%; background: currentColor; border-radius: 1px; }
.hud-btn.on .sound-bars i { animation: eq 0.9s ease-in-out infinite; }
.hud-btn.on .sound-bars i:nth-child(2) { animation-delay: -.3s; }
.hud-btn.on .sound-bars i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 50% { height: 100%; } }

/* ---------- explore mode ---------- */
.explore-bar { position: fixed; left: 50%; bottom: 26px; z-index: 26; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; display: flex; align-items: center; gap: 14px; padding: 8px 8px 8px 18px; border-radius: 999px; background: rgba(5, 9, 14, .82); border: 1px solid rgba(63, 216, 240, .3); font-size: 13px; color: var(--text-2); transition: .35s cubic-bezier(.2, .8, .2, 1); }
body.exploring .explore-bar { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
body.exploring { overflow: hidden; }
body.exploring .page, body.exploring .footer, body.exploring .hud { opacity: 0; pointer-events: none !important; }
body.exploring .page *, body.exploring .footer * { pointer-events: none !important; }
.page, .footer, .hud { transition: opacity .5s ease; }

/* ---------- motion: reveal, tilt, magnetic, cursor glow ---------- */
.reveal { opacity: 0; translate: 0 34px; transition: opacity .9s cubic-bezier(.2, .8, .2, 1) var(--rd, 0ms), translate .9s cubic-bezier(.2, .8, .2, 1) var(--rd, 0ms); }
.reveal.in { opacity: 1; translate: 0 0; }
.tilt { position: relative; transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .35s cubic-bezier(.2, .8, .2, 1), border-color .2s; transform-style: preserve-3d; }
.tilt:not(.hero) { overflow: hidden; }
.tilt:not(.hero):hover { border-color: rgba(63, 216, 240, .28); }
.glare { position: absolute; inset: 0; border-radius: inherit; pointer-events: none !important; opacity: 0; transition: opacity .3s; background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 50%), rgba(140, 230, 255, .12), transparent 45%); }
.tilt:hover .glare { opacity: 1; }
.hero .glare { display: none; }
.magnetic { transition: transform .25s cubic-bezier(.2, .8, .2, 1), background .15s, border-color .15s; }
.cursor-glow { position: fixed; left: -260px; top: -260px; width: 520px; height: 520px; z-index: 1; pointer-events: none; border-radius: 50%; background: radial-gradient(circle, rgba(63, 216, 240, .10), rgba(255, 138, 31, .03) 40%, transparent 65%); opacity: 0; transition: opacity .6s; will-change: transform; }
.cursor-glow.on { opacity: 1; }
body.exploring .cursor-glow { opacity: 0; }

/* cinematic letterbox flash when the page first comes alive */
body:not(.booted) .page, body:not(.booted) .top { opacity: 0; }
body.booted .page, body.booted .top { animation: liftIn 1.4s cubic-bezier(.2, .8, .2, 1) both; }
body.booted .top { animation-delay: .1s; }
body.booted .page { animation-delay: 1.1s; }
@keyframes liftIn { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
body.no-webgl.booted .page { animation-delay: 0s; }

/* ---------- responsive ---------- */
.page { overflow-x: clip; }
@media (max-width: 1000px) {
  body:not(.no-webgl) .hero { min-height: 0; }
  body:not(.no-webgl) .hero-copy::before { inset: -30px -10px -30px -10px; }
  .stage { min-height: 86vh; }
}
@media (max-width: 720px) {
  .hud { display: none; }
  .stage { min-height: 88vh; padding-bottom: 4vh; }
  .stage-copy { padding: 20px; }
  .stage-copy p { display: none; }
  .stage-copy h2 { margin-bottom: 14px; }
  body:not(.no-webgl) .module { padding-top: 70px; }
  body:not(.no-webgl) .hero h1 { font-size: 40px; }
  .explore-bar { bottom: calc(84px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 24px); font-size: 12px; }
  body.exploring .bottom-nav { opacity: 0; pointer-events: none; }
  .pin-card { font-size: 10.5px; padding: 4px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; translate: none; }
  body.booted .page, body.booted .top { animation: none; }
}

.sound-txt { font: 600 10px var(--mono); letter-spacing: .12em; }
.hud-btn.on .sound-txt { color: var(--acc); }
.sound-bars i:nth-child(1) { height: 45%; } .sound-bars i:nth-child(2) { height: 80%; } .sound-bars i:nth-child(3) { height: 60%; }

/* calm mode: a soft veil over the 3D world while reading data sections */
body:not(.no-webgl)::before { content: ""; position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .8s ease;
  background: radial-gradient(120% 90% at 50% 50%, rgba(3, 5, 10, .35), rgba(3, 5, 10, .7)); }
body.calm:not(.no-webgl)::before { opacity: 1; }
body.calm:not(.no-webgl) .card { background: rgba(11, 15, 22, .86); }
body.calm:not(.no-webgl) .col, body.calm:not(.no-webgl) #xrayOut .card, body.calm:not(.no-webgl) .radar-card { background: rgba(10, 14, 20, .93); }

/* keep the hero clean: the section HUD appears once you scroll past it */
body[data-section="hero"] .hud { opacity: 0; transform: translate(-50%, 12px); pointer-events: none; }
.hud { transition: opacity .4s ease, transform .4s ease; }

/* long coin names in the hero card must never widen the hero (phones) */
.hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.hero > *, .hero-visual > *, .live-card, .lc-row, .lc-row .meta { min-width: 0; }
@media (max-width: 1000px) { .hero { grid-template-columns: minmax(0, 1fr); } }

/* phones: big 2D radar background instead of the 3D world (bgradar.js) */
body.flat-radar .stage, body.flat-radar .pins, body.flat-radar .hud, body.flat-radar .explore-bar { display: none !important; }
body.flat-radar #scene { touch-action: pan-y; }
body.flat-radar .hero-copy::before { background: radial-gradient(closest-side, rgba(4, 7, 12, .7), rgba(4, 7, 12, .3) 60%, transparent); }
