:root {
  --black: #020502;
  --green: #45ff6a;
  --green-soft: rgba(69, 255, 106, 0.68);
  --green-line: rgba(69, 255, 106, 0.28);
  --mono: "SFMono-Regular", "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --text-size: clamp(1rem, 2vw, 1.35rem);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--green);
  background: var(--black);
  font-family: var(--mono);
  font-size: var(--text-size);
  cursor: text;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(0, 0, 0, 0.08) 4px
  );
  content: "";
}

.video-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--black);
}

.video-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: grayscale(0.18) contrast(1.14);
  transition: opacity 180ms linear;
}

.video-background.is-active {
  z-index: 1;
  opacity: 1;
}

.video-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.68);
}

.journey-controls {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.journey-button {
  min-width: 12ch;
  padding: 0.65em 1em;
  border: 1px solid var(--green);
  color: var(--green);
  background: rgba(2, 5, 2, 0.78);
  box-shadow: 0 0 18px rgba(69, 255, 106, 0.12);
  font: inherit;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 9px rgba(69, 255, 106, 0.3);
  cursor: pointer;
  pointer-events: auto;
}

.journey-button:hover,
.journey-button:focus-visible {
  color: var(--black);
  background: var(--green);
  outline: 0;
}

.journey-button[hidden],
.direction-choices[hidden] {
  display: none;
}

.direction-choices {
  display: grid;
  gap: 1.1em;
  justify-items: center;
  padding: 1.2em;
  background: rgba(2, 5, 2, 0.68);
  pointer-events: auto;
}

.direction-choices p {
  margin: 0;
}

.direction-choices > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1em;
}

::selection {
  color: var(--black);
  background: var(--green);
}

.profile-bar {
  position: relative;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 0 22px;
  cursor: default;
}

.profile-bar img {
  display: block;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  filter: grayscale(1) contrast(1.08);
}

.profile-bar strong {
  color: var(--green);
  font-size: inherit;
  font-weight: 400;
}

.terminal {
  position: relative;
  z-index: 10;
  width: min(100% - 44px, 1100px);
  margin: clamp(52px, 10vh, 110px) 22px 44px;
  font-size: inherit;
  line-height: 1.65;
  text-shadow: 0 0 9px rgba(69, 255, 106, 0.28);
}

.terminal-history {
  display: grid;
}

.history-line {
  min-height: 1.65em;
  color: var(--green-soft);
  white-space: pre-wrap;
}

.command-output {
  margin: 0 0 1.65em;
  color: var(--green-soft);
  white-space: pre-wrap;
}

.command-output a {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.prompt-line {
  display: flex;
  align-items: baseline;
  min-height: 1.65em;
}

.prompt-prefix,
.history-prefix {
  flex: 0 0 auto;
  color: var(--green);
  white-space: pre;
}

.terminal-input {
  min-width: 1ch;
  width: 1ch;
  max-width: calc(100vw - 190px);
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--green);
  background: transparent;
  font: inherit;
  line-height: inherit;
  caret-color: transparent;
  text-shadow: inherit;
}

.terminal-input:disabled {
  opacity: 1;
}

.terminal-caret {
  display: none;
  flex: 0 0 auto;
  color: var(--green);
}

.terminal.ready .terminal-caret {
  display: inline;
  animation: blink 820ms steps(1, end) infinite;
}

.command-suggestions {
  display: grid;
  width: min(100%, 46ch);
  margin: 0.3em 0 1.65em 2ch;
}

.command-suggestions[hidden] {
  display: none;
}

.command-suggestion {
  position: relative;
  display: grid;
  grid-template-columns: 11ch minmax(0, 1fr);
  gap: 2ch;
  width: 100%;
  padding: 0.12em 0 0.12em 2ch;
  border: 0;
  color: var(--green-soft);
  background: transparent;
  font: inherit;
  line-height: inherit;
  text-align: left;
  cursor: pointer;
}

.command-suggestion[aria-selected="true"] {
  color: var(--green);
}

.command-suggestion[aria-selected="true"]::before {
  position: absolute;
  left: 0;
  content: ">";
}

.suggestion-description {
  opacity: 0.7;
}

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

@keyframes blink {
  0%,
  46% {
    opacity: 1;
  }

  47%,
  100% {
    opacity: 0;
  }
}

@media (max-width: 560px) {
  .profile-bar {
    margin: 16px 0 0 16px;
  }

  .terminal {
    width: calc(100% - 32px);
    margin: 46px 16px 32px;
  }

  .terminal-input {
    max-width: calc(100vw - 150px);
  }

  .direction-choices > div {
    align-items: center;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .video-background {
    transition: none;
  }

  .terminal.ready .terminal-caret {
    animation-duration: 1.6s;
  }
}
