@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=VT323&display=swap');

:root {
  --phosphor: #b8ffb8;
  --phosphor-dim: #80dd80;
  --phosphor-bright: #e0ffe0;
  --phosphor-glow: rgba(184, 255, 184, 0.25);
  --bg: #0a0a0a;
  --scanline: rgba(0,0,0,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; text-transform: uppercase; user-select: none; }

#output, #output * { user-select: text; }

body {
  background: var(--bg);
  color: var(--phosphor);
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px;
  height: 100vh;
  overflow: hidden;
  cursor: crosshair;
}

/* CRT scanlines */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    var(--scanline) 0px,
    var(--scanline) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 100;
}

/* CRT vignette */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, transparent 70%, rgba(0,0,0,0.35) 100%);
  pointer-events: none;
  z-index: 99;
}

#screen {
  width: 100%;
  height: 100vh;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

#output {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  padding-bottom: 8px;
}

#output::-webkit-scrollbar { display: none; }

.line {
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
  text-shadow: 0 0 8px var(--phosphor);
}

.line.dim { color: var(--phosphor-dim); text-shadow: none; }
.line.stub { color: #4a6b4a; text-shadow: none; opacity: 0.7; }
.line.bright { color: var(--phosphor-bright); text-shadow: 0 0 12px var(--phosphor-bright); text-decoration: underline; }
.line.error { color: #ff4444; text-shadow: 0 0 8px #ff4444; }
.line.system { color: #ffaa00; text-shadow: 0 0 8px #ffaa00; }
.line.empty { height: 1.6em; }

#input-line {
  display: flex;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid var(--phosphor-dim);
  margin-top: 4px;
}

#prompt {
  color: var(--phosphor-bright);
  text-shadow: 0 0 10px var(--phosphor-bright);
  white-space: nowrap;
  margin-right: 8px;
  font-family: 'Share Tech Mono', monospace;
}

#input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

#input-mirror {
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px;
  color: var(--phosphor-bright);
  text-shadow: 0 0 10px var(--phosphor-bright);
  white-space: pre;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: inherit;
}

#cursor-block {
  display: inline-block;
  width: 0.6em;
  height: 1em;
  background-image: repeating-conic-gradient(
    var(--phosphor-bright) 0% 25%,
    transparent 0% 50%
  );
  background-size: 3px 3px;
  background-position: 0 0;
  animation: block-blink 530ms step-end infinite;
  vertical-align: text-bottom;
  pointer-events: none;
  flex-shrink: 0;
}

#input {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: transparent;
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px;
  caret-color: transparent;
  text-shadow: none;
}

/* Boot screen */
#boot-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: var(--phosphor);
}

#boot-text {
  width: 600px;
  max-width: 90vw;
}

.boot-line {
  text-shadow: 0 0 8px var(--phosphor);
}

.boot-warning {
  color: #ffaa00;
  text-shadow: 0 0 10px #ffaa00;
}

.boot-banner {
  border: 2px solid var(--phosphor);
  text-align: center;
  padding: 12px 24px;
  margin-bottom: 4px;
  font-size: 22px;
  letter-spacing: 0.2em;
  text-shadow: 0 0 12px var(--phosphor);
  box-shadow: 0 0 12px var(--phosphor-glow), inset 0 0 12px var(--phosphor-glow);
}

/* Animations */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

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

@keyframes glow-in {
  from { text-shadow: 0 0 20px var(--phosphor-bright), 0 0 40px var(--phosphor); }
  to { text-shadow: 0 0 8px var(--phosphor); }
}

.new-line { animation: glow-in 0.4s ease-out forwards; }

.memcheck-red {
  color: #ff4444;
  text-shadow: 0 0 8px #ff4444;
}

.memcheck-anomalous {
  color: #ff4444;
  text-shadow: 0 0 10px #ff4444;
}

/* CRT glitch */
@keyframes crt-glitch {
  0%   { transform: translateX(0);    filter: brightness(1); }
  10%  { transform: translateX(-7px); filter: brightness(0.3); }
  20%  { transform: translateX(6px);  filter: brightness(0.6); }
  30%  { transform: translateX(-4px); filter: brightness(0.2); }
  40%  { transform: translateX(3px);  filter: brightness(0.7); }
  50%  { transform: translateX(0);    filter: brightness(0.15); }
  60%  { transform: translateX(-2px); filter: brightness(0.5); }
  70%  { transform: translateX(5px);  filter: brightness(0.3); }
  80%  { transform: translateX(-3px); filter: brightness(0.6); }
  90%  { transform: translateX(2px);  filter: brightness(0.4); }
  100% { transform: translateX(0);    filter: brightness(1); }
}

.glitching {
  animation: crt-glitch 0.6s linear forwards;
}

/* Scrolling glitch band */
#glitch-band {
  position: fixed;
  left: 0;
  right: 0;
  top: -60px;
  height: 60px;
  pointer-events: none;
  z-index: 150;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(184, 255, 184, 0.04) 30%,
    rgba(184, 255, 184, 0.09) 50%,
    rgba(184, 255, 184, 0.04) 70%,
    transparent 100%
  );
  mix-blend-mode: screen;
  opacity: 0;
}
