:root {
  --term-color-green: #00ff00;
  --term-color-amber: #ffb000;
  --term-color-cyan: #55ffff;
  --term-color-white: #ffffff;
  --term-bg-black: #000000;
  --term-bg-blue: #0000aa;
}

.terminal-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(10, 10, 20, 0.95);
  color: var(--success);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  position: relative;
}

.terminal-container.theme-green { color: #00ff00; background: #050505; }
.terminal-container.theme-amber { color: #ffb000; background: #0c0800; }
.terminal-container.theme-cyan { color: #55ffff; background: #000c14; }
.terminal-container.theme-white { color: #ffffff; background: #0a0a0a; }
.terminal-container.theme-dosblue { color: #ffff55; background: #0000aa; }
/* with a palette all the text but errors is in its colour */
.terminal-container[class*="theme-"] .terminal-line:not(.error),
.terminal-container[class*="theme-"] .terminal-prompt,
.terminal-container[class*="theme-"] .terminal-input { color: inherit; caret-color: currentColor; }

.crt-effects {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  box-shadow: inset 0 0 100px rgba(0,0,0,0.5);
  z-index: 10;
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  line-height: 1.6;
}

.terminal-line {
  margin-bottom: 4px;
  white-space: pre-wrap;   /* the help's columns and the boxes keep their spaces */
  word-wrap: break-word;
}

/* the snake's board: its rows close, unbroken, and a finger's swipe steers rather than scrolls */
.terminal-snake {
  margin: 0 0 4px;
  font: inherit;
  line-height: 1.05;
  white-space: pre;
  touch-action: none;
}

/* a blank line is a line */
.terminal-line:empty::before {
  content: '\200b';
}

.terminal-line.command {
  color: var(--accent-secondary);
}

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

.terminal-line.system {
  color: var(--text-muted);
  font-style: italic;
}

.terminal-input-line {
  display: flex;
  padding: 8px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  align-items: center;
  gap: 8px;
}

.terminal-prompt {
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}

.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: inherit;
  caret-color: var(--accent);
}

@keyframes blink {
  50% { opacity: 0; }
}

.terminal-welcome {
  color: var(--accent);
  white-space: pre;
  margin-bottom: 16px;
}

/* a line that puts a command on the prompt when pressed: help's rows, a "did you mean" */
.terminal-link { cursor: pointer; border-radius: 3px; }
.terminal-link:hover, .terminal-link:focus-visible { background: rgba(255, 255, 255, 0.08); outline: none; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.35); }

/* under the line: what the word could become, to press, or the command's usage */
.terminal-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-height: 22px;
  padding: 0 16px 6px;
  font-size: 0.85em;
  color: var(--text-muted);
  white-space: pre-wrap;
}
.terminal-hint.tips { opacity: 0.7; }
.terminal-chip {
  padding: 1px 8px;
  border: 1px solid currentColor;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  opacity: 0.85;
}
.terminal-chip:hover, .terminal-chip:focus-visible { opacity: 1; background: rgba(255, 255, 255, 0.1); outline: none; }
.terminal-container[class*="theme-"] .terminal-hint { color: inherit; }

/* the keys a phone's keyboard has not got, on a touch screen only */
.terminal-keys { display: none; }
@media (pointer: coarse) {
  .terminal-keys {
    display: flex;
    gap: 6px;
    padding: 0 12px 8px;
    overflow-x: auto;
  }
  .terminal-keys button {
    min-width: 44px;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
    font: inherit;
  }
  .terminal-chip { min-height: 32px; padding: 4px 12px; }
}
.terminal-usage { margin-right: 4px; }
