/* ── Variables ──────────────────────────────────────────── */
:root {
  --bg: #000000;
  --green: #00ff00;
  --green-dim: #00cc00;
  --green-faint: rgba(0, 255, 0, 0.06);
  --green-glow: rgba(0, 255, 0, 0.3);
  --red: #ff3333;
  --red-dim: rgba(255, 51, 51, 0.15);
  --font: 'JetBrains Mono', 'Courier New', monospace;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--green);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
}

/* ── CRT Effects ────────────────────────────────────────── */
.crt-scanlines {
  pointer-events: none;
  position: fixed; inset: 0;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.03) 0px,
    rgba(0,0,0,0.03) 1px,
    transparent 1px,
    transparent 3px
  );
}
.crt-vignette {
  pointer-events: none;
  position: fixed; inset: 0;
  z-index: 9998;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.6) 100%);
}

/* ── Terminal Wrapper ───────────────────────────────────── */
.terminal-wrapper {
  position: fixed; inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid rgba(0,255,0,0.15);
  box-shadow:
    0 0 40px rgba(0,255,0,0.04),
    inset 0 0 80px rgba(0,255,0,0.02);
}

/* ── Title Bar ──────────────────────────────────────────── */
.title-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(0,255,0,0.03);
  border-bottom: 1px solid rgba(0,255,0,0.12);
  flex-shrink: 0;
  user-select: none;
}
.title-bar-dots { display: flex; gap: 6px; }
.dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  opacity: 0.5;
}
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #ffbd2e; }
.dot-green  { background: #28ca41; }
.title-bar-label {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--green-dim);
  letter-spacing: 0.05em;
  text-shadow: 0 0 8px var(--green-glow);
}
.title-bar-actions { display: flex; gap: 8px; }
.title-bar-actions button {
  background: none; border: none;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.6;
  transition: opacity 0.2s;
  padding: 0 4px;
}
.title-bar-actions button:hover { opacity: 1; }

/* ── Output Area ────────────────────────────────────────── */
.terminal-output {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px 8px;
  scroll-behavior: smooth;
}
.terminal-output::-webkit-scrollbar { width: 4px; }
.terminal-output::-webkit-scrollbar-track { background: transparent; }
.terminal-output::-webkit-scrollbar-thumb { background: rgba(0,255,0,0.2); border-radius: 2px; }

/* ── Output Lines ───────────────────────────────────────── */
.line {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--green);
  font-size: 13px;
  line-height: 1.7;
  text-shadow: 0 0 6px rgba(0,255,0,0.25);
}
.line.cmd-echo {
  color: var(--green);
  opacity: 0.9;
}
.line.dim {
  color: var(--green-dim);
  opacity: 0.7;
}
.line.error {
  color: var(--red);
  background: var(--red-dim);
  text-shadow: 0 0 8px rgba(255,51,51,0.4);
  padding: 2px 4px;
  border-left: 2px solid var(--red);
}
.line.bold {
  font-weight: 700;
  color: var(--green);
  text-shadow: 0 0 12px var(--green-glow);
}
.line.empty { height: 8px; }
.line.ascii {
  font-size: 11px;
  line-height: 1.2;
  color: var(--green);
  text-shadow: 0 0 10px var(--green-glow);
}

/* ── Input Row ──────────────────────────────────────────── */
.terminal-input-row {
  display: flex;
  align-items: center;
  padding: 10px 24px 14px;
  border-top: 1px solid rgba(0,255,0,0.08);
  background: rgba(0,255,0,0.015);
  flex-shrink: 0;
}
.prompt-label {
  color: var(--green);
  font-size: 13px;
  white-space: nowrap;
  text-shadow: 0 0 8px var(--green-glow);
  flex-shrink: 0;
}
.input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
}
#cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--green);
  font-family: var(--font);
  font-size: 13px;
  caret-color: transparent;
  text-shadow: 0 0 8px var(--green-glow);
}
.cursor-blink {
  font-size: 13px;
  color: var(--green);
  animation: blink 1s step-end infinite;
  text-shadow: 0 0 12px var(--green);
  margin-left: 1px;
  pointer-events: none;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Matrix Canvas ──────────────────────────────────────── */
#matrix-canvas {
  position: fixed; inset: 0;
  z-index: 100;
  display: none;
}

/* ── Glitch Animation ───────────────────────────────────── */
@keyframes glitch {
  0%   { transform: translate(0); filter: none; }
  10%  { transform: translate(-3px, 1px); filter: hue-rotate(90deg); }
  20%  { transform: translate(3px, -1px); filter: invert(0.1); }
  30%  { transform: translate(-2px, 2px); filter: none; }
  40%  { transform: translate(2px, -2px); filter: hue-rotate(180deg); }
  50%  { transform: translate(0); filter: none; }
  60%  { transform: translate(-4px, 1px); filter: invert(0.05); }
  70%  { transform: translate(4px, -1px); filter: hue-rotate(270deg); }
  80%  { transform: translate(0); filter: none; }
  100% { transform: translate(0); filter: none; }
}
.glitching { animation: glitch 0.4s steps(1) forwards; }

/* ── Scan animation ─────────────────────────────────────── */
@keyframes scanBar {
  0%   { top: 0; opacity: 0.8; }
  100% { top: 100%; opacity: 0; }
}
.scan-line-anim {
  position: fixed;
  left: 0; right: 0;
  height: 2px;
  background: rgba(0,255,0,0.4);
  box-shadow: 0 0 8px var(--green);
  z-index: 9000;
  pointer-events: none;
  animation: scanBar 1.5s linear;
}

/* ── Scrollbar global ───────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: rgba(0,255,0,0.2) transparent; }
