/* LifeScoring 공개 채팅 1단계 C 공통 위젯 */
:root {
  --ls-chat-widget-blue: #3157d5;
  --ls-chat-widget-blue-dark: #2444ae;
  --ls-chat-widget-text: #172033;
  --ls-chat-widget-muted: #687386;
  --ls-chat-widget-line: #dde3ec;
  --ls-chat-widget-surface: #ffffff;
  --ls-chat-widget-shadow: 0 18px 46px rgba(31, 45, 75, .22);
}

.ls-chat-widget {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(88px, calc(env(safe-area-inset-bottom) + 88px));
  z-index: 1180;
}

.ls-chat-widget[hidden] {
  display: none !important;
}

.ls-chat-widget__button,
.ls-chat-widget__button:link,
.ls-chat-widget__button:visited {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 112px;
  min-height: 52px;
  padding: 10px 16px 10px 12px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 999px;
  background: linear-gradient(145deg, var(--ls-chat-widget-blue), #6682e8);
  color: #ffffff !important;
  text-decoration: none !important;
  font: 900 14px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  letter-spacing: -.02em;
  box-shadow: var(--ls-chat-widget-shadow);
  isolation: isolate;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.ls-chat-widget__button:hover,
.ls-chat-widget__button:focus-visible {
  transform: translateY(-2px);
  background: linear-gradient(145deg, var(--ls-chat-widget-blue-dark), #506ed1);
  box-shadow: 0 22px 54px rgba(31, 45, 75, .28);
  outline: none;
}

.ls-chat-widget__button:focus-visible {
  box-shadow:
    0 0 0 4px rgba(49, 87, 213, .20),
    0 22px 54px rgba(31, 45, 75, .28);
}

.ls-chat-widget__icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, .16);
}

.ls-chat-widget__icon svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ls-chat-widget__icon circle {
  fill: currentColor;
  stroke: none;
}

.ls-chat-widget__badge {
  position: absolute;
  right: -4px;
  top: -6px;
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
}

.ls-chat-widget__badge[hidden] {
  display: none !important;
}

/* 홈페이지 최근 공개 메시지 5개 */
.ls-chat-preview-section {
  width: min(1080px, calc(100% - 40px));
  margin: 26px auto 0;
  padding: 0;
}

.ls-chat-preview-card {
  overflow: hidden;
  border: 1px solid rgba(49, 87, 213, .20);
  border-radius: 24px;
  background:
    radial-gradient(circle at 0 0, rgba(49, 87, 213, .08), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,255,.96));
  box-shadow: 0 14px 38px rgba(31, 45, 75, .10);
}

.ls-chat-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid rgba(49, 87, 213, .12);
}

.ls-chat-preview-title-wrap {
  min-width: 0;
}

.ls-chat-preview-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  margin-bottom: 7px;
  border: 1px solid rgba(49, 87, 213, .18);
  border-radius: 999px;
  background: #eef2ff;
  color: var(--ls-chat-widget-blue-dark);
  font-size: 11px;
  font-weight: 950;
}

.ls-chat-preview-head h2 {
  margin: 0;
  color: var(--ls-chat-widget-text);
  font-size: clamp(22px, 2.6vw, 32px);
  line-height: 1.24;
  letter-spacing: -.045em;
}

.ls-chat-preview-head p {
  margin: 6px 0 0;
  color: var(--ls-chat-widget-muted);
  font-size: 13.5px;
  line-height: 1.65;
  word-break: keep-all;
}

.ls-chat-preview-link,
.ls-chat-preview-link:link,
.ls-chat-preview-link:visited {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid var(--ls-chat-widget-blue);
  border-radius: 999px;
  background: var(--ls-chat-widget-blue);
  color: #ffffff !important;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 950;
  white-space: nowrap;
}

.ls-chat-preview-link:hover,
.ls-chat-preview-link:focus-visible {
  background: var(--ls-chat-widget-blue-dark);
  outline: none;
}

.ls-chat-preview-list {
  margin: 0;
  padding: 8px 22px 18px;
  list-style: none;
}

.ls-chat-preview-item {
  display: grid;
  grid-template-columns: minmax(110px, .7fr) minmax(0, 2.3fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 54px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f6;
}

.ls-chat-preview-item:last-child {
  border-bottom: 0;
}

.ls-chat-preview-author {
  min-width: 0;
  overflow: hidden;
  color: var(--ls-chat-widget-blue-dark);
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ls-chat-preview-body {
  min-width: 0;
  overflow: hidden;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ls-chat-preview-time {
  color: #8490a3;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ls-chat-preview-state {
  min-height: 92px;
  display: grid;
  place-items: center;
  padding: 20px;
  color: var(--ls-chat-widget-muted);
  font-size: 14px;
  text-align: center;
}

.ls-chat-preview-state[data-kind="error"] {
  color: #a8323c;
}

@media (max-width: 720px) {
  .ls-chat-widget {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(76px, calc(env(safe-area-inset-bottom) + 76px));
  }

  .ls-chat-widget__button,
  .ls-chat-widget__button:link,
  .ls-chat-widget__button:visited {
    min-width: 54px;
    width: 54px;
    height: 54px;
    padding: 0;
    border-radius: 18px;
  }

  .ls-chat-widget__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .ls-chat-preview-section {
    width: min(100% - 28px, 1080px);
    margin-top: 18px;
  }

  .ls-chat-preview-head {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .ls-chat-preview-list {
    padding: 6px 18px 14px;
  }

  .ls-chat-preview-item {
    grid-template-columns: minmax(92px, .8fr) minmax(0, 2.2fr);
    gap: 8px 12px;
  }

  .ls-chat-preview-time {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ls-chat-widget__button {
    transition: none !important;
  }
}
