:root {
  --navy: #061d34;
  --navy-dark: #031426;
  --red: #e21f2f;
  --red-dark: #bd1623;
  --yellow: #f2b705;
  --white: #ffffff;
  --muted: #c8d4e5;
  --line: rgba(255, 255, 255, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--white);
  background: var(--navy-dark);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid #f2b705;
  outline-offset: 4px;
}

/* Page */

.error-page {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 52%, rgba(226, 31, 47, 0.10), transparent 26%),
    linear-gradient(120deg, #06111f 0%, #031426 42%, #06203a 100%);
}

.error-page::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-image:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(90deg, rgba(0,0,0,0.95), transparent 78%);
  pointer-events: none;
}

/* Layout */

.error-layout {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100vh;
  padding: clamp(26px, 5vw, 72px) clamp(20px, 8vw, 140px);
  display: grid;
  grid-template-columns: minmax(310px, 0.9fr) minmax(380px, 1.1fr);
  align-items: center;
  gap: clamp(28px, 5vw, 76px);
  min-height: 100vh;
}

.error-copy {
  max-width: 660px;
}

.error-kicker {
  margin: 0 0 22px;
  color: var(--red);
  font-size: 13px;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.error-copy h1 {
  margin: 0;
  font-size: clamp(42px, 6.1vw, 84px);
  line-height: 0.96;
  letter-spacing: -0.065em;
}

.error-copy h1 span {
  display: block;
  color: var(--red);
}

.error-text {
  max-width: 540px;
  margin: 24px 0 18px;
  color: #e6edf8;
  font-size: clamp(16px, 1.35vw, 20px);
  line-height: 1.55;
}

.error-translation {
  max-width: 540px;
  margin: 0 0 26px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,0.055);
  backdrop-filter: blur(10px);
}

.error-translation h2 {
  margin: 0 0 8px;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.error-translation p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.error-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  min-height: 56px;
  padding: 0 26px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  border: 1px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-2px);
}

.btn-red {
  background: var(--red);
  color: #fff;
  box-shadow: 0 18px 36px rgba(226, 31, 47, 0.26);
}

.btn-red:hover,
.btn-red:focus-visible {
  background: var(--red-dark);
}

.btn-outline {
  border-color: rgba(255, 255, 255, 0.34);
  color: #fff;
  background: rgba(255, 255, 255, 0.055);
}

.error-site {
  margin: 24px 0 0;
  color: #c7d2e3;
  font-size: 15px;
}

.error-site strong {
  color: #fff;
}

/* Crane scene */

.crane-scene {
  position: relative;
  min-height: 520px;
  width: 100%;
}

.crane-beam {
  position: absolute;
  top: 78px;
  right: 0;
  width: 560px;
  height: 74px;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffcb23 0%, #f0b400 100%);
  box-shadow:
    0 22px 40px rgba(0, 0, 0, 0.28),
    inset 0 -6px 0 rgba(0, 0, 0, 0.12);
  transform: rotate(-2deg);
}

.crane-beam::before {
  content: "";
  position: absolute;
  left: 24px;
  top: 50%;
  width: 92px;
  height: 20px;
  transform: translateY(-50%);
  background:
    repeating-linear-gradient(
      45deg,
      rgba(6, 29, 52, 0.78) 0 12px,
      transparent 12px 24px
    );
}

.crane-beam span {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  color: #061d34;
  font-size: 23px;
  font-weight: 1000;
  letter-spacing: 0.03em;
}

.trolley {
  position: absolute;
  top: 118px;
  right: 220px;
  width: 96px;
  height: 76px;
  border-radius: 14px;
  background: linear-gradient(180deg, #253752 0%, #142338 100%);
  box-shadow:
    0 18px 30px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(255,255,255,0.07);
}

.trolley::before,
.trolley::after {
  content: "";
  position: absolute;
  bottom: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #081c31;
  border: 3px solid #d6e1ef;
}

.trolley::before {
  left: 16px;
}

.trolley::after {
  right: 16px;
}

/* Moving hanging load */

.load-group {
  position: absolute;
  top: 188px;
  right: 145px;
  width: 340px;
  height: 340px;
  transform-origin: 50% 0;
  animation: craneSwing 4.8s ease-in-out infinite;
}

.cables {
  position: absolute;
  top: 0;
  left: 50%;
  width: 34px;
  height: 132px;
  transform: translateX(-50%);
}

.cables span {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f3f7fb 0%, #93a4b9 100%);
  box-shadow: 0 0 1px rgba(255,255,255,0.35);
}

.cables span:first-child {
  left: 10px;
}

.cables span:last-child {
  right: 10px;
}

.hook {
  position: absolute;
  top: 128px;
  left: 50%;
  width: 48px;
  height: 56px;
  transform: translateX(-50%);
  border: 9px solid var(--yellow);
  border-top: 0;
  border-radius: 0 0 28px 28px;
  box-shadow: 0 14px 22px rgba(0,0,0,0.26);
}

.hook::before {
  content: "";
  position: absolute;
  top: -24px;
  left: 50%;
  width: 26px;
  height: 26px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--yellow);
}

.hook::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -2px;
  width: 22px;
  height: 16px;
  border-right: 8px solid var(--yellow);
  border-bottom: 8px solid var(--yellow);
  border-radius: 0 0 16px 16px;
}

.sign-404 {
  position: absolute;
  top: 186px;
  left: 50%;
  width: 330px;
  height: 170px;
  transform: translateX(-50%) rotate(1.5deg);
  border-radius: 18px;
  background: linear-gradient(180deg, #243652 0%, #141f31 100%);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow:
    0 28px 50px rgba(0,0,0,0.34),
    inset 0 0 0 1px rgba(255,255,255,0.04);
  display: grid;
  place-items: center;
}

.sign-404::before,
.sign-404::after {
  content: "";
  position: absolute;
  top: -52px;
  width: 3px;
  height: 68px;
  background: #a6b4c6;
}

.sign-404::before {
  left: 36%;
  transform: rotate(12deg);
}

.sign-404::after {
  right: 36%;
  transform: rotate(-12deg);
}

.sign-404 strong {
  position: relative;
  z-index: 1;
  font-size: 118px;
  line-height: 1;
  color: #ffffff;
  letter-spacing: -0.08em;
  text-shadow:
    0 8px 0 rgba(0,0,0,0.18),
    0 18px 24px rgba(0,0,0,0.30);
}

.sign-404 strong::before,
.sign-404 strong::after {
  content: "";
  position: absolute;
  width: 68px;
  height: 22px;
  background:
    repeating-linear-gradient(
      45deg,
      #ff3140 0 11px,
      transparent 11px 22px
    );
  opacity: 0.95;
}

.sign-404 strong::before {
  left: -72px;
  bottom: -12px;
}

.sign-404 strong::after {
  right: -70px;
  top: -18px;
}

.speech-bubble {
  position: absolute;
  top: 134px;
  right: -8px;
  width: 182px;
  padding: 14px 16px;
  border-radius: 20px;
  border: 2px solid rgba(255,255,255,0.72);
  background: rgba(255,255,255,0.05);
  color: #ffffff;
  font-size: 16px;
  line-height: 1.3;
  transform: rotate(-7deg);
  backdrop-filter: blur(6px);
}

.speech-bubble span {
  display: block;
  margin-top: 4px;
  color: #d9e3f0;
  font-size: 14px;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  left: 22px;
  bottom: -16px;
  width: 28px;
  height: 18px;
  border-left: 2px solid rgba(255,255,255,0.72);
  border-bottom: 2px solid rgba(255,255,255,0.72);
  border-radius: 0 0 0 18px;
}

/* Animation */

@keyframes craneSwing {
  0%, 100% {
    transform: rotate(2deg);
  }

  50% {
    transform: rotate(-2deg);
  }
}

/* Responsive */

@media (max-width: 1100px) {
  html,
  body {
    height: auto;
    overflow: auto;
  }

  .error-page {
    min-height: 100vh;
    height: auto;
    overflow: hidden;
  }

  .error-layout {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    align-items: center;
    padding: 34px 24px 44px;
  }

  .crane-scene {
    min-height: 430px;
    margin-top: 0;
  }

  .crane-beam {
    right: 20px;
    width: 500px;
  }

  .trolley {
    right: 190px;
  }

  .load-group {
    right: 110px;
  }
}

@media (max-width: 680px) {
  .error-layout {
    padding: 28px 18px 36px;
    gap: 12px;
  }

  .error-copy h1 {
    font-size: 42px;
  }

  .error-text {
    font-size: 15px;
    margin-bottom: 16px;
  }

  .error-translation {
    padding: 13px 15px;
    margin-bottom: 18px;
  }

  .error-translation h2 {
    font-size: 20px;
  }

  .error-translation p {
    font-size: 14px;
  }

  .error-actions {
    display: grid;
  }

  .btn {
    width: 100%;
    min-height: 52px;
  }

  .error-site {
    margin-top: 18px;
  }

  .crane-scene {
    min-height: 330px;
    transform: scale(0.72);
    transform-origin: top center;
  }

  .crane-beam {
    top: 30px;
    right: -30px;
    width: 430px;
  }

  .trolley {
    top: 70px;
    right: 132px;
  }

  .load-group {
    top: 138px;
    right: 58px;
  }

  .speech-bubble {
    right: -18px;
    width: 160px;
    font-size: 14px;
  }

  .speech-bubble span {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .load-group {
    animation: none;
  }
}