.error-404-page,
.error-404-page * {
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
}

.error-404-page {
    --error-bg: #1c2340;
    --error-bg-2: #252d55;
    --error-copy: rgba(232, 238, 255, 0.78);
    --error-copy-soft: rgba(232, 238, 255, 0.52);
    --error-pink: #d414a7;
    --error-pink-2: #a70088;
    --error-violet: #6b138e;
    margin: 0;
    min-height: 100vh;
    overflow: hidden;
    font-family: "Instrument Sans", sans-serif;
    background:
        radial-gradient(circle at 20% 20%, rgba(212, 20, 167, 0.16), transparent 24%),
        radial-gradient(circle at 82% 18%, rgba(113, 64, 255, 0.12), transparent 20%),
        linear-gradient(180deg, var(--error-bg) 0%, var(--error-bg-2) 100%);
    color: #fff;
}

.error-404-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    z-index: 0;
}

.error-404-layout {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 18px;
}

.error-404-panel {
    width: min(920px, 100%);
    display: grid;
    justify-items: center;
    gap: 26px;
    text-align: center;
    position: relative;
}

.error-404-orb {
    position: relative;
    width: 126px;
    height: 126px;
    display: grid;
    place-items: center;
}

.error-404-orb::before,
.error-404-orb::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
}

.error-404-orb::before {
    border: 3px solid rgba(212, 20, 167, 0.8);
    animation: error-orbit 3.4s ease-in-out infinite;
}

.error-404-orb::after {
    inset: 8px;
    border: 1px solid rgba(212, 20, 167, 0.45);
}

.error-404-orb__core {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent 42%),
        linear-gradient(135deg, #e22ac0 0%, #a70088 66%, #7a178e 100%);
    box-shadow:
        0 0 0 12px rgba(212, 20, 167, 0.08),
        0 18px 40px rgba(167, 0, 136, 0.34);
}

.error-404-code-wrap {
    display: grid;
    justify-items: center;
    gap: 14px;
    position: relative;
}

.error-404-code-shadow {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(96px, 18vw, 164px);
    font-weight: 800;
    letter-spacing: 0.04em;
    color: rgba(212, 20, 167, 0.14);
    filter: blur(10px);
    user-select: none;
    pointer-events: none;
}

.error-404-code {
    margin: 0;
    position: relative;
    font-size: clamp(96px, 18vw, 164px);
    font-weight: 700;
    line-height: 0.92;
    letter-spacing: 0.04em;
    color: var(--error-pink);
    text-transform: uppercase;
    text-shadow:
        0 0 18px rgba(212, 20, 167, 0.24),
        0 0 34px rgba(212, 20, 167, 0.18);
    animation: error-glitch-base 2.8s steps(2, end) infinite;
}

.error-404-code::before,
.error-404-code::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.84;
}

.error-404-code::before {
    color: rgba(255, 255, 255, 0.45);
    text-shadow: -2px 0 rgba(255, 255, 255, 0.4);
    transform: translate(-3px, -1px);
    clip-path: inset(0 0 58% 0);
    animation: error-glitch-top 2.6s steps(2, end) infinite;
}

.error-404-code::after {
    color: rgba(106, 222, 255, 0.5);
    text-shadow: 2px 0 rgba(106, 222, 255, 0.45);
    transform: translate(4px, 1px);
    clip-path: inset(46% 0 0 0);
    animation: error-glitch-bottom 2.2s steps(2, end) infinite;
}

.error-404-code-line {
    width: min(170px, 36vw);
    height: 4px;
    background: linear-gradient(90deg, transparent 0%, var(--error-pink) 16%, #ef56cd 50%, var(--error-pink) 84%, transparent 100%);
    box-shadow: 0 0 18px rgba(212, 20, 167, 0.3);
}

.error-404-code.is-code-scrambling {
    letter-spacing: 0.08em;
    transform: translate3d(1px, 0, 0) scale(1.02);
    text-shadow:
        -4px 0 rgba(255, 255, 255, 0.28),
        4px 0 rgba(106, 222, 255, 0.32),
        0 0 24px rgba(212, 20, 167, 0.4);
}

.error-404-copy {
    display: grid;
    gap: 10px;
}

.error-404-copy h2 {
    margin: 0;
    font-size: clamp(32px, 5vw, 52px);
    line-height: 1.05;
    font-weight: 800;
}

.error-404-copy__lead {
    margin: 0;
    color: rgba(255, 255, 255, 0.86);
    font-size: clamp(20px, 3vw, 28px);
    line-height: 1.25;
}

.error-404-copy__text {
    margin: 0;
    color: var(--error-copy-soft);
    font-size: 18px;
    line-height: 1.6;
    max-width: 720px;
}

.error-404-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
}

.error-404-button {
    min-width: 168px;
    min-height: 56px;
    padding: 0 26px;
    border-radius: 14px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.1;
    cursor: pointer;
    transition:
        transform 0.22s ease,
        background-color 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease,
        color 0.22s ease;
}

.error-404-button--primary {
    color: #fff;
    background: linear-gradient(90deg, var(--error-pink) 0%, var(--error-violet) 100%);
    box-shadow: 0 18px 36px rgba(167, 0, 136, 0.26);
}

.error-404-button--ghost {
    color: rgba(255, 255, 255, 0.92);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.18);
}

.error-404-button:hover,
.error-404-button:focus-visible {
    transform: translateY(-2px);
    outline: none;
}

.error-404-button--ghost:hover,
.error-404-button--ghost:focus-visible {
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.08);
}

.error-404-quote {
    margin: 16px 0 0;
    display: grid;
    grid-template-columns: 8px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    width: min(640px, 100%);
    text-align: left;
}

.error-404-quote__bar {
    width: 4px;
    min-height: 82px;
    border-radius: 999px;
    background: linear-gradient(180deg, #f036cb 0%, rgba(240, 54, 203, 0.14) 100%);
    box-shadow: 0 0 18px rgba(240, 54, 203, 0.3);
}

.error-404-quote__body {
    display: grid;
    gap: 10px;
    color: var(--error-copy);
}

.error-404-quote__text,
.error-404-quote__author {
    margin: 0;
    transition:
        opacity 0.45s ease,
        transform 0.45s ease,
        filter 0.45s ease;
}

.error-404-quote__text {
    font-size: clamp(20px, 2.4vw, 28px);
    line-height: 1.45;
    font-style: italic;
}

.error-404-quote__author {
    color: rgba(232, 238, 255, 0.54);
    font-size: 18px;
    line-height: 1.4;
    padding-left: 6px;
}

.error-404-quote__text.is-swapping,
.error-404-quote__author.is-swapping {
    opacity: 0;
    transform: translateY(12px);
    filter: blur(8px);
}

@keyframes error-glitch-base {
    0%,
    100% {
        transform: translate3d(0, 0, 0);
    }

    8% {
        transform: translate3d(1px, 0, 0);
    }

    10% {
        transform: translate3d(-2px, 1px, 0);
    }

    12% {
        transform: translate3d(0, 0, 0);
    }

    54% {
        transform: translate3d(0, 0, 0);
    }

    56% {
        transform: translate3d(2px, -1px, 0);
    }

    58% {
        transform: translate3d(-1px, 1px, 0);
    }

    60% {
        transform: translate3d(0, 0, 0);
    }
}

@keyframes error-glitch-top {
    0%,
    100% {
        transform: translate(-3px, -1px);
        clip-path: inset(0 0 58% 0);
    }

    18% {
        transform: translate(7px, -4px);
        clip-path: inset(0 0 50% 0);
    }

    20% {
        transform: translate(-8px, 2px);
        clip-path: inset(0 0 64% 0);
    }

    45% {
        transform: translate(3px, -2px);
        clip-path: inset(0 0 55% 0);
    }
}

@keyframes error-glitch-bottom {
    0%,
    100% {
        transform: translate(4px, 1px);
        clip-path: inset(46% 0 0 0);
    }

    14% {
        transform: translate(-8px, 2px);
        clip-path: inset(52% 0 0 0);
    }

    16% {
        transform: translate(9px, -1px);
        clip-path: inset(42% 0 0 0);
    }

    42% {
        transform: translate(-4px, 3px);
        clip-path: inset(48% 0 0 0);
    }
}

@keyframes error-orbit {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.82;
    }

    50% {
        transform: scale(1.08);
        opacity: 1;
    }
}

@media (max-width: 760px) {
    .error-404-layout {
        padding: 28px 14px;
    }

    .error-404-panel {
        gap: 22px;
    }

    .error-404-actions {
        width: 100%;
    }

    .error-404-button {
        flex: 1 1 100%;
    }

    .error-404-quote {
        grid-template-columns: 4px minmax(0, 1fr);
        gap: 14px;
    }

    .error-404-copy__text {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .error-404-orb::before,
    .error-404-code,
    .error-404-code::before,
    .error-404-code::after {
        animation: none !important;
    }

    .error-404-button,
    .error-404-quote__text,
    .error-404-quote__author {
        transition: none !important;
    }
}
