.sc-chat-root,
.sc-chat-root * {
  box-sizing: border-box;
}
.sc-chat-root {
  --sc-chat-blue: #0b3f84;
  --sc-chat-blue-dark: #082e62;
  --sc-chat-text: #172033;
  --sc-chat-muted: #58657a;
  --sc-chat-line: #d9e1ec;
  position: relative;
  z-index: 1200;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  color: var(--sc-chat-text);
}
.sc-chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1202;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 10px 17px;
  border: 0;
  border-radius: 999px;
  background: var(--sc-chat-blue);
  color: #fff;
  box-shadow: 0 10px 30px rgba(9, 40, 84, 0.28);
  font: 700 15px/1.2 inherit;
  cursor: pointer;
}
.sc-chat-launcher:hover,
.sc-chat-launcher:focus-visible {
  background: var(--sc-chat-blue-dark);
}
.sc-chat-launcher[hidden] {
  display: none;
}
.sc-chat-launcher:focus-visible,
.sc-chat-close:focus-visible,
.sc-chat-send:focus-visible,
.sc-chat-recover:focus-visible,
.sc-chat-panel input:focus-visible,
.sc-chat-panel select:focus-visible,
.sc-chat-panel textarea:focus-visible,
.sc-chat-panel summary:focus-visible,
.sc-chat-privacy:focus-visible {
  outline: 3px solid #f0b429;
  outline-offset: 2px;
}
.sc-chat-launcher__icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #52d273;
  color: transparent;
  box-shadow: 0 0 0 4px rgba(82, 210, 115, 0.18);
}
.sc-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 84px;
  z-index: 1201;
  width: min(390px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  height: min(720px, calc(100vh - 112px));
  height: min(720px, calc(100dvh - 112px));
  max-height: min(720px, calc(100vh - 112px));
  overflow: hidden;
  border: 1px solid var(--sc-chat-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 20px 56px rgba(9, 40, 84, 0.24);
}
.sc-chat-panel[hidden] {
  display: none;
}
.sc-chat-header {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  background: linear-gradient(135deg, #0b3f84, #1664b5);
  color: #fff;
}
.sc-chat-header h2 {
  margin: 0;
  color: #fff;
  font-size: 18px;
  line-height: 1.3;
}
.sc-chat-identity {
  margin: 4px 0 0;
  color: #eef7ff;
  font-size: 12px;
  line-height: 1.45;
}
.sc-chat-close {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: 400 25px/1 inherit;
  cursor: pointer;
}
/* Keep an already cached 0.3.3 widget usable during the asset transition. */
.sc-chat-panel > .sc-chat-intro {
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--sc-chat-line);
  background: #f5f9ff;
  color: #34445e;
  font-size: 12px;
  line-height: 1.5;
}
.sc-chat-panel:has(> .sc-chat-intro) { overflow-y: auto; }
.sc-chat-notice {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 14px;
  border-bottom: 1px solid var(--sc-chat-line);
  background: #f5f9ff;
  color: #34445e;
  font-size: 12px;
  line-height: 1.5;
}
.sc-chat-messages {
  flex: 1 1 auto;
  min-height: 120px;
  overflow: auto;
  padding: 14px;
  background: #f8fafc;
  scrollbar-gutter: stable;
}
.sc-chat-data { flex: 0 1 auto; max-height: 35%; overflow: auto; padding: 0 14px; border-bottom: 1px solid var(--sc-chat-line); font-size: 12px; line-height: 1.5; }
.sc-chat-data summary { min-height: 44px; padding-block: 12px; cursor: pointer; color: var(--sc-chat-blue); }
.sc-chat-data p { margin: 8px 0 0; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; }
.sc-chat-data[open] { padding-bottom: 10px; }
.sc-chat-bubble {
  max-width: 88%;
  margin: 0 0 10px;
  padding: 9px 11px;
  border: 1px solid var(--sc-chat-line);
  border-radius: 12px;
  background: #fff;
}
.sc-chat-bubble--visitor {
  margin-left: auto;
  border-color: #b9d5f4;
  background: #eaf4ff;
}
.sc-chat-bubble--human {
  border-color: #b9e0c2;
  background: #effaf1;
}
.sc-chat-bubble--system {
  max-width: 100%;
  border-style: dashed;
  background: #fff9e8;
}
.sc-chat-bubble__label {
  display: block;
  margin-bottom: 3px;
  color: var(--sc-chat-muted);
  font-size: 11px;
}
.sc-chat-bubble__text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--sc-chat-text);
  font-size: 14px;
  line-height: 1.55;
}
.sc-chat-status {
  flex: 0 1 auto;
  min-height: 34px;
  max-height: 25%;
  overflow-y: auto;
  margin: 0;
  padding: 8px 16px;
  border-top: 1px solid var(--sc-chat-line);
  color: var(--sc-chat-muted);
  font-size: 12px;
  line-height: 1.45;
}
.sc-chat-form {
  flex: 0 1 auto;
  min-height: 0;
  max-height: 55%;
  overflow-y: auto;
  padding: 0 14px 10px;
}
.sc-chat-message {
  display: block;
  width: 100%;
  min-height: 62px;
  max-height: 126px;
  resize: vertical;
  padding: 10px;
  border: 1px solid #aeb9c9;
  border-radius: 10px;
  color: var(--sc-chat-text);
  background: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.45;
}
.sc-chat-contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px 8px;
  align-items: center;
  margin-top: 8px;
}
.sc-chat-tools { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: 0 8px; }
.sc-chat-contact-disclosure { min-width: 0; max-width: 100%; color: var(--sc-chat-muted); font-size: 12px; }
.sc-chat-contact-disclosure summary { min-height: 44px; padding-block: 12px; cursor: pointer; }
.sc-chat-contact-disclosure[open] { flex-basis: 100%; }
.sc-chat-contact-disclosure .sc-chat-note { margin-bottom: 8px; }
.sc-chat-contact label {
  grid-column: 1/-1;
  color: var(--sc-chat-muted);
  font-size: 12px;
}
.sc-chat-contact select,
.sc-chat-contact input {
  min-width: 0;
  height: 44px;
  border: 1px solid #aeb9c9;
  border-radius: 8px;
  background: #fff;
  color: var(--sc-chat-text);
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
}
.sc-chat-contact select {
  padding: 0 24px 0 8px;
}
.sc-chat-contact input {
  padding: 0 9px;
}
.sc-chat-form__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 0;
}
.sc-chat-privacy {
  color: var(--sc-chat-blue);
  font-size: 12px;
  text-decoration: underline;
}
.sc-chat-send {
  min-width: 92px;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--sc-chat-blue);
  color: #fff;
  font: 700 14px/1 inherit;
  cursor: pointer;
}
.sc-chat-send:disabled {
  cursor: wait;
  opacity: 0.65;
}
.sc-chat-note {
  margin: 8px 0 0;
  color: var(--sc-chat-muted);
  font-size: 11px;
  line-height: 1.45;
}
.sc-chat-panel > .sc-chat-note {
  margin: 8px 16px;
}
.sc-chat-recover {
  margin: 0 16px 10px;
  max-width: calc(100% - 32px);
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--sc-chat-blue);
  border-radius: 8px;
  background: #fff;
  color: var(--sc-chat-blue);
  font: inherit;
  cursor: pointer;
}
.sc-chat-recover[hidden] { display: none; }
.sc-chat-tools .sc-chat-handoff { margin: 0; max-width: 100%; min-height: 44px; padding: 8px 0; border: 0; font-size: 12px; text-decoration: underline; }
.sc-chat-honeypot {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}
.sc-chat-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
@media (max-width: 767px) {
  .sc-chat-launcher {
    right: 12px;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    min-width: 50px;
    padding: 10px 13px;
  }
  .sc-chat-panel {
    left: 8px;
    right: 8px;
    top: calc(8px + env(safe-area-inset-top, 0px));
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: auto;
    height: calc(100vh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    max-height: none;
  }
  .sc-chat-messages {
    min-height: 80px;
  }
  .sc-chat-header { padding: 10px 12px; }
  .sc-chat-header h2 { font-size: 16px; }
  .sc-chat-close { flex-basis: 44px; width: 44px; height: 44px; }
  .sc-chat-message { resize: none; }
  .sc-chat-form { flex: 0 0 auto; }
}
@media (max-width: 767px) and (max-height: 480px) {
  /* Short layout viewports: one panel scroll surface keeps the composer and
     details reachable instead of clipping them between minimum flex heights. */
  .sc-chat-panel { overflow-y: auto; }
  .sc-chat-messages { flex: 0 0 120px; }
  .sc-chat-form, .sc-chat-data, .sc-chat-status { flex-shrink: 0; max-height: none; overflow: visible; }
}
@media (max-width: 360px) {
  .sc-chat-launcher__text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  .sc-chat-launcher {
    width: 52px;
    justify-content: center;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sc-chat-root * {
    scroll-behavior: auto !important;
  }
}
