:root{
  --cpd-bg: rgba(0,0,0,.78);
  --cpd-card: rgba(18,18,18,.92);
  --cpd-border: rgba(255,255,255,.10);
  --cpd-text: rgba(255,255,255,.92);
  --cpd-sub: rgba(255,255,255,.70);
  --cpd-accent1: #00f2ea; /* TikTok cyan */
  --cpd-accent2: #ff0050; /* TikTok pink */
}

/* Overlay */
#cpd-veil{
  position: fixed;
  inset: 0;
  background: var(--cpd-bg);
  z-index: 2147483000;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 14px;
  padding-left: calc(14px + env(safe-area-inset-left));
  padding-right: calc(14px + env(safe-area-inset-right));
  padding-bottom: calc(14px + env(safe-area-inset-bottom));

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  overscroll-behavior: contain;
}

@supports (height: 100dvh){
  #cpd-veil{ min-height: 100dvh; }
}

@media (min-width: 520px){
  #cpd-veil{ align-items: center; }
}

/* Card */
#cpd-box{
  width: min(94vw, 430px);
  max-height: min(86vh, 560px);
  max-height: min(86dvh, 560px);

  overflow: auto;
  -webkit-overflow-scrolling: touch;

  background: var(--cpd-card);
  border: 1px solid var(--cpd-border);
  border-radius: 16px;
  padding: 14px 14px 12px;

  box-shadow: 0 18px 60px rgba(0,0,0,.55);
  color: var(--cpd-text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;

  transform: translateY(18px);
  opacity: 0;
  animation: cpd-in .18s ease-out forwards;
}

@keyframes cpd-in{
  to { transform: translateY(0); opacity: 1; }
}

/* Top */
#cpd-top{
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

#cpd-logo{
  width: 44px; height: 44px;
  border-radius: 12px;
  background:
    radial-gradient(18px 18px at 30% 35%, rgba(0,242,234,.35), transparent 60%),
    radial-gradient(18px 18px at 70% 65%, rgba(255,0,80,.32), transparent 62%),
    linear-gradient(145deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.12);
  display:flex;
  align-items:center;
  justify-content:center;
  flex: 0 0 auto;
}

#cpd-logo svg{ width: 22px; height: 22px; opacity: .95; }

#cpd-title{
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .2px;
  margin: 0;
  line-height: 1.2;
}

#cpd-desc{
  font-size: 13px;
  color: var(--cpd-sub);
  margin: 4px 0 0;
  line-height: 1.35;
}

/* Close icon (still only closes when tapped) */
#cpd-close{
  margin-left: auto;
  width: 40px; height: 40px; /* tăng target cho mobile */
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.85);
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  -webkit-tap-highlight-color: transparent;
}
#cpd-close:hover{ background: rgba(255,255,255,.10); }

/* Actions */
#cpd-actions{
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.cpd-btn{
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 12px 12px;
  min-height: 44px; /* touch target */
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
  font-size: 13px;
  flex: 1 1 auto;
  transition: transform .06s ease, filter .12s ease, background .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.cpd-btn:active{ transform: translateY(1px) scale(.99); }

.cpd-ghost{
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.88);
  border: 1px solid rgba(255,255,255,.10);
}
.cpd-ghost:hover{ background: rgba(255,255,255,.10); }

.cpd-primary{
  color: #0b0b0b;
  background: linear-gradient(90deg, var(--cpd-accent1), var(--cpd-accent2));
  box-shadow: 0 10px 26px rgba(0,0,0,.25);
}
.cpd-primary:hover{ filter: brightness(1.03); }

#cpd-note{
  margin-top: 10px;
  font-size: 12px;
  color: rgba(255,255,255,.55);
  text-align: center;
}

/* Mobile tiny screens */
@media (max-width: 360px){
  #cpd-box{ padding: 12px 12px 10px; }
  #cpd-title{ font-size: 14px; }
  #cpd-desc{ font-size: 12.5px; }
}