:root {
  --primary: #8171D0;
  --primary-hover: #6F5DC4;
  --primary-press: #5D4DAD;
  --primary-soft: #F0EDF9;
  --primary-softer: #F6F4FC;
  --bg: #F8F6FB;
  --bg-card: #FFFFFF;
  --bg-alt: #FAF9FC;
  --text: #0F0F12;
  --text-muted: #54545E;
  --text-subtle: #8A8A93;
  --border: #ECEAF1;
  --border-strong: #DAD7E0;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-card: 24px;
  --shadow-sm: 0 1px 2px rgba(15, 15, 18, 0.04);
  --shadow-card: 0 1px 2px rgba(15, 15, 18, 0.04), 0 12px 32px rgba(89, 75, 162, 0.06);
  --shadow-card-hover: 0 1px 2px rgba(15, 15, 18, 0.04), 0 20px 48px rgba(89, 75, 162, 0.08);
  --container: 1180px;
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: -0.005em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary-press); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(89, 75, 162, 0.2), inset 0 1px 0 rgba(255,255,255,0.15); }
.btn-primary:hover { background: var(--primary-hover); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(89, 75, 162, 0.25); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: rgba(15, 15, 18, 0.04); }
.btn-outline { background: var(--bg-card); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--text); transform: translateY(-1px); }
.btn-lg { padding: 13px 22px; font-size: 15px; }

/* ─────────── ERROR HERO SECTION ─────────── */
.error-hero {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  position: relative;
  overflow: hidden;
}

.error-hero::before {
  content: '';
  position: absolute;
  top: -120px; left: 50%;
  transform: translateX(-50%);
  width: 1000px; height: 560px;
  background: radial-gradient(ellipse at center, rgba(129, 113, 208, 0.18) 0%, rgba(129, 113, 208, 0.05) 35%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.error-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(129, 113, 208, 0.12) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse 80% 60% at center, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at center, black 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.error-hero-inner {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 1;
}

/* ─────────── ERROR ILLUSTRATION ─────────── */
.error-illustration {
  position: relative;
  margin-bottom: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.error-number {
  font-family: var(--font-serif);
  font-size: clamp(120px, 20vw, 200px);
  font-weight: 400;
  font-style: italic;
  color: var(--primary);
  line-height: 1;
  text-shadow: 0 8px 32px rgba(129, 113, 208, 0.25);
  position: relative;
  z-index: 2;
}

.error-icon {
  font-size: clamp(80px, 15vw, 120px);
  line-height: 1;
  filter: drop-shadow(0 8px 24px rgba(129, 113, 208, 0.3));
  position: relative;
  z-index: 2;
}

.error-sparkles {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(129, 113, 208, 0.3);
  animation: sparkle 2s ease-in-out infinite;
}

.sparkle-1 {
  top: 10%;
  left: 15%;
  animation-delay: 0s;
}

.sparkle-2 {
  top: 20%;
  right: 20%;
  animation-delay: 0.5s;
}

.sparkle-3 {
  bottom: 30%;
  left: 10%;
  animation-delay: 1s;
}

.sparkle-4 {
  bottom: 15%;
  right: 15%;
  animation-delay: 1.5s;
}

@keyframes sparkle {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.6;
  }
}

/* ─────────── ERROR TYPOGRAPHY ─────────── */
.error-hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 24px;
}

.error-hero h1 .accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--primary);
}

.error-lede {
  font-size: clamp(16px, 2vw, 18px);
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 540px;
  margin: 0 auto 32px;
}

/* ─────────── ERROR CTA BUTTONS ─────────── */
.error-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

/* ─────────── ERROR LINKS ─────────── */
.error-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-subtle);
  flex-wrap: wrap;
}

.error-links a {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

.error-links a:hover {
  color: var(--primary);
}

.error-links .sep {
  color: var(--text-subtle);
  opacity: 0.5;
}

/* ─────────── ERROR MESSAGE (for error.tsx) ─────────── */
.error-message {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.error-code {
  color: var(--primary);
  font-weight: 600;
}

/* ─────────── RESPONSIVE DESIGN ─────────── */
@media (max-width: 760px) {
  .error-hero {
    padding: 60px 20px;
  }

  .error-illustration {
    margin-bottom: 32px;
  }

  .error-lede {
    margin-bottom: 28px;
  }

  .error-cta {
    flex-direction: column;
    width: 100%;
    max-width: 320px;
    margin: 0 auto 28px;
  }

  .error-cta .btn {
    width: 100%;
    justify-content: center;
  }

  .error-links {
    flex-direction: column;
    gap: 12px;
  }

  .error-links .sep {
    display: none;
  }
}

@media (max-width: 480px) {
  .error-hero {
    padding: 40px 16px;
  }

  .error-hero h1 {
    margin-bottom: 20px;
  }

  .error-lede {
    margin-bottom: 24px;
  }
}