/* ── palette ───────────────────────────────────────────── */
:root {
  --bg: #0a0d12;
  --terminal-bg: #0e1219;
  --terminal-border: #1d2533;
  --fg: #c9d4e3;
  --dim: #5d6b80;
  --green: #5ef0a5;
  --pink: #ff7eb6;
  --cyan: #6cc7ff;
  --yellow: #ffd166;
  --red: #ff6b6b;
  --selection: rgba(94, 240, 165, 0.25);
  --glow: 0 0 24px rgba(94, 240, 165, 0.07);
}

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

::selection { background: var(--selection); }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Hack", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  line-height: 1.55;
}

body {
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(94, 240, 165, 0.06), transparent),
    radial-gradient(ellipse 60% 50% at 90% 110%, rgba(255, 126, 182, 0.05), transparent);
}

/* subtle CRT scanlines over everything */
.crt {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.12) 0px,
    rgba(0, 0, 0, 0.12) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.35;
}

/* ── layout ────────────────────────────────────────────── */
.terminal-wrap {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  gap: 12px;
}

.terminal {
  width: 100%;
  max-width: 860px;
  height: min(78vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--terminal-bg);
  border: 1px solid var(--terminal-border);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), var(--glow);
  overflow: hidden;
}

/* ── titlebar ──────────────────────────────────────────── */
.titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #131826;
  border-bottom: 1px solid var(--terminal-border);
  user-select: none;
}

.traffic-lights { display: flex; gap: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

.title {
  flex: 1;
  text-align: center;
  font-size: 12.5px;
  color: var(--dim);
}

/* ── screen ────────────────────────────────────────────── */
.screen {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 24px;
  outline: none;
  cursor: text;
  scrollbar-width: thin;
  scrollbar-color: var(--terminal-border) transparent;
}

.screen::-webkit-scrollbar { width: 8px; }
.screen::-webkit-scrollbar-thumb { background: var(--terminal-border); border-radius: 4px; }

#output .line {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.55em;
}

/* semantic colors used by the JS renderer */
.c-green  { color: var(--green); }
.c-pink   { color: var(--pink); }
.c-cyan   { color: var(--cyan); }
.c-yellow { color: var(--yellow); }
.c-red    { color: var(--red); }
.c-dim    { color: var(--dim); }
.c-bold   { font-weight: 800; }
.c-italic { font-style: italic; }

#output a {
  color: var(--cyan);
  text-decoration-color: rgba(108, 199, 255, 0.4);
  text-underline-offset: 3px;
}
#output a:hover { color: var(--green); }

/* ── input line ────────────────────────────────────────── */
.input-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  position: relative;
}

.prompt { margin-right: 8px; white-space: nowrap; }
.p-user { color: var(--pink); font-weight: 600; }
.p-at   { color: var(--dim); }
.p-host { color: var(--green); font-weight: 600; }
.p-path { color: var(--dim); }

.typed { white-space: pre-wrap; word-break: break-all; }

.cursor {
  background: var(--green);
  color: var(--terminal-bg);
  animation: blink 1.1s steps(1) infinite;
  white-space: pre;
}

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

/* real input is invisible but focusable — keystrokes are mirrored into .typed */
#cmd-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  border: none;
}

/* ── hint chips ────────────────────────────────────────── */
.hints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  background: #10141f;
  border-top: 1px solid var(--terminal-border);
}

.chip {
  font-family: inherit;
  font-size: 12.5px;
  color: var(--terminal-bg);
  background: var(--green);
  border: none;
  border-radius: 0;
  padding: 3px 10px;
  cursor: pointer;
}

.chip:hover { background: var(--pink); }

.under-note {
  font-size: 12px;
  color: var(--dim);
  text-align: center;
}
.under-note .accent { color: var(--green); }

/* ── responsive ────────────────────────────────────────── */
@media (max-width: 640px) {
  html, body { font-size: 13px; }
  .terminal { height: 82vh; }
  .screen { padding: 14px 12px 20px; }
}

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