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

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

body {
  background: #1e1f29;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-family: "Fira Code", "SF Mono", "Roboto Mono", "Courier New", monospace;
  overflow: hidden;
}

/* Matrix rain canvas */
#matrix-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0;
  transition: opacity 1s;
  pointer-events: none;
}

#matrix-canvas.active {
  opacity: 1;
}

/* CRT scanlines */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15) 0px,
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 3px
  );
}

.scanlines.active {
  opacity: 1;
}

/* Terminal container — Dracula */
.terminal {
  background: #282a36;
  border-radius: 8px;
  width: 680px;
  max-width: 94vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 80px rgba(189, 147, 249, 0.04);
  overflow: hidden;
  position: relative;
  z-index: 10;
  transition: box-shadow 0.5s, transform 0.3s;
}

.terminal.glitch {
  animation: glitch 0.3s ease;
}

@keyframes glitch {
  0% { transform: translate(0); filter: hue-rotate(0deg); }
  20% { transform: translate(-3px, 2px); filter: hue-rotate(90deg); }
  40% { transform: translate(3px, -2px); filter: hue-rotate(180deg); }
  60% { transform: translate(-2px, -1px); filter: hue-rotate(270deg); }
  80% { transform: translate(2px, 1px); filter: hue-rotate(360deg); }
  100% { transform: translate(0); filter: hue-rotate(0deg); }
}

.terminal.hacker {
  box-shadow:
    0 0 0 1px rgba(255, 85, 85, 0.4),
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 120px rgba(255, 85, 85, 0.2);
}

.terminal-header {
  background: #21222c;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  user-select: none;
}

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

.dot.red { background: #ff5555; }
.dot.yellow { background: #f1fa8c; }
.dot.green { background: #50fa7b; }

.terminal-title {
  color: #6272a4;
  font-size: 12px;
  margin-left: 8px;
}

/* Terminal body (scrollable output) */
.terminal-body {
  padding: 16px 20px 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: #44475a transparent;
}

.terminal-body::-webkit-scrollbar {
  width: 6px;
}

.terminal-body::-webkit-scrollbar-track {
  background: transparent;
}

.terminal-body::-webkit-scrollbar-thumb {
  background: #44475a;
  border-radius: 3px;
}

/* Input line (fixed at bottom) — zsh style */
.input-line {
  display: flex;
  align-items: center;
  padding: 8px 20px 16px;
  flex-shrink: 0;
  font-size: 14px;
  gap: 0;
}

.prompt-arrow { color: #50fa7b; margin-right: 6px; font-weight: bold; }
.prompt-dir { color: #8be9fd; font-weight: bold; margin-right: 6px; }
.prompt-git { color: #ff79c6; margin-right: 8px; }

.input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

#command-input {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  color: transparent;
  caret-color: transparent;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  z-index: 2;
}

.input-hint {
  position: absolute;
  left: 0;
  color: #44475a;
  font-size: 14px;
  pointer-events: none;
  transition: opacity 0.2s;
}

.input-hint.hidden {
  opacity: 0;
}

#input-display {
  color: #f8f8f2;
  font-size: 14px;
  white-space: pre;
  pointer-events: none;
}

.cursor {
  color: #f8f8f2;
  animation: blink 1s step-end infinite;
  pointer-events: none;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Output lines — Dracula palette */
.line {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.line-cmd {
  color: #6272a4;
}

.line-cmd .cmd-text {
  color: #f8f8f2;
}

.line-output {
  color: #f8f8f2;
  padding-left: 4px;
}

.line-error {
  color: #ff5555;
  padding-left: 4px;
}

.line-success {
  color: #50fa7b;
  padding-left: 4px;
}

.line-info {
  color: #bd93f9;
  padding-left: 4px;
}

.line-warning {
  color: #f1fa8c;
  padding-left: 4px;
}

.line-cyan {
  color: #8be9fd;
  padding-left: 4px;
}

.line-pink {
  color: #ff79c6;
  padding-left: 4px;
}

.line-orange {
  color: #ffb86c;
  padding-left: 4px;
}

.line-ascii {
  color: #bd93f9;
  line-height: 1.15;
  font-size: 12px;
}

.line-rainbow {
  font-weight: bold;
  animation: rainbow 2s linear infinite;
}

@keyframes rainbow {
  0% { color: #ff5555; }
  17% { color: #ffb86c; }
  33% { color: #f1fa8c; }
  50% { color: #50fa7b; }
  67% { color: #8be9fd; }
  83% { color: #bd93f9; }
  100% { color: #ff79c6; }
}

/* Links in output */
.output-links {
  display: flex;
  gap: 20px;
  padding: 8px 4px;
}

.output-links a {
  color: #6272a4;
  font-size: 18px;
  text-decoration: none;
  transition: color 0.2s, transform 0.2s, text-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.output-links a:hover {
  color: #bd93f9;
  transform: translateY(-1px);
  text-shadow: 0 0 10px rgba(189, 147, 249, 0.4);
}

.output-links .link-label {
  font-size: 13px;
}

/* Typewriter effect */
.typewriter {
  overflow: hidden;
  border-right: none;
}

/* Progress bar */
.progress-bar {
  display: inline-block;
  width: 200px;
  height: 14px;
  background: #21222c;
  border: 1px solid #44475a;
  border-radius: 2px;
  overflow: hidden;
  vertical-align: middle;
}

.progress-fill {
  height: 100%;
  background: #50fa7b;
  width: 0%;
  transition: width 0.1s linear;
}

.progress-fill.danger {
  background: #ff5555;
}

/* Fireworks */
.firework {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  font-size: 24px;
  animation: firework-fly 1s ease-out forwards;
}

@keyframes firework-fly {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-200px) scale(0.3); }
}

/* Shake */
.shake {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* Party mode */
.party body {
  animation: party-bg 0.5s linear infinite;
}

@keyframes party-bg {
  0% { background: #1e1f29; }
  25% { background: #2a1e29; }
  50% { background: #1e2a29; }
  75% { background: #29251e; }
  100% { background: #1e1f29; }
}

/* Boot sequence fade in */
.boot-line {
  opacity: 0;
  animation: fade-in 0.3s ease forwards;
}

@keyframes fade-in {
  to { opacity: 1; }
}

/* Responsive */
@media (max-width: 500px) {
  .terminal {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    height: 100vh;
  }

  .terminal-body {
    padding: 12px 14px 8px;
  }

  .input-line {
    padding: 8px 14px 12px;
  }

  .line {
    font-size: 12px;
  }

  .line-ascii {
    font-size: 9px;
  }
}
