/* --- Terminal Section --- */
.terminal-section {
  margin: 60px auto;
  text-align: center;
}

/* --- Terminal Box --- */
.terminal-box {
  position: relative;
  background: #000;
  color: #39ff14;
  font-family: 'C64 Pro Mono', monospace;
  padding: 1.25em;
  border: 1px solid #000;
  border-radius: 8px;
  width: 600px;
  min-height: 250px;
  max-width: 90vw;
  margin: 20px auto;
  text-shadow: 0 0 8px #39ff14;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease-in-out;
}

/* --- CRT Scanline Overlay --- */
.terminal-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.35) 0px,
    rgba(0, 0, 0, 0.35) 2px,
    transparent 2px,
    transparent 5px
  );
  pointer-events: none;
  animation: scanline-move 1s linear infinite;
}

/* --- Scanline movement animation --- */
@keyframes scanline-move {
  0% { background-position: 0 0; }
  100% { background-position: 0 5px; }
}

/* --- Flicker / Glitch Animations --- */
@keyframes flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { opacity: 1; }
  20%, 22%, 24%, 55% { opacity: 0.85; }
}

@keyframes glitch-flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { opacity: 1; transform: translate(0,0); }
  20%, 22%, 24%, 55% { opacity: 0.8; transform: translate(-1px, 1px); }
}

/* --- Typing / Active Effect --- */
.terminal-box.typing {
  animation: flicker 0.15s infinite, glitch-flicker 0.3s infinite;
  color: cyan;
  text-shadow: 0 0 8px cyan, 0 0 15px cyan;
  box-shadow: inset 0 0 25px cyan, 0 0 10px cyan;
}

/* --- Terminal Text --- */
.terminal-text {
  display: inline-block;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* --- TTS Controls --- */
.tts-controls {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.tts-controls button {
  font-family: 'C64 Pro Mono', monospace;
  font-size: 16px;
  padding: 8px 16px;
  background-color: #000;
  color: #39ff14;
  border: 1px solid #000;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.2s ease-in-out;
}

.tts-controls button:hover {
  background-color: #39ff14;
  color: #000;
  box-shadow: 0 0 5px #39ff14 inset;
}

/* --- Mobile Adjustments --- */
@media (max-width: 600px) {
  .terminal-box {
    width: 90%;
    min-height: 200px;
    font-size: 0.9rem;
    padding: 1em;
  }
}
