:root {
  --bg: #000000;
  --fg: #3dff78;
  --dim: #1f8a45;
  --hi: #d4ffdf;
  --glow: 0 0 6px rgba(61, 255, 120, 0.45);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; color: var(--fg); background: var(--bg); }
body {
  background: radial-gradient(ellipse at 30% 25%, #03160a 0%, #000000 70%) fixed;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: clamp(15px, 0.55vw + 12px, 20px);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  height: 100%;
  overflow: hidden;
}
html { height: 100%; }
#tube {
  position: fixed;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  transform-origin: 50% 50%;
}

/* CRT: scanlines with a very gentle flicker, and a dark vignette at the edges */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
body::before {
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 2px, rgba(0, 0, 0, 0.26) 3px);
  animation: flicker 7s steps(1) infinite;
}
body::after {
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.6) 100%);
}
@keyframes flicker {
  0%, 100% { opacity: 1; }
  41% { opacity: 0.86; }
  42% { opacity: 1; }
  77% { opacity: 0.92; }
  78% { opacity: 1; }
}

#dump {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse at 0 0, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 38%, rgba(0, 0, 0, 0) 75%);
}
main {
  position: relative;
  z-index: 2;
  max-width: 72ch;
  padding: max(6vh, 28px) max(6vw, 20px) 64px;
}
.line {
  min-height: 1.7em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-shadow: var(--glow);
}
.ps { color: var(--dim); }
.out { color: var(--hi); }
.out a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(61, 255, 120, 0.5);
  text-underline-offset: 3px;
}
.out a:hover { background: var(--fg); color: var(--bg); text-shadow: none; }
.dim { color: var(--dim); text-shadow: none; }
.cmd {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  font: inherit;
  line-height: inherit;
  color: inherit;
  background: none;
  text-shadow: inherit;
  text-decoration: underline dotted;
  text-decoration-color: rgba(61, 255, 120, 0.55);
  text-underline-offset: 3px;
  cursor: pointer;
}
.cmd:hover { background: var(--fg); color: var(--bg); text-shadow: none; }
.white { color: #ffffff; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}
#cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.15em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--fg);
  box-shadow: var(--glow);
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.prompt { position: relative; }
.prompt input {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 16px;
  background: transparent;
  color: transparent;
  caret-color: transparent;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* shutdown: the picture squashes to a bright line, then a dot, then black */
#flash {
  position: fixed;
  inset: 0;
  z-index: 4;
  background: #eafff0;
  opacity: 0;
  pointer-events: none;
  transform-origin: 50% 50%;
}
#dot {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 6;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #f2fff5;
  box-shadow: 0 0 12px 5px rgba(61, 255, 120, 0.85);
  pointer-events: none;
}
#tube.collapsing { animation: power-off 1.5s ease-in forwards; }
#flash.collapsing { animation: power-off 1.5s ease-in forwards, flash 1.5s ease-in forwards; }
#dot.fade { animation: dot-fade 2.6s ease-out forwards; }
@keyframes power-off {
  0% { transform: scale(1, 1); }
  35% { transform: scale(1, 0.005); }
  50% { transform: scale(0.92, 0.005); }
  78% { transform: scale(0.006, 0.005); }
  100% { transform: scale(0, 0); }
}
@keyframes flash {
  0% { opacity: 0; }
  30% { opacity: 0.85; }
  78% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes dot-fade {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.3); }
}
body.dark { background: #000000; }
body.dark::before, body.dark::after { display: none; }

@media (max-width: 600px) {
  .ps .host { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #cursor, body::before { animation: none; }
}
