:root {
  --tp-max-green: #00a83a;
  --tp-max-wallpaper: #dceecf;
  --tp-max-ink: #101213;
  --tp-max-muted: #68706c;
}

html.tp-max-locked,
body.tp-max-locked {
  overflow: hidden !important;
}

.tp-max-overlay,
.tp-max-overlay * {
  box-sizing: border-box;
}

.tp-max-overlay[hidden] {
  display: none !important;
}

.tp-max-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  padding: 18px;
  font-family: Montserrat, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--tp-max-ink);
  background: rgba(18, 22, 20, 0.52);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.tp-max-modal {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(440px, 100%);
  height: min(610px, calc(100svh - 36px));
  overflow: hidden;
  background: var(--tp-max-wallpaper);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 26px;
  box-shadow: 0 28px 90px rgba(11, 25, 16, 0.34);
  transform-origin: 50% 55%;
  animation: tp-max-modal-in 360ms cubic-bezier(0.2, 0.85, 0.25, 1) both;
}

.tp-max-modal::before {
  position: absolute;
  inset: 74px 0 0;
  z-index: 0;
  content: "";
  pointer-events: none;
  background: var(--tp-max-wallpaper) url("../media/tp-max-banner/wallpaper.png") center / cover no-repeat;
}

.tp-max-header {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 42px;
  column-gap: 11px;
  align-items: center;
  min-height: 74px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(25, 45, 32, 0.08);
}

.tp-max-avatar {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  margin: 0;
  overflow: hidden;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 7px rgba(131, 0, 7, 0.2);
}

.tp-max-avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tp-max-person {
  position: static !important;
  min-width: 0;
  margin: 0 !important;
  text-align: left !important;
  transform: none !important;
}

.tp-max-person strong,
.tp-max-person span {
  display: block;
  position: static !important;
  float: none !important;
  max-width: 100%;
  margin-right: 0 !important;
  margin-left: 0 !important;
  padding: 0 !important;
  text-align: left !important;
  transform: none !important;
}

.tp-max-person strong {
  overflow: hidden;
  color: var(--tp-max-ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tp-max-person span {
  margin-top: 2px;
  color: var(--tp-max-green);
  font-size: 12px;
  line-height: 1.2;
}

.tp-max-close {
  position: relative;
  top: auto;
  right: auto;
  justify-self: end;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: #67706b;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.tp-max-close:hover {
  color: #111;
  background: #f0f2f1;
}

.tp-max-close:active {
  transform: scale(0.92);
}

.tp-max-close::before,
.tp-max-close::after {
  position: absolute;
  width: 19px;
  height: 2px;
  content: "";
  background: currentColor;
  border-radius: 3px;
}

.tp-max-close::before {
  transform: rotate(45deg);
}

.tp-max-close::after {
  transform: rotate(-45deg);
}

.tp-max-messages {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 18px 14px 14px;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.tp-max-message-row,
.tp-max-typing {
  align-self: flex-start;
  max-width: 91%;
  opacity: 0;
  transform: translate3d(-10px, 10px, 0) scale(0.98);
}

.tp-max-message-row.is-visible,
.tp-max-typing.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  transition: opacity 220ms ease, transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tp-max-bubble {
  position: relative;
  padding: 10px 13px 8px;
  color: var(--tp-max-ink);
  background: #fff;
  border-radius: 7px 17px 17px 7px;
  box-shadow: 0 1px 2px rgba(18, 49, 27, 0.08);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.34;
  text-align: left;
}

.tp-max-message-row:first-child .tp-max-bubble {
  border-top-left-radius: 17px;
}

.tp-max-sender {
  display: block;
  margin-bottom: 5px;
  color: var(--tp-max-green);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.tp-max-bubble strong {
  font-weight: 700;
}

.tp-max-bubble .tp-max-link {
  color: var(--tp-max-green);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.tp-max-time {
  display: inline-block;
  margin-left: 8px;
  color: #929993;
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
  vertical-align: -2px;
  white-space: nowrap;
}

.tp-max-message-row--emoji .tp-max-bubble {
  min-width: 72px;
  padding: 5px 11px 7px;
  font-size: 42px;
  line-height: 1.05;
}

.tp-max-typing {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 8px 13px;
  color: var(--tp-max-muted);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 17px;
  box-shadow: 0 1px 2px rgba(18, 49, 27, 0.07);
  font-size: 12px;
  line-height: 1.2;
}

.tp-max-dots {
  display: inline-flex;
  gap: 3px;
}

.tp-max-dots i {
  width: 5px;
  height: 5px;
  background: #7f8982;
  border-radius: 50%;
  animation: tp-max-dot 800ms ease-in-out infinite;
}

.tp-max-dots i:nth-child(2) {
  animation-delay: 120ms;
}

.tp-max-dots i:nth-child(3) {
  animation-delay: 240ms;
}

.tp-max-actions {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 6px;
  padding: 10px;
  background: rgba(241, 245, 242, 0.98);
  border-top: 1px solid rgba(25, 45, 32, 0.08);
  opacity: 0;
  transform: translateY(18px);
  pointer-events: none;
}

.tp-max-actions.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  transition: opacity 230ms ease, transform 340ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tp-max-action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 14px;
  color: #087c30;
  background: #fff;
  border: 1px solid rgba(27, 71, 42, 0.09);
  border-radius: 11px;
  box-shadow: 0 1px 1px rgba(27, 71, 42, 0.05);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.tp-max-action:hover {
  color: #fff;
  background: var(--tp-max-green);
}

.tp-max-action:active {
  transform: scale(0.985);
}

.tp-max-close:focus-visible,
.tp-max-action:focus-visible,
.tp-max-link:focus-visible {
  outline: 3px solid rgba(0, 168, 58, 0.38);
  outline-offset: 2px;
}

@keyframes tp-max-modal-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
}

@keyframes tp-max-dot {
  0%,
  70%,
  100% {
    opacity: 0.38;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 560px) {
  .tp-max-overlay {
    align-items: end;
    padding: 0;
  }

  .tp-max-modal {
    width: 100%;
    height: min(650px, 95svh);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 26px 26px 0 0;
  }

  .tp-max-messages {
    padding-right: 10px;
    padding-left: 10px;
  }

  .tp-max-bubble {
    font-size: 15px;
  }

  .tp-max-message-row--emoji .tp-max-bubble {
    font-size: 38px;
  }
}

@media (max-height: 640px) and (min-width: 561px) {
  .tp-max-modal {
    height: calc(100svh - 20px);
  }

  .tp-max-header {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    min-height: 64px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .tp-max-avatar {
    width: 42px;
    height: 42px;
  }

  .tp-max-messages {
    padding-top: 12px;
    padding-bottom: 10px;
  }

  .tp-max-bubble {
    padding-top: 8px;
    padding-bottom: 7px;
    font-size: 14px;
  }

  .tp-max-message-row--emoji .tp-max-bubble {
    font-size: 33px;
  }

  .tp-max-action {
    min-height: 38px;
    padding: 7px 12px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tp-max-overlay *,
  .tp-max-overlay *::before,
  .tp-max-overlay *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
