:root { --matrix: #00ff41; --bg: #000; }

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    overflow: hidden;
    font-family: 'Courier New', monospace;
    color: var(--matrix);
}

/* Shader-bakgrund */
#shader-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
}

/* AVATAR / GUARDIAN — MYCKET MER SUBTIL */
.avatar-guardian {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 2;
    pointer-events: none;
    opacity: 0.68;                    /* ← Mycket lägre opacitet */
    filter: 
        grayscale(30%)
        sepia(75%)
        hue-rotate(92deg)
        brightness(1.05)
        contrast(1.15)
        saturate(1.15);
    transition: opacity 30s ease, filter 30s ease;
}

/* Starkare vinjett så videon inte tar över */
.avatar-guardian::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: 
        radial-gradient(ellipse at center, 
            transparent 12%, 
            rgba(0, 0, 0, 0.85) 100%),
        linear-gradient(
            rgba(0, 28, 0, 0.6),
            rgba(0, 18, 0, 0.78)
        );
    pointer-events: none;
    z-index: 3;
}

#guardian-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    will-change: transform;
}

/* Scan-lines */
.hologram-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, 0.18) 2px,
        rgba(0, 0, 0, 0.18) 4px
    );
    pointer-events: none;
    z-index: 4;
}

/* Original alert */
.guardian-alert {
    opacity: 0.9 !important;
    filter: 
        grayscale(20%)
        sepia(80%)
        hue-rotate(-20deg)
        brightness(1.0)
        contrast(1.5)
        saturate(3) !important;
}

/* RÖD ALARM-EFFEKT */
.alarm-mode {
    animation: alarmPulse 0.55s infinite alternate !important;
}

@keyframes alarmPulse {
    from {
        filter: hue-rotate(0deg) saturate(1) brightness(1);
        box-shadow: 0 0 40px rgba(255, 0, 0, 0.7);
    }
    to {
        filter: hue-rotate(-20deg) saturate(2.8) brightness(1.4);
        box-shadow: 0 0 90px rgba(255, 40, 40, 0.95),
                    inset 0 0 70px rgba(255, 0, 0, 0.6);
    }
}

.guardian-alarm {
    filter: 
        hue-rotate(-30deg) 
        saturate(3.2) 
        brightness(1.55) 
        contrast(1.45) !important;
    animation: alarmVideo 0.4s infinite alternate;
}

@keyframes alarmVideo {
    from { opacity: 0.24; }
    to   { opacity: 0.65; }
}

/* INTERFACE */
.interface-layer {
    position: relative;
    z-index: 10;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    pointer-events: none;
}

/* TERMINAL */
.main-frame {
    align-self: center;
    background: rgba(0, 15, 0, 0.55);
    border-left: 3px solid var(--matrix);
    padding: 40px;
    backdrop-filter: blur(12px);
    pointer-events: auto;
    width: 100%;
    max-width: 550px;
    position: relative;
    box-shadow: 
        0 0 40px rgba(0, 255, 65, 0.08),
        inset 0 0 60px rgba(0, 0, 0, 0.3);
}

.divider { height: 1px; background: rgba(0, 255, 65, 0.3); margin: 20px 0; }

.glitch-title {
    font-size: 2.5rem;
    font-weight: bold;
    letter-spacing: 8px;
    animation: textGlitch 5s infinite;
}

.login-section { display: flex; align-items: center; margin-top: 20px; flex-wrap: nowrap; }

.prompt {
    color: var(--matrix);
    margin-right: 10px;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

#terminal-input {
    background: transparent;
    border: none;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: max(1rem, 16px);
    width: 100%;
    outline: none;
    caret-color: var(--matrix);
}

#terminal-output {
    font-size: 0.8rem;
    margin-top: 15px;
    color: #aaa;
    min-height: 1.2rem;
    word-break: break-word;
}

.top-bar, .footer-stats {
    font-size: 0.7rem;
    letter-spacing: 2px;
    opacity: 0.8;
}

.footer-stats { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.data-stream p { margin: 6px 0; font-size: 0.85rem; }
.pulse { animation: pulseAnim 2s infinite; }

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

@keyframes textGlitch {
    0% { transform: skew(0deg); }
    2% { transform: skew(7deg); text-shadow: 2px 0 #ff00ff; }
    4% { transform: skew(-7deg); text-shadow: -2px 0 #00ffff; }
    5% { transform: skew(0deg); text-shadow: none; }
}

@keyframes videoFlicker {
    0%, 95%, 100% { opacity: 0.28; }
    96% { opacity: 0.22; }
    97% { opacity: 0.28; }
    98% { opacity: 0.20; }
    99% { opacity: 0.28; }
}

.avatar-guardian {
    animation: videoFlicker 8s infinite;
}

/* Mobil */
@media (max-width: 768px) {
      .avatar-guardian {
        opacity: 0.80; /* Ännu högre synlighet endast på mobila enheter */
        filter: brightness(1.2);
    }    

    .interface-layer { padding: 12px; }
    .main-frame { padding: 20px 16px; max-width: 100%; }
    .glitch-title { font-size: 1.6rem; letter-spacing: 4px; }
    .prompt { font-size: 0.75rem; margin-right: 6px; }
    #terminal-input { font-size: 16px; }
}