:root {
  --bg: #020903;
  --bg-soft: #031408;
  --terminal-bg: rgba(0, 12, 3, 0.84);
  --terminal-edge: rgba(83, 255, 132, 0.28);
  --terminal-glow: rgba(74, 255, 126, 0.28);
  --ink: #8ef6ab;
  --ink-bright: #b8ffd5;
  --ink-dim: #63b67d;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 24% -10%, rgba(87, 255, 140, 0.14), transparent 42%),
    radial-gradient(circle at 86% 0%, rgba(87, 255, 140, 0.08), transparent 38%),
    linear-gradient(180deg, #010401 0%, var(--bg) 65%, var(--bg-soft) 100%);
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
}

.matrix-rain,
.screen-glow,
.screen-glow::before,
.screen-glow::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.matrix-rain {
  z-index: 0;
  opacity: 0.38;
}

.screen-glow {
  z-index: 1;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0) 36%, rgba(0, 0, 0, 0.72) 100%);
}

.screen-glow::before {
  content: "";
  background: repeating-linear-gradient(
    180deg,
    rgba(16, 70, 30, 0) 0,
    rgba(16, 70, 30, 0) 2px,
    rgba(30, 110, 52, 0.16) 2px,
    rgba(30, 110, 52, 0.16) 3px
  );
  opacity: 0.22;
}

.screen-glow::after {
  content: "";
  background: linear-gradient(
    180deg,
    rgba(120, 255, 161, 0) 0%,
    rgba(120, 255, 161, 0.1) 44%,
    rgba(120, 255, 161, 0) 100%
  );
  animation: sweep 7.4s linear infinite;
}

.viewport {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 100vh;
  padding: 0;
}

.terminal {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: transparent;
}

.terminal-body {
  position: relative;
  padding: clamp(16px, 2.5vw, 34px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(92, 255, 144, 0.38) rgba(1, 12, 3, 0.3);
}

.terminal-body::-webkit-scrollbar {
  width: 9px;
}

.terminal-body::-webkit-scrollbar-thumb {
  background: rgba(92, 255, 144, 0.4);
  border-radius: 999px;
}

.terminal-output {
  display: grid;
  gap: 9px;
  margin: 12px 0 0;
}

.line {
  margin: 0;
  font-size: clamp(0.76rem, 0.9vw, 0.9rem);
  line-height: 1.34;
  letter-spacing: 0.02em;
  text-shadow: 0 0 7px rgba(74, 255, 126, 0.42);
  white-space: pre-wrap;
  word-break: break-word;
}

.boot {
  color: var(--ink-dim);
}

.command-line {
  color: var(--ink-bright);
}

.command-line .prompt {
  color: #66cf85;
}

.output-line {
  color: var(--ink);
}

.output-line.mission {
  color: var(--ink-bright);
}

.output-line.subtle {
  color: var(--ink-dim);
}

.output-line.success {
  color: var(--ink-bright);
}

.output-line.error {
  color: #ff9d9d;
  text-shadow: 0 0 8px rgba(255, 104, 104, 0.35);
}

.input-line {
  margin-top: 18px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 1.45em;
}

.input-line.hidden {
  display: none;
}

.prompt {
  color: #66cf85;
}

#active-command {
  color: var(--ink-bright);
}

.cursor {
  width: 10px;
  height: 1.05em;
  background: var(--ink-bright);
  box-shadow: 0 0 12px rgba(153, 255, 192, 0.84);
  animation: blink 0.9s steps(1, end) infinite;
}

.cursor.typing {
  animation: none;
  opacity: 1;
}

.cursor.hidden {
  animation: none;
  opacity: 0;
}

.terminal.flicker {
  animation: flicker 160ms linear 1;
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

@keyframes sweep {
  0% {
    transform: translateY(-100%);
  }

  100% {
    transform: translateY(140%);
  }
}

@keyframes flicker {
  0% {
    opacity: 1;
  }

  25% {
    opacity: 0.92;
  }

  45% {
    opacity: 0.98;
  }

  80% {
    opacity: 0.94;
  }

  100% {
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .viewport {
    padding: 0;
  }

  .terminal {
    height: 100vh;
  }

  .terminal-body {
    padding: 14px 12px 18px;
  }

  .line {
    font-size: clamp(0.72rem, 2.9vw, 0.82rem);
  }
}

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

  .matrix-rain {
    display: none;
  }
}
