<script>
    import { page } from "$app/state";
    import favicon from "$lib/assets/favicon.png";
</script>

<main>
    <div class="glow"></div>

    <img src={favicon} alt="ChatRPG logo" class="logo" />

    <div class="content">
        <p class="code">Error {page.status}</p>
        <p class="message">{page.error.message}</p>
        <a href={page.error.back} class="home-btn">Back</a>
    </div>
</main>

<style>
    main {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 2rem;
        position: relative;
        overflow: hidden;
        background: #0b0b10;
    }

    .glow {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 600px;
        height: 400px;
        background: radial-gradient(ellipse, rgba(192, 132, 252, 0.07) 0%, transparent 70%);
        pointer-events: none;
    }

    .content {
        position: relative;
        text-align: center;
        max-width: 480px;
    }

    .logo {
        width: 192px;
        height: 192px;
        position: absolute;
        top: 2rem;
        left: 50%;
        transform: translateX(-50%);
    }

    .code {
        font-size: 7rem;
        font-weight: 800;
        line-height: 1;
        letter-spacing: -4px;
        background: linear-gradient(135deg, #c084fc, #5a5aff);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        margin-bottom: 1rem;
    }

    h1 {
        font-size: clamp(1.6rem, 4vw, 2.2rem);
        font-weight: 800;
        letter-spacing: -1.5px;
        color: #e5e5ea;
        margin-bottom: 0.75rem;
    }

    .message {
        font-size: 1rem;
        color: #6b6b7a;
        margin-bottom: 2.5rem;
        line-height: 1.5;
    }

    .home-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 0.65rem 1.5rem;
        background: #1a1a26;
        border: 1px solid #2e2e4a;
        border-radius: 10px;
        color: #e5e5ea;
        font-size: 0.95rem;
        font-weight: 600;
        text-decoration: none;
        transition: background 0.15s, border-color 0.15s;
    }

    .home-btn:hover {
        background: #252535;
        border-color: #c084fc;
    }
</style>
