:root {
  --term-bg-0: #03040a;
  --term-bg-1: #090b14;
  --term-cyan: #00f5ff;
  --term-magenta: #ff2bd6;
  --term-yellow: #ffd65a;
  --term-green: #39ff88;
}

.terminal {
  position: relative;
  margin: 1.35em auto !important;
  overflow: hidden !important;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: linear-gradient(180deg, #0a0f18 0%, #05070d 58%, #02040a 100%);
  box-shadow:
    0 12px 20px rgba(0, 0, 0, 0.30),
    0 0 10px rgba(0, 216, 255, 0.10),
    0 0 14px rgba(216, 95, 115, 0.08);
  font-family: "JetBrains Mono", Consolas, monospace;
}

body.dark .terminal {
  border-color: rgba(146, 64, 132, 0.38);
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(255, 43, 214, 0.20),
    0 0 16px rgba(146, 64, 132, 0.24),
    0 0 22px rgba(0, 245, 255, 0.08);
}

.terminal .terminal-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 14px;
  overflow: hidden !important;
  border: 0;
  border-bottom: 1px solid rgba(255, 43, 214, 0.42);
  border-radius: 14px 14px 0 0 !important;
  background:
    radial-gradient(circle at 10% 50%, rgba(0, 245, 255, 0.16), transparent 30%),
    radial-gradient(circle at 85% 30%, rgba(255, 43, 214, 0.16), transparent 32%),
    linear-gradient(90deg, rgba(255, 214, 90, 0.08), transparent 42%),
    linear-gradient(180deg, var(--term-bg-1), var(--term-bg-0));
  box-shadow:
    inset 0 -1px 0 rgba(255, 43, 214, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 1px 0 0 rgba(0, 245, 255, 0.08),
    inset -1px 0 0 rgba(255, 43, 214, 0.08),
    0 8px 18px rgba(0, 0, 0, 0.24);
}

.terminal .terminal-header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.48;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(0, 245, 255, 0.035) 0,
      rgba(0, 245, 255, 0.035) 1px,
      transparent 1px,
      transparent 8px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 43, 214, 0.025) 0,
      rgba(255, 43, 214, 0.025) 1px,
      transparent 1px,
      transparent 6px
    );
}

.terminal .terminal-header::after {
  content: "";
  position: absolute;
  left: -30%;
  top: 0;
  width: 30%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 245, 255, 0.22),
    rgba(255, 43, 214, 0.18),
    rgba(255, 214, 90, 0.12),
    transparent
  );
  animation: ansi2html-terminal-header-sweep 4.5s linear infinite;
}

@keyframes ansi2html-terminal-header-sweep {
  0% { transform: translateX(0); opacity: 0; }
  12% { opacity: 1; }
  48% { opacity: 0.5; }
  100% { transform: translateX(430%); opacity: 0; }
}

.terminal .terminal-dots,
.terminal .terminal-title {
  position: relative;
  z-index: 1;
}

.terminal .terminal-dots {
  display: flex;
  gap: 9px !important;
}

.terminal .terminal-dots button,
.terminal .terminal-dots span {
  position: relative;
  display: block;
  width: 13px !important;
  height: 13px !important;
  flex: 0 0 13px !important;
  padding: 0;
  border: 0;
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}

.terminal .terminal-dots button::after {
  content: none !important;
  display: none !important;
}

.terminal .terminal-dots button:hover,
.terminal .terminal-dots button:focus-visible {
  transform: translateY(-1px) scale(1.12);
  filter: saturate(1.12) brightness(1.08);
  outline: none;
}

.terminal .terminal-dots .red {
  background: #ff3b5c;
  box-shadow: 0 0 7px rgba(255, 59, 92, 0.62);
}

.terminal .terminal-dots .yellow {
  background: var(--term-yellow);
  box-shadow: 0 0 5px rgba(255, 214, 90, 0.42);
}

.terminal .terminal-dots .green {
  background: var(--term-green);
  box-shadow: 0 0 5px rgba(57, 255, 136, 0.38);
}

.terminal.is-terminal-collapsed .terminal-dots .red,
.terminal.is-collapsed .terminal-dots .red {
  background: #ff0f4f !important;
  box-shadow:
    0 0 0 3px rgba(255, 15, 79, .24),
    0 0 12px rgba(255, 15, 79, 1),
    0 0 24px rgba(255, 43, 214, .38),
    0 0 34px rgba(255, 15, 79, .20) !important;
}

.terminal.is-wrapped .terminal-dots .yellow {
  background: #ff8a1f !important;
  box-shadow:
    0 0 0 1px rgba(255, 138, 31, .10),
    0 0 7px rgba(255, 138, 31, .44),
    0 0 11px rgba(255, 214, 90, .10) !important;
}

.terminal:not(.is-wrapped) .terminal-dots .yellow {
  box-shadow: 0 0 5px rgba(255, 214, 90, .42) !important;
}

.terminal.is-copied .terminal-dots .green {
  box-shadow: 0 0 0 2px rgba(57, 255, 136, .16), 0 0 12px rgba(57, 255, 136, .92);
}

.terminal:not(.is-copied) .terminal-dots .green {
  box-shadow: 0 0 5px rgba(57, 255, 136, .38) !important;
}

.terminal .terminal-title {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 0 !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  letter-spacing: 0.01em !important;
  opacity: 0.70 !important;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35) !important;
}

.terminal-title .tt-user {
  color: rgba(205, 214, 244, 0.95) !important;
  font-weight: 500 !important;
}

.terminal-title .tt-at {
  color: rgba(205, 214, 244, 0.45) !important;
  font-weight: 400 !important;
}

.terminal-title .tt-host {
  color: rgba(205, 214, 244, 0.72) !important;
  font-weight: 400 !important;
}

.terminal-title .tt-tail {
  color: rgba(205, 214, 244, 0.95) !important;
  font-weight: 400 !important;
}

.terminal .terminal-body {
  overflow: hidden !important;
  border-radius: 0 0 14px 14px !important;
  background: #06111d !important;
}

.terminal pre {
  display: block;
  margin: 0;
  padding: 8px 12px;
  overflow-x: auto;
  background: transparent;
  color: #cdd6f4;
  white-space: pre;
  font-size: 0.8em !important;
  line-height: 1.55;
  scrollbar-width: thin;
  scrollbar-color: rgba(146, 64, 132, .62) rgba(3, 4, 10, .28);
}

.terminal pre::-webkit-scrollbar {
  width: 8px !important;
  height: 8px !important;
  background: transparent !important;
}

.terminal pre::-webkit-scrollbar-track {
  border-radius: 999px !important;
  background: rgba(3, 4, 10, .36) !important;
  box-shadow:
    inset 0 0 0 1px rgba(0, 245, 255, .08),
    inset 0 -1px 0 rgba(255, 43, 214, .10) !important;
}

.terminal pre::-webkit-scrollbar-thumb {
  border: 1px solid rgba(0, 2, 6, .30) !important;
  border-radius: 999px !important;
  background: linear-gradient(
    90deg,
    rgba(0, 245, 255, .38) 0,
    rgba(0, 245, 255, .14) 11%,
    rgba(12, 16, 28, .18) 24%,
    rgba(7, 10, 18, .12) 76%,
    rgba(255, 43, 214, .14) 89%,
    rgba(255, 43, 214, .36) 100%
  ) !important;
  box-shadow: 0 0 6px rgba(0, 245, 255, .03) !important;
}

.terminal pre::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    90deg,
    rgba(0, 245, 255, .46) 0,
    rgba(0, 245, 255, .18) 12%,
    rgba(14, 18, 30, .22) 24%,
    rgba(8, 12, 20, .18) 76%,
    rgba(255, 43, 214, .18) 88%,
    rgba(255, 43, 214, .44) 100%
  ) !important;
}

.terminal .ansi2html-content {
  display: block !important;
  white-space: pre !important;
  word-wrap: normal !important;
  background: transparent !important;
}

.terminal.is-wrapped pre,
.terminal.is-wrapped .ansi2html-content {
  overflow-x: hidden !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
}

.terminal .body_background {
  background: transparent !important;
  background-color: transparent !important;
}

.terminal .terminal-body p {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.terminal * {
  mix-blend-mode: normal !important;
}

.terminal.is-terminal-collapsed,
.terminal.is-collapsed {
  display: block !important;
  max-height: none !important;
}

.terminal.is-terminal-collapsed .terminal-body,
.terminal.is-collapsed .terminal-body {
  position: relative !important;
  display: block !important;
  max-height: calc(8px + (1.55em * 8) + 8px) !important;
  overflow: hidden !important;
}

.terminal.is-terminal-collapsed .terminal-body::after,
.terminal.is-collapsed .terminal-body::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(6, 17, 29, 0),
    rgba(6, 17, 29, .72) 38%,
    rgba(6, 17, 29, .96) 72%,
    #06111d 100%
  );
}

.terminal.is-terminal-collapsed .terminal-body::before,
.terminal.is-collapsed .terminal-body::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8px;
  z-index: 2;
  width: 30px;
  height: 24px;
  margin-left: -15px;
  pointer-events: none;
  background: var(--ansi2html-terminal-chevron) center / contain no-repeat !important;
  animation: ansi2html-terminal-chevron-bob 1.65s ease-in-out infinite !important;
}

.terminal.is-terminal-collapsed.is-terminal-collapsible .terminal-body {
  cursor: pointer !important;
}

@keyframes ansi2html-terminal-chevron-bob {
  0%, 100% { transform: translateY(0); opacity: .78; }
  50% { transform: translateY(-4px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .terminal .terminal-header::after,
  .terminal.is-terminal-collapsed .terminal-body::before,
  .terminal.is-collapsed .terminal-body::before {
    animation: none !important;
  }
}

.terminal-control-tip {
  position: fixed;
  z-index: 9999;
  padding: 4px 7px;
  border: 1px solid rgba(0, 245, 255, .22);
  border-radius: 5px;
  transform: translateX(-50%) translateY(-3px);
  background: rgba(3, 4, 10, .88);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .28), 0 0 10px rgba(255, 43, 214, .10);
  color: #dbeafe;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  pointer-events: none;
}

.terminal-control-tip.is-success {
  border-color: rgba(57, 255, 136, .38);
  background: rgba(4, 24, 16, .94);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .30), 0 0 12px rgba(57, 255, 136, .16);
  color: #ecfdf5;
}

.terminal-control-tip.is-error {
  border-color: rgba(255, 59, 92, .38);
  background: rgba(36, 6, 18, .94);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .30), 0 0 12px rgba(255, 59, 92, .16);
  color: #fff1f2;
}

.terminal .ansi1 {
  font-weight: 700 !important;
}

.ansi2html-terminal-error {
  padding: .75em 1em;
  border-left: 3px solid #ef4444;
  background: rgba(127, 29, 29, .08);
}
