#ptwx-widget,
#ptwx-widget * {
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

#ptwx-widget {
  position: fixed;
  left: calc(100vw - 86px);
  top: calc(100vh - 86px);
  z-index: 2147483000;
  width: 64px;
  height: 64px;
}

#ptwx-widget .ptwx-launcher {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(140deg, #25d366 0%, #1ea95a 55%, #128c49 100%);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 16px 32px rgba(9, 58, 33, 0.35);
  position: relative;
  overflow: hidden;
  touch-action: none;
  animation: ptwx-float 3s ease-in-out infinite;
}

#ptwx-widget .ptwx-launcher::before {
  content: "";
  position: absolute;
  inset: -26px;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 55%);
  transform: rotate(18deg);
}

#ptwx-widget .ptwx-launcher::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 2px solid rgba(37, 211, 102, 0.35);
  border-radius: 24px;
  animation: ptwx-ring 2.4s infinite;
}

#ptwx-widget .ptwx-icon {
  width: 34px;
  height: 34px;
  position: relative;
  z-index: 1;
}

#ptwx-widget .ptwx-online-dot {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #d8ff8c;
  border: 2px solid #0f8c49;
  z-index: 2;
  animation: ptwx-blink 1.6s ease-in-out infinite;
}

#ptwx-widget .ptwx-tip {
  position: absolute;
  right: 74px;
  bottom: 8px;
  background: #183f2d;
  color: #fff;
  border-radius: 999px;
  padding: 9px 12px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: all 0.2s ease;
}

#ptwx-widget.show-tip .ptwx-tip {
  opacity: 1;
  transform: translateY(0);
}

#ptwx-widget .ptwx-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(92vw, 380px);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid #cfe8d8;
  background: #f7fcf9;
  box-shadow: 0 30px 60px rgba(8, 42, 25, 0.3);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#ptwx-widget.open .ptwx-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

#ptwx-widget.panel-left .ptwx-panel {
  left: 0;
  right: auto;
  transform-origin: bottom left;
}

#ptwx-widget.panel-down .ptwx-panel {
  top: 76px;
  bottom: auto;
  transform-origin: top right;
}

#ptwx-widget.panel-left.panel-down .ptwx-panel {
  transform-origin: top left;
}

.ptwx-head {
  padding: 12px;
  background: linear-gradient(130deg, #0f7c43 0%, #25d366 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ptwx-head-main {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.ptwx-head-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  flex: 0 0 34px;
}

.ptwx-head-icon .ptwx-icon {
  width: 20px;
  height: 20px;
}

.ptwx-head-copy strong {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.ptwx-head-copy span {
  display: block;
  font-size: 11px;
  opacity: 0.95;
  white-space: nowrap;
}

.ptwx-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.ptwx-stream {
  background: linear-gradient(180deg, #eef8f1, #f9fcfa);
  padding: 12px;
  max-height: 230px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.ptwx-msg {
  max-width: 88%;
  border-radius: 14px;
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.35;
  word-wrap: break-word;
  animation: ptwx-message-in 0.18s ease;
}

.ptwx-msg.bot {
  background: #fff;
  border: 1px solid #d8ebe0;
  color: #174231;
}

.ptwx-msg.bot a {
  color: #11874b;
  text-decoration: none;
  font-weight: 700;
}

.ptwx-msg.user {
  margin-left: auto;
  background: linear-gradient(145deg, #23c763, #149a51);
  color: #fff;
}

.ptwx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #e2efe7;
  border-bottom: 1px solid #e2efe7;
}

.ptwx-chip {
  border: 1px solid #cfe6d8;
  background: #eef9f3;
  color: #1b4b36;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease;
}

.ptwx-chip:hover {
  transform: translateY(-1px);
  background: #e4f4ec;
}

.ptwx-chip.active {
  background: linear-gradient(140deg, #1ea95a, #128c49);
  color: #fff;
  border-color: #128c49;
}

.ptwx-foot {
  padding: 10px 12px 12px;
  background: #fff;
}

.ptwx-label {
  display: block;
  margin: 0 0 5px;
  color: #365f4a;
  font-size: 12px;
  font-weight: 700;
}

.ptwx-input {
  width: 100%;
  border: 1px solid #cde1d5;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 13px;
  margin-bottom: 8px;
  outline: none;
}

.ptwx-input:focus {
  border-color: #1fb15f;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.14);
}

.ptwx-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ptwx-btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.ptwx-btn.primary {
  color: #fff;
  background: linear-gradient(145deg, #1db760, #128c49);
}

.ptwx-btn.secondary {
  color: #1b4a35;
  background: #edf8f1;
  border: 1px solid #d2e8db;
}

.ptwx-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.ptwx-move-note {
  text-align: center;
  padding-top: 7px;
  font-size: 10px;
  color: #678175;
}

.ptwx-toast {
  margin-top: 8px;
  background: #14392a;
  color: #fff;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.18s ease;
  pointer-events: none;
}

.ptwx-toast.show {
  opacity: 1;
  transform: translateY(0);
}

@keyframes ptwx-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes ptwx-ring {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  75% {
    transform: scale(1.18);
    opacity: 0;
  }
  100% {
    transform: scale(1.18);
    opacity: 0;
  }
}

@keyframes ptwx-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes ptwx-message-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 540px) {
  #ptwx-widget {
    width: 60px;
    height: 60px;
  }

  #ptwx-widget .ptwx-launcher {
    width: 60px;
    height: 60px;
    border-radius: 18px;
  }

  #ptwx-widget .ptwx-icon {
    width: 31px;
    height: 31px;
  }

  #ptwx-widget .ptwx-tip {
    display: none;
  }

  #ptwx-widget .ptwx-panel {
    width: min(94vw, 360px);
  }
}

@media (max-width: 960px) {
  #ptwx-widget {
    top: calc(100vh - 156px);
  }
}

@media (prefers-reduced-motion: reduce) {
  #ptwx-widget * {
    animation: none !important;
    transition: none !important;
  }
}
