.ss-customer-service {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999998;
  color: #17263a;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.ss-chat-launcher {
  min-width: 92px;
  height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 24px;
  color: #fff;
  background: #ed1b2f;
  box-shadow: 0 10px 26px rgba(181, 24, 43, .28);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.ss-chat-panel {
  display: none;
  position: absolute;
  right: 0;
  bottom: 60px;
  width: 392px;
  height: min(640px, calc(100vh - 150px));
  overflow: hidden;
  border: 1px solid #d8e0e9;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(11, 49, 92, .22);
}

.ss-customer-service.is-open .ss-chat-panel {
  display: flex;
  flex-direction: column;
}

.ss-chat-head {
  min-height: 68px;
  flex: 0 0 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 18px;
  color: #fff;
  background: #0d315c;
}

.ss-chat-head-copy {
  min-width: 0;
}

.ss-chat-head strong {
  display: block;
  font-size: 17px;
  line-height: 1.35;
}

.ss-chat-head span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: #dce8f7;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ss-chat-close {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 0;
  color: #fff;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.ss-chat-messages {
  flex: 1 1 auto;
  min-height: 190px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px 7px;
  background: #f4f6f8;
}

.ss-chat-message {
  width: fit-content;
  max-width: 86%;
  margin: 0 0 12px;
  padding: 11px 13px;
  border: 1px solid #dce3eb;
  border-radius: 13px 13px 13px 4px;
  background: #fff;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ss-chat-message.is-visitor {
  margin-left: auto;
  color: #fff;
  border-color: #155da1;
  border-radius: 13px 13px 4px 13px;
  background: #155da1;
}

.ss-chat-message.is-error {
  color: #7d2b34;
  border-color: #f0cbd0;
  background: #fff7f7;
}

.ss-chat-typing {
  flex: 0 0 auto;
  padding: 8px 15px;
  color: #5f6f82;
  background: #f4f6f8;
  font-size: 13px;
}

.ss-chat-quick {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 116px;
  overflow-y: auto;
  padding: 11px 12px;
  border-top: 1px solid #e6ebf1;
  background: #fff;
}

.ss-chat-quick[hidden],
.ss-chat-teacher-action[hidden] {
  display: none !important;
}

.ss-chat-quick button {
  min-width: 0;
  min-height: 43px;
  padding: 8px 10px;
  border: 1px solid #c9d6e5;
  border-radius: 9px;
  color: #164f84;
  background: #f8fbfe;
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.ss-chat-actions {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 1.15fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #edf0f4;
  background: #fff;
}

.ss-chat-actions.is-compact {
  grid-template-columns: 1fr;
  padding-top: 8px;
  padding-bottom: 8px;
}

.ss-chat-contact-form[hidden] {
  display: none !important;
}

.ss-customer-service.is-contact-form .ss-chat-messages,
.ss-customer-service.is-contact-form .ss-chat-typing,
.ss-customer-service.is-contact-form .ss-chat-quick,
.ss-customer-service.is-contact-form .ss-chat-actions,
.ss-customer-service.is-contact-form .ss-chat-compose {
  display: none !important;
}

.ss-chat-contact-form {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  padding: 16px 18px 18px;
  background: #fff;
}

.ss-chat-contact-back {
  width: fit-content;
  min-height: 32px;
  padding: 0;
  border: 0;
  color: #155da1;
  background: transparent;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.ss-chat-contact-title strong,
.ss-chat-contact-title span {
  display: block;
}

.ss-chat-contact-title strong {
  color: #0d315c;
  font-size: 24px;
  line-height: 1.3;
}

.ss-chat-contact-title span {
  margin-top: 6px;
  color: #667487;
  font-size: 14px;
  line-height: 1.55;
}

.ss-chat-contact-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
  color: #142b49;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.ss-chat-contact-field input,
.ss-chat-contact-field textarea,
.ss-chat-contact-field select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid #c8d2de;
  border-radius: 9px;
  outline: 0;
  color: #17253a;
  background: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 400;
}

.ss-chat-contact-field input {
  height: 48px;
  padding: 0 12px;
}

.ss-chat-contact-field select {
  height: 48px;
  padding: 0 38px 0 12px;
  appearance: auto;
}

.ss-chat-contact-field textarea {
  min-height: 72px;
  resize: vertical;
  padding: 11px 12px;
  line-height: 1.5;
}

.ss-chat-contact-field input::placeholder,
.ss-chat-contact-field textarea::placeholder {
  color: #98a3b1;
}

.ss-chat-contact-field.is-primary input {
  height: 52px;
  border-color: #155da1;
  font-size: 16px;
  box-shadow: 0 0 0 2px rgba(21, 93, 161, .08);
}

.ss-chat-contact-field input:focus,
.ss-chat-contact-field textarea:focus,
.ss-chat-contact-field select:focus {
  border-color: #155da1;
  box-shadow: 0 0 0 3px rgba(21, 93, 161, .12);
}

.ss-chat-contact-identity {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ss-chat-contact-choice {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.ss-chat-contact-choice legend {
  margin-bottom: 8px;
  padding: 0;
  color: #142b49;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.ss-chat-contact-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ss-chat-contact-choice label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.ss-chat-contact-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.ss-chat-contact-choice span {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 7px 9px;
  border: 1px solid #cdd7e2;
  border-radius: 9px;
  color: #28415f;
  background: #fff;
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
}

.ss-chat-contact-choice input:checked + span {
  color: #fff;
  border-color: #155da1;
  background: #155da1;
  font-weight: 700;
}

.ss-chat-contact-choice input:focus-visible + span {
  outline: 3px solid rgba(21, 93, 161, .3);
  outline-offset: 2px;
}

.ss-chat-contact-choice.is-segmented .ss-chat-contact-choice-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}

.ss-chat-contact-choice.is-segmented label:not(:first-child) span {
  border-left: 0;
}

.ss-chat-contact-choice.is-segmented label:first-child span {
  border-radius: 9px 0 0 9px;
}

.ss-chat-contact-choice.is-segmented label:not(:first-child):not(:last-child) span {
  border-radius: 0;
}

.ss-chat-contact-choice.is-segmented label:last-child span {
  border-radius: 0 9px 9px 0;
}

.ss-chat-contact-status {
  margin: -5px 0 0;
  padding: 9px 11px;
  border-radius: 7px;
  color: #8b2530;
  background: #fff4f5;
  font-size: 13px;
  line-height: 1.45;
}

.ss-chat-contact-submit {
  min-height: 50px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: #ed1b2f;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.ss-chat-contact-submit:disabled {
  opacity: .58;
  cursor: wait;
}

.ss-chat-contact-notice {
  margin: -7px 0 0;
  color: #758295;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.ss-chat-contact-notice a {
  color: #155da1;
  text-decoration: none;
}

.ss-chat-teacher-action {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #ed1b2f;
  border-radius: 9px;
  color: #d9182b;
  background: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.ss-chat-direct {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ss-chat-direct a,
.ss-chat-direct button {
  display: flex;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 1px solid #d5dee8;
  border-radius: 9px;
  color: #164f84;
  background: #fff;
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.ss-chat-compose {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 7px;
  padding: 11px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid #e1e7ee;
  background: #fff;
}

.ss-chat-compose-row {
  display: flex;
  gap: 8px;
}

.ss-chat-compose input {
  flex: 1;
  min-width: 0;
  height: 46px;
  box-sizing: border-box;
  padding: 0 12px;
  border: 1px solid #bdc9d6;
  border-radius: 9px;
  outline: none;
  color: #17253a;
  background: #fff;
  font-size: 16px;
}

.ss-chat-compose input:focus {
  border-color: #155da1;
  box-shadow: 0 0 0 3px rgba(21, 93, 161, .12);
}

.ss-chat-compose button {
  width: 76px;
  min-height: 46px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: #155da1;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.ss-chat-compose button:disabled,
.ss-chat-teacher-action:disabled {
  opacity: .58;
  cursor: wait;
}

.ss-chat-compose-notice {
  margin: 0;
  color: #728094;
  font-size: 12px;
  line-height: 1.5;
}

.ss-chat-compose-notice a {
  color: #155da1;
  text-decoration: none;
}

.ss-chat-launcher:focus-visible,
.ss-chat-close:focus-visible,
.ss-chat-contact-back:focus-visible,
.ss-chat-contact-submit:focus-visible,
.ss-chat-quick button:focus-visible,
.ss-chat-direct a:focus-visible,
.ss-chat-direct button:focus-visible,
.ss-chat-teacher-action:focus-visible,
.ss-chat-compose button:focus-visible {
  outline: 3px solid rgba(21, 93, 161, .3);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .ss-customer-service {
    right: 12px;
    bottom: calc(86px + env(safe-area-inset-bottom));
  }

  .ss-chat-launcher {
    min-width: 88px;
    height: 46px;
    padding: 0 15px;
  }

  .ss-chat-panel {
    position: fixed;
    right: 8px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    left: 8px;
    width: auto;
    height: calc(100dvh - 96px - env(safe-area-inset-bottom));
    max-height: 760px;
    border-radius: 15px;
  }

  .ss-chat-head {
    min-height: 64px;
    flex-basis: 64px;
    padding-left: 15px;
  }

  .ss-chat-messages {
    min-height: 170px;
    padding: 14px 12px 5px;
  }

  .ss-chat-message {
    max-width: 90%;
    font-size: 15px;
  }

  .ss-chat-contact-form {
    gap: 14px;
    padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
  }

  .ss-chat-contact-title strong {
    font-size: 23px;
  }

  .ss-chat-quick,
  .ss-chat-actions,
  .ss-chat-compose {
    padding-right: 11px;
    padding-left: 11px;
  }
}

@media (max-width: 360px) {
  .ss-chat-quick {
    grid-template-columns: 1fr;
    max-height: 102px;
  }

  .ss-chat-actions {
    grid-template-columns: 1fr;
  }

  .ss-chat-contact-identity {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 620px) {
  .ss-chat-panel {
    height: calc(100dvh - 96px);
    bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .ss-chat-head {
    min-height: 58px;
    flex-basis: 58px;
  }

  .ss-chat-quick {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ss-chat-panel,
  .ss-chat-messages {
    scroll-behavior: auto;
  }
}
