/* XF Consent v1.0.0 — 样式（自动适配浅色/深色） */

.xfc-banner,
.xfc-modal {
  --xfc-bg: #ffffff;
  --xfc-fg: #14181f;
  --xfc-muted: #5b6472;
  --xfc-line: #e2e6ec;
  --xfc-accent: #0f766e;
  --xfc-accent-fg: #ffffff;
  --xfc-soft: #f4f6f8;
  --xfc-radius: 14px;
  --xfc-shadow: 0 18px 50px -12px rgba(15, 23, 42, .28), 0 2px 8px rgba(15, 23, 42, .06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  box-sizing: border-box;
}

.xfc-banner *,
.xfc-modal * { box-sizing: border-box; }

/* 防御站点全局样式（p / a / button 的 color、margin 继承）渗透进弹窗 */
.xfc-banner p,
.xfc-modal p {
  margin: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: normal;
}

.xfc-banner a,
.xfc-modal a {
  text-decoration: none;
  background: none;
}

.xfc-banner button,
.xfc-modal button {
  font-family: inherit;
  letter-spacing: normal;
  text-transform: none;
}

@media (prefers-color-scheme: dark) {
  .xfc-banner,
  .xfc-modal {
    --xfc-bg: #171a20;
    --xfc-fg: #eef1f6;
    --xfc-muted: #9aa4b2;
    --xfc-line: #2b313b;
    --xfc-soft: #1e222a;
    --xfc-accent: #2dd4bf;
    --xfc-accent-fg: #062b28;
    --xfc-shadow: 0 18px 50px -12px rgba(0, 0, 0, .65);
  }
}

html.xfc-lock { overflow: hidden; }

/* ---------------- banner ---------------- */

.xfc-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2147483000;
  background: var(--xfc-bg);
  color: var(--xfc-fg);
  border: 1px solid var(--xfc-line);
  border-radius: var(--xfc-radius);
  box-shadow: var(--xfc-shadow);
  opacity: 0;
  transform: translateY(140%);
  visibility: hidden;
  transition: opacity .28s ease, transform .28s cubic-bezier(.22, .8, .3, 1), visibility .28s;
  max-width: 1180px;
  margin: 0 auto;
}

.xfc-banner.is-visible {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.xfc-banner__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px 20px;
}

.xfc-banner__text { flex: 1 1 auto; min-width: 0; }

.xfc-banner__title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: .01em;
  color: var(--xfc-fg);
}

.xfc-banner__desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--xfc-muted);
}

.xfc-banner__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

/* ---------------- buttons ---------------- */

.xfc-btn {
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  padding: 11px 18px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s, border-color .16s, color .16s, transform .16s;
}

.xfc-btn:active { transform: translateY(1px); }

.xfc-btn:focus-visible {
  outline: 2px solid var(--xfc-accent);
  outline-offset: 2px;
}

.xfc-btn--primary {
  background: var(--xfc-accent);
  color: var(--xfc-accent-fg);
  border-color: var(--xfc-accent);
}
.xfc-btn--primary:hover { filter: brightness(1.08); }

.xfc-btn--outline {
  background: transparent;
  color: var(--xfc-fg);
  border-color: var(--xfc-line);
}
.xfc-btn--outline:hover { background: var(--xfc-soft); }

.xfc-btn--ghost {
  background: transparent;
  color: var(--xfc-muted);
  border-color: transparent;
  padding-left: 10px;
  padding-right: 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}
.xfc-btn--ghost:hover { color: var(--xfc-fg); }

.xfc-link {
  color: var(--xfc-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

/* ---------------- modal ---------------- */

.xfc-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.xfc-modal[hidden] { display: none; }

.xfc-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 11, 16, .55);
  backdrop-filter: blur(2px);
}

.xfc-modal__panel {
  position: relative;
  width: 100%;
  max-width: 620px;
  max-height: min(86vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--xfc-bg);
  color: var(--xfc-fg);
  border: 1px solid var(--xfc-line);
  border-radius: 16px;
  box-shadow: var(--xfc-shadow);
  overflow: hidden;
  animation: xfc-pop .24s cubic-bezier(.22, .8, .3, 1);
}

.xfc-modal__panel:focus { outline: none; }

@keyframes xfc-pop {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.xfc-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--xfc-line);
}

.xfc-modal__title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  color: var(--xfc-fg);
}

.xfc-close {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--xfc-muted);
  font-size: 24px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
}
.xfc-close:hover { background: var(--xfc-soft); color: var(--xfc-fg); }

.xfc-modal__body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.xfc-modal__desc {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--xfc-muted);
}

.xfc-cat {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--xfc-line);
}
.xfc-cat:first-of-type { border-top: 0; }

.xfc-cat__text { flex: 1 1 auto; min-width: 0; }

.xfc-cat__title {
  margin: 0 0 4px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--xfc-fg);
}

.xfc-cat__desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--xfc-muted);
}

.xfc-badge {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--xfc-muted);
  background: var(--xfc-soft);
  border: 1px solid var(--xfc-line);
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}

/* 开关 */
.xfc-switch {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  width: 44px;
  height: 26px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--xfc-line);
  background: var(--xfc-soft);
  cursor: pointer;
  position: relative;
  transition: background .18s, border-color .18s;
}

.xfc-switch span {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .28);
  transition: transform .18s cubic-bezier(.22, .8, .3, 1);
}

.xfc-switch[aria-checked="true"] {
  background: var(--xfc-accent);
  border-color: var(--xfc-accent);
}
.xfc-switch[aria-checked="true"] span { transform: translateX(18px); }

.xfc-switch:focus-visible {
  outline: 2px solid var(--xfc-accent);
  outline-offset: 2px;
}

.xfc-modal__foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--xfc-line);
  background: var(--xfc-soft);
  flex-wrap: wrap;
}

/* ---------------- 小屏 ---------------- */

@media (max-width: 720px) {
  .xfc-banner { left: 10px; right: 10px; bottom: 10px; }
  .xfc-banner__inner { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; }
  .xfc-banner__actions { flex-direction: column-reverse; align-items: stretch; }
  .xfc-banner__actions .xfc-btn { width: 100%; padding: 13px 16px; }
  .xfc-modal { padding: 0; align-items: flex-end; }
  .xfc-modal__panel { max-height: 92vh; border-radius: 16px 16px 0 0; }
  .xfc-modal__foot { flex-direction: column-reverse; }
  .xfc-modal__foot .xfc-btn { width: 100%; }
  .xfc-modal__foot .xfc-btn--ghost { order: 3; }
}

@media (prefers-reduced-motion: reduce) {
  .xfc-banner, .xfc-modal__panel, .xfc-switch span, .xfc-btn { transition: none; animation: none; }
}

@media print {
  .xfc-banner, .xfc-modal { display: none !important; }
}
