:root {
    --bg: #040816;
    --bg-soft: rgba(255, 255, 255, 0.04);
    --panel: rgba(9, 14, 30, 0.82);
    --panel-strong: rgba(11, 18, 36, 0.94);
    --border: rgba(148, 163, 184, 0.14);
    --text: #eff6ff;
    --text-dim: #9aa8c7;
    --line: rgba(99, 102, 241, 0.24);
    --primary: #6d7cff;
    --secondary: #14d3ff;
    --accent: #7c3aed;
    --success: #57f2c0;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Plus Jakarta Sans", sans-serif;
    background:
        radial-gradient(circle at 15% 20%, rgba(109, 124, 255, 0.16), transparent 28%),
        radial-gradient(circle at 85% 15%, rgba(20, 211, 255, 0.12), transparent 24%),
        linear-gradient(180deg, #07101f 0%, #040816 58%, #05070f 100%);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

.page-noise,
.grid-halo,
.orb {
    position: fixed;
    pointer-events: none;
}

.page-noise {
    inset: 0;
    opacity: 0.08;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, black 35%, transparent 88%);
}

.grid-halo {
    width: 60vw;
    height: 60vw;
    left: 50%;
    top: 16rem;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(124, 58, 237, 0.18) 0%, transparent 70%);
    filter: blur(80px);
    opacity: 0.7;
    z-index: -1;
}

.orb {
    border-radius: 999px;
    filter: blur(80px);
    z-index: -1;
}

.orb-one {
    width: 20rem;
    height: 20rem;
    top: 5rem;
    right: -6rem;
    background: rgba(109, 124, 255, 0.18);
}

.orb-two {
    width: 18rem;
    height: 18rem;
    left: -5rem;
    bottom: 8rem;
    background: rgba(20, 211, 255, 0.12);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(18px);
    background: rgba(4, 8, 22, 0.6);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    min-height: 4.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo,
.back-link {
    text-decoration: none;
}

.logo {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--text);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-dim);
    font-size: 0.92rem;
    font-weight: 600;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--text);
}

main {
    padding-bottom: 8rem;
}

.hero-shell,
.mission-band,
.tracks-section,
.problems-section,
.closing-band {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
}

.hero-shell {
    padding: 6rem 0 3rem;
}

.eyebrow,
.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.8rem;
    border: 1px solid rgba(109, 124, 255, 0.24);
    background: rgba(109, 124, 255, 0.08);
    color: #c7d2fe;
    border-radius: 999px;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    font-weight: 700;
}

.hero-shell h1,
.section-heading h2,
.mission-copy h2,
.closing-copy h2 {
    letter-spacing: 0;
    line-height: 0.98;
}

.hero-shell h1 {
    margin-top: 1.5rem;
    max-width: 9ch;
    font-size: clamp(3.4rem, 8vw, 7rem);
    background: linear-gradient(180deg, #ffffff 0%, #d7e3ff 38%, #7dd3fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-copy {
    max-width: 48rem;
    margin-top: 1.5rem;
    font-size: clamp(1.05rem, 1.7vw, 1.3rem);
    color: var(--text-dim);
}

.hero-metrics {
    margin-top: 2.5rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.metric-card,
.mission-panel,
.track-card,
.problem-card {
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025));
    box-shadow: var(--shadow);
}

.metric-card {
    padding: 1.3rem;
    border-radius: 20px;
    min-height: 11.5rem;
}

.metric-label {
    display: block;
    color: #7dd3fc;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.metric-card strong {
    display: block;
    margin-top: 0.85rem;
    font-size: 1.15rem;
    font-weight: 700;
}

.metric-card p {
    margin-top: 0.8rem;
    color: var(--text-dim);
    font-size: 0.96rem;
}

.mission-band {
    margin-top: 3rem;
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
    gap: 1.5rem;
    align-items: start;
}

.mission-copy {
    padding-top: 1rem;
}

.mission-copy h2,
.section-heading h2,
.closing-copy h2 {
    margin-top: 1rem;
    font-size: clamp(2rem, 4vw, 3.4rem);
    max-width: 12ch;
}

.mission-copy p,
.closing-copy p {
    margin-top: 1.25rem;
    max-width: 40rem;
    color: var(--text-dim);
    font-size: 1rem;
}

.mission-panel {
    border-radius: 28px;
    padding: 1.25rem;
    background:
        linear-gradient(180deg, rgba(16, 23, 43, 0.94), rgba(8, 12, 24, 0.98)),
        radial-gradient(circle at top, rgba(109, 124, 255, 0.18), transparent 45%);
}

.panel-header,
.panel-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.panel-header {
    color: var(--text-dim);
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.neural-grid {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.7rem;
}

.cell {
    appearance: none;
    aspect-ratio: 1;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
        radial-gradient(circle at top, rgba(109, 124, 255, 0.18), transparent 65%);
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 0.7rem;
    color: #a5b4fc;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease, background 0.28s ease;
}

.cell:hover,
.cell.active {
    transform: translateY(-3px);
    border-color: rgba(125, 211, 252, 0.5);
    background:
        linear-gradient(180deg, rgba(125, 211, 252, 0.18), rgba(109, 124, 255, 0.08)),
        radial-gradient(circle at top, rgba(20, 211, 255, 0.26), transparent 70%);
    box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.18), 0 12px 30px rgba(18, 33, 68, 0.35);
    color: white;
}

.panel-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    align-items: end;
}

.footer-label {
    display: block;
    color: var(--text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

#activeNodeLabel {
    display: block;
    margin-top: 0.35rem;
    font-size: 1.2rem;
}

#activeNodeDesc {
    max-width: 26rem;
    color: var(--text-dim);
    font-size: 0.95rem;
}

.tracks-section,
.problems-section,
.closing-band {
    margin-top: 6rem;
}

.section-heading {
    max-width: 42rem;
}

.tracks-grid {
    margin-top: 1.8rem;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.track-card {
    padding: 1.35rem;
    border-radius: 20px;
    min-height: 15rem;
}

.track-index {
    display: inline-flex;
    margin-bottom: 1.4rem;
    color: #7dd3fc;
    font-size: 0.9rem;
    font-weight: 700;
}

.track-card h3,
.problem-card h3 {
    font-size: 1.15rem;
    line-height: 1.15;
}

.track-card p,
.problem-card p {
    margin-top: 0.9rem;
    color: var(--text-dim);
    font-size: 0.95rem;
}

.problems-grid {
    margin-top: 1.8rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.problem-card {
    padding: 1.35rem;
    border-radius: 22px;
    display: grid;
    grid-template-columns: 4.2rem 1fr;
    gap: 1rem;
    align-items: start;
}

.problem-number {
    width: 4.2rem;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 16px;
    border: 1px solid rgba(125, 211, 252, 0.22);
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.14), rgba(109, 124, 255, 0.07));
    color: white;
    font-weight: 800;
    font-size: 1.15rem;
}

.closing-band {
    padding-bottom: 3rem;
}

.closing-copy {
    padding: 2rem 0 0;
    max-width: 54rem;
}

.primary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
    padding: 0.9rem 1.3rem;
    border-radius: 999px;
    border: 1px solid rgba(125, 211, 252, 0.28);
    background: linear-gradient(180deg, rgba(109, 124, 255, 0.18), rgba(20, 211, 255, 0.12));
    color: white;
    text-decoration: none;
    font-weight: 700;
}

.chat-widget {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chat-button {
    width: 64px;
    height: 64px;
    border: 1px solid rgba(125, 211, 252, 0.28);
    border-radius: 50%;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    color: white;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 18px 40px rgba(57, 73, 171, 0.34);
}

.chat-window {
    position: absolute;
    right: 0;
    bottom: 80px;
    width: min(390px, 92vw);
    height: 550px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: rgba(6, 10, 20, 0.95);
    backdrop-filter: blur(22px);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(18px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    overflow: hidden;
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.chat-header-title strong,
.chat-header-title span {
    display: block;
}

.chat-header-title span {
    margin-top: 0.2rem;
    color: var(--text-dim);
    font-size: 0.76rem;
}

.chat-close-button {
    background: transparent;
    color: white;
    border: 0;
    cursor: pointer;
    font-size: 1.5rem;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.message {
    max-width: 85%;
    padding: 0.8rem 0.95rem;
    border-radius: 18px;
    line-height: 1.45;
    font-size: 0.92rem;
}

.message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
}

.message.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
}

.message.error {
    align-self: center;
    background: rgba(220, 38, 38, 0.14);
    border: 1px solid rgba(248, 113, 113, 0.18);
    color: #fca5a5;
}

.message.bot p {
    margin-bottom: 0.45rem;
}

.message.bot p:last-child {
    margin-bottom: 0;
}

.message.bot ul,
.message.bot ol {
    margin-left: 1.1rem;
}

.typing-indicator {
    display: none;
    color: var(--text-dim);
    font-size: 0.8rem;
    font-style: italic;
}

.chat-input-area {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.chat-input-area input {
    flex: 1;
    min-width: 0;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: white;
    padding: 0.85rem 0.95rem;
    outline: none;
}

.send-btn {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: 0;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    color: white;
    display: grid;
    place-items: center;
    cursor: pointer;
}

@media (max-width: 1080px) {
    .hero-metrics,
    .tracks-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mission-band {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .hero-shell {
        padding-top: 4rem;
    }

    .hero-metrics,
    .tracks-grid,
    .problems-grid {
        grid-template-columns: 1fr;
    }

    .mission-panel {
        padding: 1rem;
    }

    .neural-grid {
        gap: 0.55rem;
    }

    .cell {
        padding: 0.5rem;
        border-radius: 12px;
        font-size: 0.72rem;
    }

    .panel-footer {
        flex-direction: column;
        align-items: start;
    }

    .problem-card {
        grid-template-columns: 1fr;
    }

    .problem-number {
        width: 3.6rem;
    }
}