/* ============================================
   Interaktives Terminal Easter Egg
   Aktivierung: Konami Code (↑↑↓↓←→←→BA)
   ============================================ */

@keyframes terminalOpen {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

@keyframes typeLine {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes scanline {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100vh);
  }
}

/* Overlay */
#terminal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#terminal-overlay[hidden] {
  display: none !important;
}

/* Terminal-Fenster */
#terminal-window {
  width: 100%;
  max-width: 860px;
  height: 560px;
  max-height: 90vh;
  background: #0d1117;
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(0, 255, 65, 0.15),
    0 25px 60px rgba(0, 0, 0, 0.8),
    0 0 40px rgba(0, 255, 65, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: "Courier New", "Fira Code", "Consolas", monospace;
  animation: terminalOpen 0.2s ease-out;
  position: relative;
}

/* CRT-Scanline-Effekt */
#terminal-window::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 10;
  border-radius: 10px;
}

/* Titelleiste */
#terminal-header {
  background: #161b22;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(0, 255, 65, 0.1);
  flex-shrink: 0;
  user-select: none;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.terminal-dot.red {
  background: #ff5f57;
}
.terminal-dot.yellow {
  background: #febc2e;
}
.terminal-dot.green {
  background: #28c840;
}

#terminal-title {
  flex: 1;
  text-align: center;
  color: #6e7681;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

#terminal-close-btn {
  background: none;
  border: none;
  color: #6e7681;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  transition: color 0.15s;
  line-height: 1;
}

#terminal-close-btn:hover {
  color: #ff5f57;
}

/* Ausgabe-Bereich */
#terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.2rem 0.5rem;
  color: #00ff41;
  font-size: 0.875rem;
  line-height: 1.6;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 255, 65, 0.2) transparent;
}

#terminal-output::-webkit-scrollbar {
  width: 5px;
}

#terminal-output::-webkit-scrollbar-track {
  background: transparent;
}

#terminal-output::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 65, 0.2);
  border-radius: 3px;
}

/* Ausgabe-Zeilen */
.t-line {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
}

.t-line.t-cmd {
  color: #58a6ff;
}

.t-line.t-prompt {
  color: #3fb950;
}

.t-line.t-error {
  color: #f85149;
}

.t-line.t-dim {
  color: #6e7681;
}

.t-line.t-yellow {
  color: #e3b341;
}

.t-line.t-cyan {
  color: #39d353;
}

.t-line.t-ascii {
  color: #00ff41;
  font-size: 0.75rem;
  line-height: 1.3;
}

.t-line.t-info-key {
  color: #58a6ff;
}

.t-line.t-blank {
  min-height: 1.1em;
}

/* Input-Zeile */
#terminal-input-row {
  display: flex;
  align-items: center;
  padding: 0.5rem 1.2rem 0.8rem;
  gap: 0.5rem;
  border-top: 1px solid rgba(0, 255, 65, 0.08);
  flex-shrink: 0;
}

#terminal-prompt-label {
  color: #3fb950;
  font-size: 0.875rem;
  white-space: nowrap;
  font-family: "Courier New", "Fira Code", "Consolas", monospace;
}

#terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #00ff41;
  font-size: 0.875rem;
  font-family: "Courier New", "Fira Code", "Consolas", monospace;
  caret-color: #00ff41;
}

#terminal-input::selection {
  background: rgba(0, 255, 65, 0.2);
}

/* Matrix Canvas */
#terminal-matrix-canvas {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  z-index: 5;
  display: none;
}

/* Kleiner Hinweis unten rechts im Overlay */
#terminal-hint {
  position: fixed;
  bottom: 1.2rem;
  right: 1.5rem;
  color: rgba(0, 255, 65, 0.35);
  font-size: 0.7rem;
  font-family: "Courier New", monospace;
  pointer-events: none;
  z-index: 9998;
}

/* Responsiv */
@media (max-width: 600px) {
  #terminal-window {
    height: 80vh;
    border-radius: 6px;
  }

  #terminal-output {
    font-size: 0.78rem;
  }

  #terminal-input {
    font-size: 0.78rem;
  }

  #terminal-prompt-label {
    font-size: 0.75rem;
  }
}
