/* Terminal scanlines, cursor etc */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: var(--font-size);
  line-height: var(--line-height);
  overflow: hidden;
}

/* Scanline overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    var(--scanline) 0px,
    var(--scanline) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 9999;
}

/* Subtle screen flicker */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--flicker);
  opacity: 0;
  pointer-events: none;
  z-index: 9998;
  animation: flicker 0.15s infinite alternate;
}

@keyframes flicker {
  0%   { opacity: 0;   }
  50%  { opacity: 0.01; }
  100% { opacity: 0;   }
}

/* Terminal container */
#terminal {
  width: 100%;
  max-width: var(--max-width);
  height: 100vh;
  margin: 0 auto;
  padding: 24px 32px 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Output / history area */
#history {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 8px;
  scroll-behavior: smooth;
}

#history::-webkit-scrollbar {
  width: 6px;
}
#history::-webkit-scrollbar-track {
  background: transparent;
}
#history::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* Output lines */
.line {
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 2px;
}

.line.command {
  color: var(--fg-bright);
}

.line.output {
  color: var(--fg);
}

.line.error {
  color: var(--accent);
}

.line.info {
  color: var(--fg-dim);
}

/* ASCII art block */
.ascii-art {
  color: var(--fg-bright);
  text-align: center;
  line-height: 1.15;
  margin: 12px 0;
  text-shadow: 0 0 6px var(--accent-glow);
  user-select: none;
}

.welcome-msg {
  color: var(--fg-dim);
  text-align: center;
  margin: 8px 0 16px;
}

#input-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  position: relative;
}

.prompt {
  color: var(--fg-bright);
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
  text-shadow: 0 0 8px var(--accent-glow);
}

#cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: var(--font-size);
  caret-color: var(--fg-bright);
  caret-shape: block;
}

#cmd-input::placeholder {
  color: var(--fg-faint);
}

/* Blinking cursor when input is empty */
@keyframes blink {
  0%, 100% { opacity: 1;  }
  50%      { opacity: 0;  }
}

/* Section headings in output */
.output-heading {
  color: var(--fg-bright);
  font-weight: bold;
  margin-top: 8px;
  margin-bottom: 2px;
}

.output-item {
  color: var(--fg-dim);
  padding-left: 12px;
}

.output-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.output-link:hover {
  color: var(--fg-bright);
}

/* help message */
.cmd-table {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 4px 0;
}

.cmd-table .cmd-name {
  color: var(--fg-bright);
  white-space: nowrap;
}

.cmd-table .cmd-desc {
  color: var(--fg-dim);
}
