.skm-chatbot,
.skm-chatbot * {
  box-sizing: border-box;
}

/* Vertically align Newspaper's back-to-top control with the chat launcher. */
body .td-scroll-up {
  bottom: 26px;
}

.skm-chatbot {
  --skm-teal: #16b8ad;
  --skm-teal-dark: #087d78;
  --skm-lime: #e9ef10;
  --skm-ink: #142523;
  --skm-muted: #61706e;
  color: var(--skm-ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  text-align: left;
}

.skm-chatbot .screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.skm-chatbot--floating {
  bottom: max(20px, env(safe-area-inset-bottom));
  position: fixed;
  /* Leave room for Newspaper's back-to-top button in the bottom-right corner. */
  right: max(53px, calc(env(safe-area-inset-right) + 53px));
  z-index: 99998;
}

.skm-chatbot__launcher {
  align-items: center;
  background: var(--skm-teal-dark);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 8px 30px rgba(4, 66, 62, .25);
  color: #fff;
  cursor: pointer;
  display: flex;
  font: inherit;
  font-weight: 700;
  gap: 9px;
  min-height: 58px;
  padding: 4px 18px 4px 7px;
}

.skm-chatbot__launcher img {
  background: #fff;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 50%;
  height: 48px;
  object-fit: contain;
  padding: 3px;
  width: 48px;
}

.skm-chatbot__panel {
  background: #fff;
  border: 1px solid rgba(8, 125, 120, .2);
  border-radius: 18px;
  box-shadow: 0 18px 55px rgba(12, 45, 43, .2);
  display: flex;
  flex-direction: column;
  height: min(570px, calc(100vh - 42px));
  overflow: hidden;
  width: min(390px, calc(100vw - 32px));
}

.skm-chatbot--floating .skm-chatbot__panel {
  bottom: 72px;
  position: absolute;
  right: 0;
}

.skm-chatbot__panel[hidden] {
  display: none;
}

.skm-chatbot--embedded .skm-chatbot__panel {
  height: min(620px, 75vh);
  margin: 24px auto;
  max-width: 100%;
  width: 760px;
}

.skm-chatbot__header {
  align-items: center;
  background: linear-gradient(135deg, var(--skm-teal-dark), var(--skm-teal));
  color: #fff;
  display: flex;
  flex: 0 0 auto;
  gap: 11px;
  min-height: 72px;
  padding: 11px 14px;
}

.skm-chatbot__header img {
  background: #fff;
  border-radius: 50%;
  height: 46px;
  object-fit: contain;
  padding: 4px;
  width: 46px;
}

.skm-chatbot__header div {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.skm-chatbot__header strong {
  color: #fff;
  font-size: 16px;
}

.skm-chatbot__header span {
  color: rgba(255,255,255,.85);
  font-size: 12px;
}

.skm-chatbot__close {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  font: 28px/1 Arial, sans-serif;
  height: 40px;
  justify-content: center;
  padding: 0;
  width: 40px;
}

.skm-chatbot__messages {
  background: #f5faf9;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.skm-chatbot__message {
  border-radius: 14px;
  max-width: 88%;
  overflow-wrap: anywhere;
  padding: 10px 12px;
  white-space: pre-line;
}

.skm-chatbot__message--assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #dceae8;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(15, 67, 63, .05);
}

.skm-chatbot__message--user {
  align-self: flex-end;
  background: var(--skm-teal-dark);
  border-bottom-right-radius: 4px;
  color: #fff;
}

.skm-chatbot__message--loading {
  color: var(--skm-muted);
}

.skm-chatbot__message--loading::after {
  animation: skm-chat-pulse 1.2s infinite;
  content: "";
  display: inline-block;
  margin-left: 7px;
}

.skm-chatbot__sources {
  border-top: 1px solid #e1ecea;
  font-size: 12px;
  margin-top: 10px;
  padding-top: 8px;
  white-space: normal;
}

.skm-chatbot__sources strong {
  display: block;
  margin-bottom: 3px;
}

.skm-chatbot__sources ul {
  list-style: disc;
  margin: 0 0 0 17px;
  padding: 0;
}

.skm-chatbot__sources a {
  color: var(--skm-teal-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.skm-chatbot__form {
  align-items: flex-end;
  background: #fff;
  border-top: 1px solid #e0ecea;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  margin: 0;
  padding: 11px 12px 7px;
}

.skm-chatbot__form textarea {
  background: #fff;
  border: 1px solid #b9cfcc;
  border-radius: 12px;
  box-shadow: none;
  color: var(--skm-ink);
  flex: 1;
  font: inherit;
  margin: 0;
  max-height: 110px;
  min-height: 46px;
  padding: 10px 11px;
  resize: vertical;
  width: auto;
}

.skm-chatbot__form button {
  background: var(--skm-teal-dark);
  border: 0;
  border-radius: 11px;
  color: #fff;
  cursor: pointer;
  flex: 0 0 auto;
  font: inherit;
  font-weight: 700;
  min-height: 46px;
  padding: 0 16px;
}

.skm-chatbot__form button:disabled,
.skm-chatbot__form textarea:disabled {
  cursor: wait;
  opacity: .65;
}

.skm-chatbot__notice {
  background: #fff;
  color: var(--skm-muted);
  flex: 0 0 auto;
  font-size: 10px;
  margin: 0;
  padding: 0 12px 9px;
  text-align: center;
}

.skm-chatbot button:focus-visible,
.skm-chatbot textarea:focus-visible,
.skm-chatbot a:focus-visible {
  outline: 3px solid var(--skm-lime);
  outline-offset: 2px;
}

@keyframes skm-chat-pulse {
  0%, 100% { content: "."; }
  33% { content: ".."; }
  66% { content: "..."; }
}

@media (max-width: 520px) {
  .skm-chatbot--floating {
    bottom: max(12px, env(safe-area-inset-bottom));
    right: max(53px, calc(env(safe-area-inset-right) + 53px));
  }

  .skm-chatbot__launcher span {
    display: none;
  }

  .skm-chatbot__launcher {
    height: 58px;
    padding: 5px;
    width: 58px;
  }

  .skm-chatbot--floating .skm-chatbot__panel {
    bottom: calc(82px + env(safe-area-inset-bottom));
    height: calc(100vh - 108px - env(safe-area-inset-bottom));
    max-height: 620px;
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    width: calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skm-chatbot__message--loading::after {
    animation: none;
    content: "...";
  }
}
