:root {
  color-scheme: dark;
  --bg: #090a0d;
  --surface: #11131a;
  --surface-strong: #171a22;
  --border: #282c36;
  --border-strong: #383d49;
  --text: #f3f5f7;
  --text-soft: #c9cdd5;
  --muted: #a6abb5;
  --subtle: #7f8692;
  --cyan: #4ac7ff;
  --cyan-strong: #99e2ff;
  --cyan-wash: #102737;
  --magenta: #ec5bc8;
  --green: #75d7ad;
  --amber: #e2b86b;
  --status-accent: var(--amber);
  --status-wash: rgb(226 184 107 / 10%);
  --font-sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --ease: 180ms ease;
}

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

html,
body {
  min-width: 320px;
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.status-5xx {
  --status-accent: #f287d6;
  --status-wash: rgb(236 91 200 / 10%);
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
  max-width: 100%;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

:focus-visible {
  outline: 2px solid var(--cyan-strong);
  outline-offset: 3px;
}

::selection {
  background: var(--status-accent);
  color: #090a0d;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  transform: translateY(-160%);
  padding: 9px 13px;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  transition: transform var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

.error-shell {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  isolation: isolate;
}

.error-shell::before {
  position: fixed;
  z-index: -2;
  inset: 0;
  background:
    linear-gradient(rgb(255 255 255 / 2%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 2%) 1px, transparent 1px);
  background-size: 44px 44px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 82%);
  pointer-events: none;
}

.error-shell::after {
  position: fixed;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(circle at 16% 28%, var(--status-wash), transparent 28%),
    radial-gradient(circle at 83% 66%, rgb(74 199 255 / 6%), transparent 26%);
  content: "";
  pointer-events: none;
}

.error-header {
  display: flex;
  width: 100%;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 58px);
  border-bottom: 1px solid var(--border);
  background: rgb(9 10 13 / 88%);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #266986;
  background: linear-gradient(135deg, var(--cyan-wash), rgb(50 21 44));
}

.brand-mark img {
  width: 36px;
  height: auto;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.2;
}

.brand small {
  margin-top: 3px;
  color: var(--subtle);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main-site-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.main-site-link:hover {
  color: var(--cyan-strong);
}

.main-site-link svg {
  width: 15px;
  height: 15px;
}

.error-main {
  display: grid;
  width: min(1180px, 100%);
  flex: 1;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: clamp(54px, 8vw, 120px);
  align-items: center;
  margin: 0 auto;
  padding: clamp(62px, 9vh, 110px) clamp(24px, 5vw, 64px);
}

.error-copy {
  min-width: 0;
}

.status-label,
.panel-index {
  margin: 0;
  color: var(--subtle);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.105em;
  text-transform: uppercase;
}

.status-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--status-accent);
}

.status-label span {
  width: 24px;
  height: 1px;
  background: var(--status-accent);
}

.status-code {
  margin: clamp(28px, 5vh, 54px) 0 0;
  color: transparent;
  font-family: var(--font-mono);
  font-size: clamp(94px, 15vw, 184px);
  font-weight: 600;
  letter-spacing: -0.09em;
  line-height: 0.72;
  -webkit-text-stroke: 1px var(--border-strong);
  -webkit-text-stroke: 1px color-mix(in srgb, var(--status-accent) 55%, var(--border));
}

.error-copy h1 {
  max-width: 720px;
  margin: 36px 0 16px;
  font-size: clamp(42px, 5.4vw, 68px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.error-summary {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.65;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin-top: 34px;
}

.primary-action {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border-radius: 6px;
  background: var(--cyan-strong);
  color: #071017;
  font-weight: 600;
  box-shadow: 0 12px 30px rgb(74 199 255 / 10%);
  transition: transform var(--ease), background var(--ease);
}

.primary-action:hover {
  transform: translateY(-1px);
  background: #c0efff;
}

.primary-action svg {
  width: 16px;
  height: 16px;
}

.secondary-action {
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
}

.secondary-action:hover {
  color: var(--cyan-strong);
}

.recovery-panel {
  min-width: 0;
  padding: 30px;
  border: 1px solid var(--border-strong);
  border-top-color: color-mix(in srgb, var(--status-accent) 60%, var(--border-strong));
  background: rgb(13 15 20 / 86%);
  box-shadow: 0 24px 60px rgb(0 0 0 / 18%);
}

.recovery-panel h2 {
  margin: 18px 0 0;
  color: var(--text-soft);
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.recovery-panel ol {
  display: grid;
  gap: 14px;
  margin: 24px 0 0;
  padding: 0;
  color: var(--muted);
  counter-reset: recovery;
  font-size: 14px;
  list-style: none;
}

.recovery-panel li {
  position: relative;
  min-height: 28px;
  padding-left: 38px;
  counter-increment: recovery;
}

.recovery-panel li::before {
  position: absolute;
  top: -2px;
  left: 0;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--status-accent);
  content: counter(recovery, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 8px;
}

.technical-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.technical-status span {
  color: var(--subtle);
}

.technical-status strong {
  color: var(--status-accent);
  font-weight: 600;
  text-align: right;
}

.error-footer {
  display: flex;
  min-height: 62px;
  align-items: center;
  gap: 9px;
  padding: 0 clamp(20px, 4vw, 58px);
  border-top: 1px solid var(--border);
  color: var(--subtle);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--status-accent);
  box-shadow: 0 0 0 3px var(--status-wash);
}

.error-footer small {
  margin-left: auto;
  color: var(--subtle);
  font: inherit;
}

@media (max-width: 820px) {
  .error-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 54px;
  }

  .status-code {
    font-size: clamp(92px, 28vw, 150px);
  }
}

@media (max-width: 560px) {
  .error-header {
    min-height: 64px;
  }

  .brand small,
  .main-site-link span {
    display: none;
  }

  .error-main {
    padding-top: 54px;
    padding-bottom: 54px;
  }

  .error-copy h1 {
    margin-top: 30px;
    font-size: clamp(40px, 12vw, 54px);
  }

  .error-summary {
    font-size: 16px;
  }

  .error-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
    text-align: center;
  }

  .recovery-panel {
    padding: 24px;
  }

  .technical-status {
    align-items: flex-start;
    flex-direction: column;
  }

  .technical-status strong {
    text-align: left;
  }

  .error-footer small {
    display: none;
  }
}

@media (forced-colors: active) {
  .status-code {
    color: CanvasText;
    -webkit-text-stroke: 0;
  }

  .status-dot {
    border: 1px solid currentColor;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
