body {
  background:
    radial-gradient(circle at top, rgba(0, 255, 136, 0.12), transparent 30%),
    radial-gradient(circle at bottom, rgba(0, 153, 255, 0.12), transparent 28%),
    #030607;
  color: #8fffd1;
  font-family: "Courier New", monospace;

  display: flex;
  justify-content: center;
  align-items: center;

  min-height: 100vh;
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

#terminal {
  width: 800px;
  max-width: 90%;
  position: relative;
  z-index: 2;
  border: 1px solid rgba(143, 255, 209, 0.35);
  border-radius: 18px;
  background: rgba(2, 14, 11, 0.72);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(0, 255, 136, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
}

#auth-screen {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 5, 4, 0.62);
  backdrop-filter: blur(8px);
}

#auth-screen.hidden {
  display: none;
}

#auth-form {
  width: min(560px, 100%);
  border: 1px solid rgba(143, 255, 209, 0.3);
  border-radius: 16px;
  background: rgba(2, 14, 11, 0.88);
  box-shadow: 0 20px 64px rgba(0, 0, 0, 0.45);
  padding: 28px;
}

#auth-title {
  margin: 0;
  font-size: 1.28rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#auth-question {
  margin: 12px 0 0;
  color: rgba(143, 255, 209, 0.82);
}

.auth-controls {
  margin-top: 18px;
  display: flex;
  gap: 10px;
}

#auth-input {
  flex: 1;
  border: 1px solid rgba(143, 255, 209, 0.35);
  border-radius: 10px;
  background: rgba(143, 255, 209, 0.04);
  color: #8fffd1;
  padding: 12px 14px;
  font: inherit;
  letter-spacing: 0.05em;
}

#auth-input:focus {
  outline: 2px solid rgba(143, 255, 209, 0.35);
  outline-offset: 1px;
}

#auth-submit {
  white-space: nowrap;
}

#auth-feedback {
  min-height: 24px;
  margin: 10px 0 0;
  color: rgba(143, 255, 209, 0.72);
}

#auth-feedback.error {
  color: #ff9d9d;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(143, 255, 209, 0.15);
  background: rgba(143, 255, 209, 0.04);
}

.lights {
  display: flex;
  gap: 8px;
}

.lights span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

.lights span:nth-child(1) {
  color: #ff6b6b;
  background: currentColor;
}

.lights span:nth-child(2) {
  color: #ffd166;
  background: currentColor;
}

.lights span:nth-child(3) {
  color: #06d6a0;
  background: currentColor;
}

.terminal-title {
  color: rgba(143, 255, 209, 0.8);
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#content {
  padding: 30px;
  min-height: 200px;
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 1.02rem;
  text-shadow: 0 0 12px rgba(143, 255, 209, 0.2);
  position: relative;
}

#content::after {
  content: "";
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 11px;
  height: 1.2em;
  background: rgba(143, 255, 209, 0.9);
  box-shadow: 0 0 12px rgba(143, 255, 209, 0.8);
  opacity: 0;
}

#content.typing::after {
  opacity: 1;
  animation: blink 0.8s steps(1) infinite;
}

.controls {
  display: flex;
  gap: 12px;
  padding: 0 30px 18px;
  flex-wrap: wrap;
}

#command-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 30px;
  padding: 14px 16px;
  border: 1px solid rgba(143, 255, 209, 0.18);
  border-radius: 12px;
  background: rgba(143, 255, 209, 0.03);
}

.prompt {
  color: rgba(143, 255, 209, 0.9);
  font-size: 1rem;
}

#command-input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: #8fffd1;
  font: inherit;
  letter-spacing: 0.05em;
}

#command-input::placeholder {
  color: rgba(143, 255, 209, 0.35);
}

#command-output {
  min-height: 76px;
  margin: 14px 30px 30px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(143, 255, 209, 0.08);
  background: rgba(0, 0, 0, 0.16);
  color: rgba(143, 255, 209, 0.78);
  white-space: pre-wrap;
  line-height: 1.6;
  opacity: 0.92;
}

button {
  background: transparent;
  color: #8fffd1;
  border: 1px solid rgba(143, 255, 209, 0.55);
  padding: 12px 22px;
  cursor: pointer;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
  box-shadow: inset 0 0 0 0 rgba(143, 255, 209, 0.1);
}

button:hover {
  background: #8fffd1;
  color: #03110d;
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

button.secondary {
  color: rgba(143, 255, 209, 0.78);
  border-color: rgba(143, 255, 209, 0.25);
}

.ambient-grid,
.scanlines,
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.ambient-grid {
  background-image:
    linear-gradient(rgba(143, 255, 209, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 255, 209, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black 45%, transparent 90%);
  opacity: 0.35;
}

.scanlines {
  background: linear-gradient(to bottom, transparent, rgba(143, 255, 209, 0.05), transparent);
  background-size: 100% 5px;
  mix-blend-mode: screen;
  opacity: 0.22;
}

#particles span {
  position: absolute;
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(143, 255, 209, 0.9);
  box-shadow: 0 0 16px rgba(143, 255, 209, 0.85);
  animation: floatUp linear infinite;
}

#terminal.glitch {
  animation: glitchPulse 260ms ease;
}

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

@keyframes floatUp {
  from {
    transform: translate3d(0, 20px, 0) scale(0.7);
    opacity: 0;
  }
  25% {
    opacity: 0.8;
  }
  to {
    transform: translate3d(0, -120vh, 0) scale(1.2);
    opacity: 0;
  }
}

@keyframes glitchPulse {
  0% {
    transform: translateX(0);
    filter: saturate(1);
  }
  25% {
    transform: translateX(-3px);
    filter: saturate(1.4);
  }
  50% {
    transform: translateX(3px);
    filter: saturate(1.2);
  }
  100% {
    transform: translateX(0);
    filter: saturate(1);
  }
}

@media (max-width: 640px) {
  body {
    align-items: flex-start;
    min-height: 100dvh;
    padding:
      max(16px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
  }

  #terminal {
    width: 100%;
    max-width: none;
    border-radius: 16px;
    margin: 0;
  }

  #auth-screen {
    padding:
      max(14px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
    align-items: start;
  }

  #auth-form {
    padding: 22px 18px;
    border-radius: 14px;
  }

  #auth-title {
    font-size: 1.08rem;
    line-height: 1.25;
  }

  #auth-question {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  #content {
    min-height: 160px;
    padding: 20px 18px 22px;
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .controls {
    padding: 0 18px 14px;
  }

  #command-line {
    margin: 0 18px;
    padding: 12px 14px;
  }

  #command-output {
    margin: 12px 18px 18px;
    min-height: 64px;
    padding: 14px;
  }

  button {
    width: 100%;
  }

  .terminal-bar {
    padding: 12px 14px;
    gap: 12px;
  }

  .terminal-title {
    font-size: 0.78rem;
    line-height: 1.2;
  }

  .lights span {
    width: 8px;
    height: 8px;
  }

  .controls {
    gap: 10px;
  }

  .auth-controls {
    flex-direction: column;
  }

  #auth-submit {
    width: 100%;
  }
}