:root {
  --bg: #03060d;
  --fg: #eaf2ff;
  --error-bg: rgba(9, 13, 20, 0.9);
  --error-border: rgba(234, 242, 255, 0.34);
  --error-text: rgba(234, 242, 255, 0.95);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body {
  overflow-x: hidden;
  color: var(--fg);
  font-family: "IBM Plex Mono", "JetBrains Mono", "Cascadia Mono", "Consolas", monospace;
  cursor: none;
}

#bg-canvas,
#glyph-canvas,
.scanlines,
.vignette {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#bg-canvas {
  z-index: 0;
}

#glyph-canvas {
  z-index: 1;
}

#dot-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  margin-top: -4px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 8;
  background: rgba(235, 245, 255, 0.96);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.24),
    0 0 16px rgba(160, 210, 255, 0.45);
  opacity: 0;
  transform: translate3d(0, 0, 0);
  transition: opacity 0.22s ease;
}

#dot-cursor.visible {
  opacity: 1;
}

.scanlines {
  z-index: 3;
  opacity: 0.028;
  mix-blend-mode: screen;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.012) 0 1px,
    transparent 1px 3px
  );
}

.vignette {
  z-index: 4;
  opacity: 0.62;
  background:
    radial-gradient(130vmax 100vmax at 50% 45%, transparent 30%, rgba(0, 0, 0, 0.78) 100%),
    radial-gradient(88vmax 66vmax at 55% 38%, rgba(150, 204, 255, 0.045), transparent 70%);
}

#error-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.78);
}

#error-overlay[hidden] {
  display: none !important;
}

#error-overlay p {
  margin: 0;
  max-width: 32rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--error-border);
  border-radius: 0.5rem;
  background: var(--error-bg);
  color: var(--error-text);
  font-size: 0.86rem;
  line-height: 1.4;
  text-align: center;
  letter-spacing: 0.02em;
}

#error-overlay code {
  color: inherit;
}

body.error-state .scanlines,
body.error-state .vignette {
  opacity: 0.18;
}

body.low-power .scanlines {
  opacity: 0.014;
}

@media (max-width: 760px) {
  body {
    cursor: auto;
  }

  #dot-cursor {
    display: none;
  }

  .scanlines {
    opacity: 0.02;
  }

  .vignette {
    opacity: 0.58;
  }

  #error-overlay p {
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scanlines {
    opacity: 0.01;
  }
}

@media (hover: none), (pointer: coarse) {
  body {
    cursor: auto;
  }

  #dot-cursor {
    display: none;
  }
}
