:root {
  --bg-gradient-jet: linear-gradient(
      to bottom right,
      hsla(240, 1%, 18%, 0.251) 0%,
      hsla(240, 2%, 11%, 0) 100%
    ),
    hsl(240, 2%, 13%);
  --text-gradient-sunset: linear-gradient(
    to right,
    hsl(10, 100%, 72%),
    hsl(5, 100%, 68%)
  );
  --jet: hsl(0, 0%, 22%);
  --eerie-black-2: hsl(240, 2%, 12%);
  --smoky-black: hsl(0, 0%, 7%);
  --white: #ffffff;
  --white-2: hsl(0, 0%, 98%);
  --vibrant-red: hsl(0, 100%, 72%);
  --light-gray: hsl(0, 0%, 84%);
  --ff-poppins: "Poppins", sans-serif;
  --shadow-3: 0 16px 40px hsla(0, 0%, 0%, 0.25);
  --transition-1: 0.25s ease;
  --transition-2: 0.5s ease-in-out;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--ff-poppins);
  background: var(--smoky-black);
  color: var(--white-2);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  overflow-x: hidden;
}

.error-container {
  background: var(--eerie-black-2);
  border: 1px solid var(--jet);
  border-radius: 20px;
  padding: 40px 30px;
  max-width: 600px;
  width: 100%;
  box-shadow: var(--shadow-3);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.error-container::before {
  content: "";
  position: absolute;
  inset: 1px;
  background: var(--bg-gradient-jet);
  border-radius: inherit;
  z-index: -1;
}

/* Cosmic Warp Background Effect */
.cosmic-warp {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
      circle at 30% 30%,
      hsla(10, 100%, 72%, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 70% 70%,
      hsla(5, 100%, 68%, 0.1) 0%,
      transparent 50%
    );
  z-index: -1;
  opacity: 0;
  animation: warpIn 1.5s ease-out forwards;
}

.error-content {
  opacity: 0;
  transform: scale(0.8);
  animation: cosmicReveal 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.5s
    forwards;
}

.error-code {
  font-size: 120px;
  font-weight: 700;
  background: var(--text-gradient-sunset);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
  margin-bottom: 20px;
  position: relative;
  display: inline-block;
  text-shadow: 0 0 15px rgba(255, 69, 58, 0.3);
}

.error-title {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--white);
  opacity: 0;
  transform: translateY(20px);
  animation: textReveal 0.6s ease-out 0.8s forwards;
}

.error-message {
  font-size: 18px;
  color: var(--light-gray);
  margin-bottom: 30px;
  line-height: 1.6;
  opacity: 0;
  transform: translateY(20px);
  animation: textReveal 0.6s ease-out 1s forwards;
}

.home-btn {
  display: inline-block;
  padding: 12px 30px;
  background: var(--text-gradient-sunset);
  color: var(--white);
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  z-index: 1;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(20px);
  animation: textReveal 0.6s ease-out 1.2s forwards, pulseGlow 2s infinite 2s;
}

.home-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #ff2a2a, var(--vibrant-red));
  opacity: 0;
  transition: var(--transition-1);
  z-index: -1;
}

.home-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255, 0, 0, 0.35);
}

.home-btn:hover::before {
  opacity: 1;
}

/* Particle Animation */
.particle {
  position: absolute;
  background: var(--vibrant-red);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

/* Animations */
@keyframes warpIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes cosmicReveal {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes textReveal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.4);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(255, 69, 58, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 69, 58, 0);
  }
}

@keyframes particleFloat {
  0% {
    transform: translate(0, 0);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty));
    opacity: 0;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .error-container {
    padding: 30px 20px;
  }

  .error-code {
    font-size: 90px;
  }

  .error-title {
    font-size: 26px;
  }

  .error-message {
    font-size: 16px;
    margin-bottom: 25px;
  }

  .home-btn {
    padding: 10px 25px;
  }
}

@media (max-width: 480px) {
  .error-container {
    padding: 25px 15px;
    border-radius: 15px;
  }

  .error-code {
    font-size: 70px;
  }

  .error-title {
    font-size: 22px;
  }

  .error-message {
    font-size: 15px;
    margin-bottom: 20px;
  }

  .home-btn {
    padding: 8px 20px;
    font-size: 14px;
  }
}

@media (max-width: 350px) {
  .error-code {
    font-size: 60px;
  }

  .error-title {
    font-size: 20px;
  }
}
