#freestock_support_widget_root {
  --fc-radius: 16px;
  --fc-accent: rgba(94, 106, 255, 1);
  --fc-bg: rgba(12, 16, 36, 0.82);
  --fc-panel: rgba(18, 22, 42, 0.96);
  --fc-edge: rgba(255, 255, 255, 0.12);
  --fc-muted: rgba(226, 230, 255, 0.68);
  --fc-text: rgba(246, 248, 255, 0.98);
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 99990;
  width: min(360px, calc(100vw - 2rem));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  font-family: var(--font-sans, Inter, system-ui, -apple-system, sans-serif);
  font-size: 13px;
  color: var(--fc-text);
  letter-spacing: 0.01em;
}

#freestock_support_widget_root > * {
  pointer-events: auto;
}

#freestock_support_widget_root * {
  box-sizing: border-box;
}

#freestock_support_widget_root.freestock-support-hidden {
  display: none;
}

.freestock-support-fab {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid var(--fc-edge);
  background: radial-gradient(circle at 28% 30%, rgba(255, 255, 255, 0.18), rgba(94, 106, 255, 0.45));
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px rgba(0, 0, 24, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: transform 140ms ease, box-shadow 160ms ease, border-color 140ms ease;
}

.freestock-support-fab:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.22);
}

.freestock-support-fab:active {
  transform: translateY(0);
}

.freestock-support-fab svg {
  width: 26px;
  height: 26px;
  fill: rgba(246, 248, 255, 0.94);
}

.freestock-support-panel {
  position: absolute;
  right: 0;
  bottom: calc(52px + 0.85rem);
  width: min(360px, calc(100vw - 2rem));
  max-height: min(460px, 70vh);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.55rem;
  padding: 0.68rem;
  border-radius: var(--fc-radius);
  background: linear-gradient(145deg, var(--fc-panel), rgba(10, 12, 24, 0.96));
  border: 1px solid var(--fc-edge);
  box-shadow: 0 26px 64px rgba(0, 0, 36, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 170ms ease, transform 210ms cubic-bezier(0.2, 1, 0.3, 1), visibility step-end 210ms;
  z-index: 2;
  overflow: hidden;
}

.freestock-support-panel.freestock-support-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: visibility step-start 50ms;
}

.freestock-support-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.freestock-support-title {
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fc-muted);
}

.freestock-support-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #5ef3b9;
  box-shadow: 0 0 0 7px rgba(94, 243, 185, 0.16);
}

.freestock-support-dot.off {
  background: rgba(226, 230, 255, 0.35);
  box-shadow: none;
}

.freestock-support-close {
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.freestock-support-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.freestock-support-close svg {
  width: 16px;
  height: 16px;
}

.freestock-support-stream {
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.15rem;
  scrollbar-width: thin;
  min-height: 0;
  contain: layout style;
}

.freestock-support-bubble-row {
  display: flex;
  width: 100%;
}

.freestock-support-bubble-row.in {
  justify-content: flex-end;
}

.freestock-support-bubble-row.out {
  justify-content: flex-start;
}

.freestock-support-bubble {
  max-width: 88%;
  padding: 0.55rem 0.72rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  line-height: 1.45;
  font-size: 0.875rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.freestock-support-bubble.in {
  background: linear-gradient(135deg, rgba(94, 106, 255, 0.55), rgba(128, 90, 236, 0.35));
}

.freestock-support-bubble.out {
  background: rgba(255, 255, 255, 0.05);
}

.freestock-support-meta {
  font-size: 0.72rem;
  color: var(--fc-muted);
  margin-top: 0.2rem;
  padding: 0 0.2rem;
}

.freestock-support-foot {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  position: relative;
  z-index: 1;
}

.freestock-support-status {
  font-size: 0.75rem;
  color: var(--fc-muted);
  min-height: 1.1em;
  white-space: pre-wrap;
}

.freestock-support-form {
  display: flex;
  gap: 0.45rem;
  align-items: flex-end;
}

.freestock-support-input {
  flex: 1;
  min-height: 40px;
  max-height: 96px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(4, 6, 18, 0.55);
  color: inherit;
  padding: 0.55rem 0.65rem;
  font: inherit;
}

.freestock-support-input:focus {
  outline: 2px solid rgba(94, 106, 255, 0.45);
  outline-offset: 1px;
}

.freestock-support-send {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(94, 106, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.freestock-support-send:hover {
  background: rgba(94, 106, 255, 0.76);
}

.freestock-support-send svg {
  width: 20px;
  height: 20px;
  fill: rgba(246, 248, 255, 0.96);
}

.freestock-support-empty {
  padding: 0.65rem 0.72rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--fc-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

@media (prefers-color-scheme: light) {
  #freestock_support_widget_root {
    --fc-bg: rgba(250, 250, 255, 0.95);
    --fc-panel: rgba(255, 255, 255, 0.96);
    --fc-edge: rgba(26, 32, 74, 0.16);
    --fc-muted: rgba(76, 86, 120, 0.78);
    --fc-text: rgba(26, 32, 64, 0.94);
    --fc-accent: rgba(62, 78, 227, 1);
  }

  .freestock-support-fab {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(186, 198, 255, 0.92));
    box-shadow: 0 14px 32px rgba(26, 32, 104, 0.18), 0 0 0 1px rgba(26, 32, 74, 0.08) inset;
  }

  .freestock-support-fab svg {
    fill: rgba(62, 78, 227, 0.94);
  }

  .freestock-support-panel {
    background: var(--fc-panel);
    border-color: var(--fc-edge);
    box-shadow: 0 22px 50px rgba(26, 32, 104, 0.2);
  }

  .freestock-support-input {
    background: rgba(250, 250, 255, 0.98);
    border-color: rgba(26, 32, 74, 0.12);
    color: var(--fc-text);
  }

  .freestock-support-bubble.out {
    background: rgba(244, 246, 255, 0.95);
    border-color: rgba(26, 32, 74, 0.1);
  }
}
