:root {
  --black: #0a0a0a;
  --green: #33ff33;
  --green-dim: #1a8c1a;
  --green-glow: #33ff3322;
  --amber: #ffaa00;
  --grey: #555555;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--black);
  color: var(--green);
  font-family: "IBM Plex Mono", "JetBrains Mono", monospace;
  overflow: hidden;
}

.terminal-page {
  width: 100%;
  height: 100%;
  position: relative;
  background:
    radial-gradient(circle at 50% 35%, rgba(40, 70, 20, 0.35), transparent 64%),
    radial-gradient(circle at 50% 50%, rgba(10, 30, 10, 0.3), transparent 80%),
    #050705;
}

.crt-shell {
  position: absolute;
  inset: 0;
  padding: clamp(8px, 2vw, 18px);
  filter: contrast(1.08) saturate(1.05);
}

.terminal-wrap {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(51, 255, 51, 0.25);
  box-shadow:
    0 0 0 1px rgba(51, 255, 51, 0.12),
    0 0 36px rgba(51, 255, 51, 0.2),
    inset 0 0 42px rgba(51, 255, 51, 0.08);
  background:
    linear-gradient(180deg, rgba(0, 18, 0, 0.7), rgba(0, 10, 0, 0.85)),
    rgba(6, 10, 6, 1);
  position: relative;
  overflow: hidden;
}

.terminal-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  padding: clamp(8px, 1.2vw, 14px) clamp(8px, 1.4vw, 16px) clamp(6px, 0.9vw, 10px);
  border-bottom: 1px solid rgba(51, 255, 51, 0.28);
  background: linear-gradient(180deg, rgba(0, 12, 0, 0.9), rgba(0, 10, 0, 0.72));
  text-shadow:
    0 0 4px rgba(51, 255, 51, 0.45),
    0.8px 0 rgba(255, 80, 60, 0.13),
    -0.8px 0 rgba(80, 160, 255, 0.13);
}

.terminal-header pre {
  margin: 0;
  white-space: pre;
  color: var(--green);
  font-family: "IBM Plex Mono", "JetBrains Mono", monospace;
  font-size: clamp(10px, 1.06vw, 16px);
  line-height: 1.18;
}

#header-tagline {
  margin-top: 6px;
  color: #8dff8d;
  font-size: clamp(10px, 0.95vw, 14px);
}

.terminal-header.is-mobile {
  padding: 10px 10px 8px;
}

.terminal-header.is-mobile #header-logo {
  font-size: clamp(16px, 4.5vw, 20px);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.terminal-header.is-mobile #header-tagline {
  display: none;
}

.terminal-body {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}

#terminal {
  width: 100%;
  height: 100%;
  padding: clamp(8px, 1.2vw, 16px);
}

#terminal .xterm,
#terminal .xterm-viewport,
#terminal .xterm-screen,
#terminal .xterm-rows {
  height: 100% !important;
}

#terminal .xterm-rows {
  text-shadow:
    0 0 4px rgba(51, 255, 51, 0.45),
    0.8px 0 rgba(255, 80, 60, 0.13),
    -0.8px 0 rgba(80, 160, 255, 0.13);
}

.scanlines,
.vignette {
  pointer-events: none;
  position: absolute;
  inset: 0;
}

.scanlines {
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.05) 0px,
      rgba(255, 255, 255, 0.05) 1px,
      transparent 2px,
      transparent 4px
    );
  mix-blend-mode: soft-light;
  opacity: 0.2;
  animation: sweep 7s linear infinite;
}

.vignette {
  background:
    radial-gradient(circle at 50% 50%, transparent 56%, rgba(0, 0, 0, 0.6) 100%),
    radial-gradient(circle at 50% 50%, rgba(51, 255, 51, 0.08), transparent 72%);
}

.crt-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0));
  opacity: 0.35;
  animation: flicker 0.22s infinite;
}

.crt-shell.screen-flicker {
  animation: screen-flash 55ms linear 1;
}

.glitch-glyph {
  position: absolute;
  z-index: 25;
  pointer-events: none;
  font-family: "IBM Plex Mono", "JetBrains Mono", monospace;
  font-size: clamp(12px, 1.1vw, 16px);
  text-shadow: 0 0 6px rgba(51, 255, 51, 0.85);
}

.mobile-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: none;
  background: linear-gradient(0deg, rgba(2, 10, 2, 0.94), rgba(2, 10, 2, 0.72));
  border-top: 1px solid rgba(51, 255, 51, 0.28);
  padding: 10px 10px 12px;
  color: var(--green-dim);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.mobile-hint p {
  margin: 0 0 8px;
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.chip-row button {
  border: 1px solid rgba(51, 255, 51, 0.45);
  color: var(--green);
  background: rgba(0, 10, 0, 0.9);
  text-transform: lowercase;
  font: inherit;
  padding: 6px 10px;
  border-radius: 2px;
}

.chip-row button:active {
  background: rgba(20, 45, 20, 1);
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .mobile-hint {
    display: block;
  }

  .crt-shell {
    padding-bottom: 96px;
  }

  #terminal {
    padding: 8px;
  }

  .terminal-header {
    padding-left: 10px;
    padding-right: 10px;
  }
}

@keyframes flicker {
  0% {
    opacity: 0.2;
  }
  10% {
    opacity: 0.34;
  }
  22% {
    opacity: 0.27;
  }
  53% {
    opacity: 0.29;
  }
  75% {
    opacity: 0.25;
  }
  100% {
    opacity: 0.3;
  }
}

@keyframes sweep {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(4px);
  }
}

@keyframes screen-flash {
  0% {
    opacity: 1;
  }
  40% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}
