:root {
  --pupmkt-consent-surface: var(--surface, var(--panel, #ffffff));
  --pupmkt-consent-surface-soft: var(--surface-soft, var(--panel-soft, #f2f5f8));
  --pupmkt-consent-text: var(--text-strong, var(--text, #111827));
  --pupmkt-consent-muted: var(--muted, #566273);
  --pupmkt-consent-line: var(--line, var(--border, #cfd6df));
  --pupmkt-consent-focus: var(--focus, var(--accent, #2563eb));
  --pupmkt-consent-primary: #172033;
  --pupmkt-consent-primary-text: #ffffff;
  --pupmkt-consent-backdrop: rgba(15, 23, 42, 0.56);
  --pupmkt-consent-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
}

:root[data-theme="dark"] {
  --pupmkt-consent-surface: var(--surface, var(--panel, #151e2a));
  --pupmkt-consent-surface-soft: var(--surface-soft, var(--panel-soft, #1b2735));
  --pupmkt-consent-text: var(--text-strong, var(--text, #f7faff));
  --pupmkt-consent-muted: var(--muted, #b8c3d1);
  --pupmkt-consent-line: var(--line, var(--border, #405064));
  --pupmkt-consent-primary: #edf3fb;
  --pupmkt-consent-primary-text: #101722;
  --pupmkt-consent-backdrop: rgba(3, 7, 12, 0.72);
  --pupmkt-consent-shadow: 0 22px 58px rgba(0, 0, 0, 0.42);
}

.pupmkt-consent-banner,
.pupmkt-consent-dialog,
.pupmkt-consent-footer-control {
  box-sizing: border-box;
  color: var(--pupmkt-consent-text);
  font-family: inherit;
}

.pupmkt-consent-banner *,
.pupmkt-consent-dialog *,
.pupmkt-consent-footer-control * {
  box-sizing: border-box;
}

.pupmkt-consent-banner[hidden] {
  display: none !important;
}

.pupmkt-consent-banner {
  position: fixed;
  z-index: 10020;
  right: auto;
  bottom: calc(
    max(0.75rem, env(safe-area-inset-bottom))
    + var(--mobile-nav-safe-height, var(--mobile-dock-offset, 0px))
  );
  left: 50%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(1rem, 2.4vw, 2rem);
  align-items: center;
  width: min(72rem, calc(100% - clamp(1.25rem, 4vw, 3rem)));
  max-height: calc(
    100dvh
    - max(1.5rem, env(safe-area-inset-top))
    - max(1.5rem, env(safe-area-inset-bottom))
    - var(--mobile-nav-safe-height, var(--mobile-dock-offset, 0px))
  );
  margin: 0;
  padding: clamp(1rem, 2.2vw, 1.4rem);
  overflow: auto;
  border: 1px solid var(--pupmkt-consent-line);
  border-radius: clamp(0.9rem, 2vw, 1.25rem);
  background: var(--pupmkt-consent-surface);
  box-shadow: var(--pupmkt-consent-shadow);
  transform: translateX(-50%);
}

.pupmkt-consent-copy {
  min-width: 0;
}

.pupmkt-consent-copy h2,
.pupmkt-consent-dialog h2 {
  margin: 0;
  color: var(--pupmkt-consent-text);
  font-size: clamp(1.08rem, 1.5vw, 1.3rem);
  font-weight: 750;
  line-height: 1.2;
  text-wrap: balance;
}

.pupmkt-consent-copy p,
.pupmkt-consent-dialog p {
  max-width: 66ch;
  margin: 0.45rem 0 0;
  color: var(--pupmkt-consent-muted);
  font-size: clamp(0.88rem, 1vw, 0.96rem);
  line-height: 1.55;
}

.pupmkt-consent-copy a {
  display: inline-flex;
  margin-top: 0.55rem;
  color: var(--pupmkt-consent-text);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.22em;
}

.pupmkt-consent-copy a:hover {
  text-decoration-thickness: 0.13em;
}

.pupmkt-consent-actions,
.pupmkt-consent-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: flex-end;
}

.pupmkt-consent-button,
.pupmkt-consent-footer-button {
  min-height: 2.75rem;
  margin: 0;
  border: 1px solid var(--pupmkt-consent-line);
  border-radius: 0.72rem;
  background: var(--pupmkt-consent-surface-soft);
  color: var(--pupmkt-consent-text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.pupmkt-consent-button {
  padding: 0.7rem 1rem;
}

.pupmkt-consent-button.is-primary {
  border-color: var(--pupmkt-consent-primary);
  background: var(--pupmkt-consent-primary);
  color: var(--pupmkt-consent-primary-text);
}

.pupmkt-consent-button.is-quiet {
  background: transparent;
}

.pupmkt-consent-button:hover,
.pupmkt-consent-footer-button:hover {
  border-color: var(--pupmkt-consent-text);
}

.pupmkt-consent-button.is-primary:hover {
  opacity: 0.9;
}

.pupmkt-consent-button:focus-visible,
.pupmkt-consent-footer-button:focus-visible,
.pupmkt-consent-copy a:focus-visible,
.pupmkt-consent-option input:focus-visible {
  outline: 3px solid var(--pupmkt-consent-focus);
  outline-offset: 3px;
}

.pupmkt-consent-dialog {
  width: min(36rem, calc(100% - clamp(1.25rem, 5vw, 3rem)));
  max-width: none;
  max-height: calc(100dvh - max(2rem, env(safe-area-inset-top)) - max(2rem, env(safe-area-inset-bottom)));
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--pupmkt-consent-line);
  border-radius: clamp(1rem, 2vw, 1.3rem);
  background: var(--pupmkt-consent-surface);
  color: var(--pupmkt-consent-text);
  box-shadow: var(--pupmkt-consent-shadow);
}

.pupmkt-consent-dialog::backdrop {
  background: var(--pupmkt-consent-backdrop);
  backdrop-filter: blur(2px);
}

.pupmkt-consent-dialog-form {
  display: grid;
  gap: 1.25rem;
  margin: 0;
  padding: clamp(1.1rem, 3vw, 1.6rem);
}

.pupmkt-consent-dialog-header {
  padding-right: 1rem;
}

.pupmkt-consent-options {
  display: grid;
  gap: 0.75rem;
}

.pupmkt-consent-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  min-width: 0;
  padding: 0.95rem;
  border: 1px solid var(--pupmkt-consent-line);
  border-radius: 0.9rem;
  background: var(--pupmkt-consent-surface-soft);
  color: var(--pupmkt-consent-text);
}

label.pupmkt-consent-option {
  cursor: pointer;
}

.pupmkt-consent-option span:first-child {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.pupmkt-consent-option strong {
  color: var(--pupmkt-consent-text);
  font-size: 0.94rem;
  line-height: 1.25;
}

.pupmkt-consent-option small {
  color: var(--pupmkt-consent-muted);
  font-size: 0.79rem;
  line-height: 1.45;
}

.pupmkt-consent-option input {
  width: 2.9rem;
  height: 1.6rem;
  margin: 0;
  accent-color: var(--pupmkt-consent-primary);
  cursor: pointer;
}

.pupmkt-consent-option.is-locked {
  cursor: default;
}

.pupmkt-consent-off {
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--pupmkt-consent-line);
  border-radius: 999px;
  color: var(--pupmkt-consent-muted);
  font-size: 0.75rem;
  font-weight: 750;
  white-space: nowrap;
}

.pupmkt-consent-dialog-actions {
  padding-top: 0.25rem;
  border-top: 1px solid var(--pupmkt-consent-line);
}

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

.pupmkt-consent-footer-control {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  margin-inline-start: auto;
}

.pupmkt-consent-footer-control.is-standalone {
  display: flex;
  justify-content: center;
  width: min(100% - 2rem, 72rem);
  margin: 1.5rem auto max(1.5rem, env(safe-area-inset-bottom));
}

.pupmkt-consent-footer-button {
  min-height: 2.25rem;
  padding: 0.45rem 0.7rem;
  background: transparent;
  color: inherit;
  font-size: 0.78rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --pupmkt-consent-surface: var(--surface, var(--panel, #151e2a));
    --pupmkt-consent-surface-soft: var(--surface-soft, var(--panel-soft, #1b2735));
    --pupmkt-consent-text: var(--text-strong, var(--text, #f7faff));
    --pupmkt-consent-muted: var(--muted, #b8c3d1);
    --pupmkt-consent-line: var(--line, var(--border, #405064));
    --pupmkt-consent-primary: #edf3fb;
    --pupmkt-consent-primary-text: #101722;
    --pupmkt-consent-backdrop: rgba(3, 7, 12, 0.72);
    --pupmkt-consent-shadow: 0 22px 58px rgba(0, 0, 0, 0.42);
  }
}

@media (max-width: 48rem) {
  .pupmkt-consent-banner {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.9rem;
  }

  .pupmkt-consent-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .pupmkt-consent-actions .is-quiet {
    grid-column: 1 / -1;
  }

  .pupmkt-consent-dialog-actions .pupmkt-consent-button {
    flex: 1 1 10rem;
  }
}

@media (max-width: 28rem) {
  .pupmkt-consent-banner {
    width: calc(100% - 1rem);
    padding: 0.9rem;
    border-radius: 0.9rem;
  }

  .pupmkt-consent-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .pupmkt-consent-actions .is-quiet {
    grid-column: auto;
  }

  .pupmkt-consent-option {
    grid-template-columns: minmax(0, 1fr);
  }

  .pupmkt-consent-option input,
  .pupmkt-consent-off {
    justify-self: start;
  }

  .pupmkt-consent-dialog-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (forced-colors: active) {
  .pupmkt-consent-banner,
  .pupmkt-consent-dialog,
  .pupmkt-consent-option,
  .pupmkt-consent-button,
  .pupmkt-consent-footer-button {
    border: 1px solid CanvasText;
  }

  .pupmkt-consent-button.is-primary {
    background: Highlight;
    color: HighlightText;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pupmkt-consent-banner,
  .pupmkt-consent-dialog,
  .pupmkt-consent-button,
  .pupmkt-consent-footer-button {
    scroll-behavior: auto;
    transition: none !important;
  }
}
