*,*::before,*::after{box-sizing:border-box;}

:root{
  --cpas-primary: #23bec4;
  --cpas-bg: #0b0f12;
  --cpas-panel: #121820;
  --cpas-card: #151d27;
  --cpas-text: #e8eef5;
  --cpas-muted: rgba(232,238,245,.7);
  --cpas-border: rgba(255,255,255,.08);
  --cpas-shadow: 0 20px 60px rgba(0,0,0,.55);
  --cpas-radius: 16px;
}

.cpas-hidden{display:none !important;}
.cpas-bubble{
  position: fixed; z-index: 999999;
  width: 56px; height: 56px;
  border-radius: 999px;
  background: var(--cpas-primary);
  box-shadow: var(--cpas-shadow);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
}
.cpas-bubble.br{ right: 18px; bottom: 18px;}
.cpas-bubble.bl{ left: 18px; bottom: 18px;}
.cpas-bubble svg{ width: 26px; height: 26px; fill: #001214; opacity:.95;}
.cpas-badge{
  position:absolute; top:-6px; right:-6px;
  min-width: 18px; height: 18px;
  padding:0 5px;
  border-radius: 999px;
  background:#ff3b30;
  color:#fff;
  font-size:12px;
  display:flex; align-items:center; justify-content:center;
  border:2px solid rgba(0,0,0,.25);
}

.cpas-drawer{
  position: fixed; z-index: 999998;
  top: 0; bottom: 0;
  width: 380px; max-width: 92vw;
  background: var(--cpas-panel);
  border-left: 1px solid var(--cpas-border);
  box-shadow: var(--cpas-shadow);
  transform: translateX(110%);
  transition: transform .22s ease;
  display:flex; flex-direction: column;
}
.cpas-drawer.open{ transform: translateX(0); }
.cpas-drawer.br{ right:0; }
.cpas-drawer.bl{ left:0; border-left:none; border-right:1px solid var(--cpas-border); transform: translateX(-110%); }
.cpas-drawer.bl.open{ transform: translateX(0); }
.cpas-header{
  padding: 12px 14px;
  border-bottom: 1px solid var(--cpas-border);
  display:flex; align-items:center; gap:10px;
}
.cpas-avatar{
  width: 34px; height: 34px; border-radius: 999px;
  background: rgba(255,255,255,.12);
  overflow:hidden;
  flex:0 0 auto;
}
.cpas-avatar img{width:100%;height:100%;object-fit:cover;display:block;}
.cpas-hmeta{flex:1; min-width: 0;}
.cpas-hname{color:var(--cpas-text); font-weight: 700; font-size: 14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.cpas-hsub{color:var(--cpas-muted); font-size:12px; display:flex; gap:8px; align-items:center;}
.cpas-dot{width:8px;height:8px;border-radius:999px;background:#3ddc84; display:inline-block;}
.cpas-close{background:transparent;border:none;color:var(--cpas-muted); font-size:22px; cursor:pointer; padding:6px 8px;}
.cpas-body{ flex:1; overflow:auto; padding: 14px; background: var(--cpas-bg); }
.cpas-msg{ display:flex; margin: 10px 0; }
.cpas-msg.in{ justify-content:flex-start;}
.cpas-msg.out{ justify-content:flex-end;}
.cpas-bubblemsg{
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 16px;
  line-height: 1.35;
  font-size: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.cpas-msg.in .cpas-bubblemsg{ background: rgba(255,255,255,.10); color: var(--cpas-text); border: 1px solid rgba(255,255,255,.06);}
.cpas-msg.out .cpas-bubblemsg{ background: rgba(35,190,196,.20); color: var(--cpas-text); border: 1px solid rgba(35,190,196,.25);}
.cpas-typing{ display:flex; gap:6px; align-items:center; padding: 6px 2px; color: var(--cpas-muted); font-size: 12px;}
.cpas-dots{ display:inline-flex; gap:4px; }
.cpas-dots span{ width:6px; height:6px; border-radius:999px; background: rgba(232,238,245,.65); display:block; animation: cpasDot 1.1s infinite ease-in-out; }
.cpas-dots span:nth-child(2){ animation-delay: .15s;}
.cpas-dots span:nth-child(3){ animation-delay: .3s;}
@keyframes cpasDot{ 0%, 80%, 100% { transform: translateY(0); opacity:.55;} 40% { transform: translateY(-3px); opacity: 1;} }

.cpas-footer{
  padding: 12px 14px;
  border-top: 1px solid var(--cpas-border);
  background: var(--cpas-panel);
}
.cpas-row{ display:flex; gap:10px; align-items:flex-end;}
.cpas-input{
  flex:1;
  min-height: 40px;
  max-height: 120px;
  resize:none;
  border-radius: 14px;
  border:1px solid var(--cpas-border);
  background: rgba(255,255,255,.04);
  color: var(--cpas-text);
  padding: 10px 12px;
  outline:none;
}
.cpas-send{
  height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  border:1px solid rgba(0,0,0,.15);
  background: var(--cpas-primary);
  color:#001214;
  font-weight: 700;
  cursor:pointer;
}
.cpas-meta{
  margin-top: 8px;
  display:flex; justify-content:space-between; gap:10px;
  color: var(--cpas-muted); font-size: 12px;
}
.cpas-link{ color: rgba(35,190,196,.95); text-decoration:none; }
.cpas-link:hover{ text-decoration:underline; }

.cpas-inbox-root{ padding: 16px; background: transparent; }
.cpas-inbox{ max-width: 920px; margin: 0 auto; display:grid; grid-template-columns: 1.1fr 1.4fr; gap: 16px; }
.cpas-panel{ background: var(--cpas-panel); border:1px solid var(--cpas-border); border-radius: var(--cpas-radius); overflow:hidden; box-shadow: var(--cpas-shadow); }
.cpas-list{ padding: 0; margin: 0; list-style:none; }
.cpas-item{ padding: 12px 14px; border-bottom: 1px solid var(--cpas-border); cursor:pointer; }
.cpas-item:hover{ background: rgba(255,255,255,.03);}
.cpas-item .t{ color: var(--cpas-text); font-weight: 700; font-size: 14px; }
.cpas-item .s{ color: var(--cpas-muted); font-size: 12px; margin-top:2px; }
@media (max-width: 860px){
  .cpas-inbox{ grid-template-columns: 1fr; }
}

.cpas-drawer, .cpas-bubble, .cpas-inbox-root{ font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Inter,Arial,sans-serif; }

.cpas-picker{ padding: 14px; border-bottom:1px solid var(--cpas-border); background: var(--cpas-panel); }
.cpas-picker input{
  width: 100%;
  border-radius: 12px;
  border:1px solid var(--cpas-border);
  background: rgba(255,255,255,.04);
  color: var(--cpas-text);
  padding: 10px 12px;
  outline:none;
}
.cpas-profiles{ padding: 10px; display:flex; flex-direction:column; gap:10px; }
.cpas-prof{
  display:flex; gap:10px; align-items:center;
  padding: 10px; border-radius: 14px;
  border:1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.04);
  cursor:pointer;
}
.cpas-prof:hover{ background: rgba(255,255,255,.06); }
.cpas-prof .av{ width:38px;height:38px;border-radius:999px; background: rgba(255,255,255,.12); overflow:hidden; flex:0 0 auto;}
.cpas-prof .av img{width:100%;height:100%;object-fit:cover;display:block;}
.cpas-prof .meta{ min-width:0; }
.cpas-prof .nm{ font-weight:800; color:var(--cpas-text); font-size:14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.cpas-prof .lo{ font-size:12px; color:var(--cpas-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.cpas-topup-modal{
  position:fixed; inset:0; z-index:999997; display:none;
  background: rgba(0,0,0,.55);
  align-items:center; justify-content:center;
  padding: 18px;
}
.cpas-topup-modal.open{ display:flex; }
.cpas-topup-card{
  width: 520px; max-width: 96vw;
  background: var(--cpas-panel);
  border:1px solid var(--cpas-border);
  border-radius: 18px;
  box-shadow: var(--cpas-shadow);
  overflow:hidden;
}
.cpas-topup-card .hd{ padding: 12px 14px; border-bottom:1px solid var(--cpas-border); display:flex; align-items:center; justify-content:space-between;}
.cpas-topup-card .bd{ padding: 14px; display:grid; grid-template-columns: 1fr 1fr; gap:12px; background: var(--cpas-bg);}
.cpas-pack{
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  border-radius: 16px;
  padding: 12px;
  cursor:pointer;
}
.cpas-pack:hover{ background: rgba(255,255,255,.06); }
.cpas-pack .t{ font-weight:900; color:var(--cpas-text); }
.cpas-pack .p{ color:var(--cpas-muted); margin-top:4px; font-size:12px; }
.cpas-pack .c{ margin-top:10px; font-weight:900; color: var(--cpas-primary); }


/* === Layout hardening (prevents overlap in themes) === */
.cpas-drawer{
  width: min(420px, calc(100vw - 24px));
  height: min(680px, calc(100vh - var(--cpas-adminbar) - 24px));
  max-height: calc(100vh - var(--cpas-adminbar) - 24px);
  bottom: 12px;
  top: auto;
  border-radius: 18px;
  overflow: hidden;
  display:flex;
  flex-direction:column;
}
.cpas-header{
  flex:0 0 auto;
  padding: 12px 12px;
  min-height: 56px;
  align-items:center;
}
.cpas-close{
  width: 38px; height: 38px;
  border-radius: 12px;
  line-height: 38px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.cpas-body{
  flex: 1 1 auto;
  min-height: 0;
  overflow:auto;
  padding-bottom: 12px;
}
.cpas-footer{
  flex:0 0 auto;
  padding: 10px 12px 12px;
  border-top:1px solid var(--cpas-border);
  background: var(--cpas-panel);
}
.cpas-row{ display:flex; gap:10px; align-items:flex-end; }
.cpas-input{ min-height: 44px; max-height: 110px; resize:none; }
.cpas-send{ height: 44px; border-radius: 14px; }
body.cpas-chat-open .cpas-bubble{ opacity:0; pointer-events:none; transform: scale(.85); }
@media (max-width: 560px){
  .cpas-drawer{
    inset: auto 0 0 0;
    width: 100vw;
    height: calc(100vh - var(--cpas-adminbar));
    max-height: calc(100vh - var(--cpas-adminbar));
    border-radius: 18px 18px 0 0;
    bottom: 0;
  }
  .cpas-footer{ padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}


/* Shortcodes: Buy Coins + Profiles */
.cpas-buy-wrap{ max-width: 980px; margin: 18px auto; padding: 0 12px; }
.cpas-buy-card{ border:1px solid rgba(0,0,0,.08); border-radius:18px; padding:14px; background:#fff; box-shadow: 0 10px 30px rgba(0,0,0,.06); }
.cpas-buy-title{ font-weight:900; font-size:14px; }
.cpas-buy-balance{ font-size:34px; font-weight:950; margin-top:6px; }
.cpas-buy-sub{ color:#667085; margin-top:4px; }
.cpas-buy-grid{ display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:12px; margin-top:12px; }
@media(max-width:820px){ .cpas-buy-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media(max-width:520px){ .cpas-buy-grid{ grid-template-columns: 1fr; } }
.cpas-buy-pack{ display:block; text-decoration:none !important; border:1px solid rgba(0,0,0,.08); border-radius:18px; padding:14px; background:#fff; box-shadow: 0 10px 24px rgba(0,0,0,.05); }
.cpas-buy-pack:hover{ transform: translateY(-1px); }
.cpas-buy-pack .t{ font-weight:950; color:#111827; }
.cpas-buy-pack .c{ margin-top:10px; font-weight:950; color: var(--cpas-primary, #23bec4); font-size:18px; }
.cpas-buy-pack .p{ margin-top:4px; color:#667085; }
.cpas-buy-note{ margin-top:12px; color:#667085; font-size:13px; }
.cpas-profiles-page{ max-width: 1100px; margin: 18px auto; padding: 0 12px; display:grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap:12px; }
@media(max-width:1100px){ .cpas-profiles-page{ grid-template-columns: repeat(4, minmax(0,1fr)); } }
@media(max-width:760px){ .cpas-profiles-page{ grid-template-columns: repeat(2, minmax(0,1fr)); } }
.cpas-prof-card{ display:block; text-decoration:none !important; border:1px solid rgba(0,0,0,.08); border-radius:18px; padding:12px; background:#fff; box-shadow:0 10px 24px rgba(0,0,0,.05); }
.cpas-prof-card .av{ width:54px; height:54px; border-radius:999px; overflow:hidden; background: rgba(0,0,0,.06); }
.cpas-prof-card .av img{ width:100%; height:100%; object-fit:cover; display:block; }
.cpas-prof-card .nm{ margin-top:10px; font-weight:950; color:#111827; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cpas-prof-card .lo{ margin-top:3px; font-size:12px; color:#667085; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
