:root {
    --space-0: #03050d;
    --space-1: #080d1c;
    --space-2: #101a35;

    --panel: rgba(10, 18, 40, .72);
    --panel-strong: rgba(13, 25, 54, .88);
    --line: rgba(126, 220, 255, .20);
    --line-hot: rgba(126, 220, 255, .58);

    --text: #f4f8ff;
    --muted: #aebbd3;

    --cyan: #73e8ff;
    --violet: #b58cff;
    --green: #8dffbf;
    --gold: #ffd77a;

    --radius: 22px;
    --shadow:
        0 24px 70px rgba(0,0,0,.38),
        0 0 40px rgba(80,180,255,.06);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--space-0);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background:
        radial-gradient(
            circle at 18% 12%,
            rgba(71, 122, 255, .18),
            transparent 30%
        ),
        radial-gradient(
            circle at 84% 22%,
            rgba(168, 85, 247, .13),
            transparent 27%
        ),
        radial-gradient(
            circle at 55% 90%,
            rgba(0, 229, 255, .08),
            transparent 32%
        ),
        linear-gradient(
            160deg,
            var(--space-0),
            var(--space-1) 48%,
            #050816
        );

    overflow-x: hidden;
}

/* STAR FIELD */

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -2;
}

body::before {
    opacity: .7;

    background-image:
        radial-gradient(circle, rgba(255,255,255,.75) 1px, transparent 1.3px),
        radial-gradient(circle, rgba(115,232,255,.65) 1px, transparent 1.2px),
        radial-gradient(circle, rgba(181,140,255,.55) 1px, transparent 1.2px);

    background-size:
        83px 83px,
        137px 137px,
        211px 211px;

    background-position:
        11px 17px,
        43px 61px,
        97px 23px;

    animation: starDrift 90s linear infinite;
}

body::after {
    z-index: -1;
    opacity: .22;

    background:
        linear-gradient(
            rgba(115,232,255,.08) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(115,232,255,.08) 1px,
            transparent 1px
        );

    background-size: 64px 64px;

    mask-image:
        linear-gradient(
            to bottom,
            transparent,
            black 28%,
            black 82%,
            transparent
        );
}

/* MAIN SHELL */

.shell,
main {
    width: min(1180px, calc(100% - 32px));
    margin-inline: auto;
}

main {
    padding-bottom: 40px;
}

/* BRAND HEADER */

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    width: fit-content;
    padding: 20px 0;
    color: var(--text);
    text-decoration: none;
}

.brand img {
    width: 54px;
    height: 54px;
    object-fit: contain;

    filter:
        drop-shadow(0 0 10px rgba(115,232,255,.22))
        drop-shadow(0 0 24px rgba(181,140,255,.12));

    transition:
        transform .25s ease,
        filter .25s ease;
}

.brand:hover img {
    transform: rotate(-3deg) scale(1.06);

    filter:
        drop-shadow(0 0 14px rgba(115,232,255,.42))
        drop-shadow(0 0 30px rgba(181,140,255,.22));
}

.brand strong {
    display: block;
    letter-spacing: .02em;
}

.brand span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: .82rem;
}

/* TYPOGRAPHY */

h1,
h2,
h3 {
    margin-top: 0;
}

h1 {
    font-size: clamp(2rem, 5vw, 4.3rem);
    line-height: .98;
    letter-spacing: -.045em;

    text-shadow:
        0 0 28px rgba(115,232,255,.12);
}

h2 {
    font-size: .82rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--cyan);
}

p {
    line-height: 1.7;
}

.small {
    color: var(--muted);
    line-height: 1.65;
}

/* PANELS */

.panel {
    position: relative;
    margin: 18px 0;
    padding: clamp(20px, 4vw, 34px);

    border: 1px solid var(--line);
    border-radius: var(--radius);

    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,.035),
            transparent 45%
        ),
        var(--panel);

    box-shadow: var(--shadow);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    overflow: hidden;

    transition:
        transform .22s ease,
        border-color .22s ease,
        box-shadow .22s ease;
}

.panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 24px;
    right: 24px;
    height: 1px;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(115,232,255,.75),
            rgba(181,140,255,.55),
            transparent
        );
}

.panel:hover {
    transform: translateY(-2px);
    border-color: rgba(115,232,255,.34);

    box-shadow:
        0 28px 80px rgba(0,0,0,.42),
        0 0 45px rgba(115,232,255,.07);
}

/* BOUNDARY / STATUS */

.boundary {
    border-color: rgba(141,255,191,.22);
}

.boundary h2 {
    color: var(--green);
}

/* NAVIGATION CARDS */

.nav-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.nav-card {
    position: relative;
    display: block;
    min-height: 104px;
    padding: 18px;

    border: 1px solid var(--line);
    border-radius: 17px;

    color: var(--text);
    text-decoration: none;

    background:
        linear-gradient(
            145deg,
            rgba(115,232,255,.045),
            rgba(181,140,255,.025)
        );

    overflow: hidden;

    transition:
        transform .2s ease,
        border-color .2s ease,
        background .2s ease,
        box-shadow .2s ease;
}

.nav-card::after {
    content: "";
    position: absolute;
    width: 90px;
    height: 90px;
    right: -45px;
    bottom: -45px;

    border: 1px solid rgba(115,232,255,.16);
    border-radius: 50%;

    transition:
        transform .35s ease,
        border-color .2s ease;
}

.nav-card:hover {
    transform: translateY(-4px);
    border-color: var(--line-hot);

    background:
        linear-gradient(
            145deg,
            rgba(115,232,255,.09),
            rgba(181,140,255,.055)
        );

    box-shadow:
        0 15px 35px rgba(0,0,0,.28),
        0 0 24px rgba(115,232,255,.08);
}

.nav-card:hover::after {
    transform: scale(1.45);
    border-color: rgba(181,140,255,.30);
}

.nav-card strong {
    position: relative;
    z-index: 1;
    display: block;
    font-size: 1.02rem;
}

.nav-card span {
    position: relative;
    z-index: 1;
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: .84rem;
    line-height: 1.45;
}

/* FLOW / SYSTEM NODES */

.node {
    position: relative;
    margin: 10px 0;
    padding: 13px 16px;

    border: 1px solid rgba(115,232,255,.18);
    border-radius: 14px;

    color: #eafaff;

    background:
        linear-gradient(
            90deg,
            rgba(115,232,255,.07),
            rgba(181,140,255,.035)
        );

    box-shadow:
        inset 3px 0 0 rgba(115,232,255,.45);
}

/* LINKS */

a {
    color: var(--cyan);
}

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

/* FOOTER */

.footer {
    margin: 28px 0 12px;
    padding: 18px;

    border-top: 1px solid rgba(115,232,255,.14);

    color: var(--muted);
    text-align: center;
    font-size: .78rem;
    letter-spacing: .035em;
}

/* MOTION */

@keyframes starDrift {
    from {
        transform: translate3d(0,0,0);
    }

    to {
        transform: translate3d(-83px,83px,0);
    }
}

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

@media (max-width: 640px) {
    .shell,
    main {
        width: min(100% - 20px, 1180px);
    }

    .panel {
        border-radius: 18px;
    }

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

/* ================================================
   EXISTING WORKBENCH MARKUP COMPATIBILITY
================================================ */

.surface-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}


/* ================================================
   LIGHT ORBITAL MODE
================================================ */

[data-theme="light"] {
    --space-0: #eaf2f8;
    --space-1: #dce8f2;
    --space-2: #cbdbea;

    --panel: rgba(255,255,255,.76);
    --panel-strong: rgba(248,252,255,.92);

    --line: rgba(37,99,135,.18);
    --line-hot: rgba(2,132,199,.48);

    --text: #102033;
    --muted: #53667a;

    --cyan: #0369a1;
    --violet: #7251b5;
    --green: #087f5b;
    --gold: #9a6700;

    --shadow:
        0 24px 60px rgba(38,60,80,.14),
        0 0 32px rgba(2,132,199,.05);
}

[data-theme="light"] body {
    background:
        radial-gradient(
            circle at 18% 12%,
            rgba(56,189,248,.18),
            transparent 30%
        ),
        radial-gradient(
            circle at 84% 22%,
            rgba(139,92,246,.09),
            transparent 27%
        ),
        radial-gradient(
            circle at 55% 90%,
            rgba(14,165,233,.08),
            transparent 32%
        ),
        linear-gradient(
            160deg,
            var(--space-0),
            var(--space-1) 48%,
            #f5f9fc
        );
}

[data-theme="light"] body::before {
    opacity: .24;
}

[data-theme="light"] .node {
    color: var(--text);
}

[data-theme="light"] .brand-mark {
    background: rgba(255,255,255,.42);
}


/* ================================================
   TOPBAR + THEME CONTROL
================================================ */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}

.theme-toggle {
    border: 1px solid var(--line);
    border-radius: 999px;

    padding: 9px 14px;

    color: var(--text);

    background:
        linear-gradient(
            145deg,
            rgba(115,232,255,.07),
            rgba(181,140,255,.035)
        ),
        var(--panel);

    cursor: pointer;

    box-shadow:
        0 8px 24px rgba(0,0,0,.12);

    transition:
        transform .18s ease,
        border-color .18s ease,
        box-shadow .18s ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
    border-color: var(--line-hot);

    box-shadow:
        0 10px 28px rgba(0,0,0,.18),
        0 0 20px rgba(115,232,255,.07);
}


/* ================================================
   MOBILE COMPATIBILITY
================================================ */

@media (max-width: 640px) {
    .surface-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
    }
}

