* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: #f5f6f8;
  color: #0b0d10;
  -webkit-font-smoothing: antialiased;
}

.top {
  background: #ffffff;
  border-bottom: 1px solid #e6e8ec;
  position: sticky; top: 0; z-index: 10;
}
.top-wrap {
  max-width: 760px; margin: 0 auto; padding: 14px 20px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.brand strong { display: block; font-size: 16px; }
.brand .sub { font-size: 12px; color: #6b7280; }
.reset {
  background: transparent; border: 1px solid #c8ccd2; color: #0b0d10;
  border-radius: 10px; padding: 8px 14px; font-weight: 500; cursor: pointer; font-size: 13px;
}
.reset:hover { border-color: #0b0d10; }

.chat {
  max-width: 760px; margin: 0 auto; padding: 24px 20px 120px;
  display: flex; flex-direction: column; min-height: calc(100vh - 56px);
}

.log { flex: 1; display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }

.msg {
  max-width: 80%;
  padding: 10px 14px; border-radius: 14px; line-height: 1.5;
  font-size: 15px; white-space: pre-wrap; word-wrap: break-word;
  animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.msg.bot { background: #ffffff; align-self: flex-start; border: 1px solid #e6e8ec; }
.msg.me  { background: #0b0d10; color: #fff; align-self: flex-end; }
.msg.sys {
  align-self: center; max-width: 90%;
  font-size: 12px; color: #6b7280; background: transparent; border: 0; padding: 8px 0;
}
.msg-meta { font-size: 11px; color: #9ca3af; margin-top: 2px; }
.msg.me + .msg-meta { text-align: right; }

.typing {
  align-self: flex-start; display: inline-flex; gap: 4px; padding: 8px 12px;
  background: #fff; border: 1px solid #e6e8ec; border-radius: 14px; margin-bottom: 4px; width: fit-content;
}
.typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #9ca3af;
  animation: dot 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.composer {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(245,246,248,.96); backdrop-filter: blur(8px);
  border-top: 1px solid #e6e8ec;
  padding: 12px 20px;
}
.composer { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; padding: 12px 14px; border-radius: 12px; border: 1px solid #c8ccd2;
  font-family: inherit; font-size: 15px; line-height: 1.4; max-height: 160px; background: #fff; color: #0b0d10;
}
.composer textarea:focus { outline: 2px solid #1f6feb; outline-offset: -1px; }
.composer button {
  height: 46px; padding: 0 18px; border-radius: 12px; border: 0;
  background: #0b0d10; color: #fff; font-weight: 600; cursor: pointer; font-size: 15px;
}
.composer button:hover { background: #1f6feb; }
.composer button:disabled { background: #9ca3af; cursor: default; }

.hint { color: #6b7280; font-size: 12px; margin: 18px 0 0; line-height: 1.5; }
.hint b { color: #0b0d10; }

@media (max-width: 600px) {
  .top-wrap { padding: 12px 16px; }
  .chat { padding: 16px 16px 120px; }
  .msg { max-width: 92%; font-size: 14px; }
}
