:root {
    --deep-void: #070E09;
    --canopy-dark: #0D1F12;
    --dust-overlay: #1A2B1E;
    --phosphor-green: #39B866;
    --faded-signal: #2D5A3E;
    --transmission-pulse: #5EE89A;
    --warning-amber: #D4A843;
    --critical-red: #C94040;
    color-scheme: dark;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--deep-void);
    color: var(--phosphor-green);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.2vw, 0.95rem);
    line-height: 1.75;
    letter-spacing: 0.025em;
    overflow: hidden;
    height: 100vh;
}

/* Terminal chrome bar */
.terminal-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: var(--canopy-dark);
    border-bottom: 1px solid var(--dust-overlay);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 100;
}

.terminal-dots {
    display: flex;
    gap: 6px;
    margin-right: 16px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-red {
    background: var(--critical-red);
    animation: dotPulse 3s ease-in-out infinite;
}

.dot-amber {
    background: var(--warning-amber);
}

.dot-green {
    background: var(--phosphor-green);
}

@keyframes dotPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.terminal-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--transmission-pulse);
    flex: 1;
    text-align: center;
}

/* Progress bar */
.progress-bar {
    position: fixed;
    right: 0;
    top: 32px;
    width: 2px;
    height: 0%;
    background: var(--phosphor-green);
    z-index: 100;
    transition: height 0.3s ease-out;
    box-shadow: 0 0 6px rgba(57, 184, 102, 0.4);
}

/* Terminal body */
.terminal-body {
    margin-top: 32px;
    height: calc(100vh - 32px);
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    border: 1px solid var(--dust-overlay);
    border-top: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.terminal-body::-webkit-scrollbar {
    display: none;
}

/* Spreads */
.spread {
    min-height: calc(100vh - 32px);
    scroll-snap-align: start;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

/* Spread columns */
.spread-col {
    padding: 40px 32px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.data-feed {
    border-right: 1px solid var(--dust-overlay);
}

.data-feed-final {
    display: flex;
    align-items: center;
    justify-content: center;
}

.visual-artifact {
    position: relative;
    overflow: hidden;
}

/* Spread headers */
.spread-header {
    font-family: 'Major Mono Display', monospace;
    font-size: clamp(1.2rem, 2.8vw, 2.2rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--phosphor-green);
    margin-bottom: 2rem;
    text-shadow: 0 0 20px rgba(57, 184, 102, 0.3), 0 0 40px rgba(57, 184, 102, 0.1);
}

.spread-header-warn {
    color: var(--warning-amber);
    text-shadow: 0 0 20px rgba(212, 168, 67, 0.3);
}

/* Hero title */
.hero-title {
    font-family: 'Major Mono Display', monospace;
    font-size: clamp(2rem, 5.5vw, 4.5rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--phosphor-green);
    line-height: 1.15;
    text-shadow: 0 0 20px rgba(57, 184, 102, 0.3), 0 0 40px rgba(57, 184, 102, 0.1);
    margin-bottom: 2rem;
    min-height: 1.2em;
}

/* Log entries */
.log-entry {
    margin-bottom: 1rem;
    max-width: 58ch;
}

.log-prefix {
    color: var(--faded-signal);
}

.log-corrupt {
    opacity: 0.7;
}

.text-warn {
    color: var(--warning-amber);
}

/* Spread dividers */
.spread-divider {
    border-top: 1px dashed var(--faded-signal);
    padding: 4px 16px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--dust-overlay);
    height: 24px;
    display: flex;
    align-items: center;
    scroll-snap-align: none;
}

/* Blinking cursor */
.blink-cursor {
    animation: cursorBlink 1s step-end infinite;
    color: var(--phosphor-green);
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Bokeh star field */
.bokeh-field {
    position: absolute;
    inset: 0;
}

.bokeh-fading {
    opacity: 0.3;
}

.bokeh-point {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

/* Glyph grid */
.glyph-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 24px;
    padding: 20px;
    height: 100%;
    align-content: center;
}

.glyph-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.glyph-svg {
    width: 80px;
    height: 80px;
    transition: filter 0.4s ease;
}

.glyph-cell:hover .glyph-svg {
    filter: drop-shadow(0 0 8px rgba(57, 184, 102, 0.4));
}

/* Star map */
.star-map {
    margin-top: 24px;
}

.star-map-svg {
    width: 100%;
    max-width: 300px;
    height: auto;
}

.map-node {
    transition: r 0.3s ease;
    cursor: crosshair;
}

.map-node:hover {
    filter: drop-shadow(0 0 6px rgba(57, 184, 102, 0.6));
}

/* Waypoints */
.waypoints {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 20px 32px;
    height: 100%;
    justify-content: center;
}

.waypoint {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 0;
    border-left: 1px solid var(--faded-signal);
    padding-left: 20px;
    position: relative;
}

.wp-marker {
    position: absolute;
    left: -5px;
    top: 20px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--phosphor-green);
    box-shadow: 0 0 6px rgba(57, 184, 102, 0.4);
    flex-shrink: 0;
}

.wp-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wp-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    color: var(--phosphor-green);
}

.wp-data {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--faded-signal);
}

/* Static canvas */
#staticCanvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Interference spread */
.spread-interference {
    position: relative;
}

/* Final spread */
.spread-final .data-feed {
    text-align: center;
}

.final-cursor {
    font-size: 2rem;
    text-align: center;
}

/* Stagger animation */
[data-stagger] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

[data-stagger].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Typewrite animation (handled by JS, but base style) */
[data-typewrite] {
    opacity: 0;
}

[data-typewrite].typed {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .spread {
        grid-template-columns: 1fr;
    }

    .spread-col {
        min-height: 50vh;
        padding: 24px 16px;
    }

    .data-feed {
        border-right: none;
        border-bottom: 1px solid var(--dust-overlay);
    }

    .hero-title {
        font-size: clamp(1.4rem, 5vw, 2.5rem);
    }

    .glyph-grid {
        gap: 12px;
        padding: 12px;
    }

    .waypoints {
        padding: 16px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .dot-red {
        animation: none;
        opacity: 0.8;
    }

    .blink-cursor {
        animation: none;
    }

    [data-stagger] {
        opacity: 1;
        transform: none;
        transition: none;
    }

    [data-typewrite] {
        opacity: 1;
    }

    .bokeh-point {
        animation: none !important;
    }

    .terminal-body {
        scroll-snap-type: none;
    }
}
