#apsc-root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Apple SD Gothic Neo", "Noto Sans CJK KR", "Noto Sans CJK SC",
    "Noto Sans CJK JP", "Microsoft YaHei", sans-serif;
  color: #222;
  font-size: 14px;
  line-height: 1.45;
}

#apsc-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1f7ae0;
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2147483600;
  transition: transform 0.15s ease, background 0.15s ease;
}
#apsc-launcher:hover {
  background: #1665c1;
  transform: scale(1.05);
}
#apsc-launcher:focus {
  outline: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2), 0 0 0 3px rgba(31, 122, 224, 0.35);
}

#apsc-panel {
  position: fixed;
  right: 24px;
  bottom: 92px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 2147483601;
}
#apsc-panel.apsc-open {
  display: flex;
}

#apsc-header {
  background: #1f7ae0;
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
#apsc-title {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
}
#apsc-clear,
#apsc-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
#apsc-clear:hover,
#apsc-close:hover {
  background: rgba(255, 255, 255, 0.18);
}
#apsc-close {
  font-size: 22px;
  line-height: 1;
}

#apsc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f6f8fa;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.apsc-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 12px;
  word-wrap: break-word;
  white-space: normal;
}
.apsc-user {
  align-self: flex-end;
  background: #1f7ae0;
  color: #fff;
  border-bottom-right-radius: 3px;
}
.apsc-user a {
  color: #fff;
  text-decoration: underline;
}
.apsc-assistant {
  align-self: flex-start;
  background: #fff;
  color: #222;
  border: 1px solid #e2e6ea;
  border-bottom-left-radius: 3px;
}
.apsc-assistant a {
  color: #1f7ae0;
}
.apsc-transient {
  opacity: 0.7;
  font-style: italic;
}

.apsc-email-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  background: #1f7ae0;
  color: #fff !important;
  border-radius: 6px;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 500;
}
.apsc-email-btn:hover {
  background: #1665c1;
}

#apsc-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e2e6ea;
  background: #fff;
  flex-shrink: 0;
  box-sizing: border-box;
}
#apsc-root #apsc-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  resize: none;
  max-height: 120px;
  outline: none;
  background: #fff;
  color: #222;
}
#apsc-root #apsc-input:focus {
  border-color: #1f7ae0;
  box-shadow: 0 0 0 2px rgba(31, 122, 224, 0.15);
}
#apsc-root #apsc-send {
  flex: 0 0 auto;
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background: #1f7ae0;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  margin: 0;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
}
#apsc-root #apsc-send:hover:not(:disabled) {
  background: #1665c1;
}
#apsc-root #apsc-send:disabled {
  background: #9bb9da;
  cursor: not-allowed;
}
#apsc-root #apsc-clear,
#apsc-root #apsc-close {
  flex: 0 0 auto;
  width: 28px;
}

@media (max-width: 480px) {
  #apsc-panel {
    right: 12px;
    left: 12px;
    top: max(12px, env(safe-area-inset-top, 12px));
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    width: auto;
    height: auto;
    max-height: none;
  }
  #apsc-launcher {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
}
