html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #05090c;
}

body {
    overflow: hidden;
    font-family: Consolas, "Lucida Console", "Courier New", monospace;
    font-size: 18px;
    color: #c5d4c8;
}

* {
    box-sizing: border-box;
}


/* =========================================================
   SCREEN LAYOUT
   ========================================================= */

.terminal-screen {
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr);
    background: radial-gradient( circle at 35% 50%, #091014 0%, #05090c 72% );
    color: #c5d4c8;
    overflow: hidden;
}


/* =========================================================
   MAIN TERMINAL
   ========================================================= */

.terminal-main {
    position: relative;
    height: 100vh;
    padding: 32px;
    overflow-y: auto;
    overflow-x: hidden;
    cursor: text;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

    .terminal-main::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }


/* =========================================================
   GLOBAL CRT SCANLINES
   ========================================================= */

.terminal-screen::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient( 0deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.018) 1px, transparent 1px, transparent 3px );
    z-index: 100;
}


/* =========================================================
   TERMINAL OUTPUT
   ========================================================= */

.terminal-output {
    position: relative;
    z-index: 2;
    width: 100%;
}

.terminal-line {
    margin: 0;
    padding: 0;
    min-height: 1.42em;
    white-space: pre-wrap;
    word-break: break-word;
    font: inherit;
    line-height: 1.42;
    color: #c5d4c8;
    background: transparent;
    border: 0;
}

.terminal-line-center {
    width: 100%;
    text-align: center;
}


/* =========================================================
   TERMINAL COLORS
   ========================================================= */

.terminal-normal {
    color: #c5d4c8;
}

.terminal-info {
    color: #f3f5f3;
}

.terminal-system {
    color: #b8ccc0;
}

.terminal-command {
    color: #f4f7f5;
}

.terminal-warning {
    color: #efad43;
    text-shadow: 0 0 5px rgba(239, 173, 67, 0.14);
}

.terminal-error {
    color: #e05d58;
    text-shadow: 0 0 5px rgba(224, 93, 88, 0.16);
}


/* =========================================================
   COMMAND LINE
   ========================================================= */

.terminal-command-line {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: baseline;
    width: 100%;
    line-height: 1.42;
}

.terminal-prompt {
    flex-shrink: 0;
    margin-right: 8px;
    color: #f4f7f5;
    line-height: 1.42;
}


/* =========================================================
   TERMINAL INPUT
   ========================================================= */

.terminal-input-wrapper {
    position: relative;
    display: flex;
    align-items: baseline;
    flex: 1;
    min-width: 0;
    min-height: 1.42em;
    color: #f4f7f5;
    line-height: 1.42;
}

.terminal-input-display {
    display: inline-block;
    white-space: pre;
    color: #f4f7f5;
    font: inherit;
    line-height: inherit;
}

.terminal-real-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    color: transparent;
    background: transparent;
    border: none;
    outline: none;
    font: inherit;
    caret-color: transparent;
    cursor: text;
}


/* =========================================================
   TERMINAL CURSOR
   ========================================================= */

.terminal-cursor-character {
    display: inline-block;
    min-width: 0.60em;
    color: #05090c;
    background: #ffffff;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.55);
    animation: terminal-cursor-blink 1s steps(1) infinite;
}

@keyframes terminal-cursor-blink {
    0%, 48% {
        color: #05090c;
        background: #ffffff;
        box-shadow: 0 0 4px rgba(255, 255, 255, 0.55);
    }

    49%, 100% {
        color: #f4f7f5;
        background: transparent;
        box-shadow: none;
    }
}


/* =========================================================
   RIGHT SIDEBAR
   ========================================================= */

.terminal-sidebar {
    position: relative;
    height: 100vh;
    padding: 22px 24px 24px 24px;
    overflow: hidden;
    border-left: 1px solid rgba(197, 212, 200, 0.28);
    background: linear-gradient( 90deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.005) );
}

    .terminal-sidebar::before {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        left: -1px;
        width: 1px;
        box-shadow: 0 0 10px rgba(197, 212, 200, 0.12);
        pointer-events: none;
    }


/* =========================================================
   SCP LOGO
   ========================================================= */

.foundation-logo {
    width: 100%;
    display: flex;
    justify-content: center;
    pointer-events: none;
    user-select: none;
    color: #ffffff;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.95), 0 0 6px rgba(255, 255, 255, 0.45), 0 0 14px rgba(255, 255, 255, 0.18);
}

    .foundation-logo pre {
        margin: 0;
        padding: 0;
        font-family: Consolas, "Lucida Console", "Courier New", monospace;
        font-size: clamp( 5px, 0.38vw, 8px );
        line-height: 1;
        letter-spacing: 0;
        white-space: pre;
        color: #ffffff;
        background: transparent;
        border: 0;
    }


/* =========================================================
   SIDEBAR DIVIDER
   ========================================================= */

.sidebar-divider {
    width: 100%;
    height: 1px;
    margin: 22px 0 18px 0;
    background: rgba(197, 212, 200, 0.30);
    box-shadow: 0 0 6px rgba(197, 212, 200, 0.08);
}


/* =========================================================
   NETWORK ACTIVITY
   ========================================================= */

.activity-header {
    color: #f3f5f3;
    font-size: 0.88em;
    letter-spacing: 0.08em;
}

.activity-subheader {
    margin-top: 4px;
    margin-bottom: 18px;
    color: rgba(184, 204, 192, 0.60);
    font-size: 0.67em;
    letter-spacing: 0.08em;
}

.activity-log {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: calc( 100vh - 310px );
    overflow: hidden;
    font-size: 0.72em;
    line-height: 1.35;
}

.activity-entry {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    white-space: nowrap;
    animation: activity-appear 180ms ease-out;
}

.activity-time {
    color: rgba(184, 204, 192, 0.45);
}

.activity-message {
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-normal .activity-message {
    color: rgba(197, 212, 200, 0.68);
}

.activity-warning .activity-message {
    color: #d99d3d;
}

.activity-error .activity-message {
    color: #d45754;
    text-shadow: 0 0 5px rgba(212, 87, 84, 0.18);
}

@keyframes activity-appear {
    from {
        opacity: 0;
        transform: translateY(3px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* =========================================================
   ARCHIVE IMAGE FRAME
   ========================================================= */

.terminal-image-frame {
    --archive-image-width: 520px;
    --archive-glitch-shift: 0px;
    --archive-glitch-speed: 180ms;
    --archive-glitch-opacity: 0;
    --archive-red-opacity: 0;
    position: relative;
    display: inline-block;
    width: min( var(--archive-image-width), 100% );
    max-width: 100%;
    margin: 12px 0 18px 0;
    padding: 7px;
    vertical-align: top;
    background: rgba(1, 5, 6, 0.88);
    border: 1px solid rgba(190, 217, 198, 0.26);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8), 0 0 14px rgba(153, 193, 166, 0.06), inset 0 0 18px rgba(0, 0, 0, 0.75);
}

    .terminal-image-frame::before {
        content: "VISUAL ARCHIVE // RECOVERED MEDIA";
        display: block;
        margin-bottom: 6px;
        padding: 0 2px;
        text-align: left;
        color: rgba(184, 204, 192, 0.54);
        font-size: 0.56em;
        line-height: 1.3;
        letter-spacing: 0.12em;
        white-space: nowrap;
        overflow: hidden;
    }

.terminal-image-viewport {
    position: relative;
    width: 100%;
    overflow: hidden;
    isolation: isolate;
    background: #010304;
}

.terminal-archive-image {
    user-select: none;
    -webkit-user-drag: none;
}

.terminal-image-primary {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: auto;
    filter: contrast(1.08) brightness(0.94) saturate(0.84);
}


/* =========================================================
   IMAGE BLACK & WHITE
   ========================================================= */

.image-monochrome .terminal-image-primary {
    filter: grayscale(1) saturate(0) contrast(1.28) brightness(0.92);
}

.image-monochrome .terminal-image-glitch-copy {
    filter: grayscale(1) saturate(0) contrast(1.65) brightness(1.2);
}


/* =========================================================
   IMAGE SCANLINES
   ========================================================= */

.image-scanlines .terminal-image-viewport::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    background: repeating-linear-gradient( 0deg, rgba(0, 0, 0, 0.66) 0, rgba(0, 0, 0, 0.66) 1px, rgba(238, 255, 244, 0.095) 1px, rgba(238, 255, 244, 0.095) 2px, transparent 2px, transparent 4px );
    mix-blend-mode: multiply;
}


/* =========================================================
   IMAGE FILM GRAIN
   ========================================================= */

.image-grain .terminal-image-viewport::before {
    content: "";
    position: absolute;
    inset: -28%;
    z-index: 6;
    pointer-events: none;
    opacity: 0.62;
    background-image: radial-gradient( circle, rgba(255, 255, 255, 0.72) 0, rgba(255, 255, 255, 0.72) 0.65px, transparent 1px ), radial-gradient( circle, rgba(0, 0, 0, 0.96) 0, rgba(0, 0, 0, 0.96) 0.9px, transparent 1.25px ), radial-gradient( circle, rgba(255, 255, 255, 0.44) 0, rgba(255, 255, 255, 0.44) 0.52px, transparent 0.82px ), radial-gradient( circle, rgba(0, 0, 0, 0.82) 0, rgba(0, 0, 0, 0.82) 0.7px, transparent 1px ), radial-gradient( circle, rgba(238, 255, 245, 0.30) 0, rgba(238, 255, 245, 0.30) 0.46px, transparent 0.72px );
    background-size: 3px 3px, 5px 5px, 7px 7px, 9px 9px, 13px 13px;
    background-position: 0 0, 2px 3px, 5px 1px, 7px 6px, 10px 4px;
    mix-blend-mode: overlay;
    animation: archive-image-grain 70ms steps(2, end) infinite;
}


/* =========================================================
   IMAGE GLITCH LEVELS
   ========================================================= */

.image-glitch-1 {
    --archive-glitch-shift: 2px;
    --archive-glitch-speed: 210ms;
    --archive-glitch-opacity: 0.20;
    --archive-red-opacity: 0.10;
}

.image-glitch-2 {
    --archive-glitch-shift: 5px;
    --archive-glitch-speed: 145ms;
    --archive-glitch-opacity: 0.28;
    --archive-red-opacity: 0.16;
}

.image-glitch-3 {
    --archive-glitch-shift: 9px;
    --archive-glitch-speed: 90ms;
    --archive-glitch-opacity: 0.38;
    --archive-red-opacity: 0.22;
}

.image-glitch-4 {
    --archive-glitch-shift: 16px;
    --archive-glitch-speed: 56ms;
    --archive-glitch-opacity: 0.50;
    --archive-red-opacity: 0.30;
}

.image-glitch-5 {
    --archive-glitch-shift: 26px;
    --archive-glitch-speed: 34ms;
    --archive-glitch-opacity: 0.64;
    --archive-red-opacity: 0.40;
}


/* =========================================================
   IMAGE GLITCH BASE EFFECTS
   ========================================================= */

.image-glitch .terminal-image-viewport {
    box-shadow: inset 0 0 22px rgba( 255, 0, 35, var(--archive-red-opacity) ), 0 0 18px rgba( 255, 0, 35, var(--archive-red-opacity) );
    animation: archive-image-container-pulse calc( var(--archive-glitch-speed) * 3 ) steps(2, end) infinite;
}

.image-glitch .terminal-image-primary {
    animation: archive-image-jitter var(--archive-glitch-speed) steps(2, end) infinite;
}

.image-monochrome.image-glitch
.terminal-image-primary {
    animation: archive-image-jitter-monochrome var(--archive-glitch-speed) steps(2, end) infinite;
}


/* =========================================================
   IMAGE GLITCH COPIES
   ========================================================= */

.terminal-image-glitch-copy {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
    opacity: var(--archive-glitch-opacity);
}

.terminal-image-glitch-copy-a {
    filter: sepia(1) saturate(12) hue-rotate(310deg) brightness(1.32) contrast(1.6);
    clip-path: polygon( 0 4%, 100% 0, 100% 35%, 0 43% );
    animation: archive-image-slice-a var(--archive-glitch-speed) steps(2, end) infinite;
}

.terminal-image-glitch-copy-b {
    z-index: 3;
    filter: sepia(1) saturate(15) hue-rotate(325deg) brightness(1.55) contrast(1.75);
    clip-path: polygon( 0 50%, 100% 43%, 100% 91%, 0 98% );
    animation: archive-image-slice-b calc( var(--archive-glitch-speed) * 0.78 ) steps(2, end) infinite;
}

.image-monochrome.image-glitch
.terminal-image-glitch-copy-a {
    filter: grayscale(1) contrast(2) brightness(1.55);
}

.image-monochrome.image-glitch
.terminal-image-glitch-copy-b {
    filter: grayscale(1) contrast(2.4) brightness(0.7);
}


/* =========================================================
   RED GLITCH CAST
   ========================================================= */

.image-glitch .terminal-image-viewport::selection {
    background: transparent;
}

.image-glitch-3 .terminal-image-viewport,
.image-glitch-4 .terminal-image-viewport,
.image-glitch-5 .terminal-image-viewport {
    background: radial-gradient( circle at center, rgba( 100, 0, 16, var(--archive-red-opacity) ), #010203 75% );
}


/* =========================================================
   IMAGE WARNING TEXT
   ========================================================= */

.terminal-image-warning-layer {
    position: absolute;
    inset: 0;
    z-index: 8;
    pointer-events: none;
    overflow: hidden;
}

.terminal-image-warning {
    position: absolute;
    display: inline-block;
    color: #ff2439;
    font-family: Consolas, "Lucida Console", "Courier New", monospace;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    text-shadow: -2px 0 rgba(120, 0, 17, 0.95), 2px 0 rgba(255, 50, 67, 0.40), 0 0 4px rgba(255, 0, 38, 1), 0 0 11px rgba(255, 0, 38, 0.75), 0 0 24px rgba(120, 0, 16, 0.60);
    mix-blend-mode: screen;
    animation-name: archive-image-warning-flash;
    animation-timing-function: steps(2, end);
    animation-iteration-count: infinite;
}

.image-glitch-1 .terminal-image-warning {
    filter: brightness(0.78);
    opacity: 0.45;
}

.image-glitch-2 .terminal-image-warning {
    filter: brightness(0.95);
}

.image-glitch-3 .terminal-image-warning {
    filter: brightness(1.15) contrast(1.15);
}

.image-glitch-4 .terminal-image-warning,
.image-glitch-5 .terminal-image-warning {
    filter: brightness(1.45) contrast(1.35);
    text-shadow: -3px 0 rgba(100, 0, 15, 1), 3px 0 rgba(255, 60, 75, 0.55), 0 0 5px rgba(255, 0, 38, 1), 0 0 15px rgba(255, 0, 38, 0.85), 0 0 32px rgba(160, 0, 24, 0.72);
}


/* =========================================================
   IMAGE ANIMATIONS
   ========================================================= */

@keyframes archive-image-grain {
    0% {
        transform: translate( -8%, -7% );
    }

    14% {
        transform: translate( 7%, 5% );
    }

    28% {
        transform: translate( -4%, 9% );
    }

    42% {
        transform: translate( 10%, -5% );
    }

    56% {
        transform: translate( -9%, 2% );
    }

    70% {
        transform: translate( 4%, -9% );
    }

    84% {
        transform: translate( 9%, 7% );
    }

    100% {
        transform: translate( -5%, -4% );
    }
}

@keyframes archive-image-container-pulse {
    0% {
        filter: brightness(0.92);
    }

    18% {
        filter: brightness(1.05);
    }

    21% {
        filter: brightness(0.58);
    }

    24% {
        filter: brightness(1.24);
    }

    27% {
        filter: brightness(0.95);
    }

    69% {
        filter: brightness(1);
    }

    72% {
        filter: brightness(0.72);
    }

    74% {
        filter: brightness(1.18);
    }

    100% {
        filter: brightness(0.94);
    }
}

@keyframes archive-image-jitter {
    0% {
        transform: translate(0, 0) scale(1);
        filter: contrast(1.10) brightness(0.94) saturate(0.84);
    }

    10% {
        transform: translate( calc( var(--archive-glitch-shift) * -0.35 ), 0 );
    }

    14% {
        transform: translate( var(--archive-glitch-shift), calc( var(--archive-glitch-shift) * -0.15 ) );
        filter: contrast(1.7) brightness(1.2) saturate(0.35);
    }

    17% {
        transform: translate( calc( var(--archive-glitch-shift) * -1.15 ), calc( var(--archive-glitch-shift) * 0.18 ) );
    }

    21% {
        transform: translate( 0, calc( var(--archive-glitch-shift) * -0.28 ) );
    }

    24% {
        transform: translate(0, 0);
    }

    39% {
        transform: translate( calc( var(--archive-glitch-shift) * 0.55 ), calc( var(--archive-glitch-shift) * 0.22 ) );
    }

    43% {
        transform: translate( calc( var(--archive-glitch-shift) * -0.8 ), calc( var(--archive-glitch-shift) * -0.20 ) );
        filter: contrast(1.25) brightness(0.76) saturate(1.25);
    }

    46% {
        transform: translate(0, 0);
    }

    67% {
        transform: translateX( calc( var(--archive-glitch-shift) * 0.85 ) );
    }

    70% {
        transform: translateX( calc( var(--archive-glitch-shift) * -0.62 ) );
    }

    73% {
        transform: translate(0, 0) scale(1.008);
    }

    88% {
        transform: translate( calc( var(--archive-glitch-shift) * -0.45 ), calc( var(--archive-glitch-shift) * 0.20 ) );
    }

    92% {
        transform: translate( calc( var(--archive-glitch-shift) * 0.70 ), calc( var(--archive-glitch-shift) * -0.15 ) );
    }

    100% {
        transform: translate(0, 0) scale(1);
        filter: contrast(1.10) brightness(0.94) saturate(0.84);
    }
}

@keyframes archive-image-jitter-monochrome {
    0% {
        transform: translate(0, 0);
        filter: grayscale(1) saturate(0) contrast(1.28) brightness(0.92);
    }

    13% {
        transform: translateX( var(--archive-glitch-shift) );
        filter: grayscale(1) saturate(0) contrast(2) brightness(1.18);
    }

    17% {
        transform: translateX( calc( var(--archive-glitch-shift) * -1 ) );
    }

    22% {
        transform: translateY( calc( var(--archive-glitch-shift) * -0.25 ) );
    }

    27% {
        transform: translate(0, 0);
    }

    48% {
        transform: translate( calc( var(--archive-glitch-shift) * 0.75 ), calc( var(--archive-glitch-shift) * 0.20 ) );
        filter: grayscale(1) saturate(0) contrast(1.75) brightness(0.62);
    }

    52% {
        transform: translate( calc( var(--archive-glitch-shift) * -0.6 ), 0 );
    }

    57% {
        transform: translate(0, 0);
    }

    81% {
        transform: translateX( calc( var(--archive-glitch-shift) * -0.8 ) );
    }

    84% {
        transform: translateX( calc( var(--archive-glitch-shift) * 0.55 ) );
    }

    100% {
        transform: translate(0, 0);
        filter: grayscale(1) saturate(0) contrast(1.28) brightness(0.92);
    }
}

@keyframes archive-image-slice-a {
    0% {
        transform: translateX( calc( var(--archive-glitch-shift) * -1.3 ) );
    }

    13% {
        transform: translateX( calc( var(--archive-glitch-shift) * 1.1 ) );
    }

    27% {
        transform: translateX( calc( var(--archive-glitch-shift) * 1.7 ) );
    }

    39% {
        transform: translateX( calc( var(--archive-glitch-shift) * -1.8 ) );
    }

    52% {
        transform: translateX( calc( var(--archive-glitch-shift) * 0.75 ) );
    }

    67% {
        transform: translateX( calc( var(--archive-glitch-shift) * -0.4 ) );
    }

    81% {
        transform: translateX( calc( var(--archive-glitch-shift) * 1.35 ) );
    }

    100% {
        transform: translateX( calc( var(--archive-glitch-shift) * -0.25 ) );
    }
}

@keyframes archive-image-slice-b {
    0% {
        transform: translateX( var(--archive-glitch-shift) );
    }

    14% {
        transform: translateX( calc( var(--archive-glitch-shift) * -0.9 ) );
    }

    26% {
        transform: translateX( calc( var(--archive-glitch-shift) * 1.8 ) );
    }

    41% {
        transform: translateX( calc( var(--archive-glitch-shift) * -1.6 ) );
    }

    55% {
        transform: translateX( calc( var(--archive-glitch-shift) * 1.2 ) );
    }

    69% {
        transform: translateX( calc( var(--archive-glitch-shift) * -0.5 ) );
    }

    84% {
        transform: translateX( calc( var(--archive-glitch-shift) * 1.5 ) );
    }

    100% {
        transform: translateX( calc( var(--archive-glitch-shift) * -0.3 ) );
    }
}

@keyframes archive-image-warning-flash {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0.92);
    }

    10% {
        opacity: 1;
        transform: translate( 2px, -1px ) scale(1.04);
    }

    18% {
        opacity: 0.15;
    }

    26% {
        opacity: 1;
        transform: translate( -3px, 2px ) scale(1);
    }

    35% {
        opacity: 0;
    }

    56% {
        opacity: 0;
    }

    64% {
        opacity: 0.92;
        transform: translate( 3px, 0 ) scale(1.06);
    }

    71% {
        opacity: 0.12;
    }

    76% {
        opacity: 1;
    }

    82% {
        opacity: 0;
    }

    100% {
        opacity: 0;
    }
}


/* =========================================================
   SELECTION
   ========================================================= */

::selection {
    background: rgba(197, 212, 200, 0.28);
    color: #ffffff;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1200px) {
    .terminal-screen {
        grid-template-columns: minmax(0, 3fr) minmax(300px, 1fr);
    }

    .terminal-main {
        padding: 24px;
    }

    body {
        font-size: 16px;
    }
}

@media (max-width: 850px) {
    .terminal-screen {
        display: block;
    }

    .terminal-sidebar {
        display: none;
    }

    .terminal-main {
        width: 100%;
        height: 100vh;
        padding: 20px;
    }

    .terminal-image-frame {
        max-width: 100%;
    }
}

@media (max-width: 500px) {
    .terminal-main {
        padding: 14px;
    }

    body {
        font-size: 14px;
    }

    .terminal-image-frame {
        padding: 5px;
    }
}


/* =========================================================
   FULL-SCREEN GLITCH
   ========================================================= */

.glitch-overlay {
    --shake: 3px;
    --glitch-red: #d10b32;
    --glitch-bright: #ff3657;
    --glitch-dark: #5e0015;
    position: fixed;
    inset: 0;
    z-index: 10000;
    overflow: hidden;
    display: grid;
    place-items: center;
    pointer-events: all;
    background: radial-gradient( circle at center, rgba(55, 0, 11, 0.50), rgba(4, 0, 2, 0.96) 72% );
    animation: glitch-screen-shake 85ms steps(2, end) infinite, glitch-screen-flicker 180ms steps(2, end) infinite;
}

.glitch-intensity-1 {
    --shake: 1px;
}

.glitch-intensity-2 {
    --shake: 2px;
}

.glitch-intensity-3 {
    --shake: 3px;
}

.glitch-intensity-4 {
    --shake: 5px;
}

.glitch-intensity-5 {
    --shake: 8px;
}

.glitch-overlay::before {
    content: "";
    position: absolute;
    inset: -20%;
    z-index: 3;
    pointer-events: none;
    background: repeating-linear-gradient( 0deg, transparent 0, transparent 3px, rgba(255, 0, 45, 0.075) 4px, transparent 5px );
    mix-blend-mode: screen;
    animation: glitch-scan-shift 150ms steps(2, end) infinite;
}

.glitch-overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    background: linear-gradient( 90deg, rgba(130, 0, 25, 0.06), transparent 24%, rgba(255, 0, 50, 0.08) 51%, transparent 76%, rgba(130, 0, 25, 0.08) );
    box-shadow: inset 0 0 120px rgba(160, 0, 30, 0.24);
    animation: glitch-red-flicker 110ms steps(2, end) infinite;
}

.glitch-corruption-layer {
    position: absolute;
    inset: -5%;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.glitch-corruption {
    position: absolute;
    white-space: nowrap;
    color: #b5092a;
    font-family: Consolas, "Lucida Console", "Courier New", monospace;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-shadow: -2px 0 rgba(255, 0, 48, 0.34), 2px 0 rgba(92, 0, 18, 0.46), 0 0 8px rgba(255, 0, 40, 0.55), 0 0 20px rgba(140, 0, 25, 0.34);
    animation: glitch-corruption-pulse 220ms steps(2, end) infinite;
}

.glitch-message {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 10;
    width: min( 86vw, 1500px );
    transform: translate(-50%, -50%) rotate(-1.2deg);
    text-align: center;
    color: var(--glitch-bright);
    font-family: Consolas, "Lucida Console", "Courier New", monospace;
    font-size: clamp( 2rem, 5.2vw, 6.5rem );
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: 0.045em;
    text-transform: uppercase;
    text-shadow: -5px 0 rgba(102, 0, 22, 0.8), 4px 0 rgba(255, 0, 54, 0.55), 0 0 8px rgba(255, 25, 65, 0.75), 0 0 30px rgba(200, 0, 40, 0.65), 0 0 70px rgba(110, 0, 20, 0.55);
    animation: glitch-message-jump 95ms steps(2, end) infinite;
}

    .glitch-message::before,
    .glitch-message::after {
        content: attr(data-text);
        position: absolute;
        inset: 0;
        pointer-events: none;
    }

    .glitch-message::before {
        color: #ff1748;
        clip-path: polygon( 0 0, 100% 0, 100% 43%, 0 58% );
        transform: translate( -5px, -2px );
        opacity: 0.72;
        animation: glitch-copy-a 120ms steps(2, end) infinite;
    }

    .glitch-message::after {
        color: #8f001f;
        clip-path: polygon( 0 55%, 100% 40%, 100% 100%, 0 100% );
        transform: translate( 6px, 3px );
        opacity: 0.82;
        animation: glitch-copy-b 95ms steps(2, end) infinite;
    }

.glitch-band {
    position: absolute;
    left: -10%;
    z-index: 6;
    width: 120%;
    pointer-events: none;
    background: rgba(180, 0, 35, 0.12);
    mix-blend-mode: screen;
    transform: skewX(-14deg);
    animation: glitch-band-shift 260ms steps(2, end) infinite;
}

.glitch-band-a {
    top: 18%;
    height: 3%;
}

.glitch-band-b {
    top: 53%;
    height: 7%;
    animation-delay: -90ms;
}

.glitch-band-c {
    top: 78%;
    height: 2%;
    animation-delay: -170ms;
}

.glitch-intensity-1
.glitch-corruption {
    filter: brightness(0.72);
}

.glitch-intensity-4
.glitch-corruption,
.glitch-intensity-5
.glitch-corruption {
    filter: brightness(1.28) contrast(1.18);
}

.glitch-overlay.glitch-intensity-5::after {
    background: rgba(125, 0, 22, 0.10);
}


/* =========================================================
   FULL-SCREEN GLITCH ANIMATIONS
   ========================================================= */

@keyframes glitch-screen-shake {
    0% {
        transform: translate( calc( var(--shake) * -1 ), 0 );
    }

    25% {
        transform: translate( var(--shake), calc( var(--shake) * 0.5 ) );
    }

    50% {
        transform: translate( calc( var(--shake) * -0.35 ), calc( var(--shake) * -1 ) );
    }

    75% {
        transform: translate( calc( var(--shake) * 0.5 ), var(--shake) );
    }

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

@keyframes glitch-screen-flicker {
    0% {
        filter: brightness(0.82) contrast(1.12);
    }

    30% {
        filter: brightness(1.12) contrast(1.3);
    }

    55% {
        filter: brightness(0.9) contrast(1.18);
    }

    100% {
        filter: brightness(1) contrast(1.22);
    }
}

@keyframes glitch-scan-shift {
    0% {
        transform: translateY(-8px) skewY(-1deg);
    }

    50% {
        transform: translateY(9px) skewY(1deg);
    }

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

@keyframes glitch-red-flicker {
    0% {
        opacity: 0.35;
    }

    40% {
        opacity: 0.8;
    }

    55% {
        opacity: 0.22;
    }

    100% {
        opacity: 0.55;
    }
}

@keyframes glitch-corruption-pulse {
    0% {
        transform: translate( -2px, 0 );
    }

    35% {
        transform: translate( 4px, -1px );
    }

    60% {
        transform: translate( -3px, 2px );
    }

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

@keyframes glitch-message-jump {
    0% {
        transform: translate(-50%, -50%) rotate(-1.2deg) translateX(-2px);
    }

    33% {
        transform: translate(-50%, -50%) rotate(0.6deg) translateX(4px);
    }

    66% {
        transform: translate(-50%, -50%) rotate(-0.4deg) translateY(-3px);
    }

    100% {
        transform: translate(-50%, -50%) rotate(-1.2deg) translateX(1px);
    }
}

@keyframes glitch-copy-a {
    0% {
        transform: translate( -6px, -2px );
    }

    50% {
        transform: translate( 5px, 1px );
    }

    100% {
        transform: translate( -3px, 2px );
    }
}

@keyframes glitch-copy-b {
    0% {
        transform: translate( 6px, 3px );
    }

    50% {
        transform: translate( -5px, -1px );
    }

    100% {
        transform: translate( 3px, 4px );
    }
}

@keyframes glitch-band-shift {
    0% {
        transform: translateX(-4%) skewX(-14deg);
    }

    50% {
        transform: translate( 7%, 4px ) skewX(-14deg);
    }

    100% {
        transform: translate( -2%, -3px ) skewX(-14deg);
    }
}
/* =========================================================
   TERMINAL AUDIO CONTROL
   ========================================================= */

.terminal-audio-control {
    position: fixed;
    right: 18px;
    bottom: 14px;
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 205px;
    padding: 7px 10px;
    color: rgba(197, 212, 200, 0.70);
    background: rgba(3, 8, 10, 0.90);
    border: 1px solid rgba(197, 212, 200, 0.20);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.55), inset 0 0 12px rgba(197, 212, 200, 0.025);
    font-family: Consolas, "Lucida Console", "Courier New", monospace;
    font-size: 11px;
    line-height: 1;
    letter-spacing: 0.08em;
    user-select: none;
}

    .terminal-audio-control::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 1px;
        background: rgba(220, 238, 225, 0.10);
        pointer-events: none;
    }

.terminal-audio-mute {
    min-width: 43px;
    margin: 0;
    padding: 0;
    color: rgba(205, 222, 210, 0.78);
    background: transparent;
    border: 0;
    outline: 0;
    font: inherit;
    font-size: 10px;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: color 100ms linear, text-shadow 100ms linear;
}

    .terminal-audio-mute:hover {
        color: #f2f5f3;
        text-shadow: 0 0 5px rgba(230, 245, 234, 0.22);
    }

    .terminal-audio-mute.is-muted {
        color: rgba(224, 93, 88, 0.78);
        text-shadow: 0 0 5px rgba(224, 93, 88, 0.18);
    }

.terminal-audio-slider {
    width: 105px;
    height: 14px;
    margin: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
}

    .terminal-audio-slider:focus {
        outline: none;
    }

    .terminal-audio-slider::-webkit-slider-runnable-track {
        width: 100%;
        height: 2px;
        background: rgba(197, 212, 200, 0.28);
        border: 0;
        box-shadow: 0 0 3px rgba(197, 212, 200, 0.06);
    }

    .terminal-audio-slider::-webkit-slider-thumb {
        width: 8px;
        height: 14px;
        margin-top: -6px;
        appearance: none;
        -webkit-appearance: none;
        background: #c5d4c8;
        border: 0;
        box-shadow: 0 0 4px rgba(197, 212, 200, 0.34);
    }

    .terminal-audio-slider::-moz-range-track {
        width: 100%;
        height: 2px;
        background: rgba(197, 212, 200, 0.28);
        border: 0;
    }

    .terminal-audio-slider::-moz-range-progress {
        height: 2px;
        background: rgba(197, 212, 200, 0.58);
    }

    .terminal-audio-slider::-moz-range-thumb {
        width: 8px;
        height: 14px;
        background: #c5d4c8;
        border: 0;
        border-radius: 0;
        box-shadow: 0 0 4px rgba(197, 212, 200, 0.34);
    }

.terminal-audio-value {
    width: 31px;
    text-align: right;
    color: rgba(184, 204, 192, 0.52);
    font-size: 10px;
    letter-spacing: 0;
}

@media (max-width: 850px) {
    .terminal-audio-control {
        right: 12px;
        bottom: 10px;
        min-width: 185px;
        padding: 6px 8px;
    }

    .terminal-audio-slider {
        width: 88px;
    }
}

@media (max-width: 500px) {
    .terminal-audio-control {
        right: 8px;
        bottom: 8px;
        min-width: 165px;
    }

    .terminal-audio-slider {
        width: 70px;
    }
}