.cp-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.cp-overlay.open { display: flex; }

.cp-card {
  width: min(440px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  padding: 30px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  color: #111827;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .16), 0 8px 24px rgba(15, 23, 42, .08);
  overflow: hidden;
}

.cp-logo {
  width: 350px;
  height: auto;
  object-fit: contain;
  margin: 0 auto 28px;
  border-radius: 13px;
  align-self: center;
}

.cp-header h2 {
  margin: 0 0 8px;
  font-family: "Inter", sans-serif;
  font-size: 21px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -.025em;
  color: #111827;
}

.cp-header p {
  margin: 0 0 20px;
  font-family: "Inter", sans-serif;
  font-size: 13px;
  line-height: 1.55;
  color: #6b7280;
}

.cp-terms-intro {
  margin: 0 0 16px;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  line-height: 1.6;
  color: #6b7280;
  text-align: center;
  white-space: nowrap;
}

.cp-terms-intro a {
  display: inline-block;
  color: #374151;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid #b8c0cc;
  padding-bottom: 1px;
  line-height: 1.2;
  transition: color .15s ease, border-color .15s ease;
}

.cp-terms-intro a:hover {
  color: #4f91aa;
  border-bottom-color: #4f91aa;
}

.cp-terms-box {
  height: 210px;
  overflow-y: auto;
  padding: 20px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .02);
}

.cp-terms-box::-webkit-scrollbar { width: 5px; }
.cp-terms-box::-webkit-scrollbar-track { background: transparent; }
.cp-terms-box::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 20px; }
.cp-terms-box::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.cp-terms-box h3 {
  margin: 0 0 16px;
  font-family: "Inter", sans-serif;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.4;
  color: #1f2937;
}

.cp-terms-box p {
  margin: 0 0 15px;
  font-family: "Inter", sans-serif;
  font-size: 13px;
  line-height: 1.7;
  font-weight: 400;
  color: #64748b;
}

.cp-terms-box p:last-child { margin-bottom: 0; }

.cp-scroll-note {
  padding: 10px 2px 16px;
  text-align: center;
  font-family: "Inter", sans-serif;
  font-size: 10.5px;
  line-height: 1.4;
  color: #94a3b8;
  transition: opacity .2s ease, height .2s ease, padding .2s ease;
}

.cp-scroll-note.is-hidden {
  opacity: 0;
  height: 0;
  padding: 0;
  overflow: hidden;
}

.cp-toggle-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  margin-bottom: 22px;
  cursor: pointer;
  user-select: none;
}

.cp-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.cp-switch {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #e5e7eb;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .08);
  transition: background .2s ease, box-shadow .2s ease;
}

.cp-switch-dot {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .2), 0 1px 2px rgba(15, 23, 42, .08);
  transition: transform .2s ease, background .2s ease;
}

.cp-checkbox:checked + .cp-switch {
  background: #ffd600;
  box-shadow: 0 0 0 3px rgba(105, 170, 193, .12);
}

.cp-checkbox:checked + .cp-switch .cp-switch-dot {
  transform: translateX(18px);
  background: #fff;
}

.cp-checkbox:disabled + .cp-switch { opacity: .55; }
.cp-toggle-row:has(.cp-checkbox:disabled) { cursor: not-allowed; }

.cp-toggle-label {
  color: #64748b;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.cp-toggle-label span {
  color: #1f2937;
  font-weight: 500;
}

.cp-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 10px;
}

.cp-actions button {
  height: 46px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.cp-actions button:hover { transform: translateY(-1px); }
.cp-actions button:active { transform: translateY(0); }

.cp-decline {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.cp-decline:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.cp-continue {
  color: #000000;
  background: #ffd600;
  box-shadow: 0 4px 10px rgba(105, 170, 193, .18);
}

.cp-continue:hover {
  background: #5d9eb5;
  box-shadow: 0 6px 14px rgba(105, 170, 193, .24);
}

.cp-continue:disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.cp-continue:disabled:hover {
  transform: none;
  background: #ffd600;
}

.cp-actions button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(105, 170, 193, .2);
}

.cp-toggle-row:focus-within .cp-switch {
  box-shadow: 0 0 0 3px rgba(105, 170, 193, .18);
}

@media (max-width: 600px) {
  .cp-overlay { align-items: flex-end; padding: 10px; }
  .cp-card {
    width: 100%;
    max-height: calc(100vh - 20px);
    padding: 22px;
    border-radius: 22px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .18), 0 6px 20px rgba(15, 23, 42, .08);
  }
  .cp-logo { width: 250px; height: auto; margin-bottom: 16px; }
  .cp-header h2 { font-size: 19px; }
  .cp-header p { font-size: 13px; }
  .cp-terms-intro { font-size: 12.5px; margin-bottom: 14px; white-space: normal; }
  .cp-terms-box { height: 200px; padding: 17px; }
  .cp-terms-box h3 { font-size: 15px; }
  .cp-terms-box p { font-size: 12.5px; }
  .cp-actions button { height: 44px; }
}

@media (max-width: 380px) {
  .cp-card { padding: 18px; border-radius: 20px; }
  .cp-logo { width: 210px; }
  .cp-terms-box { height: 185px; padding: 15px; }
  .cp-toggle-row { gap: 11px; }
  .cp-toggle-label { font-size: 13px; }
  .cp-actions { grid-template-columns: 1fr; }
}

/* =========================================================
   DECLINE / CLOSE RESET HOOK
   =========================================================
   The checkbox itself must be reset by JavaScript when the popup
   is declined or closed. CSS cannot change the :checked property.
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .cp-switch,
  .cp-switch-dot,
  .cp-actions button,
  .cp-terms-intro a,
  .cp-scroll-note { transition: none; }
}
