:root {
  color-scheme: dark;
  --terminal-green: #39ff14;
  --terminal-soft: rgba(57, 255, 20, 0.42);
  --terminal-dim: rgba(57, 255, 20, 0.16);
  --terminal-black: #020602;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--terminal-black);
  font-family: "SFMono-Regular", "Cascadia Code", "Liberation Mono", Menlo, monospace;
}

#game-shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, rgba(57, 255, 20, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(5, 16, 5, 0.72), #010301 62%);
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  filter: contrast(1.12) saturate(1.22);
  opacity: 0;
  transition: opacity 1800ms ease;
}

#game-shell.is-ready #game {
  opacity: 1;
}

#start-prompt {
  position: fixed;
  z-index: 6;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.28em;
  color: var(--terminal-green);
  text-align: center;
  pointer-events: none;
  user-select: none;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 1800ms ease, transform 1800ms ease, filter 1800ms ease;
  text-shadow: none;
}

#start-prompt span {
  display: block;
  max-width: min(90vw, 920px);
  padding: 0 1rem;
  font-size: clamp(3rem, 10vw, 8.6rem);
  line-height: 0.86;
  font-weight: 800;
  letter-spacing: 0;
  color: rgba(2, 18, 2, 0.92);
  -webkit-text-stroke: clamp(1px, 0.22vw, 3px) var(--terminal-green);
  paint-order: stroke fill;
}

#game-shell.is-ready #start-prompt {
  opacity: 0;
  transform: translateY(-14px);
  filter: blur(5px);
}

#score {
  position: fixed;
  z-index: 3;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  min-width: 176px;
  color: var(--terminal-green);
  text-align: center;
  letter-spacing: 0;
  text-shadow:
    0 0 8px rgba(57, 255, 20, 0.95),
    0 0 22px rgba(57, 255, 20, 0.48);
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transition: opacity 900ms ease;
}

#score span,
#score strong {
  display: block;
}

#score span {
  font-size: clamp(0.76rem, 1.4vw, 1rem);
  line-height: 1;
}

#score strong {
  margin-top: 0.08em;
  font-size: clamp(2rem, 5.6vw, 4.35rem);
  line-height: 0.92;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

#nitro {
  position: fixed;
  z-index: 3;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  width: min(190px, 32vw);
  color: var(--terminal-green);
  letter-spacing: 0;
  text-shadow:
    0 0 7px rgba(57, 255, 20, 0.85),
    0 0 18px rgba(57, 255, 20, 0.34);
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transition: filter 120ms ease, opacity 900ms ease;
}

#game-shell.is-ready #score,
#game-shell.is-ready #nitro {
  opacity: 1;
}

#nitro span {
  display: block;
  margin-bottom: 0.42rem;
  font-size: clamp(0.68rem, 1.3vw, 0.88rem);
  line-height: 1;
  text-align: right;
}

#nitro div {
  width: 100%;
  height: 10px;
  border: 1px solid var(--terminal-soft);
  background: rgba(57, 255, 20, 0.05);
  box-shadow: inset 0 0 12px rgba(57, 255, 20, 0.16);
}

#nitro-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--terminal-green);
  box-shadow: 0 0 14px rgba(57, 255, 20, 0.8);
  transform-origin: left center;
  transform: scaleX(1);
}

#nitro.is-active {
  filter: drop-shadow(0 0 10px rgba(57, 255, 20, 0.82));
}

#crt-vignette {
  position: fixed;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(57, 255, 20, 0.05) 0,
      rgba(57, 255, 20, 0.05) 1px,
      rgba(0, 0, 0, 0.12) 2px,
      rgba(0, 0, 0, 0.12) 4px
    ),
    radial-gradient(circle at 50% 45%, transparent 48%, rgba(0, 0, 0, 0.48) 100%);
  mix-blend-mode: screen;
  transition: opacity 900ms ease;
}

#game-shell.is-ready #crt-vignette {
  opacity: 1;
}

body::after {
  content: "";
  position: fixed;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0 0 38px rgba(57, 255, 20, 0.13),
    inset 0 0 140px rgba(0, 0, 0, 0.78);
}
