.wprc-chat-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 999999;
  font: 14px/1.45 Arial, sans-serif;
}

#wprc-chat-root,
#wprc-chat-root * {
  box-sizing: border-box;
}

#wprc-chat-root button,
#wprc-chat-root textarea,
#wprc-chat-root input,
#wprc-chat-root a,
#wprc-chat-root p,
#wprc-chat-root span,
#wprc-chat-root strong,
#wprc-chat-root div,
#wprc-chat-root section,
#wprc-chat-root header {
  font-family: Arial, sans-serif !important;
}

#wprc-chat-root button,
#wprc-chat-root textarea,
#wprc-chat-root input {
  margin: 0 !important;
  float: none !important;
  max-width: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

#wprc-chat-root textarea {
  display: block !important;
}

#wprc-chat-root button {
  display: inline-flex !important;
}

.wprc-toggle {
  position: relative;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #2d6cdf, #1d57c8);
  box-shadow: 0 12px 26px rgba(29, 87, 200, 0.28);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wprc-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(29, 87, 200, 0.34);
}

.wprc-toggle.is-open {
  background: linear-gradient(180deg, #1d4fb5, #163f95);
}

.wprc-toggle-ring {
  position: absolute;
  inset: 3px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.72);
}

.wprc-toggle-icon {
  position: relative;
  z-index: 1;
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
}

.wprc-toggle-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wprc-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(365px, calc(100vw - 24px));
  height: 520px;
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 22px 56px rgba(18, 34, 68, 0.2);
  border: 1px solid rgba(189, 205, 238, 0.95);
  display: flex;
  flex-direction: column;
}

.wprc-panel.is-expanded {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: min(820px, calc(100vw - 44px));
  height: min(760px, calc(100vh - 44px));
  border-radius: 20px;
}

.wprc-panel.is-hidden,
.wprc-panel[hidden] {
  display: none !important;
}

.wprc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px 12px;
  color: #ffffff;
  background: linear-gradient(180deg, #2d6cdf, #245ecf);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.wprc-header strong {
  display: block;
  font-size: 16px;
}

.wprc-header p {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

.wprc-header > div {
  flex: 1 1 auto;
  min-width: 0;
}

.wprc-size-toggle,
.wprc-close {
  border: 0;
  background: transparent;
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
  width: 28px;
  height: 28px;
  padding: 0 !important;
  align-items: center;
  justify-content: center;
}

.wprc-size-toggle:hover,
.wprc-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.wprc-size-icon {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -1px;
}

.wprc-messages {
  flex: 1 1 auto;
  min-height: 180px;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #ffffff;
}

.wprc-message {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wprc-message.is-user {
  align-items: flex-end;
}

.wprc-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 12px;
  white-space: pre-wrap;
  text-align: left;
  word-break: break-word;
}

.wprc-bubble p {
  margin: 0 0 10px;
}

.wprc-bubble p:last-child {
  margin-bottom: 0;
}

.wprc-bubble .wprc-list {
  margin: 0;
  padding-left: 18px;
}

.wprc-bubble .wprc-list li {
  margin: 0 0 6px;
}

.wprc-bubble .wprc-list li:last-child {
  margin-bottom: 0;
}

.wprc-bubble .wprc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 12px;
  background: #ffffff;
  border: 1px solid #d9e1ef;
  border-radius: 10px;
  overflow: hidden;
}

.wprc-bubble .wprc-table th,
.wprc-bubble .wprc-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e6ecf7;
  vertical-align: top;
  text-align: left;
}

.wprc-bubble .wprc-table tr:last-child th,
.wprc-bubble .wprc-table tr:last-child td {
  border-bottom: 0;
}

.wprc-bubble .wprc-table th {
  width: 38%;
  background: #f7faff;
  color: #27406b;
  font-weight: 700;
}

.wprc-message.is-bot .wprc-bubble {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #24324a;
}

.wprc-message.is-user .wprc-bubble {
  background: #3b82f6;
  color: #ffffff;
}

.wprc-redirect-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4ff;
  border: 1px solid #cdddff;
  color: #2b5ed7;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.wprc-debug-block {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7e8;
  border: 1px solid #f1d7a2;
  color: #5b4309;
  font-size: 12px;
}

.wprc-debug-block strong {
  display: block;
  margin-bottom: 6px;
}

.wprc-debug-block pre {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
}

.wprc-gate,
.wprc-form {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
  flex: 0 0 auto;
}

.wprc-form[hidden],
.wprc-gate[hidden] {
  display: none !important;
}

.wprc-form:not([hidden]) {
  display: block !important;
}

.wprc-gate-text {
  margin: 0 0 12px;
  color: #51627f;
}

.wprc-captcha-holder {
  min-height: 80px;
}

.wprc-unlock,
.wprc-form button {
  border: 0;
  border-radius: 10px;
  background: #2563eb;
  color: #ffffff;
  padding: 10px 14px;
  cursor: pointer;
}

#wprc-chat-root .wprc-form textarea {
  width: calc(100% - 54px);
  box-sizing: border-box;
  min-height: 40px !important;
  height: 40px !important;
  max-height: 96px !important;
  border: 1px solid #d1d5db;
  border-radius: 26px;
  padding: 9px 14px !important;
  resize: none;
  background: #ffffff;
  font-size: 12px;
  overflow-y: auto;
  line-height: 1.35 !important;
}

#wprc-chat-root .wprc-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: end;
  gap: 10px;
  width: 100%;
}

#wprc-chat-root .wprc-input-row textarea {
  width: 100% !important;
  min-width: 0 !important;
}

#wprc-chat-root .wprc-input-row button {
  margin-bottom: 1px;
}

.wprc-form-row {
  display: flex;
  margin-top: 6px;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.wprc-counter {
  color: #64748b;
  font-size: 12px;
}

#wprc-chat-root .wprc-form button,
#wprc-chat-root .wprc-send-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  appearance: none;
  -webkit-appearance: none;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  overflow: visible !important;
  font-size: 0 !important;
  line-height: 1.2 !important;
  text-indent: 0 !important;
  color: transparent !important;
  background: linear-gradient(135deg, #4a63ff, #2f55ea) !important;
  border: 0 !important;
  border-radius: 999px !important;
  padding: 0 !important;
  box-shadow: 0 10px 24px rgba(47, 85, 234, 0.28);
}

#wprc-chat-root .wprc-send-icon {
  display: inline-block !important;
  position: absolute !important;
  inset: 0;
  margin: auto !important;
  z-index: 1;
  transform: translateX(1px);
  width: 18px !important;
  height: 18px !important;
  line-height: 18px !important;
  font-size: 18px !important;
  color: #ffffff !important;
  text-align: center !important;
}

@media (max-width: 640px) {
  .wprc-chat-root {
    right: 12px;
    bottom: 12px;
  }

  .wprc-panel {
    width: calc(100vw - 24px);
    height: 72vh;
  }

  .wprc-panel.is-expanded {
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    border-radius: 16px;
  }

  .wprc-messages {
    height: calc(72vh - 210px);
  }

  .wprc-panel.is-expanded .wprc-messages {
    height: auto;
  }

  #wprc-chat-root .wprc-input-row {
    grid-template-columns: minmax(0, 1fr) 44px !important;
  }
}
