:root {
  --desk: #141413;
  --bg: #0a0a0a;
  --bar: #101010;
  --user: #1f1f1e;
  --text: #f2f2ec;
  --text-soft: #d8d8d2;
  --muted: #9a9a95;
  --faint: #5a5a56;
  --rule: #343432;
  --signal: #b11226;
  --signal-text: #ef4960;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--desk);
  color: var(--text);
  font: 14px/1.55 var(--mono);
}

a { color: var(--text); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
b { font-weight: 500; }
.dim { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); margin: 0; }

/* Window */
.desk { height: 100%; min-height: 480px; padding: 32px 24px; }
.win {
  width: 100%; max-width: 1120px; height: 100%; margin: 0 auto;
  display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden;
}
.titlebar {
  flex: none; position: relative; display: flex; align-items: center;
  height: 36px; padding: 0 14px;
  background: var(--bar); border-bottom: 1px solid #292927;
  font-size: 12px; color: var(--muted);
}
.lights { display: flex; gap: 8px; }
.lights span { width: 11px; height: 11px; border-radius: 50%; background: var(--rule); }
.title { position: absolute; left: 0; right: 0; text-align: center; pointer-events: none; }
.clock { margin-left: auto; position: relative; }

.scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px 24px 8px; }

.intro { display: flex; align-items: center; gap: 24px; margin: 8px 0 36px; }
.intro svg { flex: none; }
.intro-text { display: flex; flex-direction: column; font-size: 16px; line-height: 1.45; }

/* Transcript */
.log { display: flex; flex-direction: column; gap: 18px; }
.ex { display: flex; flex-direction: column; gap: 12px; }
.user { display: flex; gap: 12px; margin: 0 -24px; padding: 3px 24px; background: var(--user); }
.user > span:first-child { color: var(--muted); }
.user .q { white-space: pre-wrap; }
.row { display: flex; gap: 12px; }
.tool .dot { color: var(--signal-text); }
.tool.running .dot { color: var(--muted); animation: blink .6s steps(1) infinite; }
.tool .arg { color: var(--muted); }
.out { display: flex; gap: 10px; padding-left: 2ch; color: var(--muted); }
.out > span:first-child { display: inline-block; width: 1ch; }
.out > span:last-child { white-space: pre-wrap; }
.more { padding-left: calc(3ch + 10px); color: var(--faint); }
.answer { flex: 1; min-width: 0; }
.blk-h { font-weight: 500; margin: 2px 0 4px; }
.blk-p { color: var(--text-soft); margin: 0 0 4px; }
.blk-li { color: var(--text-soft); margin: 0 0 2px; padding-left: 2ch; text-indent: -2ch; }
.blk-li::before { content: "- "; color: var(--muted); }
.answer b { color: var(--text); }
.answer code { font: inherit; color: var(--signal-text); }
.answer a { text-decoration-color: var(--faint); text-underline-offset: 3px; }
.answer a:hover { text-decoration-color: var(--signal-text); }
.done { color: var(--muted); }

/* Prompt area */
.bottom { flex: none; padding: 8px 24px 14px; }
.spinner { height: 22px; display: flex; gap: 10px; color: var(--signal-text); }
.spinner .glyph { display: inline-block; width: 1ch; }
.spinner .meta { color: var(--faint); }
.input {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--faint); border-radius: 8px;
}
.draft { flex: 1; min-width: 0; margin-left: -10px; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.draft.ghost { opacity: .4; }
.cursor {
  display: inline-block; width: 8px; height: 17px;
  background: var(--text); animation: blink 1s steps(1) infinite;
}
.tab {
  flex: none; padding: 0 6px; border: 1px solid var(--faint); border-radius: 4px;
  font: inherit; font-size: 12px; color: var(--muted);
  transition: background-color .12s, color .12s;
}
.tab.pressed { background: var(--text); color: var(--bg); border-color: var(--text); }
.status { display: flex; justify-content: space-between; gap: 8px; padding: 4px 12px 0; font-size: 12px; color: var(--faint); }
.skip { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.skip:hover { color: var(--text); }
.skip[hidden] { display: none; }

@media (max-width: 640px) {
  .desk { padding: 0; }
  .win { border: 0; border-radius: 0; }
  .titlebar { display: none; }
  .scroll, .bottom { padding-left: 16px; padding-right: 16px; }
  .user { margin: 0 -16px; padding: 3px 16px; }
  .intro { gap: 16px; }
}

/* Terminal pointer (fine pointers only, enabled by main.js) */
.caret { display: none; }
.has-caret, .has-caret * { cursor: none !important; }
.has-caret .caret {
  display: block; position: fixed; left: 0; top: 0; z-index: 100;
  width: 9px; height: 20px;
  background: var(--text); mix-blend-mode: difference;
  pointer-events: none; opacity: 0; will-change: transform;
}
.caret.on { opacity: 1; }
.caret.idle { animation: blink 1s steps(1) infinite; }
.caret.link {
  width: auto; height: 22px; padding: 0 8px;
  background: var(--signal-text); color: var(--bg); mix-blend-mode: normal;
  font: 500 13px/22px var(--mono); white-space: nowrap;
  animation: none;
}
.caret.link::after { content: attr(data-label); }

@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .cursor, .caret.idle, .tool.running .dot { animation: none; }
}
