@font-face {
  font-family: 'Share Tech Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/share-tech-mono-latin.woff2) format('woff2');
}

/* Variable font: one file covers both the 300 and 700 weights */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(fonts/space-grotesk-latin.woff2) format('woff2');
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #0a0a0a;
  color: #e8e8e8;
  font-family: 'Share Tech Mono', monospace;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Scanline overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  pointer-events: none;
  z-index: 100;
}

/* Particles */
.particle {
  position: fixed;
  width: 2px;
  height: 2px;
  background: #f5c518;
  border-radius: 50%;
  animation: drift linear infinite;
  opacity: 0;
}

.particle:nth-of-type(1) { left: 10%; animation-duration: 6s; animation-delay: 0s; }
.particle:nth-of-type(2) { left: 25%; animation-duration: 8s; animation-delay: 1s; }
.particle:nth-of-type(3) { left: 40%; animation-duration: 5s; animation-delay: 2s; }
.particle:nth-of-type(4) { left: 60%; animation-duration: 7s; animation-delay: 0.5s; }
.particle:nth-of-type(5) { left: 75%; animation-duration: 9s; animation-delay: 3s; }
.particle:nth-of-type(6) { left: 88%; animation-duration: 6s; animation-delay: 1.5s; }

@keyframes drift {
  0% { transform: translateY(100vh) translateX(0); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% { transform: translateY(-10vh) translateX(20px); opacity: 0; }
}

/* Main 404 */
.glitch-wrap {
  position: relative;
  margin-bottom: 0.2em;
}

.code-404 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(120px, 22vw, 280px);
  color: #f5c518;
  line-height: 1;
  position: relative;
  letter-spacing: -0.05em;
  animation: glitch-base 3s infinite;
}

.code-404::before,
.code-404::after {
  content: '404';
  position: absolute;
  inset: 0;
}

.code-404::before {
  color: #00fff7;
  animation: glitch-top 3s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}

.code-404::after {
  color: #ff0055;
  animation: glitch-bottom 3s infinite;
  clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

@keyframes glitch-base {
  0%, 90%, 100% { transform: none; }
  91% { transform: skew(-0.5deg); }
  92% { transform: skew(0.5deg); }
  93% { transform: none; }
  96% { transform: skew(-1deg); }
  97% { transform: none; }
}

@keyframes glitch-top {
  0%, 90%, 100% { transform: none; opacity: 0; }
  91% { transform: translate(-4px, -2px); opacity: 1; }
  92% { transform: translate(4px, 0); opacity: 1; }
  93% { transform: none; opacity: 0; }
  96% { transform: translate(-6px, -1px); opacity: 1; }
  97% { opacity: 0; }
}

@keyframes glitch-bottom {
  0%, 90%, 100% { transform: none; opacity: 0; }
  91% { transform: translate(4px, 2px); opacity: 1; }
  92% { transform: translate(-4px, 0); opacity: 1; }
  93% { transform: none; opacity: 0; }
  96% { transform: translate(6px, 1px); opacity: 1; }
  97% { opacity: 0; }
}

/* Runner */
.runner-row {
  font-size: clamp(28px, 5vw, 52px);
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 1.5em;
}

.runner {
  display: inline-block;
  animation: run-bounce 0.4s infinite alternate, run-slide 8s linear infinite;
}

@keyframes run-bounce {
  from { transform: translateY(0) scaleX(1); }
  to   { transform: translateY(-6px) scaleX(1.05); }
}

@keyframes run-slide {
  0%   { margin-left: -60px; opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { margin-left: calc(100vw + 60px); opacity: 0; }
}

/* Terminal */
.terminal {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(245,197,24,0.25);
  border-radius: 8px;
  padding: 1.4em 2em;
  max-width: 540px;
  width: 90%;
  font-size: 13px;
  line-height: 1.9;
  text-align: left;
  backdrop-filter: blur(6px);
}

.terminal .prompt { color: #f5c518; }
.terminal .ok     { color: #00d26a; }
.terminal .err    { color: #ff5e5e; }
.terminal .dim    { color: #666; }
.terminal .val    { color: #00c8ff; }

.blink {
  animation: blink-cur 1s step-end infinite;
}
@keyframes blink-cur { 50% { opacity: 0; } }

/* Stats bar */
.stats {
  display: flex;
  gap: 2em;
  margin-top: 1.5em;
  font-size: 12px;
  color: #555;
  letter-spacing: 0.08em;
}

.stats span { display: flex; flex-direction: column; align-items: center; gap: 0.2em; }
.stats .val  { font-size: 20px; color: #f5c518; font-family: 'Space Grotesk', sans-serif; font-weight: 700; }

/* Footer */
.footer {
  margin-top: 3em;
  font-size: 11px;
  color: #333;
  letter-spacing: 0.1em;
}
