:root {
  color-scheme: light;
  font-family: "Inter", system-ui, sans-serif;
  color: #20201e;
  background: #f7f7f5;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body { background: #f7f7f5; }

button, textarea { font: inherit; }

button { color: inherit; }

.app-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  height: 68px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e5e4df;
  background: rgba(247, 247, 245, 0.92);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 11px; }

.brand-mark, .welcome-mark {
  display: grid;
  place-items: center;
  color: #fff;
  background: #c15f3c;
  font-family: Georgia, serif;
  font-weight: 700;
}

.brand-mark { width: 34px; height: 34px; border-radius: 8px; font-size: 19px; }
.brand h1 { margin: 0; font-size: 15px; line-height: 18px; font-weight: 600; letter-spacing: 0; }

.status { display: flex; align-items: center; gap: 5px; color: #77756f; font-size: 11px; line-height: 15px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #4e9b68; }

.icon-button, .send-button {
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: transparent;
}

.icon-button:hover { background: #ecebe7; }
.icon-button svg, .send-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.chat {
  width: min(100%, 820px);
  margin: 0 auto;
  padding: 44px 24px 180px;
}

.welcome { min-height: calc(100dvh - 300px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.welcome-mark { width: 54px; height: 54px; border-radius: 8px; font-size: 29px; margin-bottom: 20px; box-shadow: 0 5px 18px rgba(83, 47, 33, 0.14); }
.welcome h2 { margin: 0 0 9px; font-family: Georgia, serif; font-size: 30px; font-weight: 500; letter-spacing: 0; }
.welcome p { margin: 0; color: #77756f; font-size: 14px; }

.message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 14px; margin: 0 0 34px; animation: appear 180ms ease-out; }
.message-avatar { width: 34px; height: 34px; border-radius: 7px; display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.message.user .message-avatar { color: #55534e; background: #e7e6e1; }
.message.assistant .message-avatar { color: #fff; background: #c15f3c; font-family: Georgia, serif; font-size: 18px; }
.message-role { margin: 0 0 7px; font-size: 13px; font-weight: 600; }
.message-content { font-size: 15px; line-height: 1.72; overflow-wrap: anywhere; }
.message-content p { margin: 0 0 12px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content pre { margin: 12px 0; padding: 15px; overflow-x: auto; border: 1px solid #deddd7; border-radius: 7px; background: #eeede9; font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.message-content code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.9em; background: #e9e8e3; padding: 2px 5px; border-radius: 4px; }
.message-content pre code { background: transparent; padding: 0; }

.typing { display: flex; gap: 5px; padding-top: 8px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: #97948d; animation: pulse 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 150ms; }
.typing span:nth-child(3) { animation-delay: 300ms; }

.composer-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 26px 20px max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(247,247,245,0), #f7f7f5 28%);
}

.composer { width: min(100%, 780px); margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; padding: 10px 10px 10px 17px; border: 1px solid #d8d6cf; border-radius: 8px; background: #fff; box-shadow: 0 8px 30px rgba(37, 35, 30, 0.08); }
.composer:focus-within { border-color: #aaa79f; box-shadow: 0 8px 30px rgba(37,35,30,.08), 0 0 0 3px rgba(193,95,60,.09); }
.composer textarea { width: 100%; min-height: 36px; max-height: 180px; padding: 8px 0; resize: none; border: 0; outline: 0; color: #252421; background: transparent; line-height: 20px; }
.composer textarea::placeholder { color: #9a9891; }
.send-button { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 7px; color: white; background: #c15f3c; }
.send-button:hover { background: #a94e30; }
.send-button:disabled { cursor: default; background: #d9d7d1; }
.disclaimer { margin: 8px 0 0; text-align: center; color: #929089; font-size: 10px; }

@keyframes pulse { 0%, 70%, 100% { opacity: .35; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }
@keyframes appear { from { opacity: 0; transform: translateY(4px); } }

@media (max-width: 600px) {
  .topbar { height: 60px; padding: 0 14px; }
  .chat { padding: 30px 16px 155px; }
  .welcome { min-height: calc(100dvh - 260px); }
  .welcome h2 { font-size: 26px; }
  .composer-wrap { padding-left: 10px; padding-right: 10px; }
  .message { grid-template-columns: 30px minmax(0, 1fr); gap: 11px; margin-bottom: 28px; }
  .message-avatar { width: 30px; height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
