:root {
  --bg: #04080a;
  --green: #33ff33;
  --green-dim: #1e9e1e;
  --green-bright: #b4ffb4;
  --yellow: #ffd400;
  --red: #ff4444;
  --glow: 0 0 8px rgba(51, 255, 51, 0.55);
  --glow-yellow: 0 0 10px rgba(255, 212, 0, 0.5);
  --glow-red: 0 0 10px rgba(255, 68, 68, 0.5);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  padding: 16px;
  background: radial-gradient(120% 120% at 50% 38%, #0a120a 0%, #04080a 58%, #010301 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'VT323', 'IBM Plex Mono', 'Courier New', monospace;
  color: var(--green);
}

/* ---------- bezel + crt ---------- */

.bezel {
  width: min(1000px, 100%);
  background: linear-gradient(160deg, #1b1e1b, #0c0e0c 60%, #050705);
  border: 1px solid #2a2e2a;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.crt {
  position: relative;
  background: #030903;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.9), inset 0 0 12px rgba(51, 255, 51, 0.08);
}

.glass {
  position: relative;
  transform-origin: 50% 50%;
  animation: crt-on 0.55s ease-out;
}

@keyframes crt-on {
  0%   { transform: scaleY(0.004) scaleX(0.2); filter: brightness(7); }
  35%  { transform: scaleY(0.02)  scaleX(1);   filter: brightness(4); }
  70%  { transform: scaleY(1)     scaleX(1);   filter: brightness(1.6); }
  100% { transform: scaleY(1)     scaleX(1);   filter: brightness(1); }
}

.screen {
  position: relative;
  height: min(72vh, 660px);
  padding: 28px 30px;
  overflow-y: auto;
  overflow-x: hidden;
  font-size: clamp(15px, 2.1vw, 20px);
  line-height: 1.28;
  text-shadow: var(--glow);
  scrollbar-width: thin;
  scrollbar-color: rgba(51, 255, 51, 0.35) transparent;
  animation: flicker 5s infinite;
}

.screen::-webkit-scrollbar { width: 8px; }
.screen::-webkit-scrollbar-thumb {
  background: rgba(51, 255, 51, 0.3);
  border-radius: 4px;
}

@keyframes flicker {
  0%, 91%, 94%, 100% { opacity: 1; }
  92% { opacity: 0.86; }
  96% { opacity: 0.94; }
}

/* ---------- overlays ---------- */

.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.22) 0px,
    rgba(0, 0, 0, 0.22) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 5;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 100% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
  z-index: 6;
}

/* ---------- text lines ---------- */

.line {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.28em;
}

.line.dim    { color: var(--green-dim); text-shadow: 0 0 6px rgba(30, 158, 30, 0.4); }
.line.bright { color: var(--green-bright); }
.line.yellow { color: var(--yellow); text-shadow: var(--glow-yellow); }
.line.red    { color: var(--red); text-shadow: var(--glow-red); }

/* ---------- prompt + input ---------- */

.prompt {
  position: relative;
  display: flex;
  align-items: baseline;
  white-space: pre;
}

.prompt .label { white-space: pre; color: var(--green); }

.input-wrap {
  position: relative;
  display: inline-block;
  min-width: 0;
}

.sizer {
  display: inline-block;
  visibility: hidden;
  white-space: pre;
}

.term-input {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  background: transparent;
  border: 0;
  outline: none;
  padding: 0;
  margin: 0;
  color: var(--green-bright);
  font: inherit;
  line-height: inherit;
  caret-color: transparent;
  text-shadow: var(--glow);
}

.block-cursor {
  position: absolute;
  left: 100%;
  top: 0;
  width: 0.58em;
  height: 1.02em;
  background: var(--green-bright);
  box-shadow: var(--glow);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.frozen { white-space: pre; color: var(--green-bright); }

/* ---------- mobile ---------- */

@media (max-width: 600px) {
  body { padding: 10px; }
  .bezel { padding: 12px; border-radius: 14px; }
  .screen { padding: 18px 16px; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .glass { animation: none; }
  .screen { animation: none; }
  .block-cursor { animation: none; }
}
