:root {
  --ink: #14213d;
  --ink-soft: #3d4a66;
  --paper: #f7f3eb;
  --panel: #fffdf8;
  --accent: #c45c26;
  --accent-2: #1f6f8b;
  --line: rgba(20, 33, 61, 0.12);
  --bot: #e8eef2;
  --user: #1f6f8b;
  --shadow: 0 18px 50px rgba(20, 33, 61, 0.12);
  --radius: 18px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  min-height: 100%;
}

.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(31, 111, 139, 0.18), transparent 60%),
    radial-gradient(700px 400px at 90% 0%, rgba(196, 92, 38, 0.16), transparent 55%),
    linear-gradient(180deg, #efe8dc 0%, var(--paper) 45%, #ebe4d8 100%);
  z-index: -1;
}

.shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 16px 40px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}
.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.brand h1 {
  font-family: var(--display);
  font-size: 1.55rem;
  margin: 0 0 2px;
  line-height: 1.15;
}
.brand p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.chat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: min(70vh, 640px);
  overflow: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bubble {
  max-width: 85%;
  padding: 12px 14px;
  border-radius: 16px;
  line-height: 1.45;
  font-size: 0.98rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble.bot {
  align-self: flex-start;
  background: var(--bot);
  color: var(--ink);
  border-bottom-left-radius: 6px;
}
.bubble.user {
  align-self: flex-end;
  background: var(--user);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.bubble.system {
  align-self: center;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.82rem;
  padding: 4px 8px;
}
.bubble strong { font-weight: 600; }

.typing {
  align-self: flex-start;
  color: var(--ink-soft);
  font-size: 0.85rem;
  padding: 0 4px;
}

.composer {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.composer input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 16px;
  font: inherit;
  outline: none;
  background: #faf7f2;
}
.composer input:focus {
  border-color: rgba(31, 111, 139, 0.45);
}
.composer button {
  border: 0;
  border-radius: 999px;
  padding: 0 20px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.composer button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hint {
  margin: 0;
  padding: 0 16px 12px;
  font-size: 0.75rem;
  color: var(--ink-soft);
  text-align: center;
}

@media (max-width: 520px) {
  .shell { padding: 18px 10px 24px; }
  .brand h1 { font-size: 1.3rem; }
  .chat { min-height: 75vh; }
}
