:root {
  --ink: #09090b;
  --panel: #18181b;
  --line: rgba(228, 228, 231, 0.08);
  --lime: #10b981;
  --lime-deep: #059669;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --on-lime: #052e16;
  --warn: #fbbf24;
  --lock: #34d399;
  --deny: #f87171;
  --display: "Space Grotesk", "Segoe UI", sans-serif;
  --body: Inter, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body.err {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--body);
  line-height: 1.5;
  background:
    radial-gradient(1100px 480px at 88% -12%, rgba(16, 185, 129, 0.14), transparent 55%),
    radial-gradient(800px 360px at -8% 18%, rgba(16, 185, 129, 0.05), transparent 48%),
    var(--ink);
}

body.err--400 {
  background:
    radial-gradient(1100px 480px at 88% -12%, rgba(251, 191, 36, 0.1), transparent 55%),
    radial-gradient(800px 360px at -8% 18%, rgba(16, 185, 129, 0.05), transparent 48%),
    var(--ink);
}

body.err--403 {
  background:
    radial-gradient(1100px 480px at 88% -12%, rgba(248, 113, 113, 0.12), transparent 55%),
    radial-gradient(800px 360px at -8% 18%, rgba(16, 185, 129, 0.04), transparent 48%),
    var(--ink);
}

body.err--500 {
  background:
    radial-gradient(1100px 480px at 88% -12%, rgba(16, 185, 129, 0.08), transparent 55%),
    radial-gradient(700px 420px at 40% 110%, rgba(248, 113, 113, 0.08), transparent 50%),
    var(--ink);
}

.err-tape {
  position: fixed;
  inset: auto 0 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  border-top: 1px solid var(--line);
  background: rgba(9, 9, 11, 0.72);
  color: rgba(161, 161, 170, 0.55);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.err-tape span {
  display: inline-block;
  padding: 10px 0;
  white-space: nowrap;
  animation: err-scroll 36s linear infinite;
}

@keyframes err-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.err-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.err-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 72px;
}

.err-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
}

.err-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--lime);
  color: var(--on-lime);
}

.err-top-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.err-top-link:hover {
  color: var(--text);
}

.err-main {
  display: grid;
  align-items: center;
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 12px 0 72px;
  gap: 48px;
}

@media (min-width: 860px) {
  .err-main {
    grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.9fr);
    padding-bottom: 88px;
  }
}

.err-copy {
  position: relative;
}

.err-kicker {
  margin: 0 0 14px;
  color: var(--lime);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.err--400 .err-kicker { color: var(--warn); }
.err--403 .err-kicker { color: var(--deny); }

.err-code {
  position: absolute;
  top: -0.55em;
  left: -0.08em;
  margin: 0;
  color: rgba(244, 244, 245, 0.06);
  font-family: var(--display);
  font-size: clamp(5.2rem, 16vw, 9.5rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 0.8;
  pointer-events: none;
  user-select: none;
}

.err-copy h1 {
  position: relative;
  margin: 28px 0 12px;
  max-width: 16ch;
  font-family: var(--display);
  font-size: clamp(2.1rem, 4.4vw, 3.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.err-lead {
  position: relative;
  margin: 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 1.02rem;
}

.err-hint {
  position: relative;
  margin: 16px 0 0;
  max-width: 46ch;
  color: #71717a;
  font-size: 0.92rem;
}

.err-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.err-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.err-btn:focus-visible,
.err-brand:focus-visible,
.err-top-link:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

.err-btn-lime {
  background: var(--lime);
  color: var(--on-lime);
}

.err-btn-lime:hover {
  background: #34d399;
}

.err-btn-ghost {
  border-color: rgba(243, 246, 244, 0.18);
  background: transparent;
  color: var(--text);
}

.err-btn-ghost:hover {
  border-color: var(--lime);
  color: var(--lime);
}

.err-figure {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(24, 24, 27, 0.9), rgba(9, 9, 11, 0.72));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.err-figure svg {
  width: min(100%, 340px);
  height: auto;
}

.err-fig-label {
  margin: 18px 0 0;
  color: var(--muted);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.err-pulse {
  stroke-dasharray: 6 10;
  animation: err-dash 2.8s linear infinite;
}

.err-stutter {
  animation: err-flicker 2.4s ease-in-out infinite;
}

@keyframes err-dash {
  to { stroke-dashoffset: -120; }
}

@keyframes err-flicker {
  0%, 18%, 22%, 100% { opacity: 1; }
  20% { opacity: 0.15; }
}

@media (prefers-reduced-motion: reduce) {
  .err-tape span,
  .err-pulse,
  .err-stutter {
    animation: none;
  }
}
