html.privacy-banner-visible { scroll-padding-bottom: var(--privacy-banner-clearance); }
html.privacy-banner-visible body { padding-bottom: var(--privacy-banner-clearance); }

.privacy-consent[hidden],
.privacy-settings-trigger[hidden],
.privacy-preferences[hidden],
.privacy-consent [hidden],
.privacy-preferences [hidden] { display: none !important; }

.privacy-consent {
  position: fixed;
  z-index: 20;
  inset-inline: .75rem;
  bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 28rem);
  align-items: center;
  gap: .75rem 1.15rem;
  max-width: 68rem;
  max-height: calc(100dvh - 1.5rem - env(safe-area-inset-bottom, 0px));
  margin-inline: auto;
  padding: .85rem;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #517395;
  border-radius: clamp(1.15rem, 3vw, 1.65rem);
  background: var(--dark);
  color: var(--white);
  box-shadow: 0 10px 38px #061a3355;
}

.consent-copy {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .65rem;
}

.consent-mark {
  display: grid;
  place-items: center;
  width: 2.65rem;
  height: 2.65rem;
  border: 1px solid #537595;
  border-radius: 50%;
  background: #173959;
  color: var(--accent);
}

.consent-mark svg { width: 1.5rem; height: 1.5rem; }

.consent-copy h2 {
  margin: 0 0 .2rem;
  font-size: 1rem;
  line-height: 1.2;
  text-wrap: initial;
}

.consent-copy p {
  margin: 0;
  color: var(--dark-muted);
  font-size: .85rem;
  line-height: 1.4;
}

.consent-copy a {
  color: var(--white);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .15em;
}

.consent-actions,
.consent-dialog-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .4rem;
}

.consent-button,
.consent-close,
.privacy-settings-trigger {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  padding: .4rem .7rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: .84rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.privacy-consent .consent-button,
.privacy-settings-trigger {
  border-color: var(--white);
  background: var(--white);
  color: var(--ink);
}

.privacy-consent .consent-button:hover,
.privacy-settings-trigger:hover { background: #dfedfa; }

.privacy-consent .consent-button:nth-child(2) {
  border-color: #81a0bd;
  background: var(--dark-panel);
  color: var(--white);
}

.privacy-consent .consent-button:nth-child(2):hover { background: #183954; }

.privacy-consent :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.privacy-settings-trigger {
  position: fixed;
  z-index: 19;
  inset-inline-end: .75rem;
  bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
  gap: .35rem;
  padding-inline: .75rem;
  border-color: #7294b4;
  box-shadow: 0 4px 16px #061a3330;
}

.privacy-settings-trigger svg {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  color: var(--blue);
}

.privacy-preferences {
  width: min(100% - 1.5rem, 36rem);
  max-width: none;
  max-height: calc(100dvh - 1.5rem);
  padding: clamp(.9rem, 3.25vw, 1.6rem);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: clamp(1.15rem, 4vw, 1.75rem);
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 12px 45px #061a3355;
}

.privacy-preferences::backdrop { background: #061a33bb; }

.consent-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .45rem;
}

.consent-dialog-header h2 {
  margin: 0;
  font: 400 clamp(1.8rem, 5.8vw, 2.65rem)/1 var(--serif);
  letter-spacing: -.015em;
}

.consent-close {
  flex: 0 0 44px;
  width: 44px;
  padding: 0;
  border-color: var(--line);
  background: var(--paper);
  color: var(--blue-hover);
  font-size: 1.35rem;
}

.consent-close:hover { background: #e5f0fa; }
.consent-close svg { width: 1.1rem; height: 1.1rem; }

.consent-intro {
  margin: .5rem 0 .85rem;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
}

.consent-category {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: .45rem .65rem;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--paper);
}

.consent-category + .consent-category { margin-top: .45rem; }
.consent-category h3 { font-size: 1rem; line-height: 1.3; }

.consent-required {
  align-self: start;
  padding: .2rem .45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--blue-hover);
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.3;
}

.consent-category p,
.consent-note,
.consent-context {
  margin: .25rem 0 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.4;
}

.consent-category label {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  cursor: pointer;
  font-weight: 700;
}

.consent-category input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  margin: .2rem .15rem 0 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.consent-context {
  margin-bottom: .6rem;
  padding: .55rem .65rem;
  border-inline-start: 2px solid var(--blue);
  border-radius: .45rem;
  background: #eaf3fc;
}

.consent-context a,
.consent-note a,
.consent-category a {
  color: var(--blue-hover);
  font-weight: 700;
  text-decoration: underline;
}

.consent-context p { margin: 0; }
.consent-external-link { display: inline-block; margin-top: .25rem; }

.consent-dialog-actions { margin-top: .8rem; }

.consent-dialog-actions .consent-button {
  border-color: var(--blue);
  background: var(--white);
  color: var(--blue-hover);
}

.consent-dialog-actions .consent-button:hover { background: #eaf3fc; }

.consent-dialog-actions .consent-button:nth-child(2) {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--white);
}

.consent-dialog-actions .consent-button:nth-child(2):hover { background: var(--blue-hover); }

.privacy-preferences :focus-visible,
.privacy-settings-trigger:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.consent-note { margin-top: .7rem; }

.consent-feedback {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 52rem) {
  .privacy-consent { grid-template-columns: 1fr; }
}

@media (max-width: 25rem) {
  .privacy-consent { inset-inline: .5rem; padding: .65rem; gap: .55rem; }
  .consent-mark { grid-area: mark; width: 2.15rem; height: 2.15rem; }
  .consent-mark svg { width: 1.2rem; height: 1.2rem; }
  .consent-copy { grid-template-areas: "mark title" "description description"; gap: .35rem .5rem; }
  .consent-copy > div { display: contents; }
  .consent-copy h2 { grid-area: title; margin: 0; }
  .consent-copy p { grid-area: description; font-size: .8rem; }
  .consent-button { padding-inline: .2rem; font-size: .78rem; }
}

@media (max-height: 30rem) and (orientation: landscape) {
  .privacy-consent { bottom: calc(.35rem + env(safe-area-inset-bottom, 0px)); }
  .privacy-preferences { max-height: calc(100dvh - 1rem); }
}

@media (prefers-reduced-motion: reduce) {
  .privacy-consent,
  .privacy-preferences,
  .privacy-settings-trigger { scroll-behavior: auto; }
}
