/*
 * BotGuard overlay styles.
 *
 * Served as a file rather than injected as a <style> element so the module works under a
 * Content-Security-Policy without 'unsafe-inline' in style-src. Everything the operator can
 * configure - colours, radius, width, blur, accent - comes through CSS custom properties,
 * which JavaScript sets with element.style.setProperty(). CSP governs <style> elements and
 * style attributes that arrive in markup; it does not intercept CSSOM writes, so this stays
 * fully configurable while remaining policy-clean.
 */

:root {
  --bg-overlay-bg: rgba(255, 255, 255, .72);
  --bg-card-bg: rgba(255, 255, 255, .92);
  --bg-text-color: inherit;
  --bg-radius: 16px;
  --bg-width: 420px;
  --bg-blur: 8px;
  --bg-accent: #2f6fed;
  --bg-anim-fast: 120ms;
  --bg-anim: 160ms;
  --bg-anim-slow: 180ms;
  --bg-card-shift: 6px;
  --bg-press-scale: .99;
  --bg-spin: botguardSpin 800ms linear infinite;
}

#botguard-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  color: inherit;
  background: var(--bg-overlay-bg);
  backdrop-filter: blur(var(--bg-blur));
  -webkit-backdrop-filter: blur(var(--bg-blur));
  opacity: 0;
  transition: opacity var(--bg-anim) ease;
}

#botguard-overlay.bg-show { opacity: 1; }

#botguard-card {
  width: min(var(--bg-width), calc(100% - 32px));
  border-radius: var(--bg-radius);
  background: var(--bg-card-bg);
  color: var(--bg-text-color);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .18);
  padding: 18px 18px 16px;
  transform: translateY(var(--bg-card-shift));
  opacity: 0;
  transition: opacity var(--bg-anim-slow) ease, transform var(--bg-anim-slow) ease;
}

#botguard-card.show { opacity: 1; transform: translateY(0); }

#botguard-title { font-size: 18px; font-weight: 700; margin: 2px 0 6px; line-height: 1.2; }
#botguard-text { font-size: 14px; opacity: .78; margin: 0 0 14px; line-height: 1.35; }
#botguard-actions { margin-top: 10px; }

.botguard-btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  background: var(--bg-accent);
  color: #fff;
  transition: transform var(--bg-anim-fast) ease, filter var(--bg-anim-fast) ease;
}
.botguard-btn:hover { filter: brightness(.96); }
.botguard-btn:active { transform: scale(var(--bg-press-scale)); }
.botguard-btn[disabled] { opacity: .75; cursor: default; }

#botguard-spinner {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, .15);
  border-top-color: var(--bg-accent);
  animation: var(--bg-spin);
  margin: 0 auto 10px;
}

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

#botguard-slider-wrap { padding: 12px 12px 10px; border-radius: 14px; background: rgba(0, 0, 0, .04); }
#botguard-slider { width: 100%; accent-color: var(--bg-accent); }

#botguard-hint { font-size: 13px; opacity: .78; margin-top: 10px; text-align: center; }
#botguard-blocked { font-size: 14px; opacity: .85; margin-top: 8px; line-height: 1.35; }
#botguard-cd { font-size: 13px; opacity: .82; margin-top: 10px; text-align: center; }
#botguard-cd strong { font-weight: 700; }

/* Progress bar shown while the proof of work runs. The fill width is the one value that
   changes at runtime; it is set through CSSOM, not a style attribute. */
#botguard-progress-wrap {
  width: 100%;
  height: 6px;
  background: rgba(127, 127, 127, .22);
  border-radius: 999px;
  overflow: hidden;
  margin: 14px 0 10px;
}
#botguard-progress-bar {
  height: 100%;
  width: 0;
  background: var(--bg-accent);
  opacity: .75;
  border-radius: 999px;
  transition: width .2s linear;
}

#botguard-retry {
  margin-top: 14px;
  padding: 10px 22px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  background: var(--bg-accent);
  color: #fff;
  opacity: .9;
}
#botguard-retry[disabled] { opacity: .6; cursor: default; }

@media (prefers-color-scheme: dark) {
  #botguard-spinner { border-color: rgba(255, 255, 255, .18); }
  #botguard-slider-wrap { background: rgba(255, 255, 255, .06); }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --bg-anim-fast: 0ms;
    --bg-anim: 0ms;
    --bg-anim-slow: 0ms;
    --bg-card-shift: 0;
    --bg-press-scale: 1;
    --bg-spin: none;
  }
}

/* Minimal styling for the standalone gate document, which has no theme CSS of its own. */
body.botguard-gate-body {
  height: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: #222;
  background: #f6f7f9;
}
html.botguard-gate-html { height: 100%; }
#botguard-fallback { max-width: 520px; padding: 28px; text-align: center; }
#botguard-fallback h1 { font-size: 20px; margin: 0 0 10px; }
#botguard-fallback p { margin: 0; color: #666; }
