.ccm-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  color: var(--text);
  padding: 16px;
  z-index: 99998;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 -10px 30px rgba(0,0,0,.25);
}

.ccm-banner.ccm-visible {
  opacity: 1;
}

/* slide vs fade */
.ccm-banner.ccm-anim-slide.ccm-visible {
  transform: translateY(0);
}

.ccm-banner.ccm-anim-fade {
  transform: translateY(0);
}

.ccm-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.ccm-msg {
  margin: 0 0 12px;
}

.ccm-link {
  color: var(--link);
  text-decoration: underline;
}

.ccm-link:hover {
  color: var(--linkh);
}

.ccm-link:visited {
  color: var(--linkv);
}

.ccm-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.ccm-buttons.align-left {
  justify-content: flex-start;
}

.ccm-buttons.align-center {
  justify-content: center;
}

.ccm-buttons.align-right {
  justify-content: flex-end;
}

.ccm-btn {
  padding: 12px 16px;
  border-radius: 8px;
  border: 0;
  color: #ffffff;
  cursor: pointer;
  flex: 1 0 0;
  max-width: 200px;
  font-weight: 600;
  text-align: center;
}

.ccm-accept { background: var(--accept); }
.ccm-reject { background: var(--reject); }
.ccm-prefs  { background: var(--prefs); }
.ccm-save   { background: var(--save); }

/* Modal */

.ccm-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.ccm-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.ccm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.7);
}

.ccm-modal-dialog {
  position: relative;
  background: #0b1220;
  color: #e5e7eb;
  padding: 20px 20px 16px;
  border-radius: 16px;
  width: min(560px, 94vw);
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.ccm-modal.is-open .ccm-modal-dialog {
  transform: translateY(0);
}

.ccm-modal h2 {
  margin-top: 0;
  margin-bottom: 8px;
}

.ccm-modal p {
  margin-top: 0;
  margin-bottom: 12px;
}

.ccm-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  border: 0;
  background: transparent;
  color: #9ca3af;
  font-size: 22px;
  cursor: pointer;
}

.ccm-modal-body {
  margin-top: 8px;
}

.ccm-modal-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(148,163,184,0.4);
}

.ccm-modal-row:last-child {
  border-bottom: 0;
}

.ccm-modal-footer {
  margin-top: 16px;
  text-align: right;
}

/* Toggle switch */

.ccm-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.ccm-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ccm-switch span {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #6b7280;
  transition: .2s;
  border-radius: 999px;
}

.ccm-switch span:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #ffffff;
  transition: .2s;
  border-radius: 999px;
}

.ccm-switch input:checked + span {
  background: #22c55e;
}

.ccm-switch input:checked + span:before {
  transform: translateX(20px);
}

/* Mobile */

@media (max-width: 700px) {
  .ccm-buttons {
    flex-direction: column;
  }
  .ccm-btn {
    max-width: none;
  }
  .ccm-modal-dialog {
    width: min(94vw, 480px);
    padding: 18px 16px 14px;
  }
}

/* Persistent / inline preferences controls */
.ccm-reopen {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 99997;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(15,23,42,.14);
  border-radius: 50%;
  background: rgba(255,255,255,.88);
  color: rgba(15,23,42,.68);
  font: inherit;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: .72;
  transition: opacity .18s ease, transform .18s ease, box-shadow .18s ease;
}

.ccm-reopen:hover,
.ccm-reopen:focus-visible {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,.13);
}

.ccm-reopen:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.ccm-reopen-icon {
  display: block;
  font-size: 20px;
  line-height: 1;
}

.ccm-screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.ccm-inline-preferences {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.ccm-reopen[hidden],
.ccm-banner[hidden],
.ccm-modal[hidden] {
  display: none !important;
}


/* 2.0.4 display styles */
.ccm-banner.ccm-display-corner {
  left: auto;
  right: var(--ccm-box-offset);
  bottom: var(--ccm-box-offset);
  width: min(var(--ccm-box-width), calc(100vw - (var(--ccm-box-offset) * 2)));
  padding: 0;
  border-radius: var(--ccm-box-radius);
  box-shadow: 0 12px 34px rgba(0,0,0,.20);
  overflow: hidden;
}

.ccm-banner.ccm-display-corner.ccm-corner-bottom-left {
  left: var(--ccm-box-offset);
  right: auto;
}

.ccm-display-corner .ccm-inner {
  position: relative;
  max-width: none;
  margin: 0;
  padding: 20px;
}

.ccm-display-corner .ccm-box-heading {
  margin: 0 0 8px;
  padding-right: calc(var(--ccm-logo-width) + 18px);
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text);
}

.ccm-display-corner .ccm-msg {
  margin: 0 0 14px;
  line-height: 1.45;
}

.ccm-display-corner .ccm-box-prompt {
  margin: 0 0 9px;
  font-size: .94em;
  font-weight: 700;
}

.ccm-display-corner .ccm-brand-logo {
  line-height: 0;
  margin-bottom: 14px;
}

.ccm-display-corner .ccm-brand-logo img {
  display: block;
  max-width: var(--ccm-logo-width);
  max-height: 80px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.ccm-display-corner .ccm-logo-top-right .ccm-brand-logo,
.ccm-display-corner .ccm-logo-top-left .ccm-brand-logo {
  position: absolute;
  top: 18px;
  margin: 0;
}

.ccm-display-corner .ccm-logo-top-right .ccm-brand-logo { right: 20px; }
.ccm-display-corner .ccm-logo-top-left .ccm-brand-logo { left: 20px; }

.ccm-display-corner .ccm-logo-top-left .ccm-box-heading,
.ccm-display-corner .ccm-logo-top-left .ccm-msg {
  padding-left: calc(var(--ccm-logo-width) + 18px);
  padding-right: 0;
}

.ccm-display-corner .ccm-logo-above .ccm-box-heading {
  padding-right: 0;
}

.ccm-display-corner .ccm-buttons {
  flex-wrap: nowrap;
  gap: 8px;
}

.ccm-display-corner .ccm-btn {
  min-width: 0;
  max-width: none;
  padding: 10px 8px;
  font-size: 13px;
  line-height: 1.2;
  white-space: normal;
}

@media (max-width: 700px) {
  .ccm-banner.ccm-display-corner,
  .ccm-banner.ccm-display-corner.ccm-corner-bottom-left {
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
  }

  .ccm-display-corner .ccm-inner {
    padding: 18px;
  }

  .ccm-display-corner .ccm-buttons {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .ccm-display-corner .ccm-btn {
    flex: 1 1 30%;
  }

  .ccm-display-corner .ccm-logo-top-left .ccm-brand-logo,
  .ccm-display-corner .ccm-logo-top-right .ccm-brand-logo {
    position: static;
    margin: 0 0 12px;
  }

  .ccm-display-corner .ccm-logo-top-left .ccm-box-heading,
  .ccm-display-corner .ccm-logo-top-left .ccm-msg,
  .ccm-display-corner .ccm-box-heading {
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 430px) {
  .ccm-display-corner .ccm-buttons {
    flex-direction: column;
  }
  .ccm-display-corner .ccm-btn {
    width: 100%;
  }
}


/* 2.0.5: balanced corner-box heading/logo row */
.ccm-display-corner .ccm-logo-top-right,
.ccm-display-corner .ccm-logo-top-left {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 18px;
  align-items: center;
}

.ccm-display-corner .ccm-logo-top-right .ccm-box-heading,
.ccm-display-corner .ccm-logo-top-left .ccm-box-heading {
  grid-row: 1;
  margin: 0;
  padding: 0;
  align-self: center;
}

.ccm-display-corner .ccm-logo-top-right .ccm-box-heading {
  grid-column: 1;
}

.ccm-display-corner .ccm-logo-top-left .ccm-box-heading {
  grid-column: 2;
}

.ccm-display-corner .ccm-logo-top-right .ccm-brand-logo,
.ccm-display-corner .ccm-logo-top-left .ccm-brand-logo {
  position: static;
  grid-row: 1;
  margin: 0;
  align-self: center;
}

.ccm-display-corner .ccm-logo-top-right .ccm-brand-logo {
  grid-column: 2;
}

.ccm-display-corner .ccm-logo-top-left .ccm-brand-logo {
  grid-column: 1;
}

.ccm-display-corner .ccm-logo-top-right .ccm-msg,
.ccm-display-corner .ccm-logo-top-left .ccm-msg {
  grid-column: 1 / -1;
  margin-top: 20px;
  padding: 0;
}

.ccm-display-corner .ccm-logo-top-right .ccm-box-prompt,
.ccm-display-corner .ccm-logo-top-left .ccm-box-prompt,
.ccm-display-corner .ccm-logo-top-right .ccm-buttons,
.ccm-display-corner .ccm-logo-top-left .ccm-buttons {
  grid-column: 1 / -1;
}

@media (max-width: 700px) {
  .ccm-display-corner .ccm-logo-top-right,
  .ccm-display-corner .ccm-logo-top-left {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 14px;
    align-items: center;
  }

  .ccm-display-corner .ccm-logo-top-right .ccm-brand-logo,
  .ccm-display-corner .ccm-logo-top-left .ccm-brand-logo {
    position: static;
    margin: 0;
  }

  .ccm-display-corner .ccm-logo-top-right .ccm-msg,
  .ccm-display-corner .ccm-logo-top-left .ccm-msg {
    margin-top: 18px;
  }
}


/* 2.0.6: restore full-width corner-box buttons */
.ccm-display-corner .ccm-buttons {
  width: 100%;
  justify-self: stretch;
}

.ccm-display-corner .ccm-logo-top-right .ccm-buttons,
.ccm-display-corner .ccm-logo-top-left .ccm-buttons {
  grid-column: 1 / -1;
  display: flex;
  width: 100%;
}

.ccm-display-corner .ccm-buttons .ccm-btn {
  flex: 1 1 0;
  width: 0;
  max-width: none;
}

@media (max-width: 430px) {
  .ccm-display-corner .ccm-buttons .ccm-btn {
    width: 100%;
    flex: 1 1 auto;
  }
}


/* 2.0.7: preferences modal follows the banner colour scheme */
.ccm-modal-dialog {
  background: var(--bg);
  color: var(--text);
}

.ccm-modal-dialog h2,
.ccm-modal-dialog strong,
.ccm-modal-dialog p {
  color: var(--text);
}

.ccm-modal-close {
  color: var(--text);
  opacity: .72;
}

.ccm-modal-close:hover,
.ccm-modal-close:focus {
  color: var(--text);
  opacity: 1;
}

.ccm-modal-row {
  border-bottom-color: color-mix(in srgb, var(--text) 24%, transparent);
}

.ccm-modal-dialog .ccm-link {
  color: var(--link);
}

.ccm-modal-dialog .ccm-link:hover {
  color: var(--linkh);
}

.ccm-modal-dialog .ccm-link:visited {
  color: var(--linkv);
}

.ccm-modal-dialog .ccm-save {
  background: var(--save);
}


/* 2.0.11: reliable delayed entrance animation */
.ccm-banner {
  will-change: opacity, transform;
}

.ccm-banner.ccm-anim-slide:not(.ccm-visible) {
  opacity: 0;
  transform: translateY(28px);
}

.ccm-banner.ccm-anim-fade:not(.ccm-visible) {
  opacity: 0;
  transform: none;
}

.ccm-banner.ccm-anim-slide.ccm-visible,
.ccm-banner.ccm-anim-fade.ccm-visible {
  opacity: 1;
  transform: translateY(0);
}
