/* Global Branding Utilities */
.chamfer {
    clip-path: polygon(0 10px, 10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
}

.glow-cyan {
    text-shadow: 0 0 10px rgba(74, 157, 156, 0.5);
}

.glow-orange {
    text-shadow: 0 0 10px rgba(242, 140, 56, 0.5);
}

.dashed-border {
    background-image: linear-gradient(to right, #4A9D9C 50%, transparent 50%);
    background-position: bottom;
    background-size: 10px 1px;
    background-repeat: repeat-x;
}

/* Master CRT Overlay */
#crt-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    /* Always on top */
    pointer-events: none;
    /* Let clicks pass through */

    /* Fine Scanlines */
    background: linear-gradient(to bottom,
            rgba(18, 16, 16, 0) 50%,
            rgba(0, 0, 0, 0.15) 50%);
    background-size: 100% 4px;

    /* Vignette & CRT Screen Curve Shadow */
    box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(0, 0, 0, 1);

    /* Continuous Micro-Pulse (Phosphor fade) */
    animation: crtPulse 4s infinite alternate;
}

@keyframes crtPulse {
    0% {
        opacity: 0.95;
    }

    100% {
        opacity: 1;
    }
}



/* Scrollbar Utilities */
.custom-scrollbar::-webkit-scrollbar {
    width: 12px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #0B0F19;
    border-left: 1px solid rgba(74, 157, 156, 0.2);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(74, 157, 156, 0.3);
    border: 2px solid #0B0F19;
}

/* Network Map Utilities */
.rhombus {
    width: 40px;
    height: 40px;
    border: 1px solid #4A9D9C;
    transform: rotate(45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    transition: all 0.3s ease;
}

.rhombus:hover {
    border-color: #F28C38;
    box-shadow: 0 0 10px rgba(242, 140, 56, 0.5);
}

.rhombus>span {
    transform: rotate(-45deg);
    font-size: 10px;
    font-weight: bold;
}

.connection-line {
    stroke-dasharray: 4;
    opacity: 0.3;
}

@keyframes floating {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.floating {
    animation: floating 4s ease-in-out infinite;
}

@keyframes pulse-border {

    0%,
    100% {
        border-color: rgba(242, 140, 56, 0.4);
    }

    50% {
        border-color: rgba(242, 140, 56, 1);
    }
}

.pulsating-orange {
    animation: pulse-border 2s infinite;
}

/* CRT Flicker Animation */
@keyframes crtFlicker {
    0% {
        opacity: 0;
        transform: scaleY(0.95);
    }

    10% {
        opacity: 0.8;
        transform: scaleY(1.02);
        text-shadow: 2px 0 rgba(74, 157, 156, 0.8), -2px 0 rgba(242, 140, 56, 0.8);
    }

    20% {
        opacity: 0.4;
        text-shadow: none;
    }

    30% {
        opacity: 1;
        transform: scaleY(1);
    }

    40% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
        text-shadow: -1px 0 rgba(74, 157, 156, 0.5), 1px 0 rgba(242, 140, 56, 0.5);
    }

    60% {
        opacity: 1;
        text-shadow: none;
    }

    100% {
        opacity: 1;
    }
}

.crt-flicker {
    animation: crtFlicker 0.3s ease-out forwards;
}

/* Cursor Blink Animation */
@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.cursor-blink {
    animation: blink 1s step-end infinite;
    display: inline-block;
    vertical-align: bottom;
}

/* Global Random Glitch Animation */
@keyframes randomGlitch {
    0% {
        transform: translate(0) skew(0deg);
        opacity: 1;
    }

    2% {
        transform: translate(-2px, 1px) skew(2deg);
        filter: hue-rotate(90deg);
        opacity: 0.9;
    }

    4% {
        transform: translate(2px, -1px) skew(-2deg);
        filter: hue-rotate(-90deg);
        opacity: 0.9;
    }

    6% {
        transform: translate(0) skew(0deg);
        filter: none;
        opacity: 1;
        text-shadow: 2px 0 rgba(74, 157, 156, 0.8), -2px 0 rgba(242, 140, 56, 0.8);
    }

    8% {
        transform: translate(0) skew(0deg);
        text-shadow: none;
    }

    10% {
        transform: translate(1px, 1px);
        opacity: 0.8;
    }

    12% {
        transform: translate(0);
        opacity: 1;
    }

    100% {
        transform: translate(0);
        opacity: 1;
    }
}

.random-glitch-active {
    animation: randomGlitch 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* --- RED ALARM EASTER EGG --- */

/* 1. Global Color Shift */
body.red-alert-active #app-content,
body.red-alert-active aside {
    filter: hue-rotate(-150deg) saturate(1.5);
    transition: filter 0.1s ease-in-out;
}

/* 2. Intense Vignette on CRT Overlay */
body.red-alert-active #crt-overlay {
    box-shadow: inset 0 0 150px rgba(231, 76, 60, 0.6), inset 0 0 40px rgba(231, 76, 60, 0.9);
    animation: alarmPulse 0.3s infinite alternate;
}

@keyframes alarmPulse {
    0% {
        opacity: 0.8;
    }

    100% {
        opacity: 1;
    }
}

/* 3. Medium Continuous Glitch for the Body */
@keyframes severeGlitch {
    0% {
        transform: translate(0) skew(0deg);
    }

    20% {
        transform: translate(-2px, 1px) skew(0.5deg);
        filter: contrast(1.1);
    }

    40% {
        transform: translate(2px, -1px) skew(-1deg);
        opacity: 0.9;
    }

    60% {
        transform: translate(-1px, 2px) skew(0.5deg);
        filter: contrast(1);
    }

    80% {
        transform: translate(1px, -1px) skew(-0.5deg);
        opacity: 0.95;
    }

    100% {
        transform: translate(0) skew(0deg);
    }
}

/* Prevent clicks during chaos */
body.red-alert-active {
    animation: severeGlitch 0.15s infinite;
    pointer-events: none;
    user-select: none;
}