* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #000;
  color: #d0d0d0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  line-height: 1.45;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#terminal {
  position: relative;
  width: 100%;
  max-width: 880px;
  height: min(80vh, 700px);
  background: #000;
  border: 1px solid #1f1f1f;
  border-radius: 6px;
  padding: 18px 20px;
  overflow-y: auto;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

#terminal:focus-within { border-color: #2a2a2a; }

#hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  font-size: 16px;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
}

#output > * { margin: 0; }

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

.prompt { color: #6cf08e; }
.user { color: #d0d0d0; }
.muted { color: #777; }
.warn { color: #e0b070; }
.error { color: #e06b6b; }

.help-list { color: #d0d0d0; }
.help-list .num { color: #6cf08e; }

.rendered {
  margin: 4px 0 8px;
  color: #d0d0d0;
}
.rendered h1, .rendered h2, .rendered h3 {
  color: #6cf08e;
  margin: 6px 0 4px;
  font-size: 1em;
  font-weight: bold;
}
.rendered p { margin: 4px 0; }
.rendered ul, .rendered ol { margin: 4px 0; padding-left: 22px; }
.rendered a { color: #6c9ff0; text-decoration: underline; }
.rendered a:hover { color: #9bc0ff; }
.rendered code {
  background: #111;
  padding: 1px 4px;
  border-radius: 3px;
}
.rendered pre {
  background: #111;
  padding: 8px;
  border-radius: 4px;
  overflow-x: auto;
}

#line { display: flex; align-items: baseline; }
#prompt { color: #6cf08e; white-space: pre; }
#input { color: #d0d0d0; white-space: pre; }
#cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  background: #d0d0d0;
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: blink 1s steps(1, end) infinite;
}
@keyframes blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

#terminal::-webkit-scrollbar { width: 8px; }
#terminal::-webkit-scrollbar-track { background: #000; }
#terminal::-webkit-scrollbar-thumb { background: #222; border-radius: 4px; }
