:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #101010;
  --panel-edge: #3a3a3a;
  --text: #f1f1f1;
  --muted: #a6a6a6;
  --dim: #757575;
  --error: #d0d0d0;
  --shadow: rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: #070707;
  color: var(--text);
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    "Courier New",
    monospace;
}

.terminal-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.terminal-window {
  width: min(100%, 920px);
  height: min(760px, calc(100vh - 48px));
  min-height: 520px;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  border: 1px solid var(--panel-edge);
  border-radius: 2px;
  background: var(--panel);
  box-shadow: 0 24px 70px var(--shadow);
}

.terminal {
  overflow-y: auto;
  padding: 18px;
  line-height: 1.48;
  scrollbar-color: var(--panel-edge) transparent;
}

.terminal pre,
.terminal p {
  margin: 0 0 12px;
}

.terminal pre {
  white-space: pre-wrap;
}

.motd-output {
  margin: 0 0 12px;
}

.terminal .motd-output pre {
  margin: 0;
}

.terminal .motd-box {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre;
}

.terminal .motd-output .motd-footer {
  margin-top: 12px;
  overflow-wrap: anywhere;
}

.terminal a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.terminal a:hover,
.terminal a:focus-visible {
  color: #fff;
}

.noscript-message {
  max-width: 52ch;
}

.no-js .command-line {
  display: none;
}

.terminal pre.boot-line {
  margin-bottom: 2px;
}

.output-muted {
  color: var(--muted);
}

.output-command {
  color: var(--text);
}

.output-error {
  color: var(--error);
}

.output-success {
  color: var(--text);
}

.command-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 18px;
  border-top: 1px solid var(--panel-edge);
  background: #0a0a0a;
}

.command-line.is-booting {
  color: var(--dim);
}

.prompt {
  flex: 0 0 auto;
  color: var(--text);
  overflow-wrap: anywhere;
}

.command-line.is-booting .prompt {
  color: var(--dim);
}

.input-wrap {
  --cursor-left: 0px;
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 1.5em;
}

#command-input {
  min-width: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  caret-color: transparent;
  font: inherit;
  line-height: 1.5;
}

#command-input:disabled {
  color: var(--dim);
}

.block-cursor {
  position: absolute;
  top: 50%;
  left: var(--cursor-left);
  width: 0.62em;
  height: 1.08em;
  background: var(--text);
  pointer-events: none;
  transform: translateY(-50%);
  mix-blend-mode: difference;
  animation: cursor-blink 1s steps(1, end) infinite;
}

.command-line:not(:focus-within) .block-cursor {
  display: none;
}

.command-line.is-booting .block-cursor {
  display: none;
}

::selection {
  background: #4a4a4a;
}

@keyframes cursor-blink {
  0%,
  49% {
    opacity: 1;
  }

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

@media (prefers-reduced-motion: reduce) {
  .block-cursor {
    animation: none;
  }
}

@media (max-width: 640px) {
  .terminal-shell {
    padding: 0;
  }

  .terminal-window {
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .terminal {
    padding: 14px;
    font-size: 0.9rem;
  }

  .motd-box {
    font-size: clamp(0.6rem, 2.6vw, 0.9rem);
  }

  .command-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px 12px;
  }

  .prompt {
    font-size: 0.86rem;
  }
}
