:root {
  --phosphor: #b6ffce;
  --glow: rgba(182, 255, 206, 0.55);
  --ink: #041208;
  color-scheme: dark;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

html,
body {
  margin: 0;
  height: 100%;
  background: #020302;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  color: var(--phosphor);
  font-family: "JetBrains Mono", ui-monospace, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(15px, 2.05vw, 20px);
  line-height: 1.6;
}

.crt {
  position: relative;
  min-height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background: #020302;
  transform-origin: center center;
}

html.booting .crt {
  animation: power-on 720ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.tube {
  position: relative;
  min-height: 100dvh;
  background: radial-gradient(ellipse at center, #102216 0%, #07110b 58%, #020302 100%);
}

.screen {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding: clamp(1.4rem, 5vh, 2.8rem) clamp(1.2rem, 6vw, 4rem) 3rem;
}

.terminal {
  margin: 0;
  max-width: 46rem;
  text-shadow: 0 0 8px rgba(182, 255, 206, 0.28);
}

.line {
  margin: 0;
  min-height: 1.6em;
  white-space: pre-wrap;
}

.line.gap {
  min-height: 0.85em;
}

.line.dim {
  color: #4f9d74;
}

.line[data-pace="print"] {
  color: #7dcea0;
  white-space: pre;
}

.host {
  color: #e7fff2;
}

.path {
  color: #8fecc0;
}

.sigil {
  color: var(--phosphor);
}

.cmd {
  color: var(--phosphor);
}

a {
  color: #f4fff8;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: rgba(182, 255, 206, 0.7);
  text-shadow:
    0 0 8px rgba(182, 255, 206, 0.85),
    0 0 18px rgba(120, 255, 180, 0.4);
  border-radius: 2px;
}

a:hover,
a:focus,
a:focus-visible {
  background: var(--phosphor);
  color: var(--ink);
  text-shadow: none;
  outline: none;
}

html.booting .reveal {
  display: inline-block;
  max-width: 0;
  overflow: hidden;
  white-space: pre;
  vertical-align: bottom;
}

html.booting .line.done .reveal {
  max-width: none;
  overflow: visible;
  white-space: pre-wrap;
}

html.booting .line.done[data-pace="print"] .reveal {
  white-space: pre;
}

.cursor {
  display: inline-block;
  width: 0.58em;
  height: 1.05em;
  margin-left: 0.04em;
  background: var(--phosphor);
  box-shadow: 0 0 10px var(--glow);
  vertical-align: text-bottom;
  transform: translateY(0.14em);
}

.cursor.idle {
  animation: blink 1.06s steps(1) infinite;
}

html.booting .line:not(.active):not(.done) {
  height: 0;
  min-height: 0;
  overflow: hidden;
}

.scanlines,
.vignette,
.glare,
.flicker {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scanlines {
  z-index: 2;
  background: repeating-linear-gradient(
    to bottom,
    rgba(182, 255, 206, 0.022) 0px,
    rgba(182, 255, 206, 0.022) 1px,
    transparent 1px,
    transparent 4px
  );
}

.vignette {
  z-index: 3;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, 0.55) 100%);
}

.glare {
  z-index: 5;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.07), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 18%, transparent 78%, rgba(0, 0, 0, 0.2));
}

.flicker {
  z-index: 4;
  background: rgba(182, 255, 206, 0.035);
  opacity: 0;
  animation: flicker 16s infinite;
}

@keyframes power-on {
  0% {
    opacity: 0;
    filter: brightness(4) saturate(0.2);
    transform: scaleY(0.004);
  }
  16% {
    opacity: 1;
    filter: brightness(2.6);
    transform: scaleY(0.015);
  }
  46% {
    filter: brightness(1.4);
    transform: scaleY(1);
  }
  100% {
    opacity: 1;
    filter: none;
    transform: none;
  }
}

@keyframes flicker {
  0%,
  97%,
  100% {
    opacity: 0;
  }
  97.6% {
    opacity: 0.28;
  }
  98.1% {
    opacity: 0;
  }
}

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

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .screen {
    padding: 1.2rem 1rem 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.booting .crt,
  .cursor.idle,
  .flicker {
    animation: none;
  }

  .flicker {
    opacity: 0;
  }

  .cursor {
    opacity: 1;
  }
}
