/* ============================================================
   terminal.css — shared CRT terminal aesthetic
   for loona51.dev
   ============================================================ */

:root {
  --phosphor: #ffb000;
  --phosphor-dim: #995f00;
  --phosphor-glow: #ffcc44;
  --bg: #0a0806;
  --screen-bg: #0d0b08;
  --text-glow: 0 0 8px rgba(255,176,0,0.3);
  --error: #cc6644;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--phosphor);
  font-family: 'Courier New', 'Liberation Mono', 'DejaVu Sans Mono', monospace;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: text;
}

/* CRT screen curvature */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center,
    transparent 60%,
    rgba(0,0,0,0.4) 80%,
    rgba(0,0,0,0.8) 100%);
  pointer-events: none;
  z-index: 10;
}

/* Scanlines */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  pointer-events: none;
  z-index: 11;
}

/* Occasional flicker */
@keyframes flicker {
  0% { opacity: 1; }
  3% { opacity: 0.85; }
  6% { opacity: 1; }
  92% { opacity: 1; }
  94% { opacity: 0.9; }
  96% { opacity: 1; }
  100% { opacity: 1; }
}

/* Noise overlay */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* --- Terminal container --- */
.crt-container {
  position: relative;
  z-index: 1;
  width: min(90vw, 820px);
  height: min(90vh, 700px);
  animation: flicker 8s infinite;
}

/* --- Screen --- */
.screen {
  background: var(--screen-bg);
  border: 2px solid rgba(255,176,0,0.15);
  border-radius: 8px;
  padding: 28px 32px;
  box-shadow:
    inset 0 0 60px rgba(255,176,0,0.04),
    0 0 40px rgba(255,176,0,0.06),
    0 0 80px rgba(255,176,0,0.03);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.screen::-webkit-scrollbar { width: 4px; }
.screen::-webkit-scrollbar-track { background: transparent; }
.screen::-webkit-scrollbar-thumb { background: rgba(255,176,0,0.15); border-radius: 2px; }

/* --- Output area --- */
.output {
  flex: 1;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.55;
  text-shadow: var(--text-glow);
  letter-spacing: 0.02em;
  min-height: 0; /* crucial for flex overflow */
}

.output::-webkit-scrollbar { width: 4px; }
.output::-webkit-scrollbar-track { background: transparent; }
.output::-webkit-scrollbar-thumb { background: rgba(255,176,0,0.12); border-radius: 2px; }

/* --- Input line --- */
.input-line {
  display: flex;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,176,0,0.08);
  font-size: 14px;
  line-height: 1.55;
  flex-shrink: 0;
}

.input-line .prefix {
  color: var(--phosphor-dim);
  margin-right: 8px;
  flex-shrink: 0;
}

.cmd-input {
  background: transparent;
  border: none;
  color: var(--phosphor);
  font-family: inherit;
  font-size: inherit;
  outline: none;
  flex: 1;
  caret-color: var(--phosphor);
  text-shadow: var(--text-glow);
  min-width: 0;
}

/* Blinking cursor */
.cursor-blink {
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* --- Text styles --- */
.output .dim { color: var(--phosphor-dim); }
.output .bright { color: var(--phosphor-glow); }
.output .prompt-cmd { color: var(--phosphor); }
.output .info { color: #ffaa33; }
.output .error { color: var(--error); }
.output .title { color: var(--phosphor-glow); text-shadow: 0 0 10px rgba(255,176,0,0.5); font-weight: bold; }

/* ASCII art */
.ascii-header {
  color: var(--phosphor-glow);
  text-shadow: 0 0 12px rgba(255,176,0,0.4);
  line-height: 1.1;
  font-size: 13px;
  margin: 4px 0 8px 0;
}

/* Links in output */
.output a {
  color: var(--phosphor-glow);
  text-decoration: none;
  border-bottom: 1px dashed rgba(255,176,0,0.4);
  cursor: pointer;
  transition: color 0.15s;
}
.output a:hover {
  color: #fff;
  border-bottom-color: #fff;
  text-shadow: 0 0 8px rgba(255,255,255,0.3);
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .screen {
    padding: 16px 14px;
    border-radius: 4px;
  }
  .output, .input-line {
    font-size: 12px;
  }
  .ascii-header {
    font-size: 8px;
  }
}
