:root {
  --orange: #f47b36;
  --ink: #1f252c;
  --muted: #6e7883;
  --line: #f2dfd1;
  --bg: #f3f4f6;
  --page: #fffdfb;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

.app {
  width: min(100vw, 860px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 18px 112px;
  background: var(--page);
  position: relative;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(223, 124, 65, 0.16);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.brand-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 10px 26px rgba(182, 92, 30, 0.14);
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.chat {
  min-height: calc(100dvh - 88px);
  padding: 20px 20px 110px;
}

.assistant-message {
  width: 100%;
  margin: 24px 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.74;
  white-space: pre-wrap;
}

.assistant-message.intro {
  color: #50565e;
  font-size: 17px;
}

.user-message {
  width: fit-content;
  max-width: min(92%, 720px);
  margin: 18px 0 24px auto;
  padding: 11px 14px;
  border-radius: 12px 6px 12px 12px;
  background: var(--orange);
  color: #fff;
  font-size: 15.5px;
  line-height: 1.55;
  box-shadow: 0 10px 24px rgba(244, 123, 54, 0.2);
}

.thinking {
  color: #8a6f61;
}

.thinking::after {
  content: "";
  display: inline-block;
  min-width: 1.6em;
  animation: dots 1.15s steps(4, end) infinite;
}

@keyframes dots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75%,
  100% {
    content: "...";
  }
}

.references {
  margin-top: 20px;
  color: #5d6670;
  font-size: 14px;
}

.references-title {
  margin-bottom: 8px;
  color: #8a4b24;
  font-weight: 700;
}

.references a {
  color: #4f5965;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.references li {
  margin: 6px 0;
}

.composer {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 5;
  width: min(824px, calc(100vw - 36px));
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 9px 9px 9px 14px;
  margin-bottom: 14px;
  border: 1px solid #f0d7c5;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 34px rgba(133, 82, 47, 0.14);
}

.composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 132px;
  padding: 8px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
}

.composer button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 0;
  border-radius: 12px;
  background: var(--orange);
  color: #fff;
  font-size: 22px;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
}

.composer button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 520px) {
  .app {
    width: 100vw;
    padding: 0 10px 108px;
  }

  .topbar {
    padding-left: 10px;
    padding-right: 10px;
  }

  .chat {
    padding-left: 18px;
    padding-right: 18px;
  }

  .composer {
    width: calc(100vw - 20px);
    margin-bottom: max(12px, env(safe-area-inset-bottom));
  }
}
