:root {
  --bg: #0D1117;
  --surface: #131922;
  --surface-high: #1C2432;
  --border: #212834;
  --border-strong: #2D3645;
  --text: #E3E6EC;
  --text-muted: #7E8691;
  --text-faint: #525966;
  --accent: #D9B382;
  --accent-dim: #8C7558;
  --danger: #B88;
  --radius: 10px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 72px;
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

.shell {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: var(--space-7) var(--space-5) var(--space-5);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: var(--space-5);
  min-height: 100dvh;
}

/* Masthead - just a quiet signature, not a logo */
.masthead {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.masthead .name {
  font-weight: 500;
  letter-spacing: -0.01em;
}

.masthead .role {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.02em;
}

/* Transcript */
.transcript {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-4) 0;
}

.msg {
  display: grid;
  grid-template-columns: 2px 1fr;
  gap: var(--space-4);
  align-items: start;
}

.msg__mark {
  width: 2px;
  align-self: stretch;
  border-radius: 2px;
}

.msg--twin .msg__mark { background: var(--accent); }
.msg--user .msg__mark { background: var(--border-strong); }

.msg__body {
  min-width: 0;
}

.msg__who {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}

.msg--twin .msg__who { color: var(--accent-dim); }

.msg__text {
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg--user .msg__text {
  color: var(--text-muted);
}

.msg__text p { margin: 0 0 var(--space-3); }
.msg__text p:last-child { margin-bottom: 0; }

.msg__text a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.msg__text ul, .msg__text ol { margin: var(--space-2) 0; padding-left: 1.2em; }
.msg__text li { margin-bottom: var(--space-1); }
.msg__text code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--accent);
}

/* Thinking indicator - understated, not three bouncing dots */
.msg--thinking .msg__text {
  color: var(--text-faint);
  font-style: italic;
}
.msg--thinking .msg__text::after {
  content: "";
  display: inline-block;
  width: 0;
  animation: thinking-dots 1.6s steps(4, end) infinite;
}
@keyframes thinking-dots {
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".."; }
  75%  { content: "..."; }
  100% { content: ""; }
}

@media (prefers-reduced-motion: reduce) {
  .msg--thinking .msg__text::after { animation: none; content: "..."; }
}

/* Composer */
.composer {
  position: sticky;
  bottom: var(--space-5);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-3);
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  transition: border-color 120ms ease;
}

.composer:focus-within {
  border-color: var(--border-strong);
}

.input {
  width: 100%;
  resize: none;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.55;
  padding: 6px 0;
  outline: none;
  max-height: 160px;
}

.input::placeholder {
  color: var(--text-faint);
}

.send {
  background: var(--surface-high);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-family: inherit;
  font-weight: 500;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.send:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.send:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.send:disabled {
  color: var(--text-faint);
  cursor: not-allowed;
  background: transparent;
}

/* Footer */
.footer {
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 12px;
  text-align: left;
}

.footer code {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Mobile tightening */
@media (max-width: 540px) {
  .shell {
    padding: var(--space-5) var(--space-4) var(--space-4);
    gap: var(--space-4);
  }
  .masthead {
    flex-wrap: wrap;
  }
  .transcript {
    gap: var(--space-5);
  }
  .composer {
    bottom: var(--space-3);
  }
}

/* Smooth scrollbar on dark */
.transcript::-webkit-scrollbar { width: 6px; }
.transcript::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
