:root {
  --bg: #050807;
  --panel: rgba(5, 10, 8, 0.94);
  --panel-top: rgba(13, 20, 16, 0.96);
  --line: rgba(116, 255, 183, 0.16);
  --text: #d8ffe8;
  --muted: #8bb79a;
  --accent: #74ffb7;
  --warn: #ffd46a;
  --danger: #ff8570;
  --glow: 0 0 32px rgba(116, 255, 183, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  overflow: hidden;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  background:
    radial-gradient(circle at top, rgba(32, 84, 52, 0.18), transparent 38%),
    radial-gradient(circle at bottom right, rgba(116, 255, 183, 0.08), transparent 26%),
    linear-gradient(180deg, #030504 0%, #07100c 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

input {
  font: inherit;
}

.noise-layer,
.scanline-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.noise-layer {
  opacity: 0.08;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.22) 0 0.7px, transparent 0.8px),
    radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.15) 0 0.6px, transparent 0.8px),
    radial-gradient(circle at 40% 80%, rgba(255, 255, 255, 0.17) 0 0.7px, transparent 0.8px);
  background-size: 22px 22px, 28px 28px, 34px 34px;
}

.scanline-layer {
  background: linear-gradient(
    180deg,
    transparent 0,
    transparent 48%,
    rgba(116, 255, 183, 0.035) 49%,
    transparent 50%,
    transparent 100%
  );
  background-size: 100% 4px;
  opacity: 0.4;
}

.terminal-app {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  padding: 16px;
}

.terminal-shell {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 32px);
  flex-direction: column;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-top), var(--panel));
  box-shadow: var(--glow), inset 0 0 0 1px rgba(116, 255, 183, 0.04);
}

.terminal-bar,
.terminal-form {
  display: flex;
  align-items: center;
  gap: 14px;
}

.terminal-bar {
  min-height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.terminal-dots {
  display: inline-flex;
  gap: 8px;
}

.terminal-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.terminal-dots span:nth-child(1) {
  background: var(--danger);
}

.terminal-dots span:nth-child(2) {
  background: var(--warn);
}

.terminal-dots span:nth-child(3) {
  background: var(--accent);
}

.terminal-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.terminal-status {
  color: var(--accent);
}

.terminal-viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
}

.terminal-output {
  height: 100%;
  overflow: auto;
  padding: 22px 22px 16px;
}

.terminal-line {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
  line-height: 1.72;
  text-shadow: 0 0 10px rgba(116, 255, 183, 0.06);
}

.terminal-line[data-tone="command"] .line-prefix,
.terminal-line[data-tone="command"] .line-content {
  color: var(--accent);
}

.terminal-line[data-tone="system"] .line-prefix,
.terminal-line[data-tone="system"] .line-content {
  color: var(--muted);
}

.terminal-line[data-tone="warn"] .line-prefix,
.terminal-line[data-tone="warn"] .line-content {
  color: var(--warn);
}

.terminal-line[data-tone="error"] .line-prefix,
.terminal-line[data-tone="error"] .line-content {
  color: var(--danger);
}

.terminal-line[data-tone="success"] .line-prefix,
.terminal-line[data-tone="success"] .line-content {
  color: var(--accent);
}

.line-prefix {
  flex: 0 0 auto;
  color: var(--muted);
}

.line-content {
  min-width: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-form {
  min-height: 64px;
  padding: 0 22px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.prompt {
  color: var(--accent);
  white-space: nowrap;
}

#terminal-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  caret-color: var(--accent);
}

#terminal-input::placeholder {
  color: rgba(139, 183, 154, 0.72);
}

.terminal-hint {
  min-height: 36px;
  padding: 8px 22px 12px;
  border-top: 1px solid rgba(116, 255, 183, 0.08);
  color: var(--muted);
  font-size: 0.9rem;
}

.turnstile-shell {
  padding: 14px 22px 10px;
  border-top: 1px solid rgba(116, 255, 183, 0.08);
  background: rgba(255, 255, 255, 0.015);
}

.turnstile-shell[hidden] {
  display: none;
}

.turnstile-copy {
  margin-bottom: 10px;
  color: var(--warn);
  font-size: 0.9rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .terminal-app {
    padding: 8px;
  }

  .terminal-shell {
    min-height: calc(100vh - 16px);
  }

  .terminal-bar,
  .terminal-form,
  .turnstile-shell,
  .terminal-hint,
  .terminal-output {
    padding-left: 14px;
    padding-right: 14px;
  }

  .terminal-bar {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .terminal-form {
    min-height: 72px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
  }

  #terminal-input {
    width: 100%;
  }
}
