#ai-summarizer-root {
  position: fixed;
  bottom: 20px;
  right: 16px;
  z-index: 99999;
  font-family: system-ui, -apple-system, sans-serif;
}

/* FORCE PERFECT SQUARE BUTTON */
#ai-btn {
  width: 52px !important;
  height: 52px !important;
  min-width: 52px !important;
  min-height: 52px !important;
  max-width: 52px !important;
  max-height: 52px !important;
  aspect-ratio: 1 / 1;

  padding: 0 !important;
  line-height: 0 !important;
  box-sizing: border-box;

  flex: 0 0 52px !important;
  align-self: center !important;
  justify-self: center !important;

  border-radius: 14px;
  background: var(--ai-bg);
  border: 1px solid transparent;
  background-image:
    linear-gradient(var(--ai-bg), var(--ai-bg)),
    linear-gradient(135deg, #8b5cf6, #3b82f6, #22d3ee);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);

  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
}

.ai-icon-img {
  width: 100%;
  height: 100%;
  padding: 4px;
  box-sizing: border-box;
  display: block;
  object-fit: contain;
  pointer-events: none;
  transition: filter 0.2s ease;
}

@media (prefers-color-scheme: dark) {
  .ai-icon-img {
    filter: invert(1) brightness(1.2);
  }
}

/* LOADER FIX */
.loader {
  width: 14px;
  height: 14px;
  min-width: 14px;
  min-height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #3b82f6;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

.loading-text {
  vertical-align: middle;
}

/* PANEL */
#ai-box {
  margin-top: 10px;
  width: min(94vw, 380px);
  max-height: min(72vh, 520px);
  overflow-y: auto;
  border-radius: 16px;
  border: 1px solid transparent;
  background-image:
    linear-gradient(var(--ai-bg), var(--ai-bg)),
    linear-gradient(135deg, #8b5cf6, #3b82f6, #22d3ee);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  color: var(--ai-text);
}

.ai-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  font-weight: 600;
}

#ai-content {
  padding: 16px 18px 18px;
  font-size: 14px;
  line-height: 1.7;
}

#ai-content h4 {
  margin: 18px 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ai-heading);
}

#ai-close {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--ai-text);
}

:root {
  --ai-bg: #ffffff;
  --ai-text: #0f172a;
  --ai-heading: #0f172a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ai-bg: #0b0f14;
    --ai-text: #f1f5f9;
    --ai-heading: #c7d2fe;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
