:root {
  color-scheme: dark;
  --bg: #1a1410;
  --card: #241c17;
  --line: #3a2e26;
  --text: #f6f1ea;
  --muted: #cbbbaa;
  --ai: #5460c9;
  --user: #3c2d24;
  --danger: #e7b2a4;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 10% -10%, #3a241c 0%, transparent 55%),
    var(--bg);
  color: var(--text);
}

button, textarea { font: inherit; color: inherit; }

#app { min-height: 100vh; }

.gate, .shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.mark {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}

h1 {
  font-weight: 500;
  font-size: clamp(40px, 6vw, 68px);
  line-height: 0.95;
  margin: 12px 0 16px;
}

.lede { max-width: 46rem; color: var(--muted); font-size: 18px; line-height: 1.5; }

.confirm {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 28px 0 18px;
  color: var(--text);
}

.confirm input { width: 18px; height: 18px; margin-top: 3px; }

.primary, .ghost {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
}

.primary { background: var(--text); color: var(--bg); }
.primary:disabled { opacity: 0.4; cursor: not-allowed; }
.ghost { background: transparent; border: 1px solid var(--line); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.card {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  cursor: pointer;
}

.card:hover { border-color: #5460c9; }

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: #1a1410;
  position: relative;
  overflow: hidden;
  flex: none;
}

.avatar.tall {
  width: 100%;
  height: 280px;
  border-radius: 16px;
  font-size: 42px;
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  background: #5460c9;
  color: white;
  border-radius: 999px;
  padding: 4px 8px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card h2, .who h2 { margin: 10px 0 0; font-size: 26px; font-weight: 500; }
.meta { color: var(--muted); margin-top: 4px; }
.sketch { color: var(--text); line-height: 1.4; min-height: 4.2em; }

.chat {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  width: min(820px, 100%);
  margin: 0 auto;
}

.top, .composer {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: rgba(26, 20, 16, 0.92);
  border-bottom: 1px solid var(--line);
}

.composer { border-bottom: 0; border-top: 1px solid var(--line); align-items: flex-end; }

.who { display: flex; gap: 12px; align-items: center; }
.who h2 { font-size: 22px; }
.who .meta { margin: 0; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; color: #c9d0ff; }

.thread {
  overflow: auto;
  padding: 18px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: min(68ch, 88%);
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.bubble.assistant { background: #2c241e; border: 1px solid #5460c9; }
.bubble.user { align-self: flex-end; background: var(--user); }
.bubble.system, .bubble.disclosure {
  align-self: center;
  max-width: 62ch;
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--line);
  text-align: center;
  font-size: 15px;
}
.bubble.refusal { border-color: var(--danger); color: var(--danger); }

.ai-cap {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c9d0ff;
  margin: 0 0 6px;
}

textarea {
  flex: 1;
  resize: none;
  min-height: 48px;
  max-height: 140px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #140f0c;
  padding: 12px 14px;
}

.hint { color: var(--muted); font-size: 13px; padding: 0 16px 10px; font-family: ui-sans-serif, system-ui, sans-serif; }
