.hfcm {
  --hfcm-bg: #fff;
  --hfcm-text: #17202a;
  --hfcm-muted: #52606d;
  --hfcm-primary: #173f5f;
  --hfcm-border: #c7d0d9;
  --hfcm-accent-foreground: #fff;
  --hfcm-focus: #f39c12;
  --hfcm-overlay: rgb(10 20 30 / 62%);
  --hfcm-radius: 0.5rem;
  --hfcm-shadow: 0 0.75rem 2.5rem rgb(0 0 0 / 20%);
  --hfcm-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --hfcm-background: var(--hfcm-bg);
  --hfcm-foreground: var(--hfcm-text);
  --hfcm-accent: var(--hfcm-primary);
  color: var(--hfcm-foreground);
  font-family: var(--hfcm-font);
  font-size: 16px;
  line-height: 1.5;
}

.hfcm[hidden],
.hfcm [hidden] {
  display: none !important;
}

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

.hfcm__banner {
  position: fixed;
  z-index: 2147483000;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.25rem;
  max-width: 72rem;
  max-height: calc(100vh - 2rem);
  margin: 0 auto;
  padding: 1.25rem;
  overflow: auto;
  background: var(--hfcm-background);
  border: 1px solid var(--hfcm-border);
  border-radius: var(--hfcm-radius);
  box-shadow: var(--hfcm-shadow);
}

.hfcm__content,
.hfcm__dialog-header,
.hfcm__category span {
  min-width: 0;
}

.hfcm__title {
  margin: 0 0 0.375rem;
  color: var(--hfcm-foreground);
  font: inherit;
  font-size: 1.25rem;
  font-weight: 700;
}

.hfcm__description,
.hfcm__notice {
  margin: 0;
  color: var(--hfcm-muted);
}

.hfcm__policy-link {
  margin: 0.5rem 0 0;
}

.hfcm__policy-link a {
  color: var(--hfcm-accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.hfcm__notice--error {
  color: #8a1c1c;
}

.hfcm__notice {
  margin-top: 0.75rem;
  font-weight: 600;
}

.hfcm__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  align-items: center;
}

.hfcm__actions--banner {
  justify-content: flex-end;
}

.hfcm__button,
.hfcm__close,
.hfcm__reopen {
  min-height: 2.75rem;
  margin: 0;
  padding: 0.625rem 1rem;
  color: var(--hfcm-foreground);
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  background: var(--hfcm-background);
  border: 2px solid var(--hfcm-accent);
  border-radius: var(--hfcm-radius);
}

.hfcm__screen-reader-status {
  position: fixed;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hfcm__button--choice {
  color: var(--hfcm-accent-foreground);
  background: var(--hfcm-accent);
}

.hfcm__button--secondary:hover,
.hfcm__close:hover,
.hfcm__reopen:hover {
  background: #eef3f7;
}

.hfcm__button--choice:hover {
  filter: brightness(1.15);
}

.hfcm button:disabled {
  cursor: not-allowed;
  filter: none;
  opacity: 0.55;
}

.hfcm button:focus-visible,
.hfcm input:focus-visible {
  outline: 3px solid var(--hfcm-focus);
  outline-offset: 3px;
}

.hfcm__backdrop {
  position: fixed;
  z-index: 2147483001;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow: auto;
  background: var(--hfcm-overlay);
}

.hfcm__dialog {
  width: min(100%, 42rem);
  max-height: calc(100vh - 2rem);
  padding: 1.25rem;
  overflow: auto;
  background: var(--hfcm-background);
  border: 1px solid var(--hfcm-border);
  border-radius: var(--hfcm-radius);
  box-shadow: var(--hfcm-shadow);
}

.hfcm__dialog-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.hfcm__close {
  display: grid;
  flex: 0 0 2.75rem;
  place-items: center;
  width: 2.75rem;
  padding: 0;
  font-size: 1.5rem;
}

.hfcm__categories {
  display: grid;
  gap: 0.625rem;
  margin: 1.25rem 0;
}

.hfcm__category {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  min-height: 4.25rem;
  padding: 0.875rem;
  cursor: pointer;
  border: 1px solid var(--hfcm-border);
  border-radius: var(--hfcm-radius);
}

.hfcm__category:hover {
  border-color: var(--hfcm-accent);
}

.hfcm__category--fixed {
  cursor: default;
  background: #f5f7f9;
}

.hfcm__category strong,
.hfcm__category small {
  display: block;
}

.hfcm__category small {
  margin-top: 0.125rem;
  color: var(--hfcm-muted);
  font-size: 0.875rem;
}

.hfcm__category input {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--hfcm-accent);
}

.hfcm__actions--dialog {
  justify-content: space-between;
}

.hfcm__reopen {
  position: fixed;
  z-index: 2147482999;
  bottom: 1rem;
  left: 1rem;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--hfcm-background);
  box-shadow: 0 0.25rem 1rem rgb(0 0 0 / 15%);
}

@media (max-width: 48rem) {
  .hfcm__banner {
    grid-template-columns: 1fr;
  }

  .hfcm__actions--banner,
  .hfcm__actions--dialog {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .hfcm__button--secondary {
    grid-column: 1 / -1;
  }
}

@media (max-width: 30rem) {
  .hfcm__banner {
    right: 0.5rem;
    bottom: 0.5rem;
    left: 0.5rem;
    max-height: calc(100vh - 1rem);
    padding: 1rem;
  }

  .hfcm__backdrop {
    align-items: end;
    padding: 0.5rem;
  }

  .hfcm__dialog {
    max-height: calc(100vh - 1rem);
    padding: 1rem;
  }

  .hfcm__actions--banner,
  .hfcm__actions--dialog {
    grid-template-columns: 1fr;
  }

  .hfcm__button--secondary {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hfcm * {
    scroll-behavior: auto !important;
  }
}
