@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;600&family=Unbounded:wght@400;600&display=swap");

:root {
  --bg: #05070b;
  --bg-deep: #02040a;
  --ink: #c6f2d2;
  --ink-dim: #7bbf92;
  --accent: #32ff9b;
  --warning: #ff5b5b;
  --glow: rgba(50, 255, 155, 0.18);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(circle at 10% 20%, #0d1a26 0%, var(--bg) 40%, var(--bg-deep) 100%);
  color: var(--ink);
  font-family: "IBM Plex Mono", "Courier New", monospace;
  letter-spacing: 0.02em;
  overflow: hidden;
}

.terminal {
  position: relative;
  height: 100%;
  padding: 4vh 6vw;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  z-index: 2;
  background: linear-gradient(135deg, rgba(8, 16, 24, 0.6), rgba(3, 10, 18, 0.85));
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.7);
  animation: terminal-flicker 6s ease-in-out infinite;
}

#output {
  overflow-y: auto;
  padding-right: 1rem;
  scrollbar-color: var(--accent) transparent;
  scrollbar-width: thin;
  flex: 1;
  white-space: pre-wrap;
}

.line {
  margin: 0 0 0.6rem 0;
}

.line.glitch {
  position: relative;
  text-shadow: 0 0 12px rgba(50, 255, 155, 0.35);
  animation: glitch 1.6s infinite;
}

.line.glitch::before,
.line.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0.7;
  width: 100%;
  overflow: hidden;
}

.line.glitch::before {
  color: #7bf5ff;
  clip-path: inset(0 0 45% 0);
  transform: translate(1px, -1px);
}

.line.glitch::after {
  color: #ff6ad5;
  clip-path: inset(55% 0 0 0);
  transform: translate(-1px, 1px);
}

.system {
  color: var(--ink-dim);
}

.clara {
  color: var(--accent);
  text-shadow: 0 0 12px var(--glow);
}

.question {
  font-family: "Unbounded", "IBM Plex Mono", monospace;
  color: var(--ink);
  margin-top: 1rem;
}

.warning {
  color: var(--warning);
  text-shadow: 0 0 12px rgba(255, 91, 91, 0.35);
}

.input-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.6rem 0;
  border-top: 1px solid rgba(123, 191, 146, 0.2);
}

.prompt {
  color: var(--accent);
  font-weight: 600;
}

.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 1rem;
  outline: none;
  font-family: inherit;
  caret-color: var(--accent);
}

#overlay {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(transparent 0%, rgba(0, 0, 0, 0.2) 45%, transparent 70%),
    repeating-linear-gradient(0deg, rgba(50, 255, 155, 0.06), rgba(50, 255, 155, 0.06) 1px, transparent 1px, transparent 3px);
  mix-blend-mode: screen;
  opacity: 0.5;
  pointer-events: none;
  animation: scan 4s linear infinite;
}

#overlay.glitch {
  animation: scan 4s linear infinite, overlay-glitch 2.2s steps(2, end) infinite;
}

body.blackout {
  background: #000;
}

body.blackout .terminal {
  display: none;
}

body.blackout #overlay {
  opacity: 0;
}

@keyframes scan {
  0% { transform: translateY(0); }
  100% { transform: translateY(30px); }
}

@keyframes terminal-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.96; }
  55% { opacity: 0.9; }
  60% { opacity: 0.98; }
}

@keyframes glitch {
  0%, 100% { transform: none; }
  20% { transform: translate(0.5px, -0.5px); }
  40% { transform: translate(-0.5px, 0.5px); }
  60% { transform: translate(1px, 0); }
  80% { transform: translate(-1px, 0); }
}

@keyframes overlay-glitch {
  0% { opacity: 0.45; }
  50% { opacity: 0.7; }
  100% { opacity: 0.5; }
}

@media (max-width: 720px) {
  .terminal {
    padding: 3vh 6vw;
  }

  .terminal-input {
    font-size: 0.95rem;
  }
}
