/* Claude Code terminal — mimics a real macOS terminal session */

:root {
  --term-bg: #0d0d0d;
  --term-fg: #d4d4d4;
  --term-dim: #8a8a8a;
  --term-faint: #5e5e5e;
  --term-cyan: #5eb8c4;
  --term-blue: #6aa0ff;
  --term-green: #7fcf6a;
  --term-yellow: #d4b15e;
  --term-orange: #d4a26a;
  --term-magenta: #c599d9;
  --term-red: #e57373;
  --term-white: #f5f5f5;
  --term-accent: #ff8c5a;          /* Claude Code accent (matches mascot) */
  --term-selection: #2c3a52;
  --term-border: #2a2a2a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #1c1c1c;
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
  color: var(--term-fg);
}

.terminal-window {
  width: 100vw;
  height: 100vh;
  background: var(--term-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* macOS-style title bar */
.term-titlebar {
  display: flex;
  align-items: center;
  height: 28px;
  background: linear-gradient(180deg, #3a3a3a, #2a2a2a);
  border-bottom: 1px solid #000;
  padding: 0 12px;
  flex-shrink: 0;
  position: relative;
  user-select: none;
}
.term-traffic {
  display: flex;
  gap: 8px;
  align-items: center;
}
.term-traffic .dot {
  width: 12px; height: 12px; border-radius: 999px;
  display: inline-block;
}
.term-traffic .dot.red    { background: #ff5f57; border: 0.5px solid #e0443e; }
.term-traffic .dot.yellow { background: #febc2e; border: 0.5px solid #dea123; }
.term-traffic .dot.green  { background: #28c840; border: 0.5px solid #1aab29; }
.term-title {
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  font-size: 12px;
  color: #b0b0b0;
  font-family: -apple-system, system-ui, sans-serif;
  font-weight: 500;
  pointer-events: none;
}

/* Scrollable terminal body */
.term-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 18px 18px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--term-fg);
}
.term-body::-webkit-scrollbar { width: 10px; }
.term-body::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 6px; }
.term-body::-webkit-scrollbar-track { background: transparent; }

/* The leading shell prompt before claude starts */
.shell-line { color: var(--term-fg); margin: 0 0 6px; white-space: pre-wrap; }
.shell-line .prompt-host { color: var(--term-green); }
.shell-line .prompt-path { color: var(--term-blue); }
.shell-line .prompt-sign { color: var(--term-dim); }
.shell-line .cmd { color: var(--term-fg); }

/* Welcome banner */
.welcome-banner {
  display: flex;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--term-border);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 8px 0 18px;
  background: #141414;
}
.welcome-banner .mascot {
  width: 56px; height: 56px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
}
.welcome-banner .welcome-text { display: flex; flex-direction: column; gap: 4px; }
.welcome-banner .welcome-title {
  font-size: 14px; font-weight: 600; color: var(--term-white);
}
.welcome-banner .welcome-title .accent { color: var(--term-accent); }
.welcome-banner .welcome-sub {
  font-size: 12px; color: var(--term-dim); line-height: 1.45;
}
.welcome-banner .welcome-sub code {
  background: #1f1f1f; padding: 1px 5px; border-radius: 3px;
  color: var(--term-cyan); font-size: 11.5px;
}

/* Tips line */
.tips {
  color: var(--term-faint);
  font-size: 12px;
  margin: 0 0 18px;
  padding-left: 4px;
}
.tips .key {
  color: var(--term-fg);
  background: #1f1f1f;
  border: 1px solid #333;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
  font-size: 11px;
}

/* cwd / model info row */
.meta-row {
  display: flex;
  gap: 18px;
  color: var(--term-faint);
  font-size: 11.5px;
  margin: 0 0 14px;
  padding-left: 4px;
}
.meta-row span strong { color: var(--term-dim); font-weight: 500; }

/* User prompt bubble inside terminal */
.user-prompt {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 14px 0;
  white-space: pre-wrap;
}
.user-prompt .chev { color: var(--term-white); flex-shrink: 0; }
.user-prompt .text { color: var(--term-white); }

/* Slash command — distinct cyan accent so /api-key reads as a command,
   both when the user types it and when Claude suggests it inline. */
.user-prompt .text .slash {
  color: var(--term-cyan);
  font-weight: 500;
}
code.slash {
  color: var(--term-cyan);
  background: #1f1f1f;
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Claude / assistant bullet line */
.ai-bullet {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 14px 0 6px;
}
.ai-bullet .bullet { color: var(--term-white); flex-shrink: 0; }
.ai-bullet .ai-text { color: var(--term-fg); white-space: pre-wrap; line-height: 1.55; }
.ai-bullet .ai-text code { color: var(--term-cyan); background: #1f1f1f; padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.ai-bullet .ai-text strong { color: var(--term-white); font-weight: 600; }

/* Tool / function call line — like "Read(path)" or "Bash(cmd)" */
.tool-call {
  margin: 6px 0 6px 20px;
  color: var(--term-fg);
  font-size: 12.5px;
}
.tool-call .name { color: var(--term-magenta); font-weight: 600; }
.tool-call .args { color: var(--term-dim); }
.tool-call .branch {
  color: var(--term-faint);
  padding-left: 16px;
  display: block;
  margin-top: 2px;
}
.tool-call .branch .label { color: var(--term-dim); }
.tool-call .branch .value { color: var(--term-green); }
.tool-call .branch .value.err { color: var(--term-red); }
.tool-call .branch .value.warn { color: var(--term-yellow); }

/* Plain-text block — like real CLI output, no card chrome */
.term-block {
  font-family: inherit;
  font-size: 13px;
  line-height: 1.7;
  color: var(--term-fg);
  margin: 8px 0 12px;
  padding: 0;
  background: transparent;
  border: 0;
  white-space: pre;
  overflow-x: auto;
}
.term-block .url-link {
  text-decoration: underline;
  text-decoration-color: #2a4a55;
  text-underline-offset: 2px;
}

/* Generic dim text */
.dim { color: var(--term-faint); }
.cyan { color: var(--term-cyan); }
.green { color: var(--term-green); }
.yellow { color: var(--term-yellow); }
.red { color: var(--term-red); }
.magenta { color: var(--term-magenta); }
.accent { color: var(--term-accent); }
.white { color: var(--term-white); }

/* Bottom composer / input bar — anchored to the terminal window's bottom.
   Real-terminal styling: just two horizontal rules above and below the
   prompt row. No rounded box, no fill. */
.term-composer {
  flex-shrink: 0;
  padding: 6px 18px 10px;
  background: var(--term-bg);
}
.term-composer-box {
  border: 0;
  border-top: 1px solid #3a3a3a;
  border-bottom: 1px solid #3a3a3a;
  border-radius: 0;
  background: transparent;
  padding: 8px 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.term-composer-box .chev { color: var(--term-white); }
.term-composer-box .placeholder { color: var(--term-faint); flex: 1; }
.term-composer-box .cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: var(--term-fg);
  vertical-align: middle;
}
.term-composer-hints {
  display: flex; gap: 14px;
  font-size: 11px;
  color: var(--term-faint);
  margin-top: 6px;
  padding: 0 4px;
}
.term-composer-hints .hint .key {
  color: var(--term-dim);
  background: #1f1f1f;
  border: 1px solid #2a2a2a;
  border-radius: 3px;
  padding: 0 5px;
  font-size: 10.5px;
}

/* Demo-only hint below the composer (not part of the real Claude Code UI) */
.demo-tip {
  display: block;
  margin-top: 10px;
  padding: 8px 10px;
  font-size: 11px;
  font-family: -apple-system, system-ui, sans-serif;
  color: #9aa0a8;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed #2f2f2f;
  border-radius: 6px;
  text-align: center;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.demo-tip:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--term-fg);
  border-color: #3a3a3a;
}
.demo-tip kbd {
  font-family: inherit;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 0 5px;
  color: var(--term-white);
  font-size: 10.5px;
}
.demo-tip .link {
  color: var(--term-cyan);
  text-decoration: underline;
  text-decoration-color: #2a4a55;
  text-underline-offset: 2px;
}

/* Diff-like / file-write blocks for handoff screen */
.file-block {
  margin: 6px 0 10px 20px;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  overflow: hidden;
  font-size: 12px;
  font-family: inherit;
}
.file-block .file-head {
  background: #161616;
  padding: 6px 12px;
  color: var(--term-dim);
  border-bottom: 1px solid #2a2a2a;
  display: flex; justify-content: space-between; align-items: center;
}
.file-block .file-head .path { color: var(--term-cyan); }
.file-block .file-head .lines-added { color: var(--term-green); }
.file-block .file-head .lines-added .removed { color: var(--term-red); }

.file-block .file-body {
  background: #0f0f0f;
  line-height: 1.65;
  padding: 4px 0;
}
.file-block .file-body .line {
  display: grid;
  grid-template-columns: 16px 38px 1fr;
  column-gap: 8px;
  padding: 0 12px;
  font-family: inherit;
  white-space: pre;
}
.file-block .file-body .line .mark {
  text-align: center;
  user-select: none;
  color: #555;
}
.file-block .file-body .line .ln {
  text-align: right;
  user-select: none;
  color: #555;
}
.file-block .file-body .line .code { color: var(--term-dim); }

.file-block .file-body .line.added {
  background: rgba(127, 207, 106, 0.12);
}
.file-block .file-body .line.added .mark,
.file-block .file-body .line.added .ln { color: var(--term-green); }
.file-block .file-body .line.added .code { color: #d4eecf; }

.file-block .file-body .line.removed {
  background: rgba(229, 115, 115, 0.12);
}
.file-block .file-body .line.removed .mark,
.file-block .file-body .line.removed .ln { color: var(--term-red); }
.file-block .file-body .line.removed .code { color: #ecc7c7; }

/* Spinner / running line */
.run-line { color: var(--term-yellow); margin: 6px 0 6px 20px; font-size: 12.5px; }

/* Generic spinner line — used for "waiting for key" / "thinking" states */
.spinner-line {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 10px 0 10px 20px;
  font-size: 13px;
  color: var(--term-fg);
  transition: opacity 250ms ease, max-height 350ms ease, margin 350ms ease;
  overflow: hidden;
  max-height: 40px;
}
.spinner-line.is-gone {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
  margin-bottom: 0;
}
.spinner-line .spin-glyph {
  color: var(--term-accent);
  display: inline-block;
  width: 1.1em;
  text-align: center;
  font-size: 14px;
  line-height: 1;
}

/* Reveal — items start hidden; JS reveals them either by streaming
   characters into the element or by toggling visibility for non-text chrome. */
.reveal {
  visibility: hidden;
  opacity: 0;
  transition: opacity 220ms ease;
}
.reveal.is-visible {
  visibility: visible;
  opacity: 1;
}
/* Stream caret — a faint blinking block at the end of the actively
   streaming element so it reads as "typing", not just "appearing". */
.is-streaming::after {
  content: "▌";
  color: var(--term-accent);
  margin-left: 1px;
  animation: caretBlink 0.9s steps(2) infinite;
}
@keyframes caretBlink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

/* small separator between turns */
.term-sep {
  height: 0;
  border-top: 1px dashed #1f1f1f;
  margin: 18px 0;
}
