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

:root {
  /* Editorial / refined palette */
  --ink: #0e0d0b;
  --bg: #0e0d0b;
  --bone: #1a1714;
  --surface: #1a1714;
  --bone-2: #221d18;
  --surface-hover: #221d18;
  --rule: #2e2620;
  --border: #2e2620;
  --paper: #f3ede2;
  --text: #e8dfce;
  --text-strong: #f6efde;
  --muted: #8a7d6e;
  --text-muted: #8a7d6e;
  --accent: #c89456;
  --accent-soft: #d6a872;
  --primary: #c89456;
  --primary-hover: #d6a872;
  --sage: #6b8f6e;
  --assistant-bg: #1f1a14;
  --user-bg: #221d18;
  --danger: #d27361;

  --font-display: "Fraunces", "Iowan Old Style", "Cambria", Georgia, serif;
  --font-body: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

body {
  font-family: var(--font-body);
  background: var(--ink);
  color: var(--text);
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app {
  height: 100%;
}

.screen {
  display: none;
  height: 100%;
  flex-direction: column;
}
.screen.active {
  display: flex;
}

.hidden {
  display: none !important;
}

/* --- Buttons --- */

.btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.15s;
}
.btn:hover {
  background: var(--surface-hover);
}
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn.primary:hover {
  background: var(--primary-hover);
}
.btn.small {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.3rem;
  line-height: 0;
  border-radius: 2px;
  transition: color 0.15s, background 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  color: var(--accent);
  background: var(--bone-2);
}
.btn-icon.btn-kill:hover {
  color: var(--danger);
  background: rgba(210, 115, 97, 0.12);
}
.btn-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
}

/* --- Scrollbar --- */

::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
