:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
  background: #ededed;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: #111111;
  background: #ededed;
}

button,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  cursor: pointer;
}

.chat {
  display: grid;
  width: min(100%, 460px);
  height: 100dvh;
  grid-template-rows: auto 1fr auto;
  margin: 0 auto;
  overflow: hidden;
  background: #ededed;
  box-shadow: 0 0 28px rgba(0, 0, 0, 0.12);
}

.topbar {
  position: relative;
  z-index: 2;
  display: grid;
  height: calc(50px + env(safe-area-inset-top));
  grid-template-columns: 58px 1fr 96px;
  align-items: end;
  padding: env(safe-area-inset-top) 8px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(237, 237, 237, 0.96);
}

.topbar h1 {
  align-self: center;
  margin: 0;
  overflow: hidden;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1.5px solid #181818;
  border-radius: 50%;
  background: transparent;
  font-size: 24px;
  line-height: 1;
}

.back-button {
  align-self: center;
  border: 0;
  font-size: 37px;
  font-weight: 300;
}

.capsule {
  display: flex;
  width: 88px;
  height: 32px;
  align-self: center;
  align-items: center;
  justify-content: space-evenly;
  padding: 0 8px;
  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
}

.capsule span {
  margin-top: -7px;
  font-size: 20px;
  letter-spacing: 2px;
}

.capsule i {
  width: 1px;
  height: 18px;
  background: rgba(0, 0, 0, 0.12);
}

.capsule b {
  font-size: 18px;
  font-weight: 400;
}

.messages {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 14px 14px;
  scrollbar-width: none;
}

.messages::-webkit-scrollbar {
  display: none;
}

.connection,
.time {
  padding: 13px 0 9px;
  color: #a2a2a2;
  font-size: 12px;
  text-align: center;
}

.connection.connected {
  display: none;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 17px;
}

.message.mine {
  flex-direction: row-reverse;
}

.avatar {
  display: flex;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: #ffffff;
  background: #1aad19;
  font-size: 15px;
  font-weight: 600;
}

.mine .avatar {
  background: #576b95;
}

.content {
  position: relative;
  display: flex;
  max-width: min(68%, 300px);
  align-items: center;
}

.mine .content {
  flex-direction: row-reverse;
}

.bubble {
  position: relative;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 4px;
  background: #ffffff;
  font-size: 16px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.bubble::before {
  position: absolute;
  top: 13px;
  left: -7px;
  border-top: 6px solid transparent;
  border-right: 8px solid #ffffff;
  border-bottom: 6px solid transparent;
  content: "";
}

.mine .bubble {
  background: #95ec69;
}

.mine .bubble::before {
  right: -7px;
  left: auto;
  border-right: 0;
  border-left: 8px solid #95ec69;
}

.message-image {
  display: block;
  width: min(180px, 48vw);
  max-height: 260px;
  border-radius: 4px;
  object-fit: cover;
  background: #d8d8d8;
}

.message-image.sending {
  opacity: 0.55;
}

.sticker {
  display: flex;
  width: 72px;
  height: 72px;
  align-items: center;
  justify-content: center;
  font-size: 58px;
  line-height: 1;
}

.delivery {
  margin: 0 7px;
  color: #999999;
  font-size: 11px;
  white-space: nowrap;
}

.failed {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  background: #fa5151;
  font-weight: 700;
}

.composer {
  z-index: 3;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: #f7f7f7;
}

.composer-row {
  display: flex;
  min-height: 56px;
  align-items: flex-end;
  gap: 7px;
  padding: 8px 10px;
}

.composer-row textarea {
  min-width: 0;
  min-height: 38px;
  max-height: 108px;
  flex: 1;
  resize: none;
  padding: 8px 9px;
  overflow-y: auto;
  border: 0;
  border-radius: 4px;
  outline: 0;
  background: #ffffff;
  font-size: 16px;
  line-height: 22px;
}

.voice {
  font-size: 20px;
}

.face {
  font-size: 23px;
}

.plus {
  font-size: 23px;
  font-weight: 300;
}

.send {
  width: 54px;
  height: 34px;
  padding: 0;
  border-radius: 3px;
  color: #ffffff;
  background: #07c160;
  font-size: 14px;
}

.panel {
  height: 250px;
  overflow-y: auto;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.emoji-panel {
  display: grid;
  grid-template-columns: repeat(8, minmax(34px, 1fr));
  gap: 7px 2px;
  padding: 15px 10px 20px;
}

.emoji-panel[hidden],
.more-panel[hidden] {
  display: none;
}

.emoji-item {
  display: flex;
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 27px;
}

.emoji-item:hover {
  background: #e5e5e5;
}

.more-panel {
  padding: 19px;
}

.tool {
  display: flex;
  width: 64px;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 0;
  color: #8a8a8a;
  background: transparent;
  font-size: 12px;
}

.tool-icon {
  display: flex;
  width: 58px;
  height: 58px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #5f5f5f;
  background: #ffffff;
  font-size: 28px;
}

@media (min-width: 700px) {
  body {
    padding: 20px;
    background: #d8d8d8;
  }

  .chat {
    height: calc(100dvh - 40px);
    border: 1px solid rgba(0, 0, 0, 0.12);
  }
}

