.flvconsent,
.flvconsent__embed {
  --flvconsent-font: inherit;
  --flvconsent-font-size: 15px;
  --flvconsent-accent: #2d6cdf;
  --flvconsent-accent-hover: #2358bb;
  --flvconsent-on-accent: #ffffff;
  --flvconsent-surface: #ffffff;
  --flvconsent-surface-muted: #f3f5fa;
  --flvconsent-surface-hover: #e7edfa;
  --flvconsent-text: #16192b;
  --flvconsent-text-muted: #5a6076;
  --flvconsent-border: #dde2ee;
  --flvconsent-border-strong: #bcc7e0;
  --flvconsent-switch-off: #c3cadb;
  --flvconsent-shadow: 0 16px 48px rgba(14, 18, 40, 0.18);
  --flvconsent-shadow-sm: 0 4px 14px rgba(14, 18, 40, 0.14);
  --flvconsent-overlay: rgba(12, 16, 34, 0.55);
  --flvconsent-focus: #ffbf47;
  --flvconsent-radius: 14px;
  --flvconsent-radius-sm: 10px;
  --flvconsent-radius-pill: 999px;
  --flvconsent-max-width: var(--wp--style--global--wide-size, 1120px);
  --flvconsent-edge: 16px;
  --flvconsent-z: 99999;
}

/* Layout belongs to the banner root alone: the embed placeholder shares the
   tokens above, but sits inline in the content flow. */
.flvconsent {
  position: fixed;
  inset: auto 0 0 0;
  z-index: var(--flvconsent-z);
  font-family: var(--flvconsent-font);
  font-size: var(--flvconsent-font-size);
  line-height: 1.55;
  color: var(--flvconsent-text);
}

[data-flvconsent-scheme="light"] :is(.flvconsent, .flvconsent__embed) {
  --flvconsent-accent: #2d6cdf;
  --flvconsent-accent-hover: #2358bb;
  --flvconsent-on-accent: #ffffff;
  --flvconsent-surface: #ffffff;
  --flvconsent-surface-muted: #f3f5fa;
  --flvconsent-surface-hover: #e7edfa;
  --flvconsent-text: #16192b;
  --flvconsent-text-muted: #5a6076;
  --flvconsent-border: #dde2ee;
  --flvconsent-border-strong: #bcc7e0;
  --flvconsent-switch-off: #c3cadb;
  --flvconsent-shadow: 0 16px 48px rgba(14, 18, 40, 0.18);
  --flvconsent-shadow-sm: 0 4px 14px rgba(14, 18, 40, 0.14);
  --flvconsent-overlay: rgba(12, 16, 34, 0.55);
}

@media (prefers-color-scheme: dark) {
  .flvconsent,
  .flvconsent__embed {
    --flvconsent-accent: #6d9bf5;
    --flvconsent-accent-hover: #86adf8;
    --flvconsent-on-accent: #0d1220;
    --flvconsent-surface: #171b28;
    --flvconsent-surface-muted: #1f2433;
    --flvconsent-surface-hover: #262c3d;
    --flvconsent-text: #eef1f8;
    --flvconsent-text-muted: #a8b0c4;
    --flvconsent-border: #2e3547;
    --flvconsent-border-strong: #414a61;
    --flvconsent-switch-off: #4a5468;
    --flvconsent-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
    --flvconsent-shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.45);
    --flvconsent-overlay: rgba(4, 6, 14, 0.7);
  }
}

[data-flvconsent-scheme="dark"] .flvconsent {
  --flvconsent-accent: #6d9bf5;
  --flvconsent-accent-hover: #86adf8;
  --flvconsent-on-accent: #0d1220;
  --flvconsent-surface: #171b28;
  --flvconsent-surface-muted: #1f2433;
  --flvconsent-surface-hover: #262c3d;
  --flvconsent-text: #eef1f8;
  --flvconsent-text-muted: #a8b0c4;
  --flvconsent-border: #2e3547;
  --flvconsent-border-strong: #414a61;
  --flvconsent-switch-off: #4a5468;
  --flvconsent-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  --flvconsent-shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.45);
  --flvconsent-overlay: rgba(4, 6, 14, 0.7);
}

[data-flvconsent-scheme="theme"] .flvconsent {
  --flvconsent-font: var(--wp--preset--font-family--body, inherit);
  --flvconsent-surface: var(--wp--preset--color--base, var(--wp--preset--color--background, #ffffff));
  --flvconsent-text: var(--wp--preset--color--contrast, var(--wp--preset--color--foreground, #16192b));
  --flvconsent-accent: var(--wp--preset--color--accent, var(--wp--preset--color--accent-1, var(--wp--preset--color--primary, #2d6cdf)));
  --flvconsent-accent-hover: color-mix(in srgb, var(--flvconsent-accent) 82%, var(--flvconsent-text));
  --flvconsent-on-accent: var(--flvconsent-surface);
  --flvconsent-surface-muted: color-mix(in srgb, var(--flvconsent-text) 5%, var(--flvconsent-surface));
  --flvconsent-surface-hover: color-mix(in srgb, var(--flvconsent-text) 10%, var(--flvconsent-surface));
  --flvconsent-text-muted: color-mix(in srgb, var(--flvconsent-text) 68%, var(--flvconsent-surface));
  --flvconsent-border: color-mix(in srgb, var(--flvconsent-text) 14%, var(--flvconsent-surface));
  --flvconsent-border-strong: color-mix(in srgb, var(--flvconsent-text) 28%, var(--flvconsent-surface));
  --flvconsent-switch-off: color-mix(in srgb, var(--flvconsent-text) 32%, var(--flvconsent-surface));
}

.flvconsent *,
.flvconsent *::before,
.flvconsent *::after {
  box-sizing: border-box;
}

.flvconsent__panel {
  width: min(var(--flvconsent-max-width), calc(100% - var(--flvconsent-edge) * 2));
  margin: 0 auto var(--flvconsent-edge);
  padding: 22px 26px;
  background: var(--flvconsent-surface);
  border: 1px solid var(--flvconsent-border);
  border-radius: var(--flvconsent-radius);
  box-shadow: var(--flvconsent-shadow);
  animation: flvconsent-rise 0.28s ease-out both;
}

.flvconsent__panel--banner,
.flvconsent__panel--notice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 32px;
  row-gap: 8px;
}

.flvconsent__panel--banner {
  grid-template-areas:
    "title actions"
    "text actions"
    "policy actions";
}

.flvconsent__panel--notice {
  grid-template-areas:
    "title actions"
    "text actions"
    "policy actions";
}

.flvconsent__panel--banner .flvconsent__title,
.flvconsent__panel--notice .flvconsent__title {
  grid-area: title;
}

.flvconsent__panel--banner .flvconsent__text,
.flvconsent__panel--notice .flvconsent__text {
  grid-area: text;
}

.flvconsent__panel--banner .flvconsent__policy,
.flvconsent__panel--notice .flvconsent__policy {
  grid-area: policy;
  justify-self: start;
}

.flvconsent__panel--banner .flvconsent__links,
.flvconsent__panel--notice .flvconsent__links {
  grid-area: policy;
  justify-self: start;
  display: flex;
  flex-wrap: wrap;
  column-gap: 16px;
  row-gap: 4px;
}

/* Single-column layouts stack the links under the buttons, so they follow the
   buttons' centring instead of hugging the left edge. */
:is(.flvconsent--pos-bottom-left, .flvconsent--pos-bottom-right, .flvconsent--pos-center)
  :is(.flvconsent__panel--banner, .flvconsent__panel--notice) .flvconsent__links {
  justify-self: center;
  justify-content: center;
}

.flvconsent__panel--banner .flvconsent__actions,
.flvconsent__panel--notice .flvconsent__actions {
  grid-area: actions;
  justify-content: flex-end;
}

.flvconsent__title {
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: normal;
  text-transform: none;
  color: var(--flvconsent-text);
}

.flvconsent__text {
  margin: 0;
  padding: 0;
  color: var(--flvconsent-text-muted);
}

.flvconsent__text a,
.flvconsent__policy {
  color: var(--flvconsent-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.flvconsent__policy {
  font-size: 14px;
  font-weight: 600;
}

.flvconsent__text a:hover,
.flvconsent__policy:hover {
  color: var(--flvconsent-accent-hover);
}

.flvconsent__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.flvconsent__btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  padding: 10px 22px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--flvconsent-radius-sm);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: normal;
  text-align: center;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.flvconsent__btn:hover {
  transform: translateY(-1px);
}

.flvconsent__btn:active {
  transform: translateY(0);
}

.flvconsent__btn:focus-visible,
.flvconsent__manage:focus-visible,
.flvconsent__manage-link:focus-visible,
.flvconsent__cat input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--flvconsent-focus);
  outline-offset: 2px;
}

.flvconsent__btn--primary {
  background: var(--flvconsent-accent);
  color: var(--flvconsent-on-accent);
}

.flvconsent__btn--primary:hover {
  background: var(--flvconsent-accent-hover);
}

.flvconsent__btn--secondary {
  background: var(--flvconsent-surface-muted);
  border-color: var(--flvconsent-border-strong);
  color: var(--flvconsent-text);
}

.flvconsent__btn--secondary:hover {
  background: var(--flvconsent-surface-hover);
}

.flvconsent__btn--link {
  padding-left: 10px;
  padding-right: 10px;
  color: var(--flvconsent-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.flvconsent__btn--link:hover {
  color: var(--flvconsent-accent-hover);
}

.flvconsent__btn--dns {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.flvconsent__btn[disabled] {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

.flvconsent__panel--prefs {
  position: fixed;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  display: flex;
  flex-direction: column;
  width: min(600px, calc(100vw - var(--flvconsent-edge) * 2));
  max-height: min(760px, calc(100dvh - 48px));
  margin: 0;
  padding: 28px;
  animation: flvconsent-pop 0.24s ease-out both;
}

.flvconsent:has(.flvconsent__panel--prefs)::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--flvconsent-overlay);
  animation: flvconsent-fade 0.24s ease-out both;
}

.flvconsent__panel--prefs .flvconsent__text {
  margin-top: 6px;
}

.flvconsent__cats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
  padding: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.flvconsent__cat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--flvconsent-surface);
  border: 1px solid var(--flvconsent-border);
  border-radius: var(--flvconsent-radius-sm);
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.flvconsent__cat:hover {
  border-color: var(--flvconsent-border-strong);
}

.flvconsent__cat--locked {
  background: var(--flvconsent-surface-muted);
}

.flvconsent__cat label {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  cursor: pointer;
}

.flvconsent__cat--locked label {
  cursor: default;
}

.flvconsent__cat-name {
  display: block;
  font-weight: 600;
  color: var(--flvconsent-text);
}

.flvconsent__cat-desc {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--flvconsent-text-muted);
}

.flvconsent__cat input[type="checkbox"] {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  margin: 0;
  padding: 0;
  appearance: none;
  background: var(--flvconsent-switch-off, var(--flvconsent-border-strong));
  border: 0;
  border-radius: var(--flvconsent-radius-pill);
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.flvconsent__cat input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: translate 0.18s ease;
}

.flvconsent__cat input[type="checkbox"]:checked {
  background: var(--flvconsent-accent);
}

.flvconsent__cat input[type="checkbox"]:checked::after {
  translate: 18px 0;
}

.flvconsent__cat input[type="checkbox"]:disabled {
  opacity: 0.55;
  cursor: default;
}

.flvconsent__panel--prefs .flvconsent__actions {
  justify-content: flex-end;
  padding-top: 18px;
  border-top: 1px solid var(--flvconsent-border);
}

.flvconsent--pos-top {
  inset: 0 0 auto 0;
}

.flvconsent--pos-top .flvconsent__panel--banner,
.flvconsent--pos-top .flvconsent__panel--notice {
  margin: var(--flvconsent-edge) auto 0;
  animation-name: flvconsent-drop;
}

:is(.flvconsent--pos-bottom-left, .flvconsent--pos-bottom-right, .flvconsent--pos-center) .flvconsent__panel--banner {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "title"
    "text"
    "actions"
    "policy";
  row-gap: 12px;
}

:is(.flvconsent--pos-bottom-left, .flvconsent--pos-bottom-right, .flvconsent--pos-center) .flvconsent__panel--notice {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "title"
    "text"
    "actions"
    "policy";
  row-gap: 12px;
}

:is(.flvconsent--pos-bottom-left, .flvconsent--pos-bottom-right, .flvconsent--pos-center) :is(.flvconsent__panel--banner, .flvconsent__panel--notice) .flvconsent__actions {
  justify-content: stretch;
}

:is(.flvconsent--pos-bottom-left, .flvconsent--pos-bottom-right, .flvconsent--pos-center) :is(.flvconsent__panel--banner, .flvconsent__panel--notice) .flvconsent__btn {
  flex: 1 1 140px;
}

:is(.flvconsent--pos-bottom-left, .flvconsent--pos-bottom-right) :is(.flvconsent__panel--banner, .flvconsent__panel--notice) {
  --flvconsent-max-width: 420px;
}

.flvconsent--pos-bottom-left :is(.flvconsent__panel--banner, .flvconsent__panel--notice) {
  margin-inline: var(--flvconsent-edge) auto;
}

.flvconsent--pos-bottom-right :is(.flvconsent__panel--banner, .flvconsent__panel--notice) {
  margin-inline: auto var(--flvconsent-edge);
}

.flvconsent--pos-center :is(.flvconsent__panel--banner, .flvconsent__panel--notice) {
  position: fixed;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  width: min(560px, calc(100vw - var(--flvconsent-edge) * 2));
  margin: 0;
  animation-name: flvconsent-pop;
}

.flvconsent--pos-center:has(.flvconsent__panel--banner)::before,
.flvconsent--pos-center:has(.flvconsent__panel--notice)::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--flvconsent-overlay);
  animation: flvconsent-fade 0.24s ease-out both;
}

.flvconsent__manage {
  position: fixed;
  inset-block-end: var(--flvconsent-edge);
  inset-inline-start: var(--flvconsent-edge);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  margin: 0;
  padding: 9px 18px;
  background: var(--flvconsent-surface);
  color: var(--flvconsent-accent);
  border: 1px solid var(--flvconsent-border-strong);
  border-radius: var(--flvconsent-radius-pill);
  box-shadow: var(--flvconsent-shadow-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.flvconsent__manage--bottom-right {
  inset-inline-start: auto;
  inset-inline-end: var(--flvconsent-edge);
}

.flvconsent__manage:hover {
  background: var(--flvconsent-surface-hover);
  transform: translateY(-1px);
}

.flvconsent__manage-icon {
  flex: none;
  width: 16px;
  height: 16px;
}

.flvconsent__manage-link {
  appearance: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--flvconsent-accent, #2d6cdf);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* The wrapper imposes no size of its own — the gated element keeps its box and
   the notice is laid over it, so the slot occupies exactly the space the embed
   would have. `align-self` stops a flex/grid parent stretching it to the row. */
.flvconsent__embed {
  position: relative;
  display: block;
  align-self: start;
  max-width: 100%;
  min-height: 90px;
  font-family: var(--flvconsent-font);
}

.flvconsent__embed > [data-flvconsent-src] {
  display: block;
  max-width: 100%;
}

.flvconsent__embed-notice {
  box-sizing: border-box;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  padding: 16px;
  background: var(--flvconsent-surface-muted);
  border: 1px dashed var(--flvconsent-border-strong);
  border-radius: var(--flvconsent-radius-sm);
  color: var(--flvconsent-text-muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.flvconsent__embed-btn {
  margin: 0;
  padding: 8px 16px;
  background: var(--flvconsent-accent);
  color: var(--flvconsent-on-accent);
  border: 1px solid transparent;
  border-radius: var(--flvconsent-radius-pill);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.flvconsent__embed-btn:hover {
  background: var(--flvconsent-accent-hover);
}

.flvconsent__embed-btn:focus-visible {
  outline: 3px solid var(--flvconsent-focus);
  outline-offset: 2px;
}

@keyframes flvconsent-rise {
  from {
    opacity: 0;
    translate: 0 14px;
  }
}

@keyframes flvconsent-drop {
  from {
    opacity: 0;
    translate: 0 -14px;
  }
}

@keyframes flvconsent-pop {
  from {
    opacity: 0;
    scale: 0.96;
  }
}

@keyframes flvconsent-fade {
  from {
    opacity: 0;
  }
}

@media (max-width: 860px) {
  .flvconsent__panel--banner,
  .flvconsent__panel--notice {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 12px;
  }

  .flvconsent__panel--banner {
    grid-template-areas:
      "title"
      "text"
      "actions"
      "policy";
  }

  .flvconsent__panel--notice {
    grid-template-areas:
      "title"
      "text"
      "actions"
      "policy";
  }

  .flvconsent__panel--banner .flvconsent__actions,
  .flvconsent__panel--notice .flvconsent__actions {
    justify-content: stretch;
  }

  .flvconsent__actions .flvconsent__btn {
    flex: 1 1 150px;
  }

  /* Stacked by breakpoint rather than by position, so this has to repeat the
     centring the corner/centred layouts get above: the buttons span the full
     width here, and left-aligned links under them read as a stray element. */
  .flvconsent__panel--banner .flvconsent__links,
  .flvconsent__panel--notice .flvconsent__links {
    justify-self: center;
    justify-content: center;
  }
}

@media (max-width: 767px) {
  .flvconsent__manage {
    width: 40px;
    padding: 0;
  }

  .flvconsent__manage-icon {
    width: 18px;
    height: 18px;
  }

  .flvconsent__manage-text {
    display: none;
  }
}

@media (max-width: 560px) {
  .flvconsent:not(.flvconsent--pos-bottom-left, .flvconsent--pos-bottom-right, .flvconsent--pos-center) :is(.flvconsent__panel--banner, .flvconsent__panel--notice) {
    width: 100%;
    margin: 0;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    border-inline: 0;
    border-block-end: 0;
    border-radius: var(--flvconsent-radius) var(--flvconsent-radius) 0 0;
  }

  .flvconsent--pos-top :is(.flvconsent__panel--banner, .flvconsent__panel--notice) {
    padding: calc(20px + env(safe-area-inset-top)) 18px 20px;
    border-block: 0;
    border-radius: 0 0 var(--flvconsent-radius) var(--flvconsent-radius);
  }

  .flvconsent__panel--prefs {
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  }

  .flvconsent__manage {
    inset-inline-start: 12px;
    inset-block-end: 12px;
  }

  .flvconsent__manage--bottom-right {
    inset-inline-start: auto;
    inset-inline-end: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flvconsent *,
  .flvconsent *::before,
  .flvconsent *::after {
    animation: none;
    transition: none;
  }

  .flvconsent__btn:hover,
  .flvconsent__manage:hover {
    transform: none;
  }
}

@media (forced-colors: active) {
  .flvconsent__panel,
  .flvconsent__cat,
  .flvconsent__btn,
  .flvconsent__manage,
  .flvconsent__embed-notice,
  .flvconsent__embed-btn {
    border: 1px solid CanvasText;
  }

  .flvconsent__cat input[type="checkbox"] {
    width: auto;
    height: auto;
    appearance: auto;
  }

  .flvconsent__cat input[type="checkbox"]::after {
    display: none;
  }
}

@media print {
  .flvconsent {
    display: none;
  }
}
