:root {
  --bg-color: #050814;
  --text-color: #e5ecff;
  --muted-color: #7c88aa;
  --accent: #ff7f27;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--bg-color);
  overflow: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: -40px;
  background: radial-gradient(circle at 0% 0%, #263c74 0, transparent 55%),
    radial-gradient(circle at 100% 100%, #ff7f2735 0, transparent 55%),
    radial-gradient(circle at 0% 100%, #32ffc540 0, transparent 55%),
    radial-gradient(circle at 100% 0%, #7f4dff33 0, transparent 55%);
  background-size: 160% 160%;
  animation: cyb-bg-move 24s ease-in-out infinite alternate;
  opacity: 0.9;
  z-index: -2;
}

@keyframes cyb-bg-move {
  0% {
    background-position: 0% 0%, 100% 100%, 0% 100%, 100% 0%;
  }
  50% {
    background-position: 30% 10%, 80% 90%, 10% 80%, 90% 20%;
  }
  100% {
    background-position: 60% 30%, 60% 100%, 0% 60%, 100% 40%;
  }
}

.error-card {
  max-width: 520px;
  width: 100%;
  padding: 32px 20px 26px;
  border-radius: 20px;
  background: radial-gradient(circle at top, #ffffff0a 0, transparent 60%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.85);
  position: relative;
  z-index: 1;
}

.error-code {
  font-size: 80px;
  letter-spacing: 8px;
  margin: 0 0 10px;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(255, 127, 39, 0.95),
    0 0 28px rgba(255, 127, 39, 0.8);
}

.error-subtitle {
  font-size: 18px;
  margin-bottom: 8px;
}

.error-text {
  font-size: 14px;
  color: var(--muted-color);
  margin: 0 0 24px;
}

.link-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--text-color);
  text-decoration: none;
  font-size: 14px;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 14px rgba(0, 0, 0, 0.8);
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out,
    border-color 0.12s ease-out, background 0.12s ease-out;
}

.link-home span:last-child {
  font-size: 16px;
}

.link-home:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 127, 39, 0.9);
  background: rgba(5, 8, 20, 0.85);
  box-shadow: 0 0 22px rgba(255, 127, 39, 0.8);
}

.service-message {
  margin-top: 26px;
  font-size: 13px;
  color: var(--muted-color);
  display: none;
}

.service-message a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.4);
}

.service-message a:hover {
  border-bottom-color: var(--accent);
  color: #ffd0a4;
}

.falling-orb {
  position: fixed;
  top: -40px;
  width: 77px;
  height: 77px;
  border-radius: 999px;
  background: radial-gradient(
    circle at 30% 30%,
    #fff 0,
    #ffe1c0 20%,
    #ff7f27 55%,
    rgba(0, 0, 0, 0) 70%
  );
  box-shadow: 0 0 12px rgba(255, 127, 39, 0.95),
    0 0 28px rgba(255, 127, 39, 0.7);
  cursor: pointer;
  animation: fall-orb 4s linear forwards;
  z-index: 0;
}

@keyframes fall-orb {
  0% {
    transform: translate3d(0, -40px, 0) scale(0.9);
    opacity: 0;
  }
  5% {
    opacity: 1;
  }
  100% {
    transform: translate3d(0, 110vh, 0) scale(1.05);
    opacity: 0;
  }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(6px);
  z-index: 9999;
}

.modal-content {
  background: #262837;
  padding: 30px;
  border-radius: 16px;
  width: 380px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
  animation: pop 0.25s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes pop {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.convariant {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 14px;
  animation: cv-appear 0.8s ease forwards;
  opacity: 0;
}

.convariant .circle {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    #ffd8a3,
    #ff7f27 60%,
    rgba(255, 127, 39, 0.4)
  );
  filter: blur(1px);
  animation: circle-pulse 2.4s ease-in-out infinite;
  opacity: 0.9;
}

.convariant .emoji {
  position: absolute;
  inset: 0;
  font-size: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: emoji-bounce 1.8s ease-in-out infinite;
  text-shadow: 0 0 6px rgba(255, 127, 39, 0.8), 0 0 14px rgba(255, 127, 39, 0.4);
}

.title {
  margin-top: 4px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 4px;
}

.subtitle {
  margin: 0 0 16px;
  color: #c8cde6;
  font-size: 14px;
  text-align: center;
}

@keyframes cv-appear {
  0% {
    opacity: 0;
    transform: translateY(-16px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes circle-pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.75;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.75;
  }
}

@keyframes emoji-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-6px) scale(1.06);
  }
  70% {
    transform: translateY(0);
  }
}

.modal-content h2 {
  margin: 0 0 10px;
  font-size: 18px;
  color: white;
}

.modal-content p {
  margin: 0 0 15px;
  color: #b8bfd6;
}

#promptInput {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  background: #1f1f2b;
  border: 1px solid #444;
  outline: none;
  font-size: 15px;
  color: #e9e9e9;
}

#promptInput:focus {
  border-color: #ff7f27;
  box-shadow: 0 0 8px rgba(255, 127, 39, 0.5);
}

.buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

button {
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  transition: 0.2s;
}

#confirmBtn {
  background: #ff7f27;
  color: #fff;
}

#confirmBtn:hover {
  background: #ff923f;
}

.cancel {
  background: #3a3d52;
  color: #ccc;
}

.cancel:hover {
  background: #4d516c;
}

@media (max-width: 600px) {
  .error-card {
    padding: 26px 16px 20px;
    border-radius: 16px;
  }
  .error-code {
    font-size: 64px;
  }
}

@media (max-width: 600px) {
  .falling-orb {
    width: 150px;
    height: 150px;
  }
}
