:root {
    color-scheme: dark;
    --bg: #05070d;
    --ink: #f6f8ff;
    --muted: rgba(229, 234, 255, 0.62);
    --faint: rgba(229, 234, 255, 0.38);
    --line: rgba(255, 255, 255, 0.14);
    --cyan: #65ebff;
    --violet: #8b79ff;
    --pink: #ff66ba;
    --lime: #b9ff7d;
    --ease: cubic-bezier(0.22, 0.9, 0.3, 1);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-width: 320px;
    min-height: 100%;
    margin: 0;
    background: var(--bg);
}

body {
    overflow: hidden;
    color: var(--ink);
    font-family: "Inter", "SF Pro Display", "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    color: inherit;
    font: inherit;
}

::selection {
    color: #081016;
    background: var(--cyan);
}

:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 4px;
}

.skip-link {
    position: fixed;
    top: 10px;
    left: 12px;
    z-index: 100;
    padding: 10px 14px;
    border-radius: 999px;
    color: #071015;
    background: #fff;
    transform: translateY(-160%);
    transition: transform 180ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.experiment-nav {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    left: 50%;
    z-index: 40;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: min(1180px, calc(100% - 32px));
    min-height: 54px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 999px;
    background: rgba(5, 7, 13, 0.54);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 18px 70px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    transform: translateX(-50%);
}

.back-link {
    display: inline-flex;
    width: fit-content;
    min-height: 40px;
    align-items: center;
    gap: 9px;
    padding: 0 14px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    transition: color 180ms ease, background 180ms ease, transform 180ms var(--ease);
    touch-action: manipulation;
}

.back-link:hover,
.back-link:focus-visible {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.09);
    transform: translateX(-2px);
}

.nav-label,
.nav-counter {
    margin: 0;
    font-size: 0.69rem;
    font-weight: 750;
    letter-spacing: 0.17em;
    text-transform: uppercase;
}

.nav-label {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
}

.nav-label i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 16px rgba(101, 235, 255, 0.92);
}

.nav-counter {
    justify-self: end;
    padding-right: 14px;
    color: var(--faint);
}

.metaball-stage {
    position: relative;
    width: 100%;
    height: 100svh;
    min-height: 620px;
    overflow: hidden;
    isolation: isolate;
    touch-action: pinch-zoom;
    background:
        radial-gradient(circle at 76% 36%, rgba(82, 58, 168, 0.15), transparent 30%),
        radial-gradient(circle at 28% 78%, rgba(35, 130, 151, 0.1), transparent 28%),
        #05070d;
}

.ambient-field,
.static-field,
#gooey-canvas,
.field-grid,
.noise {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.ambient-field {
    z-index: -5;
    opacity: 0.9;
    background:
        radial-gradient(circle at 78% 52%, rgba(111, 85, 255, 0.2), transparent 26%),
        radial-gradient(circle at 58% 24%, rgba(101, 235, 255, 0.11), transparent 24%);
}

.static-field {
    z-index: -3;
    filter: blur(16px) contrast(15) saturate(1.35);
    transform: scale(1.05);
    transition: opacity 500ms ease;
}

.static-field i {
    position: absolute;
    display: block;
    width: clamp(120px, 16vw, 260px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--violet);
}

.static-field i:nth-child(1) { top: 11%; left: 58%; width: clamp(170px, 21vw, 340px); background: var(--cyan); }
.static-field i:nth-child(2) { top: 32%; left: 68%; background: var(--violet); }
.static-field i:nth-child(3) { top: 55%; left: 53%; width: clamp(150px, 18vw, 290px); background: var(--pink); }
.static-field i:nth-child(4) { top: 63%; left: 78%; width: clamp(90px, 11vw, 180px); background: var(--lime); }
.static-field i:nth-child(5) { top: 28%; left: 47%; width: clamp(75px, 8vw, 130px); background: var(--pink); }
.static-field i:nth-child(6) { top: 72%; left: 39%; width: clamp(70px, 7vw, 120px); background: var(--cyan); }

.is-live .static-field {
    opacity: 0;
}

#gooey-canvas {
    z-index: -2;
    display: block;
    opacity: 0;
    filter: blur(clamp(10px, 1.3vw, 18px)) contrast(14) saturate(1.3);
    transform: scale(1.035);
    transition: opacity 500ms ease;
    touch-action: none;
}

.is-live #gooey-canvas {
    opacity: 1;
}

.field-grid {
    z-index: -1;
    opacity: 0.18;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.13) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.13) 1px, transparent 1px);
    background-size: 76px 76px;
    mask-image: radial-gradient(circle at 70% 48%, #000 0%, transparent 70%);
    pointer-events: none;
}

.noise {
    z-index: 2;
    opacity: 0.065;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
    pointer-events: none;
}

.hero-copy {
    position: absolute;
    top: clamp(130px, 18vh, 190px);
    left: max(32px, calc((100vw - 1180px) / 2));
    z-index: 8;
    width: min(480px, 38vw);
    pointer-events: none;
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 760;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.eyebrow span {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--cyan);
}

.hero-copy h1 {
    margin: 0;
    font-size: clamp(4.4rem, 9.6vw, 10.2rem);
    font-weight: 820;
    line-height: 0.7;
    letter-spacing: -0.085em;
    text-transform: uppercase;
}

.hero-copy h1 em {
    display: inline-block;
    margin-left: 0.26em;
    color: transparent;
    font-style: normal;
    -webkit-text-stroke: 1px rgba(238, 242, 255, 0.52);
    text-stroke: 1px rgba(238, 242, 255, 0.52);
}

.intro {
    width: min(420px, 100%);
    margin: clamp(30px, 5vh, 58px) 0 0;
    color: var(--muted);
    font-size: clamp(0.9rem, 1vw, 1.04rem);
    line-height: 1.9;
}

.field-note {
    position: absolute;
    top: clamp(132px, 19vh, 202px);
    right: max(34px, calc((100vw - 1180px) / 2));
    z-index: 8;
    display: grid;
    justify-items: end;
    max-width: 250px;
    color: var(--muted);
    text-align: right;
    pointer-events: none;
}

.field-note p,
.field-note span {
    margin: 0;
    font-size: 0.62rem;
    letter-spacing: 0.15em;
    line-height: 1.7;
    text-transform: uppercase;
}

.field-note strong {
    margin: 12px 0;
    color: var(--ink);
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: clamp(1.15rem, 1.7vw, 1.55rem);
    font-weight: 500;
    letter-spacing: 0.04em;
}

.field-note span {
    color: var(--faint);
    text-transform: none;
}

.interaction-dock {
    position: absolute;
    bottom: max(28px, calc(env(safe-area-inset-bottom) + 20px));
    left: max(32px, calc((100vw - 1180px) / 2));
    z-index: 12;
    display: flex;
    align-items: center;
    gap: 12px;
}

.live-state,
.scatter-button {
    min-height: 62px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(7, 10, 18, 0.64);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 46px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.live-state {
    display: flex;
    min-width: 250px;
    align-items: center;
    gap: 13px;
    padding: 10px 18px;
}

.live-state > i {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--lime);
    box-shadow: 0 0 15px rgba(185, 255, 125, 0.9);
    animation: breathe 1.8s ease-in-out infinite;
}

.live-state p {
    display: grid;
    gap: 5px;
    margin: 0;
}

.live-state span,
.live-state small,
.scatter-button {
    font-size: 0.64rem;
    font-weight: 740;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.live-state small {
    color: var(--faint);
    font-size: 0.57rem;
    font-weight: 620;
    letter-spacing: 0.08em;
    text-transform: none;
}

.scatter-button {
    display: flex;
    min-width: 136px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 17px;
    cursor: pointer;
    transition: border-color 180ms ease, background 180ms ease, transform 180ms var(--ease);
    touch-action: manipulation;
}

.scatter-button:hover,
.scatter-button:focus-visible {
    border-color: rgba(101, 235, 255, 0.42);
    background: rgba(18, 27, 42, 0.82);
    transform: translateY(-2px);
}

.scatter-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
}

.scatter-button i {
    color: var(--cyan);
    font-style: normal;
    font-size: 0.95rem;
}

.edge-label {
    position: absolute;
    right: max(34px, calc((100vw - 1180px) / 2));
    bottom: 117px;
    z-index: 8;
    margin: 0;
    color: rgba(230, 235, 255, 0.28);
    font-size: 0.59rem;
    font-weight: 740;
    letter-spacing: 0.18em;
    writing-mode: vertical-rl;
}

.next-link {
    position: absolute;
    right: max(34px, calc((100vw - 1180px) / 2));
    bottom: max(28px, calc(env(safe-area-inset-bottom) + 20px));
    z-index: 12;
    display: flex;
    min-width: 250px;
    min-height: 64px;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding: 0 20px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(7, 10, 18, 0.66);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 46px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: border-color 180ms ease, background 180ms ease, transform 180ms var(--ease);
    touch-action: manipulation;
}

.next-link:hover,
.next-link:focus-visible {
    border-color: rgba(255, 102, 186, 0.46);
    background: rgba(25, 15, 32, 0.82);
    transform: translateX(3px);
}

.next-link span {
    display: grid;
    gap: 5px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.next-link small {
    color: var(--faint);
    font-size: 0.56rem;
    font-weight: 750;
    letter-spacing: 0.16em;
}

.next-link i {
    color: var(--pink);
    font-style: normal;
    font-size: 1.25rem;
}

.pointer-orbit {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 7;
    width: 52px;
    height: 52px;
    margin: -26px 0 0 -26px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transform: translate3d(-100px, -100px, 0) scale(0.72);
    transition: opacity 180ms ease, scale 180ms var(--ease);
}

.pointer-orbit::before,
.pointer-orbit::after {
    position: absolute;
    top: 50%;
    left: 50%;
    content: "";
    background: rgba(255, 255, 255, 0.36);
    transform: translate(-50%, -50%);
}

.pointer-orbit::before { width: 72px; height: 1px; }
.pointer-orbit::after { width: 1px; height: 72px; }

.pointer-orbit i {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 12px var(--cyan);
    transform: translate(-50%, -50%);
}

.pointer-orbit.is-visible {
    opacity: 1;
    scale: 1;
}

.pointer-orbit.is-pulling {
    border-color: var(--cyan);
    scale: 0.74;
}

.no-script {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 50;
    margin: 0;
    padding: 10px 16px;
    border-radius: 999px;
    color: #111521;
    background: #fff;
    font-size: 0.78rem;
    transform: translateX(-50%);
}

@keyframes breathe {
    50% { opacity: 0.42; transform: scale(0.72); }
}

@media (max-width: 760px) {
    .experiment-nav {
        width: calc(100% - 20px);
        min-height: 50px;
    }

    .nav-label {
        display: none;
    }

    .experiment-nav {
        grid-template-columns: 1fr auto;
    }

    .back-link {
        padding: 0 10px;
    }

    .nav-counter {
        padding-right: 10px;
    }

    .metaball-stage {
        min-height: 580px;
    }

    .hero-copy {
        top: 105px;
        left: 22px;
        width: calc(100% - 44px);
    }

    .eyebrow {
        margin-bottom: 15px;
    }

    .hero-copy h1 {
        font-size: clamp(4rem, 21vw, 7rem);
    }

    .hero-copy h1 em {
        margin-left: 0.12em;
    }

    .intro {
        width: min(350px, 84%);
        margin-top: 28px;
        font-size: 0.82rem;
        line-height: 1.75;
    }

    .field-note,
    .edge-label {
        display: none;
    }

    .interaction-dock {
        right: 18px;
        bottom: max(92px, calc(env(safe-area-inset-bottom) + 84px));
        left: 18px;
    }

    .live-state {
        min-width: 0;
        flex: 1;
        min-height: 56px;
        padding: 8px 13px;
    }

    .scatter-button {
        min-width: 116px;
        min-height: 56px;
        padding: 0 13px;
    }

    .next-link {
        right: 18px;
        bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px));
        left: 18px;
        min-width: 0;
        min-height: 58px;
    }

    .field-grid {
        background-size: 54px 54px;
        mask-image: radial-gradient(circle at 60% 58%, #000 0%, transparent 75%);
    }
}

@media (max-width: 440px) {
    .intro {
        width: 94%;
    }

    .live-state small {
        font-size: 0.52rem;
        letter-spacing: 0.03em;
    }

    .scatter-button {
        min-width: 54px;
        width: 54px;
        justify-content: center;
    }

    .scatter-button span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }
}

@media (max-height: 680px) and (orientation: landscape) {
    .metaball-stage {
        height: 100svh;
        min-height: 100svh;
    }

    .hero-copy {
        top: 94px;
        width: min(460px, 44vw);
    }

    .eyebrow {
        margin-bottom: 12px;
    }

    .hero-copy h1 {
        font-size: clamp(3.8rem, 9vw, 7rem);
    }

    .intro {
        display: none;
    }

    .field-note {
        top: 100px;
    }

    .interaction-dock,
    .next-link {
        bottom: max(12px, env(safe-area-inset-bottom));
    }

    .edge-label {
        display: none;
    }
}

@media (max-width: 760px) and (max-height: 680px) and (orientation: landscape) {
    .interaction-dock {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    #gooey-canvas,
    .pointer-orbit {
        display: none;
    }

    .is-live .static-field {
        opacity: 1;
    }
}
