:root {
    --retro-bg: #07120f;
    --retro-panel: #061610;
    --retro-line: #214736;
    --retro-text: #b9ffc0;
    --retro-muted: #7ed596;
    --retro-amber: #ffd166;
    --retro-red: #ff6b6b;
    --retro-blue: #7dd3fc;
    --crt-brightness: 1.13;
    --crt-bloom: 0 0 2px rgba(185, 255, 192, 0.95), 0 0 8px rgba(90, 255, 136, 0.48), 0 0 22px rgba(90, 255, 136, 0.18);
    --crt-rgb-shift: -1.2px 0 rgba(255, 61, 61, 0.22), 1.2px 0 rgba(83, 197, 255, 0.2);
    --modern-bg: #eef2f0;
    --modern-panel: #fbfcfa;
    --modern-line: #c9d4d0;
    --modern-text: #17211c;
    --modern-muted: #5f6f67;
    --modern-green: #0a7d62;
    --modern-blue: #315f9d;
    --modern-rust: #b4553d;
    --modern-yellow: #c8922d;
    --shadow: 0 28px 80px rgba(8, 16, 13, 0.28);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--retro-text);
    background:
        radial-gradient(circle at 50% 44%, rgba(31, 61, 48, 0.44), transparent 34rem),
        radial-gradient(circle at 50% 100%, rgba(0, 0, 0, 0.22), transparent 24rem),
        #010403;
    font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
    line-height: 1.55;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

.site-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 0;
}

.terminal-frame {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background:
        radial-gradient(ellipse at 50% 48%, rgba(29, 68, 48, 0.4) 0%, rgba(8, 30, 21, 0.52) 58%, rgba(0, 0, 0, 0.72) 100%),
        linear-gradient(rgba(255, 255, 255, 0.028) 50%, rgba(0, 0, 0, 0.1) 50%),
        var(--retro-panel);
    background-size: 100% 4px, auto;
    box-shadow:
        inset 0 0 44px rgba(180, 255, 182, 0.08),
        inset 0 0 120px rgba(0, 0, 0, 0.72);
    filter: brightness(var(--crt-brightness)) saturate(1.25) contrast(1.08);
    animation: crt-flicker 5.6s infinite steps(1);
}

.terminal-frame::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 44%, rgba(210, 255, 210, 0.13) 0%, rgba(210, 255, 210, 0.05) 30%, transparent 58%),
        linear-gradient(90deg, rgba(255, 0, 72, 0.08), transparent 30%, rgba(32, 255, 136, 0.05) 52%, rgba(0, 153, 255, 0.08));
    border-radius: 0;
    mix-blend-mode: screen;
    opacity: 0.72;
    z-index: 3;
}

.terminal-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 0;
    background:
        radial-gradient(ellipse at 50% 48%, transparent 54%, rgba(0, 0, 0, 0.32) 74%, rgba(0, 0, 0, 0.82) 100%),
        linear-gradient(115deg, rgba(255, 255, 255, 0.16) 0%, transparent 18%, transparent 70%, rgba(255, 255, 255, 0.05) 100%);
    box-shadow: inset 0 0 132px rgba(0, 0, 0, 0.74);
    mix-blend-mode: screen;
    z-index: 3;
}

.terminal-screen {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
}

.terminal-window {
    position: relative;
    z-index: 4;
}

.terminal-output {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.terminal-line {
    min-height: 1.55em;
    color: var(--retro-muted);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    text-shadow: var(--crt-rgb-shift), 0 0 8px rgba(112, 255, 145, 0.34);
}

pre.terminal-line {
    margin: 0;
    white-space: pre;
    overflow-wrap: normal;
}

.system-line,
.success-line {
    color: var(--retro-text);
}

.echo-line {
    color: var(--retro-blue);
}

.completion-line {
    color: var(--retro-text);
}

.warning-line {
    color: var(--retro-amber);
}

.error-line {
    color: var(--retro-red);
}

.muted-line {
    color: var(--retro-muted);
}

.logo-line {
    color: var(--retro-text);
    line-height: 1.16;
    min-height: auto;
    text-shadow:
        var(--crt-rgb-shift),
        0 0 3px rgba(210, 255, 214, 0.96),
        0 0 16px rgba(90, 255, 136, 0.82),
        0 0 36px rgba(90, 255, 136, 0.34);
}

.working-line {
    color: var(--retro-amber);
}

.terminal-cursor {
    display: inline-block;
    color: var(--retro-text);
    font-weight: 600;
    line-height: 1;
    text-shadow: var(--crt-rgb-shift), 0 0 14px rgba(183, 255, 184, 0.78);
    animation: cursor-blink 1s steps(1) infinite;
}

.crt-layer {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    border-radius: inherit;
}

.crt-raster {
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.25) 0,
            rgba(0, 0, 0, 0.25) 1px,
            rgba(190, 255, 190, 0.045) 1px,
            rgba(190, 255, 190, 0.045) 2px,
            transparent 2px,
            transparent 4px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(255, 0, 0, 0.035) 0,
            rgba(255, 0, 0, 0.035) 1px,
            rgba(0, 255, 86, 0.025) 1px,
            rgba(0, 255, 86, 0.025) 2px,
            rgba(0, 132, 255, 0.035) 2px,
            rgba(0, 132, 255, 0.035) 3px
        );
    opacity: 0.84;
    mix-blend-mode: multiply;
}

.crt-static {
    opacity: 0.18;
    mix-blend-mode: screen;
    background-image:
        radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.22) 0 1px, transparent 1px),
        radial-gradient(circle at 74% 61%, rgba(255, 255, 255, 0.14) 0 1px, transparent 1px),
        radial-gradient(circle at 39% 84%, rgba(185, 255, 192, 0.16) 0 1px, transparent 1px),
        radial-gradient(circle at 89% 14%, rgba(255, 209, 102, 0.1) 0 1px, transparent 1px);
    background-size: 21px 19px, 29px 31px, 37px 27px, 43px 41px;
    animation: crt-noise 0.18s infinite steps(2);
}

.crt-beam {
    opacity: 0.52;
    mix-blend-mode: screen;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 46%,
        rgba(210, 255, 210, 0.03) 48%,
        rgba(210, 255, 210, 0.5) 50%,
        rgba(210, 255, 210, 0.03) 52%,
        transparent 56%,
        transparent 100%
    );
    transform: translateY(-110%);
    animation: crt-beam 4.8s linear infinite;
}

.crt-bloom {
    z-index: 1;
    background:
        radial-gradient(ellipse at 50% 42%, rgba(117, 255, 145, 0.2), transparent 32%),
        radial-gradient(ellipse at 18% 24%, rgba(255, 209, 102, 0.08), transparent 24%),
        radial-gradient(ellipse at 80% 20%, rgba(125, 211, 252, 0.08), transparent 28%);
    filter: blur(18px);
    opacity: 0.9;
    mix-blend-mode: screen;
}

.crt-glass {
    background:
        radial-gradient(ellipse at 50% 52%, transparent 48%, rgba(0, 0, 0, 0.3) 76%, rgba(0, 0, 0, 0.78) 100%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.045), transparent 18%, transparent 82%, rgba(0, 132, 255, 0.045));
    mix-blend-mode: multiply;
}

.output-cursor {
    margin-left: 1px;
}

.menu-line,
.response-text,
.link-line {
    color: var(--retro-muted);
}

.response-title {
    color: var(--retro-amber);
    font-weight: 600;
    text-transform: uppercase;
}

.case-meta {
    color: var(--retro-amber);
    font-size: 0.82rem;
    text-transform: uppercase;
}

.terminal-input-row {
    position: relative;
    display: block;
    margin-top: 20px;
    min-height: 1.55em;
}

.terminal-input-row.is-booting .terminal-prompt-line {
    visibility: hidden;
}

.terminal-input-row.is-busy .prompt-cursor {
    visibility: hidden;
    animation: none;
}

.terminal-prompt-line {
    display: flex;
    align-items: baseline;
    min-height: 1.55em;
    color: var(--retro-text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    text-shadow: var(--crt-rgb-shift), var(--crt-bloom);
}

.prompt-label {
    color: var(--retro-amber);
    margin-right: 0.65ch;
    white-space: nowrap;
}

.command-value {
    color: var(--retro-text);
}

.terminal-input {
    position: fixed;
    inset: 0;
    z-index: 10;
    width: 100vw;
    height: 100dvh;
    min-height: 100vh;
    padding: 0;
    border: 0;
    border-radius: 0;
    outline: 0;
    opacity: 0.01;
    color: transparent;
    background: transparent;
    caret-color: transparent;
    -webkit-text-fill-color: transparent;
    appearance: none;
    -webkit-appearance: none;
    font-size: 16px;
    direction: ltr;
    unicode-bidi: plaintext;
    text-align: left;
    text-transform: none;
    touch-action: manipulation;
    pointer-events: auto;
}

.terminal-input:disabled {
    cursor: wait;
    pointer-events: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.theme-modern {
    color: var(--modern-text);
    background:
        radial-gradient(circle at 18% 14%, rgba(49, 95, 157, 0.16), transparent 23rem),
        radial-gradient(circle at 78% 10%, rgba(180, 85, 61, 0.14), transparent 22rem),
        linear-gradient(135deg, #eef2f0 0%, #f7f8f5 100%);
    font-family: "Satoshi", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.theme-modern .terminal-frame {
    border-color: var(--modern-line);
    border-radius: 8px;
    background: var(--modern-panel);
    box-shadow: 0 26px 80px rgba(23, 33, 28, 0.16);
}

.theme-modern .terminal-frame::before,
.theme-modern .terminal-frame::after {
    display: none;
}

.theme-modern .terminal-input-row {
    border-color: var(--modern-line);
}

.theme-modern .terminal-line,
.theme-modern .muted-line {
    color: var(--modern-muted);
}

.theme-modern .system-line,
.theme-modern .success-line {
    color: var(--modern-text);
}

.theme-modern .terminal-window {
    padding-top: 28px;
}

.theme-modern .terminal-output {
    max-height: 606px;
}

.theme-modern .response-title,
.theme-modern .warning-line,
.theme-modern .working-line,
.theme-modern .case-meta,
.theme-modern .prompt-label {
    color: var(--modern-yellow);
}

.theme-modern .command-value,
.theme-modern .terminal-prompt-line,
.theme-modern .terminal-cursor {
    color: var(--modern-text);
}

.theme-modern .echo-line {
    color: var(--modern-blue);
}

.theme-modern .completion-line {
    color: var(--modern-text);
}

.theme-modern .error-line {
    color: var(--modern-rust);
}

.theme-modern a:focus-visible {
    outline-color: var(--modern-yellow);
}

@media (max-width: 860px) {
    .site-shell {
        padding: 0;
        place-items: stretch;
    }

    .terminal-frame {
        min-height: 100vh;
    }
}

@media (max-width: 620px) {
    pre.terminal-line {
        overflow-x: auto;
    }

    .site-shell {
        padding: 0;
    }

    .terminal-frame {
        min-height: 100vh;
    }

}

@keyframes cursor-blink {
    0%,
    49% {
        opacity: 1;
    }

    50%,
    100% {
        opacity: 0;
    }
}

@keyframes crt-flicker {
    0%,
    100% {
        filter: brightness(1.13) saturate(1.25) contrast(1.08);
    }

    11% {
        filter: brightness(1.2) saturate(1.28) contrast(1.1);
    }

    12% {
        filter: brightness(1.02) saturate(1.17) contrast(1.04);
    }

    32% {
        filter: brightness(1.16) saturate(1.25) contrast(1.08);
    }

    33% {
        filter: brightness(1.08) saturate(1.2) contrast(1.06);
    }

    71% {
        filter: brightness(1.21) saturate(1.3) contrast(1.12);
    }

    72% {
        filter: brightness(1.09) saturate(1.22) contrast(1.06);
    }
}

@keyframes crt-jitter {
    0%,
    100% {
        transform: translate(0, 0);
    }

    9% {
        transform: translate(0.4px, -0.3px);
    }

    10% {
        transform: translate(-0.5px, 0.2px);
    }

    39% {
        transform: translate(0.3px, 0.4px);
    }

    40% {
        transform: translate(-0.2px, -0.2px);
    }

    67% {
        transform: translate(0.6px, 0);
    }

    68% {
        transform: translate(-0.4px, 0.3px);
    }
}

@keyframes crt-hsync {
    0%,
    94%,
    100% {
        clip-path: inset(0 0 0 0);
    }

    95% {
        transform: translateX(1.6px) skewX(0.12deg);
    }

    95.5% {
        transform: translateX(-2.2px) skewX(-0.14deg);
    }
}

@keyframes crt-noise {
    0% {
        transform: translate(0, 0);
        opacity: 0.14;
    }

    25% {
        transform: translate(-2%, 1%);
        opacity: 0.2;
    }

    50% {
        transform: translate(1%, -2%);
        opacity: 0.16;
    }

    75% {
        transform: translate(2%, 2%);
        opacity: 0.22;
    }

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

@keyframes crt-beam {
    0% {
        transform: translateY(-115%);
    }

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }

    .crt-beam {
        display: none;
    }

    .terminal-frame,
    .terminal-window,
    .crt-static {
        animation: none;
    }
}
