
:root {
  --term-bg: #0a0a0a;
  --term-fg: #d9fffb;
  --term-dim: #aee7df;
  --term-accent: #00ffc8;
  --term-green: #34d399;
  --term-yellow: #fbbf24;
  --term-red: #f87171;
  --term-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.terminal-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1002;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 10, 10, 0.75);
  color: var(--term-fg);
  font: 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  cursor: pointer;
  backdrop-filter: blur(8px) saturate(1.2);
  box-shadow: var(--term-shadow);
}
.terminal-toggle:hover { border-color: rgba(0, 255, 200, 0.5); color: #fff; }

.terminal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--term-bg);
  color: var(--term-fg);
  font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.terminal-overlay.active { display: flex; }

.terminal-window {
  width: min(920px, 96vw);
  max-height: 80vh;
  background: rgba(10, 10, 10, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--term-shadow);
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.term-dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.term-dot.red { background: #ef4444; }
.term-dot.yellow { background: #f59e0b; }
.term-dot.green { background: #10b981; }
.term-title { margin-left: 8px; color: var(--term-dim); font-size: 12px; }

.terminal-body {
  padding: 14px 14px 8px 14px;
  overflow: auto;
  height: 64vh;
}
.terminal-body .line { white-space: pre-wrap; text-shadow: 0 0 8px rgba(0, 255, 200, 0.25); }
.terminal-body a { color: var(--term-accent); text-decoration: none; }
.terminal-body a:hover { text-decoration: underline; }

.terminal-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.prompt { color: var(--term-accent); }
.input-text { color: var(--term-fg); min-height: 1.2em; word-break: break-all; }
.cursor { width: 0.6em; display: inline-block; }
.cursor.block { background: var(--term-accent); height: 1.1em; }

@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.blink { animation: blink 900ms step-end infinite; }
.typing .blink { opacity: 0; animation: none; }

@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.98; }
}
.terminal-window { animation: flicker 6s ease-in-out infinite; }

@keyframes tw {
  0% { filter: hue-rotate(0deg) saturate(1); }
  20% { filter: hue-rotate(60deg) saturate(1.3); transform: skewX(1deg); }
  50% { filter: hue-rotate(180deg) saturate(1.6); transform: skewX(-1deg); }
  80% { filter: hue-rotate(300deg) saturate(1.3); }
  100% { filter: hue-rotate(360deg) saturate(1); transform: none; }
}
.tw-glitch { animation: tw 3s ease; }

.term-ro { color: var(--term-dim); font-size: 12px; margin-left: auto; }

@media (max-width: 900px) { .terminal-body { height: 58vh; } }
@media (max-width: 640px) { .terminal-body { height: 52vh; } }

.term-error { color: #f87171; text-shadow: 0 0 8px rgba(248, 113, 113, 0.45); }
.term-error.blink { animation: blink 700ms step-end 6; }
