:root {
  --fcgpa-ivory: #f6f1e9;
  --fcgpa-paper: #fffdf8;
  --fcgpa-stone: #d8cdbd;
  --fcgpa-ink: #292825;
  --fcgpa-muted: #6e6a61;
  --fcgpa-green: #3f4f45;
  --fcgpa-line: rgba(63, 79, 69, 0.18);
}

#fcgpa-root {
  position: fixed;
  right: 22px;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 99990;
  display: block;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--fcgpa-ink);
}

.fcgpa-launch,
.fcgpa-fallback {
  min-height: 52px;
  border: 1px solid rgba(41, 40, 37, 0.16);
  border-radius: 999px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--fcgpa-paper);
  background: var(--fcgpa-green);
  box-shadow: 0 16px 42px rgba(37, 45, 39, 0.22);
  cursor: pointer;
  font-weight: 650;
  text-decoration: none;
}

.fcgpa-fallback {
  position: relative;
  z-index: 1;
}

.fcgpa-launch svg,
.fcgpa-close svg,
.fcgpa-input button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fcgpa-panel {
  position: absolute;
  right: 0;
  bottom: 70px;
  width: min(410px, calc(100vw - 32px));
  max-height: 76vh;
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--fcgpa-line);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--fcgpa-paper), var(--fcgpa-ivory));
  box-shadow: 0 24px 80px rgba(37, 45, 39, 0.26);
  transform: translateY(14px) scale(0.98);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.fcgpa-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--fcgpa-line);
  background: rgba(255, 253, 248, 0.86);
}

.fcgpa-head p {
  margin: 0 0 4px;
  color: var(--fcgpa-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.fcgpa-head h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 500;
}

.fcgpa-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--fcgpa-line);
  border-radius: 50%;
  background: transparent;
  color: var(--fcgpa-green);
  cursor: pointer;
}

.fcgpa-log {
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.fcgpa-bubble {
  max-width: 88%;
  margin: 0 0 10px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.fcgpa-assistant {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--fcgpa-line);
}

.fcgpa-user {
  margin-left: auto;
  color: #fff;
  background: var(--fcgpa-green);
}

.fcgpa-muted {
  color: var(--fcgpa-muted);
}

.fcgpa-quick,
.fcgpa-contact {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 10px 0 16px;
}

.fcgpa-quick button,
.fcgpa-contact a,
.fcgpa-contact button,
.fcgpa-lead-form button {
  min-height: 38px;
  border: 1px solid var(--fcgpa-line);
  border-radius: 10px;
  padding: 9px 12px;
  text-align: left;
  text-decoration: none;
  color: var(--fcgpa-ink);
  background: rgba(255, 255, 255, 0.64);
  cursor: pointer;
}

.fcgpa-quick button:hover,
.fcgpa-contact a:hover,
.fcgpa-contact button:hover {
  border-color: rgba(63, 79, 69, 0.45);
  background: #fff;
}

.fcgpa-compare {
  overflow-x: auto;
  border: 1px solid var(--fcgpa-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.fcgpa-compare h3 {
  margin: 14px 14px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

.fcgpa-compare table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.fcgpa-compare th,
.fcgpa-compare td {
  padding: 10px 12px;
  border-top: 1px solid var(--fcgpa-line);
  text-align: left;
  vertical-align: top;
}

.fcgpa-lead-form {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 14px;
  border: 1px solid var(--fcgpa-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
}

.fcgpa-lead-form h3 {
  margin: 0 0 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

.fcgpa-lead-form label {
  display: grid;
  gap: 5px;
  color: var(--fcgpa-muted);
  font-size: 12px;
}

.fcgpa-lead-form input,
.fcgpa-lead-form textarea,
.fcgpa-input input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--fcgpa-line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--fcgpa-ink);
  background: #fff;
  font: inherit;
}

.fcgpa-lead-form textarea {
  min-height: 72px;
  resize: vertical;
}

.fcgpa-consent {
  grid-template-columns: auto 1fr !important;
  align-items: start;
}

.fcgpa-hp {
  position: absolute;
  left: -10000px;
}

.fcgpa-input {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--fcgpa-line);
  background: rgba(255, 253, 248, 0.92);
}

.fcgpa-input button {
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--fcgpa-green);
  cursor: pointer;
}

@media (max-width: 640px) {
  #fcgpa-root {
    position: fixed !important;
    right: 14px !important;
    bottom: max(16px, calc(env(safe-area-inset-bottom) + 16px)) !important;
    left: auto !important;
    top: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 2147483000 !important;
    transform: none !important;
  }

  .fcgpa-launch,
  .fcgpa-fallback {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 48px;
    padding: 0 15px;
    font-size: 14px;
  }

  .fcgpa-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(76px, calc(env(safe-area-inset-bottom) + 76px));
    width: auto;
    max-width: 420px;
    height: min(52svh, 560px);
    max-height: none;
    margin-left: auto;
    grid-template-rows: auto minmax(0, 1fr) auto;
    border-radius: 16px;
    transform-origin: bottom right;
  }

  .fcgpa-head {
    padding: 14px 15px 12px;
    gap: 12px;
  }

  .fcgpa-head h2 {
    font-size: 18px;
  }

  .fcgpa-head p {
    font-size: 10px;
  }

  .fcgpa-close {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }

  .fcgpa-log {
    padding: 12px;
  }

  .fcgpa-bubble {
    max-width: 94%;
    padding: 10px 12px;
    font-size: 13px;
  }

  .fcgpa-quick,
  .fcgpa-contact {
    gap: 6px;
    margin: 8px 0 12px;
  }

  .fcgpa-quick button,
  .fcgpa-contact a,
  .fcgpa-contact button,
  .fcgpa-lead-form button {
    min-height: 34px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .fcgpa-input {
    grid-template-columns: 1fr 40px;
    gap: 7px;
    padding: 10px;
  }

  .fcgpa-input input {
    min-height: 40px;
    padding: 7px 10px;
    font-size: 16px;
    line-height: 1.25;
  }

  .fcgpa-lead-form input,
  .fcgpa-lead-form textarea {
    font-size: 16px;
    line-height: 1.25;
  }

  .fcgpa-input button {
    min-height: 40px;
    border-radius: 10px;
  }

  .fcgpa-launch {
    min-height: 50px;
    padding: 0 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fcgpa-panel {
    transition: none;
  }
}
