@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600&display=swap');

/* FantasyLore error screens — glass morphism window */

:root {
    --error-glass-bg: rgba(12, 10, 22, 0.55);
    --error-glass-bg-light: rgba(255, 255, 255, 0.08);
    --error-glass-border: rgba(255, 255, 255, 0.22);
    --error-glass-border-bright: rgba(255, 215, 140, 0.35);
    --error-glass-shadow: rgba(0, 0, 0, 0.45);
    --error-glass-glow: rgba(186, 148, 255, 0.18);
    --error-accent: #e8c872;
    --error-accent-soft: rgba(232, 200, 114, 0.15);
    --error-text: #f5f0e8;
    --error-text-muted: rgba(245, 240, 232, 0.72);
    --error-title-font: "Cinzel", "Palatino Linotype", "Book Antiqua", serif;
    --error-body-font: "Segoe UI", system-ui, sans-serif;
}

@keyframes error-fade-in {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes error-shimmer {
    0%, 100% {
        opacity: 0.35;
    }
    50% {
        opacity: 0.65;
    }
}

@keyframes error-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

.error-scene {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 58vh;
    padding: clamp(1.5rem, 4vw, 3rem);
    isolation: isolate;
}

.error-scene--fullscreen {
    min-height: 100vh;
    width: 100%;
    padding: clamp(1.25rem, 4vw, 2.5rem);
}

.error-scene__backdrop {
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: 24px;
    background:
        radial-gradient(circle at 20% 20%, rgba(120, 86, 255, 0.16), transparent 42%),
        radial-gradient(circle at 80% 75%, rgba(232, 200, 114, 0.12), transparent 38%);
    pointer-events: none;
}

.error-glass-window {
    width: min(100%, 34rem);
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.14) 0%,
        var(--error-glass-bg) 38%,
        rgba(8, 6, 16, 0.72) 100%
    );
    border: 1px solid var(--error-glass-border);
    box-shadow:
        0 24px 64px var(--error-glass-shadow),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 1px 0 rgba(255, 255, 255, 0.12) inset,
        0 0 48px var(--error-glass-glow);
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    animation: error-fade-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.error-glass-window--critical {
    background: linear-gradient(
        145deg,
        rgba(255, 120, 120, 0.08) 0%,
        rgba(18, 8, 12, 0.78) 42%,
        rgba(6, 4, 8, 0.88) 100%
    );
    border-color: rgba(255, 130, 130, 0.28);
    box-shadow:
        0 28px 70px rgba(0, 0, 0, 0.55),
        0 0 40px rgba(180, 40, 60, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.error-glass-window__chrome {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.85rem 1rem;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.03) 100%
    );
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.error-glass-window__dots {
    display: none;
    align-items: center;
    gap: 0.45rem;
}

.error-glass-window__dot {
    width: 0.72rem;
    height: 0.72rem;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25) inset;
}

.error-glass-window__dot--close {
    background: #ff5f57;
}

.error-glass-window__dot--minimize {
    background: #febc2e;
}

.error-glass-window__dot--maximize {
    background: #28c840;
}

.error-glass-window__chrome-title {
    flex: 1;
    text-align: center;
    font-family: var(--error-body-font);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--error-text-muted);
    user-select: none;
}

.error-glass-window__body {
    padding: clamp(1.5rem, 4vw, 2.25rem);
    text-align: center;
    color: var(--error-text);
}

.error-glass-window__code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.5rem;
    padding: 0.35rem 0.85rem;
    margin-bottom: 1rem;
    border-radius: 999px;
    font-family: var(--error-body-font);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--error-accent);
    background: var(--error-accent-soft);
    border: 1px solid var(--error-glass-border-bright);
}

.error-glass-window__title {
    margin: 0 0 0.85rem;
    font-family: var(--error-title-font);
    font-size: clamp(1.55rem, 3.5vw, 2rem);
    font-weight: 600;
    line-height: 1.25;
    color: var(--error-text);
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}

.error-glass-window__message,
.error-glass-window__quote {
    margin: 0 auto 1.5rem;
    max-width: 28rem;
    font-family: var(--error-body-font);
    font-size: clamp(1rem, 2.2vw, 1.12rem);
    line-height: 1.65;
    color: var(--error-text-muted);
}

.error-glass-window__quote {
    font-style: italic;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.error-glass-window__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.error-glass-window__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 9rem;
    padding: 0.72rem 1.35rem;
    border-radius: 999px;
    font-family: var(--error-body-font);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    color: #1a1208;
    background: linear-gradient(180deg, #f0d998 0%, #c9a44d 100%);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.28),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.error-glass-window__action:hover,
.error-glass-window__action:focus-visible {
    transform: translateY(-2px);
    filter: brightness(1.05);
    box-shadow:
        0 14px 28px rgba(0, 0, 0, 0.32),
        0 0 24px rgba(232, 200, 114, 0.22);
}

.error-glass-window__action:focus-visible {
    outline: 2px solid var(--error-accent);
    outline-offset: 3px;
}

.error-glass-window__action--ghost {
    color: var(--error-text);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: none;
}

.error-glass-window__action--ghost:hover,
.error-glass-window__action--ghost:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.08);
}

.error-scene__logo {
    position: fixed;
    left: clamp(1rem, 4vw, 4rem);
    bottom: clamp(1rem, 4vw, 2.5rem);
    width: min(220px, 34vw);
    opacity: 0.88;
    filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.45));
    animation: error-float 6s ease-in-out infinite;
    user-select: none;
    pointer-events: none;
}

.error-scene__background {
    position: fixed;
    inset: 0;
    z-index: -2;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.45s ease;
}

.error-scene__background.is-visible {
    opacity: 1;
}

.error-scene__background::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(6, 4, 12, 0.35) 0%, rgba(6, 4, 12, 0.72) 100%),
        radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.35) 100%);
}

/* Legacy wrappers keep older markup usable inside the layout */
.error-container:not(.error-scene) {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 58vh;
    padding: clamp(1.5rem, 4vw, 3rem);
}

.error-content,
.error-box {
    width: min(100%, 34rem);
}

@media (max-width: 640px) {
    .error-glass-window__chrome-title {
        font-size: 0.68rem;
    }

    .error-scene__logo {
        width: min(160px, 40vw);
        opacity: 0.65;
    }
}

@media (prefers-reduced-motion: reduce) {
    .error-glass-window,
    .error-scene__logo {
        animation: none;
    }

    .error-glass-window__action {
        transition: none;
    }
}
