@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap');

:root {
  --bg: #0d0f0e;
  --surface: #111412;
  --green: #39ff7e;
  --green-dim: #1a7a3d;
  --green-glow: rgba(57, 255, 126, 0.15);
  --amber: #ffb627;
  --red: #ff4757;
  --blue: #00d2ff;
  --gray: #7a8a6e;
  --text: #c8d5b9;
  --cursor: #39ff7e;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  padding: 0;
  overflow-x: hidden;
}

/* Scanline overlay */
body::before {
  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: 9999;
}

#terminal {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* === HEADER / ASCII LOGO === */
#header {
  border: 1px solid var(--green-dim);
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
  box-shadow: 0 0 30px var(--green-glow), inset 0 0 30px rgba(0,0,0,0.3);
  animation: fadeIn 0.8s ease;
}

#ascii-logo {
  color: var(--green);
  font-size: clamp(7px, 1.5vw, 13px);
  line-height: 1.2;
  text-shadow: 0 0 8px var(--green), 0 0 20px rgba(57,255,126,0.4);
  white-space: pre;
  margin-bottom: 1rem;
}

.header-hint {
  color: var(--gray);
  font-size: 12px;
}

.header-hint span {
  color: var(--amber);
}

/* === OUTPUT AREA === */
#output {
  margin-bottom: 0.5rem;
}

.line {
  animation: lineIn 0.15s ease;
  padding: 1px 0;
}

@keyframes lineIn {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

.line.prompt-line  { color: var(--text); }
.line.output-text  { color: var(--text); }
.line.error        { color: var(--red); }
.line.success      { color: var(--green); text-shadow: 0 0 6px rgba(57,255,126,0.5); }
.line.section-header {
  color: var(--amber);
  font-weight: 700;
  margin-top: 0.3rem;
  text-shadow: 0 0 6px rgba(255,182,39,0.4);
}
.line.dimmed { color: var(--gray); }

.line.link-line a {
  color: var(--blue);
  text-decoration: none;
  text-shadow: 0 0 6px rgba(0,210,255,0.4);
  transition: text-shadow 0.2s;
}
.line.link-line a:hover {
  text-shadow: 0 0 12px rgba(0,210,255,0.8);
  text-decoration: underline;
}

.spacer { height: 0.5rem; }

/* === INPUT LINE === */
#input-area {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 0.25rem;
}

.prompt-prefix {
  color: var(--green);
  text-shadow: 0 0 6px rgba(57,255,126,0.5);
  white-space: nowrap;
  flex-shrink: 0;
}

.prompt-user   { color: var(--green); }
.prompt-at     { color: var(--gray); }
.prompt-host   { color: var(--blue); }
.prompt-sep    { color: var(--gray); }
.prompt-path   { color: var(--amber); }
.prompt-dollar { color: var(--green); margin-right: 6px; }

#cmd-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--green);
  font-family: inherit;
  font-size: inherit;
  caret-color: var(--cursor);
  flex: 1;
  text-shadow: 0 0 4px rgba(57,255,126,0.3);
  width: 100%;
}

/* Help table */
.cmd-table {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 2px 12px;
  margin: 4px 0;
}
.cmd-table .cmd-name { color: var(--green); }
.cmd-table .cmd-desc { color: var(--text); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  #ascii-logo { font-size: 6px; overflow: hidden; }
  body { font-size: 13px; }
  #terminal { padding: 1rem 0.75rem 3rem; }
  #header { padding: 1rem; }
  /* iOS zoomt beim Fokus ins Eingabefeld, wenn font-size < 16px */
  #cmd-input { font-size: 16px; }
}

/* === CRT SHUTDOWN ANIMATION === */
#crt-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
}

#crt-overlay.active {
  animation: crtShutdown 1.4s ease-in forwards;
}

/* The glowing line/dot in the center */
#crt-overlay::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center,
    rgba(255,255,255,0.95) 0%,
    rgba(180,255,200,0.7) 15%,
    rgba(57,255,126,0.3) 40%,
    transparent 70%
  );
  animation: crtBeam 1.4s ease-in forwards;
}

@keyframes crtShutdown {
  0%   { opacity: 1; }
  60%  { opacity: 1; }
  100% { opacity: 1; }
}

@keyframes crtBeam {
  /* Phase 1 (0–50%): Bild kollabiert vertikal zur horizontalen Linie */
  0%   { width: 100%; height: 100%; opacity: 1; border-radius: 0; }
  10%  { width: 100%; height: 100%; opacity: 1; }
  50%  { width: 100%; height: 3px;  opacity: 1; border-radius: 50%; }
  /* Phase 2 (50–80%): Linie schrumpft zum Punkt */
  80%  { width: 6px;  height: 3px;  opacity: 1; border-radius: 50%; }
  /* Phase 3 (80–100%): Punkt blinkt und erlischt */
  90%  { width: 4px;  height: 4px;  opacity: 0.8; border-radius: 50%; }
  100% { width: 0px;  height: 0px;  opacity: 0;   border-radius: 50%; }
}

body.crt-off {
  background: #000 !important;
}
body.crt-off * {
  visibility: hidden;
}
