html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  background: #d9dbd5;
  color: #111b21;
  overflow: hidden;
  position: relative;
}

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px;
  background: #008069;
  color: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar__avatar {
  width: 36px;
  height: 36px;
  max-width: 36px;
  max-height: 36px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  object-fit: cover;
  display: block;
}

.topbar__title {
  font-weight: 800;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__link {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
}

.chat {
  flex: 1;
  overflow: hidden;
  background-color: #efeae2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260' viewBox='0 0 260 260'%3E%3Cg fill='none' stroke='%23d7d2c9' stroke-width='2' opacity='0.35'%3E%3Cpath d='M28 54c22-12 42 12 64 0s42-12 64 0 42 12 64 0'/%3E%3Cpath d='M52 196c10-10 20-10 30 0s20 10 30 0'/%3E%3Ccircle cx='54' cy='120' r='10'/%3E%3Ccircle cx='206' cy='84' r='8'/%3E%3Cpath d='M168 170c-14 10-30 10-44 0'/%3E%3Cpath d='M96 92c12 8 24 8 36 0'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 260px 260px;
}

.chat__messages {
  height: 100%;
  overflow-y: auto;
  padding: 14px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row {
  display: flex;
}

.row--user {
  justify-content: flex-end;
}

.row--bot {
  justify-content: flex-start;
}

.row--notice {
  justify-content: center;
}

.bubble {
  max-width: min(520px, 90%);
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.35;
  font-size: 0.95rem;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
  border: 0;
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
}

.bubble--user {
  background: #d9fdd3;
  color: #111b21;
  border-top-right-radius: 0;
}

.bubble--bot {
  background: #ffffff;
  color: #111b21;
  border-top-left-radius: 0;
}

.bubble--notice {
  background: #fff3c4;
  color: #54656f;
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
  font-size: 0.82rem;
  line-height: 1.3;
  text-align: center;
  max-width: min(680px, 92%);
}

.bubble--user::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 0;
  width: 0;
  height: 0;
  border-top: 10px solid #d9fdd3;
  border-right: 10px solid transparent;
}

.bubble--bot::after {
  content: "";
  position: absolute;
  left: -8px;
  top: 0;
  width: 0;
  height: 0;
  border-top: 10px solid #ffffff;
  border-left: 10px solid transparent;
}

.meta {
  margin-top: 6px;
  font-size: 0.72rem;
  color: rgba(17, 27, 33, 0.55);
  text-align: right;
}

.composer {
  position: sticky;
  bottom: 0;
  background: #f0f2f5;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: 10px;
}

.composer__form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.composer__input {
  flex: 1;
  resize: none;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #ffffff;
  color: #111b21;
  padding: 10px 12px;
  outline: none;
  font-size: 0.95rem;
  line-height: 1.35;
  max-height: 130px;
}

.composer__send {
  border: 0;
  background: #008069;
  color: #ffffff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.composer__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.composer__send::before {
  content: "";
  width: 24px;
  height: 24px;
  display: block;
  background-repeat: no-repeat;
  background-size: contain;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24' fill='white'><path d='M1.101 21.757 23.8 12.028 1.101 2.3l.011 7.912 13.623 1.816-13.623 1.817-.011 7.912z'/></svg>");
}

.bubble a {
  color: #027eb5;
  text-decoration: underline;
  cursor: pointer;
}

.bubble code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9em;
  cursor: pointer;
  user-select: all;
}

@media (min-width: 920px) {
  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    background: linear-gradient(#00bfa5 0, #00bfa5 127px, #d9dbd5 127px, #d9dbd5 100%);
  }

  .app {
    max-width: 980px;
    margin: 0 auto;
    height: calc(100% - 30px);
    margin-top: 15px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  }
}
