:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: #ece8e2;
  color: #242321;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.9), transparent 32rem),
    #ece8e2;
}

button,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 480px);
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
  background: #f7f5f2;
  box-shadow: 0 20px 80px rgba(56, 50, 44, 0.12);
}

.topbar {
  min-height: 76px;
  display: grid;
  grid-template-columns: 46px 1fr 42px;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid rgba(55, 51, 47, 0.08);
  background: rgba(247, 245, 242, 0.9);
  backdrop-filter: blur(18px);
}

.avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: #33312f;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.identity h1,
.identity p {
  margin: 0;
}

.identity h1 {
  font-size: 17px;
  line-height: 1.35;
}

.identity p {
  margin-top: 3px;
  font-size: 12px;
  color: #8b8781;
}

.online-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: #7ca887;
}

.icon-button,
.voice-button,
.send-button {
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: transparent;
  color: #6c6863;
  font-size: 24px;
}

.icon-button:hover {
  background: #efebe6;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  padding: 24px 16px 36px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.message-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0 0 20px;
}

.message-row.user {
  align-items: flex-end;
}

.bubble {
  max-width: min(84%, 360px);
  padding: 11px 14px;
  border-radius: 8px 18px 18px 18px;
  background: #e7e4e0;
  color: #292725;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.user .bubble {
  border-radius: 18px 8px 18px 18px;
  background: #cfdced;
  color: #20252d;
}

.message-row time {
  margin-top: 5px;
  padding: 0 3px;
  color: #aaa59f;
  font-size: 10px;
}

.message-row.pending .bubble::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 9px 0 currentColor, 18px 0 currentColor;
  animation: blink 1.1s infinite ease-in-out;
}

@keyframes blink {
  0%,
  100% { opacity: 0.25; }
  50% { opacity: 0.85; }
}

.notice {
  margin: 0 16px 8px;
  padding: 8px 12px;
  border: 1px solid #ded8d1;
  border-radius: 10px;
  background: #fffdfa;
  color: #77716a;
  font-size: 12px;
  text-align: center;
}

.composer {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: end;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(55, 51, 47, 0.08);
  background: #f7f5f2;
}

.voice-button,
.send-button {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.voice-button {
  background: #ece8e3;
  color: #5f5a55;
  font-size: 24px;
}

.send-button {
  background: #33312f;
  color: white;
  font-size: 22px;
  transition: transform 120ms ease, opacity 120ms ease;
}

.send-button:active,
.voice-button:active {
  transform: scale(0.94);
}

.send-button:disabled {
  cursor: default;
  opacity: 0.35;
}

.input-wrap {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid #ded9d3;
  border-radius: 15px;
  background: white;
}

textarea {
  width: 100%;
  max-height: 116px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: #282624;
  font-size: 15px;
  line-height: 1.45;
}

textarea::placeholder {
  color: #b1aca6;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 700px) {
  body {
    padding: 28px;
  }

  .app-shell {
    height: min(880px, calc(100dvh - 56px));
    border: 1px solid rgba(75, 69, 62, 0.08);
    border-radius: 28px;
  }
}

