/* --- THEME ROOT CONFIGURATION --- */
:root {
    --bg-main: #161616;         /* Dark Void */
    --text-primary: #edeae5;    /* Platinum */
    --text-muted: #6f6251;      /* Deep Taupe */
    --panel-bg: rgba(31, 33, 28, 0.4); /* Underworld Glass */
    --panel-border: rgba(71, 66, 55, 0.4); /* Dark Lava Border */
    --stream-opacity: 0.05;
    --waterfall-opacity: 0.18;
    --canvas-blend: rgba(22, 22, 22, 0.08);
    
    /* Offline Precision Typography Stacks */
    --font-mono: ui-monospace, 'JetBrains Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
    --font-display: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="light"] {
    --bg-main: #edeae5;         /* Platinum */
    --text-primary: #161616;    /* Dark Void */
    --text-muted: #6f6251;      /* Deep Taupe */
    --panel-bg: rgba(219, 212, 204, 0.4); /* Timberwolf Glass */
    --panel-border: rgba(111, 98, 81, 0.3); /* Deep Taupe Border */
    --stream-opacity: 0.12;
    --waterfall-opacity: 0.25;
    --canvas-blend: rgba(237, 234, 229, 0.14); /* FIXED: Increased opacity prevents trailing text build-up */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Explicit transition target lists to stop canvas blend-tracking delays */
body, #theme-toggle, .hud-container, .corner, .hud-header, .hud-footer, #holo-target {
    transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}

body {
    font-family: var(--font-mono);
    background-color: var(--bg-main);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    perspective: 1000px;
}

/* --- MINIMALIST THEME TOGGLE BUTTON --- */
#theme-toggle {
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: 10;
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text-muted);
    font-family: var(--font-mono);
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    cursor: pointer;
    letter-spacing: 0.1em;
    border-radius: 4px;
}
#theme-toggle:hover {
    color: var(--text-primary);
    background-color: var(--panel-bg);
}

/* Screen scanline overlay */
.scanlines {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    background: linear-gradient(
        rgba(22, 22, 22, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    opacity: 0.25;
}

/* --- PASSIVE SCROLLING BACKGROUND TEXT --- */
.holo-stream {
    position: absolute;
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--text-primary);
    opacity: var(--stream-opacity);
    letter-spacing: 0.12em;
    pointer-events: none;
    z-index: 1;
    user-select: none;
}
.stream-top { top: 12%; animation: scrollText 45s linear infinite; }
.stream-bottom { bottom: 12%; animation: scrollText 60s linear infinite reverse; }

@keyframes scrollText {
    0% { transform: translateX(0); }
    100% { transform: translateX(-33.33%); }
}

/* --- MID-SECTION VERTICAL DATA WATERFALL --- */
#waterfall-canvas {
    position: absolute;
    top: 15%;    
    bottom: 15%; 
    left: 0;
    width: 100vw;
    height: 70vh;
    z-index: 1;
    pointer-events: none;
    opacity: var(--waterfall-opacity); 
    mask-image: radial-gradient(circle, black 40%, transparent 80%);
    -webkit-mask-image: radial-gradient(circle, black 40%, transparent 80%);
}

/* --- MAIN CONTAINER HUD --- */
.hud-container {
    position: relative;
    z-index: 2;
    width: 90vw;
    max-width: 680px;
    padding: 2.5rem;
    background: var(--panel-bg); 
    border: 1px solid var(--panel-border); 
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px); 
    transform: rotateX(4deg); 
    animation: holoStartup 0.6s ease-out, holoFlicker 5s linear infinite 1s;
}

/* Corner accent brackets */
.corner {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid var(--panel-border);
}
.tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.tr { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.bl { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.br { bottom: -1px; right: -1px; border-left: none; border-top: none; }

/* Structural HUD headers */
.hud-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}
.status-indicator {
    letter-spacing: 0.05em;
    color: var(--text-primary);
    animation: pulse 2s infinite alternate;
}

.hud-content {
    min-height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
}

.prefix {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.dynamic-wrapper {
    display: block;
    width: 100%;
    overflow: hidden;
}

#holo-target {
    font-family: var(--font-display);
    font-size: 2.6rem;
    font-weight: 300; 
    letter-spacing: -0.01em;
    color: var(--text-primary);
    display: inline-block;
}

.hud-footer {
    margin-top: 1.5rem;
    font-size: 0.68rem;
    border-top: 1px solid var(--panel-border);
    padding-top: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
}

/* Animations */
@keyframes holoStartup {
    0% { opacity: 0; transform: scaleY(0.01) rotateX(10deg); }
    80% { opacity: 0.8; transform: scaleY(1.05) rotateX(4deg); }
    100% { opacity: 1; transform: scaleY(1) rotateX(4deg); }
}
@keyframes holoFlicker {
    0%, 19.999%, 22%, 62.999%, 64%, 64.999%, 70%, 100% { opacity: 1; }
    20%, 21.999%, 63%, 63.999%, 65%, 69.999% { opacity: 0.95; }
}
@keyframes pulse {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

@media (max-width: 640px) {
    #holo-target { font-size: 1.9rem; }
    .hud-header { flex-direction: column; gap: 0.5rem; }
}
