:root {
    --primary-blue: #3b82f6;
    --primary-blue-dark: #2563eb;
    --dark-900: #0a0a0a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--dark-900);
    color: #e2e8f0;
    overflow-x: hidden;
    min-height: 100vh;
}

.bg-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.bg-gradient {
    background: radial-gradient(ellipse at 30% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
    linear-gradient(135deg, #0a0a0a 0%, #111827 50%, #0a0a0a 100%);
}

.bg-grid {
    background-image: linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
}

.page-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    gap: 2.5rem;
}

.error-section {
    text-align: center;
    animation: fadeInDown 0.7s ease forwards;
}

.error-code {
    font-size: clamp(6rem, 20vw, 12rem);
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, #3b82f6, #60a5fa, #2563eb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -4px;
    filter: drop-shadow(0 0 40px rgba(59, 130, 246, 0.3));
    user-select: none;
}

.error-message {
    font-size: 1.1rem;
    color: #94a3b8;
    margin-top: 0.75rem;
    letter-spacing: 0.05em;
}

.error-message span {
    color: #60a5fa;
    font-weight: 600;
}

.links-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0.5rem;
    animation: fadeInUp 0.7s ease 0.3s both;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.35rem;
    background: #1a2a3f;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 8px;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.btn-link i {
    font-size: 1.1rem;
    line-height: 1;
}

.btn-link:hover {
    background: #1e3558;
    border-color: rgba(59, 130, 246, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.game-section {
    width: 100%;
    max-width: 750px;
    animation: fadeInUp 0.7s ease 0.5s both;
}

.game-card {
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
    transition: border-color 0.3s ease;
}

.game-card:hover {
    border-color: rgba(59, 130, 246, 0.25);
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(0, 0, 0, 0.2);
}

.game-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.score-display {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #60a5fa;
    font-weight: 700;
    letter-spacing: 2px;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 220px;
    background: transparent;
    cursor: pointer;
}

.game-footer {
    padding: 0.65rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 0.78rem;
    color: #475569;
}

.game-footer kbd {
    display: inline-block;
    padding: 2px 7px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    font-family: monospace;
    color: #94a3b8;
    font-size: 0.75rem;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #3b82f6, #2563eb);
    border-radius: 4px;
}

@media (max-width: 640px) {
    .error-code {
        letter-spacing: -2px;
    }

    #gameCanvas {
        height: 180px;
    }
}