.terminal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(3px);
  z-index: 1500;
  cursor: default;
}

.terminal-overlay.hidden {
  display: none;
}

@keyframes terminal-popup-open {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

@keyframes terminal-popup-close {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
}

.terminal-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 90vw;
  max-width: 900px;
  height: 90vh;
  max-height: 700px;
  background: #0c0c0c;
  font-family: 'Courier New', monospace;
  color: #00ff00;
  padding: 1.5rem;
  box-sizing: border-box;
  overflow: hidden;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  box-shadow: 0 0 30px rgba(0, 255, 0, 0.5);
  opacity: 0;
  animation-fill-mode: forwards;
  pointer-events: none;
  cursor: default;
}

.terminal-container.active {
  animation: terminal-popup-open 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
  pointer-events: auto;
}

.terminal-container.closing {
  animation: terminal-popup-close 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
  pointer-events: none;
}

.matrix-rain {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.3;
}

.matrix-column {
  position: absolute;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #00ff00;
  text-shadow: 0 0 5px #00ff00;
  white-space: pre;
  animation: matrix-fall linear infinite;
  user-select: none;
  line-height: 1.2;
}

@keyframes matrix-fall {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh);
    opacity: 0;
  }
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #00ff00;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  user-select: none;
  position: relative;
  z-index: 10;
}

.terminal-title {
  font-weight: bold;
  font-size: 1.3rem;
  color: #00ff00;
}

.terminal-close {
  background: transparent;
  border: 2px solid #00ff00;
  color: #00ff00;
  font-size: 1.5rem;
  font-weight: bold;
  line-height: 1;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.terminal-close:hover {
  background: #00ff00;
  color: #0c0c0c;
}

#terminal-output {
  flex-grow: 1;
  overflow-y: auto;
  margin-bottom: 1.5rem;
  padding: 0;
  position: relative;
  z-index: 10;
  cursor: text;
}

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

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

#terminal-output::-webkit-scrollbar-thumb {
  background: #00ff00;
  border-radius: 4px;
}

.terminal-line {
  margin-bottom: 0.6rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
  display: flex;
  align-items: baseline;
}

.terminal-prompt {
  color: #00ff00;
  font-weight: bold;
  flex-shrink: 0;
}

.terminal-text {
  color: #00ff00;
  margin-left: 0.5rem;
  flex: 1;
}

.terminal-command {
  color: #88cc88;
  margin-left: 0.5rem;
  flex: 1;
}

.terminal-error {
  color: #ff4444;
  margin-left: 0.5rem;
  flex: 1;
}

.terminal-info {
  color: #44ddff;
  margin-left: 0.5rem;
  flex: 1;
}

.terminal-input-line {
  display: flex;
  align-items: center;
  background: rgba(0, 255, 0, 0.05);
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid #00ff00;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  cursor: text;
}

.terminal-input {
  background: transparent;
  border: none;
  color: #00ff00;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  outline: none;
  flex: 1;
  margin-left: 0.5rem;
  min-width: 0;
  cursor: text;
}

.terminal-cursor {
  color: #00ff00;
  animation: blink 1s infinite;
  margin-left: 0.2rem;
}

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

@media screen and (max-width: 600px) {
  .terminal-container {
    width: 95vw;
    height: 95vh;
    padding: 1rem;
  }

  .matrix-column {
    font-size: 12px;
  }
}
