/*
 * nexus-intro.css  v4
 * Shadow Nexus Social — Logo-Focused Cinematic Brand Intro
 * Namespaced: #snxIntro* / .snxi-*   Zero collision with existing styles.
 * NO flashing / strobe effects.  Atmospheric only.
 * Logo is the hero — environment supports, never competes.
 */

/* ─── Overlay ───────────────────────────────────────────────────────────── */
#snxIntroOverlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: #000204;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* ── iPhone safe-area: push content clear of Dynamic Island, notch,
       Safari toolbar, and home indicator.  Use padding so the flex centering
       happens inside the safe zone, not behind hardware chrome. ── */
    padding-top:    max(env(safe-area-inset-top, 0px), 0px);
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 0px);
    padding-left:   max(env(safe-area-inset-left, 0px), 0px);
    padding-right:  max(env(safe-area-inset-right, 0px), 0px);
    box-sizing: border-box;
    /* transition used only for exit, not entry */
    transition: opacity 1.8s ease;
    /* touch-action: manipulation keeps overlay interactive without blocking Android pan gestures
       at the document level — do NOT use touch-action:none on a full-screen fixed element */
    touch-action: manipulation;
}
#snxIntroOverlay.snxi-exit {
    opacity: 0;
    pointer-events: none;
    /* When fading out, restore touch-action so Android gesture recognizer is not confused
       by an invisible element still consuming touch events */
    touch-action: auto;
}
#snxIntroOverlay.snxi-gone {
    display: none !important;
    pointer-events: none !important;
    touch-action: auto !important;
}

/* ─── Atmospheric background glow — very subtle, slowly emerges ─────────── */
#snxIntroGlow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 50% 50%, rgba(0,40,160,.18) 0%, transparent 70%),
        radial-gradient(ellipse 100% 45% at 50% 100%, rgba(0,25,100,.24) 0%, transparent 65%);
    opacity: 0;
    animation: snxiGlowIn 3s 0.3s both ease-out;
}

/* ─── Stars ─────────────────────────────────────────────────────────────── */
#snxIntroStars {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(1.0px 1.0px at  8% 12%, rgba(180,230,255,.50) 0%, transparent 100%),
        radial-gradient(0.8px 0.8px at 18% 44%, rgba(180,230,255,.38) 0%, transparent 100%),
        radial-gradient(0.8px 0.8px at 27%  6%, rgba(210,245,255,.42) 0%, transparent 100%),
        radial-gradient(1.2px 1.2px at 38% 30%, rgba(180,230,255,.55) 0%, transparent 100%),
        radial-gradient(0.8px 0.8px at 46% 72%, rgba(180,230,255,.38) 0%, transparent 100%),
        radial-gradient(0.8px 0.8px at 55% 20%, rgba(210,245,255,.35) 0%, transparent 100%),
        radial-gradient(1.0px 1.0px at 63% 55%, rgba(180,230,255,.50) 0%, transparent 100%),
        radial-gradient(0.8px 0.8px at 72%  8%, rgba(210,245,255,.32) 0%, transparent 100%),
        radial-gradient(0.8px 0.8px at 80% 40%, rgba(180,230,255,.44) 0%, transparent 100%),
        radial-gradient(1.2px 1.2px at 88% 82%, rgba(180,230,255,.46) 0%, transparent 100%),
        radial-gradient(0.8px 0.8px at  4% 78%, rgba(210,245,255,.30) 0%, transparent 100%),
        radial-gradient(0.8px 0.8px at 34% 88%, rgba(210,245,255,.42) 0%, transparent 100%),
        radial-gradient(1.0px 1.0px at 58% 92%, rgba(180,230,255,.38) 0%, transparent 100%),
        radial-gradient(0.8px 0.8px at 78% 68%, rgba(210,245,255,.44) 0%, transparent 100%),
        radial-gradient(0.8px 0.8px at 94% 15%, rgba(180,230,255,.32) 0%, transparent 100%),
        radial-gradient(1.2px 1.2px at 96% 85%, rgba(210,245,255,.42) 0%, transparent 100%);
    opacity: 0;
    animation: snxiStarsFade 5s 1.0s forwards ease-out;
}

/* ─── Distant ambient lightning (left/right edges only — never centre) ───── */
#snxIntroLightning {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.snxi-bolt {
    position: absolute;
    top: 0;
    width: 1px;
    opacity: 0;
    background: linear-gradient(180deg,
        rgba(60,140,255,0)    0%,
        rgba(80,160,255,.16) 15%,
        rgba(60,140,255,.30) 30%,
        rgba(100,180,255,.22) 50%,
        rgba(60,140,255,.10) 80%,
        rgba(60,140,255,0)  100%);
    filter: blur(1px);
    transform-origin: top center;
}
.snxi-bolt::before {
    content: '';
    position: absolute;
    top: 20%;
    left: -8px;
    width: 10px;
    height: 40%;
    background: radial-gradient(ellipse at left center, rgba(80,160,255,.12) 0%, transparent 70%);
    filter: blur(4px);
}
.snxi-bolt::after {
    content: '';
    position: absolute;
    top: 10%;
    left: -40px;
    width: 80px;
    height: 60%;
    background: radial-gradient(ellipse at center, rgba(60,130,255,.05) 0%, transparent 70%);
    filter: blur(12px);
}
/* Keep bolts on far edges so they don't compete with logo centre */
.snxi-bolt:nth-child(1){ left: 5%;  height:55vh; animation: snxiBolt 26s  9s infinite ease-in-out; }
.snxi-bolt:nth-child(2){ left:11%;  height:42vh; animation: snxiBolt 33s 18s infinite ease-in-out; }
.snxi-bolt:nth-child(3){ left:84%;  height:60vh; animation: snxiBolt 29s  6s infinite ease-in-out; }
.snxi-bolt:nth-child(4){ left:91%;  height:48vh; animation: snxiBolt 38s 24s infinite ease-in-out; }
/* Two very faint centre arcs that converge toward the logo (intro only — long delay) */
.snxi-bolt:nth-child(5){ left:38%;  height:25vh; opacity:0; animation: snxiBoltArc 8s 1.8s 1 ease-out; filter:blur(3px); }
.snxi-bolt:nth-child(6){ left:62%;  height:25vh; opacity:0; animation: snxiBoltArc 8s 2.2s 1 ease-out; filter:blur(3px); }

/* Lightning environmental glow */
#snxIntroLightGlow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 60% 80% at 50% 30%, rgba(60,120,255,.06) 0%, transparent 70%);
    opacity: 0;
    animation: snxiLightGlow 26s 9s infinite ease-in-out;
}

/* ─── Fog layers ─────────────────────────────────────────────────────────── */
#snxIntroFog {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.snxi-fog {
    position: absolute;
    width: 230%;
    left: -65%;
    border-radius: 50%;
    opacity: 0;
}
/* Background fog — slow, faint, appears early */
.snxi-fog:nth-child(1) {
    height: 22vh;
    bottom: 25vh;
    filter: blur(28px);
    background: radial-gradient(ellipse at 50% 55%, rgba(0,20,70,.35) 0%, transparent 68%);
    animation: snxiFogIn 4s 0.5s both ease-out, snxiFogDrift 80s 4.5s linear infinite;
}
/* Midground fog */
.snxi-fog:nth-child(2) {
    height: 26vh;
    bottom: 8vh;
    filter: blur(38px);
    background: radial-gradient(ellipse at 50% 60%, rgba(0,28,85,.45) 0%, transparent 70%);
    animation: snxiFogIn 3.5s 1.2s both ease-out, snxiFogDrift 65s 4.7s linear infinite reverse;
}
/* Foreground fog — stronger, ground-level */
.snxi-fog:nth-child(3) {
    height: 18vh;
    bottom: -4vh;
    filter: blur(22px);
    background: radial-gradient(ellipse at 50% 75%, rgba(0,18,60,.55) 0%, transparent 65%);
    animation: snxiFogIn 3s 2.0s both ease-out, snxiFogDrift 50s 5.0s linear infinite;
}
/* Extra depth — very faint, mid-height */
.snxi-fog:nth-child(4) {
    height: 14vh;
    bottom: 38vh;
    width: 180%;
    left: -40%;
    filter: blur(44px);
    background: radial-gradient(ellipse at 50% 50%, rgba(0,12,50,.20) 0%, transparent 65%);
    animation: snxiFogIn 5s 3.0s both ease-out, snxiFogDrift2 110s 8s linear infinite;
}
.snxi-fog.snxi-fog-expand {
    animation: snxiFogBurst 2s ease-out forwards !important;
}

/* ─── Forest silhouettes ─────────────────────────────────────────────────── */
#snxIntroForest {
    position: absolute;
    bottom: 0;
    left: 0; right: 0;
    height: 32vh;
    pointer-events: none;
    opacity: 0;
    animation: snxiSilIn 3s 2.5s both ease-out;
}
.snxi-tree {
    position: absolute;
    bottom: 0;
    background: linear-gradient(180deg, #010407 0%, #000204 100%);
}
.snxi-tree:nth-child(1)  { width:60px;  height:24vh; left:0%;    clip-path:polygon(50% 0%,100% 100%,0% 100%); }
.snxi-tree:nth-child(2)  { width:82px;  height:30vh; left:3%;    clip-path:polygon(50% 0%,100% 100%,0% 100%); }
.snxi-tree:nth-child(3)  { width:50px;  height:19vh; left:7%;    clip-path:polygon(50% 0%,100% 100%,0% 100%); }
.snxi-tree:nth-child(4)  { width:75px;  height:27vh; left:11%;   clip-path:polygon(50% 0%,100% 100%,0% 100%); }
.snxi-tree:nth-child(5)  { width:55px;  height:21vh; left:16%;   clip-path:polygon(50% 0%,100% 100%,0% 100%); }
.snxi-tree:nth-child(6)  { width:48px;  height:17vh; left:20%;   clip-path:polygon(50% 0%,100% 100%,0% 100%); }
.snxi-tree:nth-child(7)  { width:68px;  height:25vh; right:19%;  clip-path:polygon(50% 0%,100% 100%,0% 100%); }
.snxi-tree:nth-child(8)  { width:52px;  height:19vh; right:14%;  clip-path:polygon(50% 0%,100% 100%,0% 100%); }
.snxi-tree:nth-child(9)  { width:85px;  height:29vh; right:9%;   clip-path:polygon(50% 0%,100% 100%,0% 100%); }
.snxi-tree:nth-child(10) { width:57px;  height:22vh; right:4%;   clip-path:polygon(50% 0%,100% 100%,0% 100%); }
.snxi-tree:nth-child(11) { width:70px;  height:26vh; right:0%;   clip-path:polygon(50% 0%,100% 100%,0% 100%); }

/* ─── Wolf (distant silhouette, barely visible, in background) ───────────── */
#snxIntroWolf {
    position: absolute;
    bottom: 26vh;
    left: calc(50% + 80px);
    transform: translateX(-50%);
    width: clamp(50px, 9vw, 110px);
    height: clamp(32px, 6vw, 70px);
    opacity: 0;
    animation: snxiWolfFade 5s 9s both ease-out;
    filter: blur(3px) drop-shadow(0 0 10px rgba(0,60,200,.18));
}
#snxIntroWolf.snxi-wolf-lit {
    filter: blur(1.5px) drop-shadow(0 0 22px rgba(80,160,255,.44));
    opacity: .55 !important;
    transition: opacity .15s, filter .15s;
}

/* ─── Cat ─────────────────────────────────────────────────────────────────── */
#snxIntroCat {
    position: absolute;
    bottom: 29vh;
    left: -140px;
    width: 90px;
    height: 56px;
    opacity: 0;
    animation: snxiCatWalk 11s 6s both linear;
    filter: drop-shadow(0 0 8px rgba(0,60,200,.25));
}

/* ─── Crows ───────────────────────────────────────────────────────────────── */
#snxIntroCrows {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.snxi-crow {
    position: absolute;
    top: var(--cy, 18%);
    left: -100px;
    width: var(--csz, 34px);
    height: auto;
    opacity: 0;
    animation: snxiCrowFly var(--cdur,16s) var(--cdelay,2s) both linear;
    will-change: transform;
}

/* ─── Blue atmosphere flames — reduced on mobile ─────────────────────────── */
#snxIntroFlames {
    position: absolute;
    bottom: 0;
    left: 0; right: 0;
    height: 28vh;
    pointer-events: none;
    overflow: visible;
    opacity: 0;
    animation: snxiFlamesIn 3s 3.2s both ease-out;
}
.snxi-flame {
    position: absolute;
    bottom: 0;
    border-radius: 50% 50% 25% 25%;
    transform-origin: bottom center;
    animation: snxiFlame var(--fdur,3.5s) var(--fdelay,0s) ease-in-out infinite alternate;
}
.snxi-flame::after {
    content: '';
    position: absolute;
    inset: 10% 25% 0 25%;
    border-radius: 50% 50% 30% 30%;
    background: radial-gradient(ellipse at 50% 80%, rgba(120,200,255,.22) 0%, transparent 65%);
    filter: blur(4px);
}
.snxi-flame:nth-child(1)  { width:68px;  height:15vh; left:2%;   background:radial-gradient(ellipse at 50% 100%, rgba(0,55,210,.85) 0%, rgba(0,18,90,.55) 40%, transparent 75%); filter:blur(.5px); --fdur:3.2s; --fdelay:0s; }
.snxi-flame:nth-child(2)  { width:50px;  height:10vh; left:5%;   background:radial-gradient(ellipse at 50% 100%, rgba(0,70,230,.70) 0%, rgba(0,14,80,.45) 40%, transparent 75%); filter:blur(.8px); --fdur:2.8s; --fdelay:.4s; }
.snxi-flame:nth-child(3)  { width:88px;  height:20vh; left:9%;   background:radial-gradient(ellipse at 50% 100%, rgba(0,45,190,.85) 0%, rgba(0,18,100,.60) 40%, transparent 75%); filter:blur(.4px); --fdur:4.0s; --fdelay:.2s; }
.snxi-flame:nth-child(4)  { width:56px;  height:12vh; left:14%;  background:radial-gradient(ellipse at 50% 100%, rgba(0,62,220,.72) 0%, rgba(0,18,85,.50) 40%, transparent 75%); filter:blur(.7px); --fdur:3.6s; --fdelay:.7s; }
.snxi-flame:nth-child(5)  { width:44px;  height:9vh;  left:18%;  background:radial-gradient(ellipse at 50% 100%, rgba(10,100,245,.60) 0%, rgba(0,18,72,.40) 40%, transparent 75%); filter:blur(1px); --fdur:2.5s; --fdelay:1.0s; }
/* Centre mega-flame behind logo — large, heavily blurred */
.snxi-flame:nth-child(6)  { width:130px; height:26vh; left:calc(50% - 65px); background:radial-gradient(ellipse at 50% 100%, rgba(0,45,170,.45) 0%, rgba(0,18,70,.22) 40%, transparent 70%); filter:blur(12px); --fdur:5.5s; --fdelay:.3s; }
.snxi-flame:nth-child(7)  { width:56px;  height:13vh; right:2%;  background:radial-gradient(ellipse at 50% 100%, rgba(0,55,210,.85) 0%, rgba(0,18,90,.55) 40%, transparent 75%); filter:blur(.5px); --fdur:3.4s; --fdelay:.5s; }
.snxi-flame:nth-child(8)  { width:78px;  height:18vh; right:5%;  background:radial-gradient(ellipse at 50% 100%, rgba(0,50,200,.78) 0%, rgba(0,18,85,.52) 40%, transparent 75%); filter:blur(.6px); --fdur:3.8s; --fdelay:.1s; }
.snxi-flame:nth-child(9)  { width:50px;  height:11vh; right:10%; background:radial-gradient(ellipse at 50% 100%, rgba(0,80,235,.62) 0%, rgba(0,18,76,.42) 40%, transparent 75%); filter:blur(.9px); --fdur:2.6s; --fdelay:.8s; }
.snxi-flame:nth-child(10) { width:66px;  height:15vh; right:15%; background:radial-gradient(ellipse at 50% 100%, rgba(0,62,220,.70) 0%, rgba(0,18,80,.46) 40%, transparent 75%); filter:blur(.6px); --fdur:3.0s; --fdelay:1.1s; }

#snxIntroFlameGlow {
    position: absolute;
    bottom: 0;
    left: 0; right: 0;
    height: 10vh;
    pointer-events: none;
    background:
        radial-gradient(ellipse 30% 100% at 10% 100%, rgba(0,55,190,.16) 0%, transparent 70%),
        radial-gradient(ellipse 30% 100% at 90% 100%, rgba(0,55,190,.16) 0%, transparent 70%);
    filter: blur(8px);
    opacity: 0;
    animation: snxiFlamesIn 3.5s 3.5s both ease-out;
}
.snxi-flame.snxi-flame-react { animation-duration:.6s !important; }

/* ─── Logo container — THE HERO ─────────────────────────────────────────── */
/*
 * Sequence:
 *   0.0s  — completely invisible (opacity:0, scale:.85)
 *   0.5s  — faint electrical pre-glow begins
 *   1.8s  — logo starts to emerge (snxiLogoIn)
 *   3.0s  — logo is fully visible, forward/depth feel (snxiLogoHero)
 *   3.2s  — gentle idle pulse starts (snxiLogoPulse)
 */
#snxIntroLogoWrap {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    /* GPU-only: transform + opacity only */
    will-change: transform, opacity;
    animation: snxiLogoIn 2.0s 1.8s both cubic-bezier(0.16,1,0.3,1);
    /* Subtle parallax: done in JS via mousemove/deviceorientation, very gentle */
}

/* The logo image itself */
#snxIntroLogoImg {
    display: block;
    /* Width constraint keeps logo from being too narrow on large screens.
       Height constraint (via max-height) is the critical iPhone fix:
       limits logo so it never overflows the visible viewport vertically,
       accounting for safe-area padding and UI chrome above/below. */
    width: clamp(280px, 72vw, 680px);
    max-width: 92vw;
    /* Leave ~220px for buttons + tagline + safe areas.
       Using dvh (dynamic viewport = Safari toolbar excluded) with a svh fallback. */
    max-height: min(calc(100dvh - 220px), calc(100svh - 220px), calc(var(--snxi-stable-h, 100svh) - 220px));
    height: auto;
    object-fit: contain;
    /* drop-shadow only — cheaper than box-shadow, GPU composited */
    filter:
        drop-shadow(0 0 28px rgba(0,130,255,.70))
        drop-shadow(0 0 70px rgba(0,90,220,.45))
        drop-shadow(0 0 14px rgba(0,200,120,.28));
    animation: snxiLogoGlow 3.0s 3.8s ease-in-out infinite alternate;
    transform-origin: center center;
    /* No spin, no shake, no distort */
}

/* Logo electric pre-glow — radial bloom that forms before logo appears */
#snxIntroLogoPreGlow {
    position: absolute;
    width: clamp(300px, 80vw, 720px);
    height: clamp(160px, 40vw, 380px);
    border-radius: 50%;
    background: radial-gradient(ellipse at 50% 55%,
        rgba(0,100,255,.22) 0%,
        rgba(0,60,200,.10) 35%,
        transparent 70%);
    filter: blur(18px);
    opacity: 0;
    animation: snxiPreGlow 2.5s 0.5s both ease-out;
    pointer-events: none;
    z-index: 9;
}

/* Screen dimmer — very slightly darkens everything EXCEPT the logo */
#snxIntroDimmer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* Vignette that leaves centre brighter and dims the edges */
    background: radial-gradient(ellipse 65% 65% at 50% 48%,
        transparent 0%,
        transparent 40%,
        rgba(0,0,4,.45) 100%);
    opacity: 0;
    animation: snxiDimmerIn 2s 2.5s both ease-out;
    z-index: 8;
}

/* Small floating particles — cheap CSS, no canvas */
#snxIntroParticles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 9;
}
.snxi-particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    will-change: transform, opacity;
}

/* ─── Blue energy burst (enter transition) ───────────────────────────────── */
#snxIntroEnergy {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 60% 60% at 50% 50%, rgba(0,80,255,.88) 0%, rgba(0,20,120,.80) 40%, rgba(0,0,30,.70) 100%);
    opacity: 0;
    z-index: 12;
}
#snxIntroEnergy.snxi-energy-burst {
    animation: snxiEnergyBurst 1.6s 0.8s ease-in-out both;
}

/* ─── Tagline (below logo, appears after logo) ───────────────────────────── */
.snxi-tagline {
    position: relative;
    z-index: 10;
    font-size: clamp(10px, 1.8vw, 14px);
    letter-spacing: .50em;
    text-transform: uppercase;
    color: rgba(0,200,120,.70);
    margin-top: 18px;
    font-weight: 500;
    font-family: -apple-system,"Segoe UI",system-ui,sans-serif;
    opacity: 0;
    animation: snxiTagIn 1.8s 4.2s both ease-out;
    text-align: center;
}

/* ─── Now Playing strip ──────────────────────────────────────────────────── */
#snxIntroNowPlaying {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,8,28,.55);
    border: 1px solid rgba(0,120,255,.22);
    border-radius: 28px;
    padding: 7px 14px 7px 10px;
    margin-top: 14px;
    opacity: 0;
    max-width: min(88vw, 500px);
    box-sizing: border-box;
}
#snxIntroNowPlaying.snxi-np-visible {
    animation: snxiNpIn 1.2s 4.8s ease-out both;
}
.snxi-np-art {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: rgba(0,30,90,.6);
    border: 1px solid rgba(0,120,255,.28);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: rgba(80,160,255,.7);
    overflow: hidden;
}
.snxi-np-art img { width:100%; height:100%; object-fit:cover; border-radius:5px; }
.snxi-np-info { flex: 1; min-width: 0; }
.snxi-np-label {
    font-size: 9px;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: rgba(0,200,120,.60);
    margin-bottom: 2px;
    font-family: -apple-system,"Segoe UI",system-ui,sans-serif;
}
.snxi-np-title {
    font-size: clamp(11px, 2.5vw, 13px);
    font-weight: 700;
    color: #d8eeff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: -apple-system,"Segoe UI",system-ui,sans-serif;
}
.snxi-np-artist {
    font-size: 11px;
    color: rgba(120,180,255,.60);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: -apple-system,"Segoe UI",system-ui,sans-serif;
}

/* ─── Button row ─────────────────────────────────────────────────────────── */
#snxIntroBtns {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: clamp(20px, 3.5vh, 40px);
}
#snxIntroEnterBtn {
    padding: clamp(13px, 2.6vw, 18px) clamp(32px, 7vw, 64px);
    font-size: clamp(13px, 2.2vw, 18px);
    letter-spacing: .26em;
    text-transform: uppercase;
    font-weight: 700;
    font-family: -apple-system,"Segoe UI",system-ui,sans-serif;
    color: #c8eaff;
    background: rgba(0,22,80,.68);
    border: 1.5px solid rgba(0,138,255,.62);
    border-radius: 4px;
    cursor: pointer;
    box-shadow:
        0 0 26px rgba(0,100,255,.40),
        0 0 8px  rgba(0,200,120,.10) inset,
        inset 0 1px 0 rgba(255,255,255,.04);
    opacity: 0;
    animation: snxiEnterIn 1.8s 5.0s both ease-out;
    outline: none;
    transition: box-shadow .28s, border-color .28s, color .28s, background .28s, transform .12s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
#snxIntroEnterBtn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent);
    animation: snxiEnterShimmer 4s 6s ease-in-out infinite;
}
#snxIntroEnterBtn::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 4px;
    border: 1px solid rgba(0,200,120,.18);
    pointer-events: none;
}
#snxIntroEnterBtn:hover, #snxIntroEnterBtn:focus-visible {
    color: #fff;
    background: rgba(0,40,140,.80);
    border-color: rgba(0,180,255,.95);
    box-shadow:
        0 0 50px rgba(0,140,255,.65),
        0 0 16px rgba(0,200,120,.22) inset,
        inset 0 1px 0 rgba(255,255,255,.07);
}
#snxIntroEnterBtn:active { transform: scale(.97); }

/* ─── Start Music button ─────────────────────────────────────────────────── */
#snxIntroStartMusicBtn {
    padding: 9px 24px;
    font-size: clamp(12px, 1.8vw, 14px);
    letter-spacing: .14em;
    text-transform: uppercase;
    font-weight: 600;
    font-family: -apple-system,"Segoe UI",system-ui,sans-serif;
    color: rgba(160,210,255,.80);
    background: rgba(0,18,58,.52);
    border: 1px solid rgba(0,110,220,.38);
    border-radius: 22px;
    cursor: pointer;
    outline: none;
    transition: color .2s, border-color .2s, background .2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    display: none;
    opacity: 0;
    animation: snxiEnterIn 1.2s ease-out both;
}
#snxIntroStartMusicBtn:hover, #snxIntroStartMusicBtn:focus-visible {
    color: #90c8ff;
    border-color: rgba(0,150,255,.60);
    background: rgba(0,26,75,.68);
}

/* ─── Corner buttons ─────────────────────────────────────────────────────── */
#snxIntroSkipBtn, #snxIntroSoundBtn {
    position: absolute;
    z-index: 20;
    background: rgba(0,6,22,.55);
    border: 1px solid rgba(0,100,200,.25);
    border-radius: 20px;
    color: rgba(150,205,255,.55);
    font-size: 12px;
    padding: 7px 15px;
    cursor: pointer;
    font-family: -apple-system,"Segoe UI",system-ui,sans-serif;
    opacity: 0;
    animation: snxiSkipIn 1.2s 1.2s both ease-out;
    transition: color .2s, border-color .2s, background .2s;
    outline: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}
#snxIntroSkipBtn  { top:max(14px,env(safe-area-inset-top,14px)); right:max(14px,env(safe-area-inset-right,14px)); }
#snxIntroSoundBtn { top:max(14px,env(safe-area-inset-top,14px)); left:max(14px,env(safe-area-inset-left,14px)); }
#snxIntroSkipBtn:hover,  #snxIntroSkipBtn:focus-visible,
#snxIntroSoundBtn:hover, #snxIntroSoundBtn:focus-visible {
    color: #90c8ff;
    border-color: rgba(0,150,255,.55);
    background: rgba(0,16,50,.70);
}

/* ─── Music status ───────────────────────────────────────────────────────── */
#snxIntroMusicStatus {
    position: absolute;
    bottom: max(10px, env(safe-area-inset-bottom, 10px));
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: rgba(80,120,180,.50);
    letter-spacing: .1em;
    font-family: -apple-system,"Segoe UI",system-ui,sans-serif;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
}

/* ─── Logo exit — shrinks toward its normal nav position ────────────────── */
#snxIntroLogoWrap.snxi-logo-exit {
    animation: snxiLogoExit 1.2s cubic-bezier(0.4,0,1,1) both !important;
}
/* Camera travel on cinematic enter */
#snxIntroOverlay.snxi-enter-travel {
    animation: snxiCameraIn 1.4s 0.6s cubic-bezier(0.4,0,0.2,1) both !important;
}
/* Title exit (still referenced for fog/etc) */
.snxi-title-exit-compat {
    animation: snxiTitleExit 1.4s ease-in forwards !important;
}

/* ─── Keyframes ──────────────────────────────────────────────────────────── */

/* Background glow */
@keyframes snxiGlowIn { from{opacity:0} to{opacity:1} }

/* Stars */
@keyframes snxiStarsFade { 0%{opacity:0} 100%{opacity:1} }

/* Fog */
@keyframes snxiFogIn    { from{opacity:0} to{opacity:1} }
@keyframes snxiFogDrift { 0%{transform:translateX(0)} 50%{transform:translateX(8%)} 100%{transform:translateX(0)} }
@keyframes snxiFogDrift2{ 0%{transform:translateX(0)} 50%{transform:translateX(-12%)} 100%{transform:translateX(0)} }
@keyframes snxiFogBurst { 0%{opacity:1;transform:scale(1)} 100%{opacity:0;transform:scale(3.0)} }

/* Environment silhouettes */
@keyframes snxiSilIn    { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:translateY(0)} }
@keyframes snxiWolfFade { 0%{opacity:0} 30%{opacity:.30} 70%{opacity:.40} 100%{opacity:.35} }
@keyframes snxiCatWalk  { 0%{opacity:0;transform:translateX(0)} 8%{opacity:.80} 40%{opacity:.80;transform:translateX(calc(45vw - 45px))} 44%{opacity:.80;transform:translateX(calc(47vw - 45px))} 46%{opacity:.55;transform:translateX(calc(47vw - 45px))} 55%{opacity:.60;transform:translateX(calc(51vw - 45px))} 92%{opacity:.65} 100%{opacity:0;transform:translateX(calc(100vw + 160px))} }
@keyframes snxiCrowFly  { 0%{opacity:0;transform:translateX(0) scaleX(1)} 6%{opacity:.70} 50%{transform:translateX(calc(55vw + 45px)) scaleX(1)} 51%{transform:translateX(calc(55vw + 45px)) scaleX(-1)} 94%{opacity:.70} 100%{opacity:0;transform:translateX(calc(100vw + 110px)) scaleX(-1)} }

/* Flames */
@keyframes snxiFlamesIn { from{opacity:0;transform:translateY(24px)} to{opacity:1;transform:translateY(0)} }
@keyframes snxiFlame    { 0%{transform:scaleX(1) scaleY(1) translateY(0)} 100%{transform:scaleX(.88) scaleY(1.14) translateY(-9px)} }

/* Lightning bolts */
/* Persistent distant bolts — very rare single flash */
@keyframes snxiBolt     { 0%,100%{opacity:0} 46%{opacity:0} 48%{opacity:.24} 50%{opacity:.10} 52%{opacity:0} }
@keyframes snxiLightGlow{ 0%,100%{opacity:0} 46%{opacity:0} 48%{opacity:.60} 50%{opacity:.25} 52%{opacity:0} }
/* Intro convergence arcs — travel toward centre once during the reveal */
@keyframes snxiBoltArc  { 0%{opacity:0;transform:translateX(0) scaleY(0)} 20%{opacity:.20} 60%{opacity:.14;transform:translateX(8vw) scaleY(1)} 100%{opacity:0;transform:translateX(12vw) scaleY(1)} }

/* Logo reveal */
@keyframes snxiPreGlow  { 0%{opacity:0} 40%{opacity:.6} 100%{opacity:.35} }
/* scale peak reduced from 1.04 → 1.02 so the logo never clips the viewport
   on small screens (iPhone SE, iPhone 13 mini) during the reveal animation */
@keyframes snxiLogoIn   { 0%{opacity:0;transform:scale(.82) translateY(12px)} 60%{opacity:1;transform:scale(1.02) translateY(-2px)} 100%{opacity:1;transform:scale(1.0) translateY(0)} }
@keyframes snxiLogoGlow { from{filter:drop-shadow(0 0 20px rgba(0,120,255,.60)) drop-shadow(0 0 50px rgba(0,80,200,.38)) drop-shadow(0 0 10px rgba(0,180,110,.22))} to{filter:drop-shadow(0 0 36px rgba(0,160,255,.85)) drop-shadow(0 0 80px rgba(0,110,240,.55)) drop-shadow(0 0 20px rgba(0,220,130,.38))} }
@keyframes snxiDimmerIn { from{opacity:0} to{opacity:1} }

/* Logo exit — shrinks toward header position while page fades in */
@keyframes snxiLogoExit { 0%{opacity:1;transform:scale(1) translateY(0)} 100%{opacity:0;transform:scale(.22) translateY(-38vh)} }

/* Tagline + NowPlaying + Enter */
@keyframes snxiTagIn     { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }
@keyframes snxiNpIn      { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }
@keyframes snxiEnterIn   { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }
@keyframes snxiEnterShimmer { 0%{left:-100%} 50%{left:140%} 100%{left:140%} }
@keyframes snxiSkipIn    { from{opacity:0} to{opacity:1} }

/* Particles */
@keyframes snxiParticleA { 0%{opacity:0;transform:translate(0,0) scale(1)} 20%{opacity:.8} 100%{opacity:0;transform:translate(var(--px,30px),var(--py,-60px)) scale(.4)} }
@keyframes snxiParticleB { 0%{opacity:0;transform:translate(0,0) scale(1)} 25%{opacity:.6} 100%{opacity:0;transform:translate(var(--px,-40px),var(--py,-50px)) scale(.3)} }

/* Camera zoom on cinematic enter */
@keyframes snxiCameraIn  { from{transform:scale(1)} to{transform:scale(1.10)} }
@keyframes snxiEnergyBurst{ 0%{opacity:0} 30%{opacity:1} 100%{opacity:0} }

/* Title exit (compatibility) */
@keyframes snxiTitleExit { to{opacity:0;transform:translateY(-24px) scale(.97)} }

/* ─── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    #snxIntroOverlay { transition-duration:.001ms !important; }
    #snxIntroGlow, #snxIntroStars, #snxIntroFlames, #snxIntroFlameGlow,
    #snxIntroForest, #snxIntroWolf, #snxIntroCat,
    #snxIntroLogoWrap, #snxIntroLogoImg, #snxIntroLogoPreGlow, #snxIntroDimmer,
    .snxi-tagline, #snxIntroNowPlaying, #snxIntroEnterBtn, #snxIntroStartMusicBtn,
    #snxIntroSkipBtn, #snxIntroSoundBtn,
    .snxi-fog, .snxi-crow, .snxi-flame, .snxi-bolt, #snxIntroLightGlow, #snxIntroEnergy,
    .snxi-particle {
        animation-duration: .001ms !important;
        animation-delay: 0ms !important;
        transition-duration: .001ms !important;
    }
    #snxIntroGlow        { opacity: .7; }
    #snxIntroStars       { opacity: .5; }
    #snxIntroForest      { opacity: .8; }
    #snxIntroFlames      { opacity: .5; }
    #snxIntroFlameGlow   { opacity: .4; }
    #snxIntroWolf        { opacity: .3; }
    #snxIntroLogoWrap    { opacity: 1; }
    #snxIntroLogoPreGlow { opacity: .4; }
    #snxIntroDimmer      { opacity: 1; }
    .snxi-tagline           { opacity: 1; }
    #snxIntroNowPlaying     { opacity: 1; }
    #snxIntroEnterBtn       { opacity: 1; }
    #snxIntroSkipBtn        { opacity: 1; }
    #snxIntroSoundBtn       { opacity: 1; }
    #snxIntroStartMusicBtn  { opacity: 1; }
}

/* ─── Mobile performance ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
    /* ── Viewport stability: use fixed pixel height captured by JS on load.
       The CSS fallback uses 100svh (small viewport = with chrome) so the intro
       never resizes when Android Chrome's address bar slides in/out.
       JS will override this with a stable pixel value via --snxi-stable-h. */
    #snxIntroOverlay {
        height: calc(var(--snxi-stable-h, 100svh));
        /* Prevent the overlay from stretching when Android address bar hides */
        max-height: calc(var(--snxi-stable-h, 100svh));
    }

    /* ── iPhone logo sizing: constrain by BOTH width AND height.
       On portrait iPhones the logo must fit between the Dynamic Island / notch
       at the top and the home indicator + button row at the bottom.
       ~200px reserved for buttons, tagline, safe areas.
       object-fit:contain is set on the base rule; width+max-height drive the box. */
    #snxIntroLogoImg {
        width: clamp(200px, 82vw, 380px);
        max-height: min(
            calc(var(--snxi-stable-h, 100svh) - 200px),
            55vw
        );
    }

    /* Reduce pre-glow blur to save GPU */
    #snxIntroLogoPreGlow { filter: blur(10px); }

    /* Lighter fog — reduce blur and layer count on mobile */
    .snxi-fog                { filter: blur(16px); }
    .snxi-fog:nth-child(2)   { filter: blur(22px); }
    /* 4th fog layer (high depth, most expensive blur) hidden on mobile */
    .snxi-fog:nth-child(4)   { display: none; }

    /* Hide centre mega-flame on mobile (expensive 12px blur) */
    .snxi-flame:nth-child(6) { display: none; }
    /* Reduce individual flame blur on mobile */
    .snxi-flame:nth-child(1) { filter: none; }
    .snxi-flame:nth-child(3) { filter: none; }
    .snxi-flame:nth-child(7) { filter: none; }
    .snxi-flame:nth-child(8) { filter: none; }

    /* Hide ambient lightning glow layers on mobile (expensive repeated radial-gradient) */
    #snxIntroLightGlow { display: none; }
    /* Only keep 2 edge bolts on mobile — hide the converging arcs (less impactful) */
    .snxi-bolt:nth-child(5),
    .snxi-bolt:nth-child(6) { display: none; }

    /* Simpler wolf on mobile */
    #snxIntroWolf { filter: blur(2px); }

    /* Reduce logo glow to a single drop-shadow (one GPU pass instead of three) */
    #snxIntroLogoImg {
        filter: drop-shadow(0 0 20px rgba(0,120,255,.62));
    }
    @keyframes snxiLogoGlow {
        from { filter: drop-shadow(0 0 16px rgba(0,110,240,.55)); }
        to   { filter: drop-shadow(0 0 30px rgba(0,150,255,.75)); }
    }

    /* Reduce backdrop glow blur */
    #snxIntroFlameGlow { filter: blur(4px); }
}

/* ─── Landscape iPhone / small height screens ───────────────────────────── */
/* Matches portrait phones rotated AND compact iPhones (SE, 13 mini) landscape */
@media (max-height: 500px) and (max-width: 900px) {
    /* Flex direction stays column; shrink everything to fit reduced height */
    #snxIntroOverlay {
        justify-content: flex-start;
        /* Extra top padding to clear Dynamic Island / notch in landscape */
        padding-top: max(env(safe-area-inset-top, 8px), 8px);
    }

    #snxIntroLogoWrap {
        margin-top: 4px;
    }

    /* Logo must fit inside a short viewport — height is the bottleneck.
       Use dvh so Safari toolbar doesn't eat the available space.
       90px reserved for buttons row + safe areas. */
    #snxIntroLogoImg {
        width: auto;
        max-width: min(90vw, calc(100dvh * 2.8));  /* keep aspect ratio */
        max-height: calc(100dvh - 90px);
        height: auto;
    }

    /* Collapse tagline margin in landscape — every pixel counts */
    .snxi-tagline {
        margin-top: 6px;
        font-size: 10px;
    }

    /* Reduce button row spacing in landscape */
    #snxIntroBtns {
        margin-top: 8px;
        gap: 8px;
    }

    /* Skip/sound buttons: safe-area-aware placement for landscape notch */
    #snxIntroSkipBtn  { top: max(env(safe-area-inset-top, 8px), 8px);  right: max(env(safe-area-inset-right, 14px), 14px); }
    #snxIntroSoundBtn { top: max(env(safe-area-inset-top, 8px), 8px);  left:  max(env(safe-area-inset-left,  14px), 14px); }

    /* Tighter now-playing strip in landscape */
    #snxIntroNowPlaying { display: none; }

    /* Reduce fog layers for landscape performance */
    .snxi-fog:nth-child(3),
    .snxi-fog:nth-child(4) { display: none; }
}

/* ─── Tablet: moderate reduction ────────────────────────────────────────── */
@media (min-width: 641px) and (max-width: 1024px) {
    /* Stable height for tablets too (landscape orientation changes) */
    #snxIntroOverlay {
        height: calc(var(--snxi-stable-h, 100svh));
        max-height: calc(var(--snxi-stable-h, 100svh));
    }
    /* Slightly reduce blur on tablets */
    .snxi-fog:nth-child(4)   { filter: blur(32px); }
    #snxIntroLogoImg {
        filter:
            drop-shadow(0 0 22px rgba(0,120,255,.65))
            drop-shadow(0 0 55px rgba(0,80,200,.40));
    }
}

/* ─── Founder Control — Welcome Music tab ───────────────────────────────── */
.snxwm-card {
    background: rgba(0,12,35,.70);
    border: 1px solid rgba(0,140,255,.22);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 14px;
}
.snxwm-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,80,180,.15);
}
.snxwm-row:last-child { border-bottom: none; }
.snxwm-label { font-size:12px; color:#6a90b8; flex:1; min-width:140px; }
.snxwm-label strong { display:block; font-size:13px; color:#d8eeff; margin-bottom:2px; }
.snxwm-label small { font-size:11px; color:#4a6a88; display:block; }
.snxwm-btns { display:flex; gap:8px; flex-wrap:wrap; }
.snxwm-btn {
    padding: 7px 16px;
    font-size: 12px;
    font-family: -apple-system,"Segoe UI",system-ui,sans-serif;
    border-radius: 6px;
    border: 1px solid rgba(0,140,255,.30);
    color: #90c8ff;
    background: rgba(0,30,80,.40);
    cursor: pointer;
    transition: background .18s, border-color .18s;
    outline: none;
    touch-action: manipulation;
}
.snxwm-btn:hover { background:rgba(0,50,140,.6); border-color:rgba(0,180,255,.6); }
.snxwm-btn.danger { border-color:rgba(255,60,80,.38); color:#ff8899; background:rgba(80,0,15,.3); }
.snxwm-btn.danger:hover { background:rgba(120,0,20,.5); border-color:rgba(255,60,80,.65); }
.snxwm-btn.primary { border-color:rgba(0,200,100,.4); color:#5effb8; background:rgba(0,60,30,.3); }
.snxwm-btn.primary:hover { background:rgba(0,80,40,.5); border-color:rgba(0,220,110,.7); }
.snxwm-song-art {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    background: rgba(0,20,60,.60);
    border: 1px solid rgba(0,100,200,.28);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: rgba(80,150,255,.65);
    overflow: hidden;
}
.snxwm-song-art img { width:100%; height:100%; object-fit:cover; border-radius:8px; }
.snxwm-song-info { flex:1; min-width:0; }
.snxwm-song-title { font-size:13px; font-weight:700; color:#d8eeff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.snxwm-song-artist { font-size:11px; color:#6a90b8; }
.snxwm-song-meta { font-size:10px; color:#4a6a88; margin-top:2px; }
.snxwm-status-dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:5px; vertical-align:middle; }
.snxwm-status-dot.on  { background:#00dd88; box-shadow:0 0 6px rgba(0,220,140,.55); }
.snxwm-status-dot.off { background:#4a5a6a; }
.snxwm-progress { height:4px; background:rgba(0,40,100,.50); border-radius:2px; margin-top:8px; overflow:hidden; }
.snxwm-progress-bar { height:100%; background:linear-gradient(90deg,#0060ff,#00ccff); width:0; transition:width .3s; border-radius:2px; }
.snxwm-volume-wrap { display:flex; align-items:center; gap:10px; flex:1; min-width:160px; }
.snxwm-volume-wrap input[type=range] {
    flex:1; height:4px; cursor:pointer;
    accent-color: #0099ff;
}
.snxwm-vol-val { font-size:12px; color:#6ab8ff; min-width:32px; text-align:right; }
.snxwm-panel {
    background: rgba(0,8,28,.75);
    border: 1px solid rgba(0,120,255,.20);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 16px;
}
.snxwm-title { font-size:15px; font-weight:700; color:#d8eeff; margin-bottom:4px; }
.snxwm-subtitle { font-size:12px; color:#6a90b8; margin-bottom:14px; }
.snxwm-section-title { font-size:11px; font-weight:600; color:#4a7aaa; letter-spacing:.12em; text-transform:uppercase; margin-bottom:10px; }
.snxwm-status-lbl { font-size:12px; color:#8ab8d8; }
.snxwm-btn-sm { padding: 5px 12px !important; font-size: 11px !important; }
.snxwm-btn-off {
    opacity: .55;
    border-style: dashed !important;
}
.snxwm-btn-off:hover {
    opacity: 1;
}
.snxwm-action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.snxwm-action-row .snxwm-btn {
    flex: 1;
    min-width: 100px;
    text-align: center;
}
.snxwm-art {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    background: rgba(0,20,55,.55);
    border: 1px solid rgba(0,100,200,.25);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: rgba(80,150,255,.6);
    overflow: hidden;
}
.snxwm-art img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.snxwm-input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0,15,50,.60);
    border: 1px solid rgba(0,100,200,.28);
    border-radius: 6px;
    color: #c8e0ff;
    font-size: 13px;
    font-family: -apple-system,"Segoe UI",system-ui,sans-serif;
    outline: none;
    box-sizing: border-box;
}
.snxwm-input:focus { border-color: rgba(0,180,255,.60); outline: none; }

@media (max-width: 540px) {
    .snxwm-row { flex-direction: column; align-items: flex-start; }
    .snxwm-btns { width: 100%; }
    .snxwm-action-row .snxwm-btn { flex: unset; width: 100%; }
}
