:root{
  --bg0:#05060a;
  --bg1:#0b0f1a;
  --panel:rgba(18,22,36,.62);
  --panel2:rgba(10,12,20,.78);
  --border:rgba(255,255,255,.08);
  --border2:rgba(255,255,255,.12);
  --text:#e9ecff;
  --muted:rgba(233,236,255,.72);
  --muted2:rgba(233,236,255,.52);
  --accent:#8b5cf6;
  --accent2:#ec4899;
  --good:#22c55e;
  --bad:#ef4444;
  --shadow: 0 18px 60px rgba(0,0,0,.55);
  --radius: 22px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background:
    radial-gradient(1000px 700px at 15% 10%, rgba(139,92,246,.30), transparent 55%),
    radial-gradient(900px 600px at 85% 5%, rgba(236,72,153,.22), transparent 55%),
    radial-gradient(900px 700px at 75% 95%, rgba(34,197,94,.12), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  overflow:auto;
}

a{color:inherit}
.small{font-size:12px; color:var(--muted2); line-height:1.35}
.muted{color:var(--muted)}
.hidden{display:none!important}

.glass{
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border:1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.layout{
  height:100vh;
  display:grid;
  grid-template-columns: 78px 330px 1fr 330px;
  gap:12px;
  padding:12px;
}

/* left icon rail */
.iconbar{
  border-radius: var(--radius);
  padding:10px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
}
.sb-icon{
  width:52px; height:52px;
  border-radius: 18px;
  display:grid;
  place-items:center;
  cursor:pointer;
  border:1px solid transparent;
  background: rgba(255,255,255,.04);
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.sb-icon:hover{ transform: translateY(-1px); border-color:var(--border2); background: rgba(255,255,255,.06); }
.sb-icon.active{
  border-color: rgba(139,92,246,.55);
  background: linear-gradient(180deg, rgba(139,92,246,.18), rgba(236,72,153,.10));
}

/* side panels */
.sidebar, .right{
  border-radius: var(--radius);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.sidebar .topbar, .right .topbar{
  padding:14px 14px 10px;
  border-bottom:1px solid var(--border);
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
}
.brand{
  font-weight:800;
  letter-spacing:.3px;
}
.brand span{
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color:transparent;
}
.search{
  display:flex; gap:8px; align-items:center;
  padding:10px 14px;
  border-bottom:1px solid var(--border);
}
.search input{
  width:100%;
  border:1px solid var(--border);
  background: rgba(0,0,0,.25);
  color:var(--text);
  padding:10px 12px;
  border-radius: 16px;
  outline:none;
}
.search input:focus{ border-color: rgba(139,92,246,.6); box-shadow: 0 0 0 3px rgba(139,92,246,.16); }

.panel{
  padding:12px 14px;
  overflow:auto;
}

.cards{ display:grid; grid-template-columns: 1fr; gap:10px; }
.card{
  display:flex;
  gap:10px;
  padding:12px;
  border-radius: 18px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.20);
  cursor:pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.card:hover{ transform: translateY(-1px); border-color: var(--border2); background: rgba(255,255,255,.05); }
.card.active{
  border-color: rgba(139,92,246,.55);
  background: linear-gradient(180deg, rgba(139,92,246,.14), rgba(236,72,153,.06));
}
.avatar{
  width:52px; height:52px;
  border-radius: 18px;
  border:1px solid var(--border);
  object-fit:cover;
  background: rgba(255,255,255,.05);
}
.card .title{font-weight:800; margin-top:2px}
.card .desc{font-size:12px; color:var(--muted2); line-height:1.35}

/* main chat */
.main{
  border-radius: var(--radius);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.main .header{
  padding:14px;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.header .hleft{display:flex; align-items:center; gap:10px}
.header .hname{font-weight:900}
.header .hsub{font-size:12px; color:var(--muted2)}
.pill{
  border:1px solid var(--border);
  background: rgba(255,255,255,.04);
  color:var(--text);
  padding:10px 12px;
  border-radius: 999px;
  cursor:pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.pill:hover{ transform: translateY(-1px); border-color: var(--border2); background: rgba(255,255,255,.06); }
.pill.primary{
  border-color: rgba(139,92,246,.55);
  background: linear-gradient(90deg, rgba(139,92,246,.25), rgba(236,72,153,.18));
}
.pill.bad{
  border-color: rgba(239,68,68,.55);
  background: rgba(239,68,68,.12);
}

.messages{
  flex:1;
  padding:14px;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.bubble{
  max-width: 78%;
  padding:12px 12px 10px;
  border-radius: 18px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.22);
  line-height:1.45;
  white-space:pre-wrap;
  word-wrap:break-word;
}
.bubble.me{
  align-self:flex-end;
  border-color: rgba(139,92,246,.55);
  background: linear-gradient(180deg, rgba(139,92,246,.22), rgba(236,72,153,.14));
}
.bubble.ai{
  align-self:flex-start;
  background: rgba(0,0,0,.28);
}
.bubble img{
  display:block;
  max-width: 100%;
  border-radius: 16px;
  margin:8px 0 4px;
  border:1px solid var(--border);
}

.meta{
  margin-top:6px;
  font-size:11px;
  color:var(--muted2);
  text-align:right;
}

/* composer */
.composer{
  padding:12px;
  border-top:1px solid var(--border);
  display:flex;
  gap:10px;
  align-items:flex-end;
}
.composer textarea{
  flex:1;
  min-height:52px;
  max-height:160px;
  resize:vertical;
  border:1px solid var(--border);
  background: rgba(0,0,0,.25);
  color:var(--text);
  padding:12px 12px;
  border-radius: 18px;
  outline:none;
}
.composer textarea:focus{ border-color: rgba(139,92,246,.6); box-shadow: 0 0 0 3px rgba(139,92,246,.14); }
.actions{display:flex; gap:10px; align-items:center}
.row{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.field{display:flex; flex-direction:column; gap:6px; margin-top:10px}
.field label{font-size:12px; color:var(--muted2)}
.field input, .field select{
  border:1px solid var(--border);
  background: rgba(0,0,0,.25);
  color:var(--text);
  padding:10px 12px;
  border-radius: 16px;
  outline:none;
}
.field input:focus, .field select:focus{ border-color: rgba(139,92,246,.6); box-shadow: 0 0 0 3px rgba(139,92,246,.14); }

/* modal */
.modalBack{
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
}
.modal{
  width:min(680px, 96vw);
  border-radius: var(--radius);
  padding:16px;
}
.modal .title{font-weight:900; margin-bottom:8px}
.modal .close{
  float:right;
  cursor:pointer;
  opacity:.8;
}
.modal .close:hover{opacity:1}

hr.sep{
  border:0;
  border-top:1px solid var(--border);
  margin:14px 0;
}

@media (max-width: 1200px){
  .layout{ grid-template-columns: 78px 320px 1fr; }
  .right{ display:none; }
}
@media (max-width: 860px){
  .layout{ grid-template-columns: 1fr; padding:10px; }
  .iconbar, .sidebar, .right{ display:none; }
  body{ overflow:auto; }
  .main{ height: calc(100vh - 20px); }
}


/* PolyBuzz skin ---------------------------------------------------------- */
body.pb{
  background:
    radial-gradient(900px 600px at 20% 15%, rgba(139,92,246,.22), transparent 55%),
    radial-gradient(900px 600px at 80% 10%, rgba(236,72,153,.14), transparent 55%),
    radial-gradient(900px 700px at 70% 90%, rgba(34,197,94,.08), transparent 60%),
    linear-gradient(180deg, #05060a, #090a10 60%, #05060a);
  overflow:hidden;
}

/* Layout */
body.pb .pb-shell{
  height:100dvh;
  height:100vh;
  width:100vw;
  display:grid;
  grid-template-columns: clamp(220px, 20vw, 280px) minmax(0, 1fr) clamp(300px, 26vw, 420px);
  gap:0;
  color:var(--text);
}

body.pb .pb-sidebar{
  background: rgba(10,10,14,.92);
  border-right:1px solid rgba(255,255,255,.06);
  padding:14px 12px;
  display:flex;
  flex-direction:column;
  min-height:0;
  overflow:hidden;
}

body.pb .pb-brand{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:8px 8px 12px;
}

body.pb .pb-logo{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:900;
  letter-spacing:.2px;
  user-select:none;
}
body.pb .pb-mark{
  width:26px; height:26px;
  display:grid; place-items:center;
  border-radius:9px;
  background: linear-gradient(135deg, rgba(139,92,246,.45), rgba(236,72,153,.30));
  border:1px solid rgba(255,255,255,.10);
}
body.pb .pb-word{
  font-size:18px;
}
body.pb .pb-word2{
  font-size:18px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}

body.pb .pb-burger{
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  color:var(--text);
  border-radius:12px;
  width:38px; height:38px;
  cursor:pointer;
}
body.pb .pb-burger:hover{ background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); }

body.pb .pb-nav{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:2px 6px 10px;
}

body.pb .pb-navitem{
  width:100%;
  border:1px solid transparent;
  background: transparent;
  color: rgba(233,236,255,.88);
  border-radius:14px;
  padding:11px 10px;
  display:flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  text-decoration:none;
  transition: background .12s ease, border-color .12s ease, transform .12s ease;
  font-size:14px;
}
body.pb .pb-navitem .pb-ico{ width:20px; opacity:.95; display:inline-flex; justify-content:center; }
body.pb .pb-navitem:hover{ background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.08); transform: translateY(-1px); }
body.pb .pb-navitem.active{
  background: linear-gradient(90deg, rgba(139,92,246,.22), rgba(236,72,153,.12));
  border-color: rgba(139,92,246,.35);
}

body.pb .pb-sep{
  height:1px;
  background: rgba(255,255,255,.06);
  margin:10px 6px;
}

body.pb .pb-chatlist{
  display:flex;
  flex-direction:column;
  min-height:0;
  flex:1;
  padding:0 6px;
}

body.pb .pb-chathead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 2px 8px;
}
body.pb .pb-chatlabel{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:800;
  color: rgba(233,236,255,.92);
}
body.pb .pb-mini{
  width:30px; height:30px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  color:var(--text);
  cursor:pointer;
}
body.pb .pb-mini:hover{ background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); }

body.pb .pb-tabs{
  display:flex;
  gap:8px;
  padding:6px 2px 10px;
}
body.pb .pb-tab{
  flex:1;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: rgba(233,236,255,.86);
  padding:8px 10px;
  border-radius:999px;
  cursor:pointer;
  font-size:12px;
}
body.pb .pb-tab.active{
  border-color: rgba(139,92,246,.35);
  background: rgba(139,92,246,.16);
}

body.pb .pb-list{
  flex:1;
  min-height:0;
  overflow:auto;
  padding-right:4px;
}

/* list items (reuse .card from JS) */
body.pb .card{
  display:flex;
  gap:10px;
  align-items:center;
  padding:10px;
  padding-right:48px; /* room for delete button */
  margin:0 2px 8px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.03);
  cursor:pointer;
  position:relative;
}
body.pb .card:hover{ background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.10); transform:none; }
body.pb .card.active{
  border-color: rgba(139,92,246,.35);
  background: linear-gradient(90deg, rgba(139,92,246,.18), rgba(236,72,153,.08));
}
body.pb .card .avatar{
  width:34px; height:34px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  object-fit:cover;
  flex:0 0 34px;
}
body.pb .card .title{
  font-weight:800;
  font-size:13px;
  margin:0;
}
body.pb .card .desc{
  font-size:12px;
  color: rgba(233,236,255,.55);
  margin-top:2px;
  line-height:1.2;
}
body.pb .card .metaRow{
  display:flex;
  flex-direction:column;
  min-width:0;
}
body.pb .card .title, body.pb .card .desc{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width: 100%; }

body.pb .cardDel{
  position:absolute;
  right:10px;
  top:50%;
  transform: translateY(-50%);
  width:34px; height:34px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  color: rgba(233,236,255,.80);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  opacity:0;
  transition: opacity .12s ease, background .12s ease, border-color .12s ease;
}
body.pb .card:hover .cardDel{ opacity:1; }
body.pb .cardDel:hover{ background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.16); }
@media (max-width: 880px){
  body.pb .cardDel{ opacity:1; }
}

body.pb .pb-listempty{
  margin:0 2px;
  padding:14px 12px;
  border-radius:16px;
  border:1px dashed rgba(255,255,255,.12);
  background: rgba(255,255,255,.02);
}
body.pb .pb-listempty .t{ font-weight:800; margin-bottom:4px; }
body.pb .pb-listempty .d{ font-size:12px; color: rgba(233,236,255,.60); margin-bottom:10px; }



/* account */
body.pb .pb-account{
  padding:10px 6px 2px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
body.pb .pb-mechip{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 10px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.03);
}
body.pb .pb-userdot{
  width:10px; height:10px;
  border-radius:999px;
  background: rgba(139,92,246,.75);
  box-shadow: 0 0 0 4px rgba(139,92,246,.12);
}
body.pb .pb-melabel{
  font-size:12px;
  color: rgba(233,236,255,.74);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
body.pb .pb-logout{
  background: rgba(255,255,255,.02);
}

/* Center chat */
body.pb .pb-main{
  background: rgba(0,0,0,.16);
  display:flex;
  flex-direction:column;
  min-width:0;
  /* Body is overflow:hidden in PolyBuzz skin.
     Any scrolling must happen inside pb-main children. */
  min-height:0;
}

/* Pages (Discover / Hub / Create) must be scrollable.
   When a page is visible we hide the chat messages/footer; without this rule,
   the long Create form cannot be scrolled with the mouse wheel. */
body.pb .pb-page{
  flex:1;
  min-height:0;
  overflow:auto;
}

body.pb .pb-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border-bottom:1px solid rgba(255,255,255,.06);
  background: rgba(7,8,12,.65);
  backdrop-filter: blur(16px);
}

/* PolyBuzz-like "Dos" button */
body.pb .pb-dos{
  height:40px;
  padding:0 14px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: rgba(233,236,255,.92);
  cursor:pointer;
  font-weight:700;
  font-size:13px;
  display:none; /* shown in chat via JS */
}
body.pb .pb-dos:hover{ background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12); }

/* Top-right account controls */
body.pb .pb-pill.pb-coin{ padding:0 12px; min-width:64px; }
body.pb .pb-pill.pb-lang{ min-width:52px; }
body.pb .pb-avatarbtn{
  width:38px; height:38px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  cursor:pointer;
}
body.pb .pb-avatarbtn:hover{ background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.16); }
body.pb .pb-avatarbtn img{ width:100%; height:100%; object-fit:cover; display:block; }

/* PolyBuzz chips row (chat only) */
body.pb .pb-chipbar{
  border-bottom:1px solid rgba(255,255,255,.06);
  background: rgba(7,8,12,.45);
  padding:10px 16px;
}
body.pb .pb-chips{
  display:flex;
  gap:10px;
  overflow:auto;
  padding-bottom:2px;
  scrollbar-width: none;
}
body.pb .pb-chips::-webkit-scrollbar{ display:none; }
body.pb .pb-chip{
  height:28px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  color: rgba(233,236,255,.80);
  font-size:12px;
  display:inline-flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
}

/* Optional banner spacing (hub/discover only) */
body.pb .pb-adbar{ padding:10px 16px 0; }
body.pb .pb-adbox{
  width:100%;
  height:64px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
}

body.pb .pb-topleft{ display:flex; align-items:center; gap:12px; min-width:0; }
body.pb .pb-back{
  width:40px; height:40px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: rgba(233,236,255,.9);
  cursor:pointer;
}
body.pb .pb-back:hover{ background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12); }

body.pb .pb-title{ min-width:0; }
body.pb .pb-name{
  font-weight:900;
  font-size:18px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
body.pb .pb-tagline{
  font-size:12px;
  color: rgba(233,236,255,.55);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  margin-top:2px;
}

body.pb .pb-topright{ display:flex; align-items:center; gap:10px; }
body.pb .pb-search{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  width:min(380px, 40vw);
}
body.pb .pb-searchico{ opacity:.75; }
body.pb .pb-search input{
  width:100%;
  border:0;
  outline:none;
  background: transparent;
  color: rgba(233,236,255,.9);
  font-size:13px;
}

body.pb .pb-pill{
  height:36px;
  min-width:36px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  color: rgba(233,236,255,.92);
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  font-size:13px;
  line-height:1;
  flex: 0 0 auto;
}
body.pb .pb-pill.pb-pill-icon{
  width:38px;
  padding:0;
}
body.pb .pb-pill:hover{ background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.16); }


body.pb .pb-messages{
  flex:1;
  min-height:0;
  overflow:auto;
  padding:18px 18px 14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

/* Message bubbles (reuse .bubble from JS) */
body.pb .bubble{
  max-width: 76%;
  padding:12px 12px 10px;
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.03);
  line-height:1.45;
}
body.pb .bubble.ai{
  align-self:flex-start;
  background: rgba(255,255,255,.04);
}
body.pb .bubble.me{
  align-self:flex-end;
  background: linear-gradient(90deg, rgba(139,92,246,.62), rgba(236,72,153,.40));
  border-color: rgba(139,92,246,.50);
}
body.pb .meta{
  margin-top:8px;
  font-size:11px;
  color: rgba(233,236,255,.45);
  text-align:right;
}

/* Message actions (under assistant replies) */
body.pb .msgactions{
  margin-top:8px;
  display:flex;
  gap:8px;
  align-items:center;
  justify-content:flex-start;
}
body.pb .msgactions .actbtn{
  height:28px;
  padding:0 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  color: rgba(233,236,255,.9);
  font-size:12px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:6px;
}
body.pb .msgactions .actbtn:hover{ background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.16); }
body.pb .msgactions .actbtn.primary{
  border-color: rgba(139,92,246,.40);
  background: rgba(139,92,246,.14);
}
body.pb .msgactions .actbtn.primary:hover{
  border-color: rgba(139,92,246,.60);
  background: rgba(139,92,246,.22);
}

/* Lightbox for chat images */
body.pb .pb-lightbox{
  position:fixed;
  inset:0;
  z-index:9999;
  display:none;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,.78);
  backdrop-filter: blur(6px);
}
body.pb .pb-lightbox.show{ display:flex; }
body.pb .pb-lightbox-inner{
  position:relative;
  max-width:min(1100px, 92vw);
  max-height: 86vh;
  border-radius: 18px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(10,10,14,.92);
  box-shadow: var(--shadow);
  display:flex;
  align-items:center;
  justify-content:center;
}
body.pb .pb-lightbox-inner img{
  max-width: 92vw;
  max-height: 86vh;
  display:block;
}
body.pb .pb-lightbox-close{
  position:fixed;
  top:14px;
  right:14px;
  width:42px;
  height:42px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(10,10,14,.75);
  color: rgba(233,236,255,.92);
  cursor:pointer;
}
body.pb .pb-lightbox-close:hover{ background: rgba(255,255,255,.06); }
body.pb .pb-lightbox-download{
  position:absolute;
  left:14px;
  bottom:14px;
  height:30px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(10,10,14,.72);
  color: rgba(233,236,255,.92);
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:12px;
}
body.pb .pb-lightbox-download:hover{ background: rgba(255,255,255,.06); }

body.pb .pb-composer{
  padding:14px 16px;
  border-top:1px solid rgba(255,255,255,.06);
  background: rgba(7,8,12,.65);
  display:flex;
  align-items:center;
  gap:10px;
}
body.pb .pb-iconbtn{
  width:42px; height:42px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: rgba(233,236,255,.9);
  cursor:pointer;
}
body.pb .pb-iconbtn:hover{ background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12); }
body.pb .pb-input{
  flex:1;
  height:44px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: rgba(233,236,255,.92);
  padding:0 14px;
  outline:none;
  font-size:14px;
}
body.pb .pb-input:focus{
  border-color: rgba(139,92,246,.35);
  box-shadow: 0 0 0 3px rgba(139,92,246,.12);
}
body.pb .pb-send{
  background: linear-gradient(90deg, rgba(139,92,246,.35), rgba(236,72,153,.22));
  border-color: rgba(139,92,246,.28);
}

/* Right profile */
body.pb .pb-profile{
  background: rgba(10,10,14,.92);
  border-left:1px solid rgba(255,255,255,.06);
  padding:14px 14px 14px;
  overflow:auto;
}
body.pb .pb-profileinner{
  display:flex;
  flex-direction:column;
  gap:10px;
}

body.pb .pb-proclose{
  align-self:flex-end;
  width:36px; height:36px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  color: rgba(233,236,255,.92);
  cursor:pointer;
  display:none;
}
body.pb .pb-proclose:hover{ background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.16); }
body.pb .pb-profimg{
  width:100%;
  height: 320px;
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
}

@media (max-width: 980px){
  body.pb .pb-profimg{ height: 240px; }
}
body.pb .pb-profimg img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
body.pb .pb-profname{
  font-weight:900;
  font-size:22px;
  margin-top:2px;
}
body.pb .pb-profsub{
  color: rgba(233,236,255,.58);
  font-size:13px;
}

body.pb .pb-metrics{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
body.pb .pb-metric{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.03);
  font-size:12px;
  color: rgba(233,236,255,.78);
}

body.pb .pb-moments{
  margin-top:6px;
}
body.pb .pb-momenthead{
  font-weight:800;
  font-size:13px;
  color: rgba(233,236,255,.86);
  margin:6px 0 8px;
}
body.pb .pb-momentgrid{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
}
body.pb .pb-momentimg{
  width:100%;
  height:160px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
  overflow:hidden;
}
body.pb .pb-momentimg img{ width:100%; height:100%; object-fit:cover; display:block; }

@media (max-width: 980px){
  body.pb .pb-proclose{ display:inline-flex; align-items:center; justify-content:center; }
  body.pb .pb-momentimg{ height:140px; }
}

body.pb .pb-stats{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  padding:6px 0 2px;
}
body.pb .pb-stat{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.03);
  font-size:12px;
  color: rgba(233,236,255,.72);
}
body.pb .pb-statdot{
  width:8px; height:8px;
  border-radius:999px;
  background: rgba(34,197,94,.75);
  box-shadow: 0 0 0 4px rgba(34,197,94,.10);
}

body.pb .pb-tags{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  padding-top:4px;
}
body.pb .tag{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  padding:8px 10px;
  font-size:12px;
  color: rgba(233,236,255,.74);
}

body.pb .pb-profactions{
  display:flex;
  gap:10px;
  align-items:center;
  padding-top:8px;
}
body.pb .pb-membtn{
  flex:1;
  border-radius: 999px;
  border:1px solid rgba(139,92,246,.30);
  background: linear-gradient(90deg, rgba(139,92,246,.32), rgba(236,72,153,.18));
  color: rgba(233,236,255,.92);
  padding:12px 12px;
  cursor:pointer;
  font-weight:800;
}
body.pb .pb-iconpill{
  width:44px; height:44px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: rgba(233,236,255,.9);
  cursor:pointer;
}
body.pb .pb-iconpill:hover{ background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12); }

body.pb .pb-help{
  margin-top:6px;
  color: rgba(233,236,255,.45);
  font-size:12px;
  line-height:1.45;
}

/* Utility */
body.pb .pb-mobileonly{ display:none; }
@media (max-width: 1180px){
  body.pb .pb-mobileonly{ display:inline-flex; align-items:center; justify-content:center; }
}

/* Modals used by polybuzz.html */
body.pb .modal-wrap{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index:50;
}
body.pb .modal{
  width:min(680px, 96vw);
  border-radius: 18px;
  padding:16px;
}
body.pb .modal h3{ margin:0 0 8px 0; }
body.pb textarea{ width:100%; min-height:110px; }

/* Shared overlay + mobile drawers */
body.pb .pb-overlay{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.55);
  opacity:0;
  pointer-events:none;
  transition: opacity .14s ease;
  z-index:55;
}
body.pb.pb-nav-open .pb-overlay,
body.pb.pb-prof-open .pb-overlay{
  opacity:1;
  pointer-events:auto;
}

/* Simple card style usable in admin */
body.pb .pb-card{
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  border-radius:18px;
  padding:14px;
}
body.pb .pb-card h3{ margin:0 0 10px 0; }
body.pb .pb-row{ display:flex; gap:12px; flex-wrap:wrap; align-items:flex-start; }
body.pb .pb-row > *{ flex: 1 1 260px; }
body.pb .pb-muted{ color: rgba(233,236,255,.60); }
body.pb .pb-small{ font-size:12px; }
body.pb .pb-btn{
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: rgba(233,236,255,.92);
  border-radius:999px;
  padding:10px 12px;
  cursor:pointer;
  font-weight:800;
}
body.pb .pb-btn:hover{ background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12); }
body.pb .pb-btn.primary{
  background: linear-gradient(90deg, rgba(139,92,246,.35), rgba(236,72,153,.22));
  border-color: rgba(139,92,246,.28);
}
body.pb .pb-input2{
  width:100%;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: rgba(233,236,255,.92);
  padding:10px 12px;
  outline:none;
}
body.pb .pb-input2:focus{
  border-color: rgba(139,92,246,.35);
  box-shadow: 0 0 0 3px rgba(139,92,246,.12);
}

/* Responsive */
@media (max-width: 1180px){
  body.pb .pb-shell{ grid-template-columns: 260px 1fr; }
  body.pb .pb-search{ width:min(320px, 44vw); }

  /* profile becomes a drawer */
  body.pb .pb-profile{
    display:block;
    position:fixed;
    top:0;
    right:0;
    height:100dvh;
    height:100vh;
    width: min(380px, 92vw);
    transform: translateX(110%);
    transition: transform .16s ease;
    z-index:60;
  }
  body.pb.pb-prof-open .pb-profile{ transform:none; }
}

@media (max-width: 880px){
  body.pb .pb-shell{ grid-template-columns: 1fr; }
  body.pb .pb-search{ display:none; }

  /* sidebar becomes a drawer */
  body.pb .pb-sidebar{
    display:flex;
    position:fixed;
    top:0;
    left:0;
    height:100dvh;
    height:100vh;
    width: min(320px, 86vw);
    transform: translateX(-110%);
    transition: transform .16s ease;
    z-index:60;
  }
  body.pb.pb-nav-open .pb-sidebar{ transform:none; }

  /* make the center comfortable on mobile */
  body.pb .pb-messages{ padding:14px 12px 12px; }
  body.pb .pb-composer{ padding:12px 12px calc(12px + env(safe-area-inset-bottom)); }
  body.pb .pb-input{ height:46px; }
}

/* Admin layout tweaks */
body.pb.pb-admin{ overflow:auto; }
body.pb.pb-admin .pb-shell{ grid-template-columns: 260px 1fr; }
body.pb.pb-admin .pb-profile{ display:none !important; }
body.pb.pb-admin .pb-main{ background: rgba(0,0,0,.14); }
body.pb.pb-admin .pb-admin-scroll{ flex:1; min-height:0; overflow:auto; padding:16px; }
body.pb.pb-admin .pb-topbar{ position:sticky; top:0; z-index:20; }
@media (max-width: 880px){
  body.pb.pb-admin .pb-shell{ grid-template-columns: 1fr; }
}



/* PolyBuzz message rows with avatars */
body.pb .msgrow{
  display:flex;
  align-items:flex-end;
  gap:10px;
  width:100%;
  max-width: 980px;
  margin: 0 auto;
}
body.pb .msgrow.me{
  justify-content:flex-end;
  flex-direction:row-reverse;
}
body.pb .msgava{
  width:34px;
  height:34px;
  border-radius:999px;
  overflow:hidden;
  flex: 0 0 auto;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  font-size:13px;
  color: rgba(233,236,255,.92);
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
body.pb .msgava img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

/* Better bubbles inside rows */
body.pb .msgrow .bubble{
  max-width: min(76%, 720px);
}
body.pb .msgrow.me .bubble{
  box-shadow: 0 12px 40px rgba(124,58,237,.12);
}
body.pb .msgrow.ai .bubble{
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}

/* Hide timestamps unless hover */
body.pb .bubble .meta{
  opacity:0;
  transition: opacity .15s ease;
}
body.pb .bubble:hover .meta{
  opacity:.6;
}





/* PolyBuzz script rendering (actions vs dialogues) */
body.pb .msgtext{ line-height: 1.35; }
body.pb .msgtext .rp-line{ margin: 2px 0; }
body.pb .msgtext .rp-action{
  color: rgba(255,255,255,.60);
  font-style: italic;
}
body.pb .msgtext .rp-say{ color: rgba(255,255,255,.95); }
body.pb .msgtext .rp-name{
  font-weight: 650;
  opacity: .92;
}
body.pb .msgtext .rp-gap{ height: 6px; }
/* --- PolyBuzz UX fixes: scroll + chat toolbar --- */
body.pb .pb-shell{
  grid-template-rows: 1fr;
  min-height:0;
}
body.pb .pb-shell > *{
  min-height:0;
}
body.pb .pb-sidebar,
body.pb .pb-main,
body.pb .pb-profile{
  min-height:0;
  height:100%;
}
body.pb .pb-sidebar{ overflow:auto; }

/* Admin pages must scroll */
body.pb-admin{ overflow:auto !important; }

/* Chat footer: toolbar row + composer row */
body.pb .pb-footer{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:10px 12px 14px;
  border-top:1px solid rgba(255,255,255,.06);
  background: rgba(12,12,16,.72);
  backdrop-filter: blur(10px);
}
body.pb .pb-chatbar{
  display:flex;
  align-items:center;
  gap:10px;
}
body.pb .pb-chatbar-left{
  display:flex;
  align-items:center;
  gap:10px;
  flex:1;
  min-width:0;
  overflow-x:auto;
  overflow-y:hidden;
  padding-bottom:2px;
  scrollbar-width: thin;
}
body.pb .pb-chatbar-left::-webkit-scrollbar{ height:6px; }
body.pb .pb-chatbar-left::-webkit-scrollbar-thumb{ background: rgba(255,255,255,.12); border-radius:999px; }
body.pb .pb-mode{
  display:inline-flex;
  align-items:center;
  gap:8px;
}
body.pb .pb-mode-label{
  font-size:12px;
  opacity:.75;
}
body.pb .pb-select{
  height:36px;
  padding:0 34px 0 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  color: rgba(233,236,255,.92);
  outline:none;
  cursor:pointer;
}
body.pb .pb-select:hover{ background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.16); }

body.pb .pb-chatbar-left{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  min-width:0;
}
body.pb .pb-mode{
  display:flex;
  align-items:center;
  gap:8px;
}
body.pb .pb-pill.pb-on,
body.pb .pb-iconbtn.pb-on{
  outline:1px solid rgba(139,92,246,.55);
  background: rgba(139,92,246,.18);
}

/* Keep composer visible on 1080p */
body.pb .pb-composer{
  padding:0;
  border-top:none;
  background: transparent;
}
body.pb .pb-composer .pb-input{
  min-height:42px;
}

@media (max-width: 880px){
  body.pb .pb-chatbar{
    gap:8px;
  }
  body.pb .pb-mode-label{
    display:none;
  }
}


/* PolyBuzz v3 - Discover filters & cards */
.pb-filters{
  margin: 10px 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
}
.pb-filterrow{
  display:flex;
  gap:12px;
  align-items:flex-end;
  flex-wrap:wrap;
}
.pb-field.pb-inline{ min-width: 180px; }
.pb-catrow{
  margin-top:10px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.pb-pill.pb-chip{
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1;
}

.pb-cardava{
  width: 48px;
  height: 48px;
  border-radius: 14px;
  overflow: hidden;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(255,255,255,.06);
  flex: 0 0 auto;
}
.pb-cardava img{
  width:100%;
  height:100%;
  object-fit:cover;
}
.pb-cardmeta{
  flex: 1 1 auto;
  text-align:left;
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width: 0;
}
.pb-cardname{
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pb-cardtag{
  font-size: 12px;
  opacity: .8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pb-cardbadges{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}
.pb-badge{
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
}
.pb-badge.pb-on{
  border-color: rgba(255,255,255,.32);
  background: rgba(255,255,255,.12);
}
.pb-cardgo{
  margin-left:auto;
  font-size: 12px;
  font-weight: 700;
  opacity: .85;
}
.pb-check{
  display:flex;
  gap:10px;
  align-items:center;
}
.pb-check span{
  flex: 1 1 auto;
}



/* --- PolyBuzz-like Create Character page (v3) --- */
.pb-meavatar{width:26px;height:26px;border-radius:50%;object-fit:cover;display:none;}
.pb-mechip{cursor:pointer;}
.pb-mechip .pb-userdot{width:10px;height:10px;border-radius:50%;background:#5cf;display:inline-block;}
.pb-profava{width:72px;height:72px;border-radius:14px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);background-size:cover;background-position:center;flex:0 0 auto;margin-right:14px;}

.pb-createpage{padding:18px 18px 28px;}
.pb-profilepage{padding:18px 18px 28px;}
.pb-profrow{display:flex;gap:14px;align-items:center;}
.pb-profmeta{flex:1;min-width:0;}
.pb-profmeta input{width:100%;}
.pb-profhints{margin-top:8px;}
.pb-profactions{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-top:12px;}
.pb-profactions .pb-pill{min-width:160px;}
@media (max-width: 560px){ .pb-profactions .pb-pill{min-width:0;flex:1;} }
.pb-createhead{display:flex;align-items:center;gap:14px;margin:6px 0 16px;}
.pb-backbtn{background:transparent;border:0;color:rgba(255,255,255,.85);font-size:14px;padding:8px 10px;border-radius:10px;cursor:pointer;}
.pb-backbtn:hover{background:rgba(255,255,255,.06);}
.pb-createtitle{font-size:18px;font-weight:800;letter-spacing:.2px;}
.pb-createwrap{display:flex;gap:18px;align-items:flex-start;}
.pb-createform{flex:1;min-width:0;}
.pb-createpreview{width:min(420px,34vw);min-width:320px;position:sticky;top:16px;align-self:flex-start;}
@media (max-width: 980px){
  .pb-createwrap{flex-direction:column;}
  .pb-createpreview{width:100%;position:static;min-width:0;}
}

.pb-block{background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.08);border-radius:16px;padding:14px;margin-bottom:14px;}
.pb-block.pb-grid2{display:grid;grid-template-columns:1fr 1fr;gap:14px;}
@media (max-width: 760px){.pb-block.pb-grid2{grid-template-columns:1fr;}}

.pb-blocktitle{font-weight:700;margin-bottom:10px;}
.pb-muted{opacity:.65;font-weight:600;font-size:12px;}
.pb-req{color:#b8a2ff;font-weight:900;}
.pb-hint{opacity:.65;font-size:12px;line-height:1.35;margin-top:6px;}
.pb-error{color:#ff8b8b;font-size:13px;margin:8px 0;}

.pb-input,.pb-textarea,.pb-select{width:100%;background:rgba(0,0,0,.22);border:1px solid rgba(255,255,255,.10);color:rgba(255,255,255,.92);border-radius:12px;padding:12px 12px;outline:none;}
.pb-textarea{resize:vertical;}
.pb-input:focus,.pb-textarea:focus,.pb-select:focus{border-color:rgba(184,162,255,.7);box-shadow:0 0 0 3px rgba(184,162,255,.16);}
.pb-select{appearance:none;}

.pb-counterwrap{position:relative;}
.pb-counter{position:absolute;right:10px;bottom:10px;font-size:12px;opacity:.55;pointer-events:none;}

.pb-segwrap{display:flex;gap:10px;flex-wrap:wrap;}
.pb-seg{background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.10);color:rgba(255,255,255,.85);border-radius:14px;padding:10px 14px;cursor:pointer;}
.pb-seg.pb-on{background:rgba(184,162,255,.22);border-color:rgba(184,162,255,.55);}

.pb-blocktop{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:8px;}
.pb-voicefilters{display:flex;gap:10px;flex-wrap:wrap;}
.pb-voicechosen{opacity:.75;font-size:13px;}

.pb-voicegrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:10px;}
@media (max-width: 760px){.pb-voicegrid{grid-template-columns:repeat(2,minmax(0,1fr));}}
.pb-voicecard{display:flex;gap:10px;align-items:flex-start;background:rgba(0,0,0,.18);border:1px solid rgba(255,255,255,.08);border-radius:14px;padding:12px;cursor:pointer;min-height:72px;}
.pb-voicecard:hover{border-color:rgba(255,255,255,.16);}
.pb-voicecard.pb-on{border-color:rgba(184,162,255,.65);box-shadow:0 0 0 3px rgba(184,162,255,.12);}
.pb-voiceico{width:28px;height:28px;border-radius:10px;background:rgba(255,255,255,.06);display:flex;align-items:center;justify-content:center;flex:0 0 auto;}
.pb-voicetxt{min-width:0;}
.pb-voicename{font-weight:800;line-height:1.1;margin-bottom:6px;}
.pb-voicechips{display:flex;gap:6px;flex-wrap:wrap;}
.pb-chip{font-size:11px;opacity:.75;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.10);padding:3px 8px;border-radius:999px;}

.pb-upload{display:block;}
.pb-upload input{display:none;}
.pb-uploadbtn{display:inline-flex;align-items:center;gap:8px;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.10);padding:10px 12px;border-radius:12px;cursor:pointer;}
.pb-avatarprev{margin-top:10px;width:100%;aspect-ratio:1/1;border-radius:16px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.10);background-size:cover;background-position:center;}

.pb-addtag{display:inline-flex;align-items:center;justify-content:center;gap:8px;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.10);color:rgba(255,255,255,.88);padding:10px 12px;border-radius:12px;cursor:pointer;}
.pb-addtag:hover{border-color:rgba(255,255,255,.18);}
.pb-chiprow{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px;}
.pb-tagchip{display:inline-flex;gap:6px;align-items:center;background:rgba(0,0,0,.18);border:1px solid rgba(255,255,255,.10);padding:6px 10px;border-radius:999px;font-size:12px;}
.pb-tagchip button{background:transparent;border:0;color:rgba(255,255,255,.75);cursor:pointer;font-size:14px;line-height:1;}

.pb-createbtn{width:100%;margin-top:10px;background:linear-gradient(90deg, rgba(130,110,255,.85), rgba(210,120,255,.75));border:0;border-radius:16px;padding:14px 16px;color:white;font-weight:900;cursor:pointer;}
.pb-createbtn:disabled{opacity:.45;cursor:not-allowed;}

.pb-prevcard{background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.08);border-radius:18px;padding:16px;}
.pb-previmg{height:260px;border-radius:16px;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.10);background-size:cover;background-position:center;margin-bottom:14px;}
.pb-prevphone{border-radius:18px;background:rgba(0,0,0,.18);border:1px solid rgba(255,255,255,.08);padding:14px;}
.pb-prevtop{display:flex;align-items:center;gap:10px;margin-bottom:10px;}
.pb-prevdot{width:10px;height:10px;border-radius:50%;background:#5cf;}
.pb-prevname{font-weight:900;}
.pb-prevmsg{opacity:.85;line-height:1.35;min-height:60px;white-space:pre-wrap;}

.pb-tabs{display:flex;gap:10px;margin:10px 0 14px;}
.pb-tab{background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.10);border-radius:12px;padding:10px 12px;color:rgba(255,255,255,.88);cursor:pointer;}
.pb-tab.pb-on{background:rgba(184,162,255,.18);border-color:rgba(184,162,255,.45);}
.pb-stylelist{display:flex;flex-direction:column;gap:10px;margin-bottom:12px;}
.pb-stylepair{display:grid;grid-template-columns:1fr 1fr auto;gap:10px;align-items:start;}
.pb-stylepair textarea{min-height:56px;}
.pb-delbtn{background:transparent;border:1px solid rgba(255,255,255,.12);border-radius:12px;color:rgba(255,255,255,.75);padding:10px 12px;cursor:pointer;}
.pb-delbtn:hover{border-color:rgba(255,255,255,.22);}



/* PolyBuzz v3 - Hub banners & character bank */
.pb-hubgrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 760px){
  .pb-hubgrid{ grid-template-columns: 1fr; }
}
.pb-hubbanner{
  position:relative;
  overflow:hidden;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  min-height: 140px;
  padding: 18px 18px;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 10px;
  cursor:pointer;
  background: rgba(255,255,255,.04);
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.pb-hubbanner:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.20);
}
.pb-hubbanner:active{ transform: translateY(0px); }
.pb-hubcreate{
  background: radial-gradient(1200px 420px at 30% 30%, rgba(139,92,246,.55), rgba(255,255,255,.02));
}
.pb-hubupload{
  background: radial-gradient(1200px 420px at 30% 30%, rgba(236,72,153,.55), rgba(255,255,255,.02));
}
.pb-hubtxt{ text-align:left; }
.pb-hubbig{
  font-size: 44px;
  font-weight: 800;
  letter-spacing: .5px;
  line-height: 1;
}
.pb-hubsmall{
  margin-top: 10px;
  font-size: 14px;
  opacity: .9;
}
.pb-hubbadge{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 22px;
  background: rgba(0,0,0,.20);
  border: 1px solid rgba(255,255,255,.18);
}

.pb-bankwrap{ margin-top: 18px; }
.pb-banktitle{ margin: 10px 0 10px; }
.pb-bankempty{
  padding: 18px;
  border-radius: 16px;
  border: 1px dashed rgba(255,255,255,.16);
  background: rgba(255,255,255,.03);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap: 6px;
}
.pb-bankghost{ font-size: 46px; opacity:.75; }

.pb-bankgrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 760px){
  .pb-bankgrid{ grid-template-columns: 1fr; }
}
.pb-bankcard{
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
  border-radius: 16px;
  padding: 12px;
  display:flex;
  align-items:center;
  gap: 10px;
  cursor:pointer;
  transition: background .12s ease, border-color .12s ease;
}
.pb-bankcard:hover{
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.22);
}
.pb-bankava{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  overflow:hidden;
  background: rgba(255,255,255,.06);
  display:flex;
  align-items:center;
  justify-content:center;
  flex: 0 0 auto;
}
.pb-bankava img{ width:100%; height:100%; object-fit:cover; }
.pb-bankmeta{ flex: 1 1 auto; min-width:0; text-align:left; }
.pb-bankname{
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pb-banktag{
  font-size: 12px;
  opacity: .8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.pb-bankactions{ display:flex; gap: 8px; }
.pb-pill.pb-mini{
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1;
}

/* PolyBuzz v3 - Sidebar chat list (grouped) */
.pb-listgroup{
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .65;
  padding: 10px 8px 6px;
}
.pb-convcard{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 14px;
  cursor:pointer;
  border: 1px solid transparent;
  background: rgba(255,255,255,.03);
  margin: 4px 6px;
  transition: background .12s ease, border-color .12s ease;
}
.pb-convcard:hover{
  background: rgba(255,255,255,.05);
}
.pb-convcard.active{
  background: rgba(139,92,246,.12);
  border-color: rgba(139,92,246,.35);
}
.pb-convava{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  overflow:hidden;
  background: rgba(255,255,255,.07);
  display:flex;
  align-items:center;
  justify-content:center;
  flex: 0 0 auto;
}
.pb-convava img{ width:100%; height:100%; object-fit:cover; }
.pb-convcard .meta{ flex: 1 1 auto; min-width:0; }
.pb-convcard .title{
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pb-convcard .desc{
  font-size: 11px;
  opacity: .75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.pb-convcard .delbtn{
  opacity: 0;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.75);
  cursor:pointer;
  font-size: 14px;
  padding: 6px 6px;
  border-radius: 10px;
}
.pb-convcard:hover .delbtn{ opacity: .9; }
.pb-convcard .delbtn:hover{ background: rgba(255,255,255,.08); }

/* Better scrolling on the sidebar overlay */
body.pb .pb-sidebar{
  overflow:auto;
  -webkit-overflow-scrolling: touch;
}

.pb-avaPh{opacity:.85; font-size:16px;}

/* =======================================================================
   PolyBuzz video match (UI tweaks)
   ======================================================================= */

/* Show right panel only in chat (like the video) */
body.pb .pb-shell{ grid-template-columns: 260px minmax(0, 1fr); }
body.pb.pb-view-chat .pb-shell{ grid-template-columns: 260px minmax(0, 1fr) 360px; }
body.pb:not(.pb-view-chat) .pb-profile{ display:none !important; }

/* Topbar: video-style (no back/title outside chat) */
body.pb:not(.pb-view-chat) #backBtn,
body.pb:not(.pb-view-chat) .pb-titlewrap{ display:none !important; }

body.pb .pb-topright{ gap:10px; }

body.pb .pb-coins{
  display:flex;
  align-items:center;
  gap:6px;
  padding:7px 10px;
  border-radius:999px;
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
  font-weight:900;
  font-size:12px;
  cursor:pointer;
  user-select:none;
}
body.pb .pb-coins:hover{ background: rgba(255,255,255,.08); }
body.pb .pb-coini{ filter: saturate(1.2); }

body.pb .pb-langpill{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.90);
  border-radius:999px;
  padding:7px 10px;
  font-weight:900;
  font-size:12px;
  cursor:pointer;
}
body.pb .pb-langpill:hover{ background: rgba(255,255,255,.08); }

body.pb .pb-avatarbtn{
  width:34px;
  height:34px;
  border-radius:999px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  display:grid;
  place-items:center;
  cursor:pointer;
}
body.pb .pb-avatarbtn img{ width:100%; height:100%; object-fit:cover; display:block; }

/* Sidebar: keep chat list visible */
body.pb .pb-chatlist{ flex: 1 1 auto; min-height: 220px; }

/* Discover (video-like) */
body.pb .pb-discover{ padding: 0; }

body.pb .pb-hero{
  display:flex;
  align-items:stretch;
  gap:14px;
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
body.pb .pb-hero-left{ flex: 1 1 auto; min-width: 240px; }
body.pb .pb-hero-title{
  font-size: 26px;
  font-weight: 950;
  letter-spacing: .2px;
  line-height: 1.1;
}
body.pb .pb-hero-sub{
  margin-top: 8px;
  font-size: 13px;
  opacity: .78;
  max-width: 520px;
}
body.pb .pb-hero-btn{
  margin-top: 12px;
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 950;
  color: white;
  background: linear-gradient(135deg, rgba(139,92,246,.95), rgba(236,72,153,.90));
  box-shadow: 0 10px 28px rgba(139,92,246,.18);
}
body.pb .pb-hero-btn:hover{ filter: brightness(1.03); }

body.pb .pb-hero-right{ width: 320px; max-width: 35%; display:flex; justify-content:flex-end; }
body.pb .pb-hero-art{
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.10);
  background:
    radial-gradient(600px 300px at 20% 30%, rgba(139,92,246,.35), transparent 55%),
    radial-gradient(520px 260px at 80% 15%, rgba(236,72,153,.25), transparent 55%),
    linear-gradient(135deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
}

body.pb .pb-discoverbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 16px;
}
body.pb .pb-h2{ font-weight: 950; font-size: 18px; }

body.pb .pb-genderseg{
  margin-top: 10px;
  display:inline-flex;
  gap: 8px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  padding: 6px;
  border-radius: 999px;
}
body.pb .pb-gchip{
  border: 0;
  cursor:pointer;
  background: transparent;
  color: rgba(255,255,255,.78);
  font-weight: 900;
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 999px;
}
body.pb .pb-gchip.pb-on{
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.95);
}

body.pb .pb-catrow{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 0 16px 12px;
}
body.pb .pb-catrow-scroll{ overflow-x:auto; -webkit-overflow-scrolling: touch; }
body.pb .pb-catrow-scroll::-webkit-scrollbar{ height: 8px; }
body.pb .pb-catrow-scroll::-webkit-scrollbar-thumb{ background: rgba(255,255,255,.10); border-radius: 999px; }

body.pb .pb-adv{ padding: 0 16px 12px; }
body.pb .pb-adv.hidden{ display:none; }

body.pb .pb-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 0 16px 16px;
}

body.pb .pb-charcard{
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  border-radius: 18px;
  overflow:hidden;
  cursor:pointer;
  text-align:left;
  padding:0;
  display:flex;
  flex-direction:column;
  min-height: 290px;
}
body.pb .pb-charcard:hover{ background: rgba(255,255,255,.06); }

body.pb .pb-charimg{
  position:relative;
  width:100%;
  aspect-ratio: 1 / 1;
  background: rgba(255,255,255,.06);
}
body.pb .pb-charimg img{ width:100%; height:100%; object-fit:cover; display:block; }
body.pb .pb-charimg::after{
  content:"";
  position:absolute;
  inset:auto 0 0 0;
  height: 55%;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.55));
}

body.pb .pb-charbadge{
  position:absolute;
  left:10px;
  top:10px;
  z-index:2;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.14);
  font-size: 11px;
  font-weight: 900;
}

body.pb .pb-charmeta{ padding: 10px 12px 12px; display:flex; flex-direction:column; gap:6px; }
body.pb .pb-charname{ font-weight: 950; font-size: 16px; }
body.pb .pb-chardesc{ opacity:.78; font-size: 12px; line-height: 1.25; min-height: 30px; }

body.pb .pb-chartags{ display:flex; flex-wrap:wrap; gap:6px; margin-top:2px; }
body.pb .pb-tag{
  font-size: 11px;
  opacity: .9;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
}

/* Hub (Create / Upload) */
body.pb .pb-hub{ padding: 16px; }
body.pb .pb-hubtop{ display:flex; align-items:center; justify-content:space-between; }
body.pb .pb-hubtitle{ font-size: 22px; font-weight: 950; margin-bottom: 10px; }

body.pb .pb-hubcards{ display:grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 860px){ body.pb .pb-hubcards{ grid-template-columns: 1fr; } }

body.pb .pb-hubbig{
  border: 0;
  cursor:pointer;
  border-radius: 20px;
  padding: 18px;
  min-height: 140px;
  color: white;
  text-align:left;
  position:relative;
  overflow:hidden;
}
body.pb .pb-hubbig::after{
  content:"";
  position:absolute;
  inset:0;
  background: radial-gradient(540px 260px at 80% 20%, rgba(255,255,255,.18), transparent 55%);
  pointer-events:none;
}

body.pb .pb-hubcreate{ background: linear-gradient(135deg, rgba(99,102,241,.85), rgba(139,92,246,.75)); }
body.pb .pb-hubupload{ background: linear-gradient(135deg, rgba(168,85,247,.85), rgba(236,72,153,.75)); }

body.pb .pb-hubword{ font-size: 44px; font-weight: 950; letter-spacing: .3px; }
body.pb .pb-hubsub{ opacity:.92; max-width: 420px; }
body.pb .pb-hubplus{
  position:absolute;
  left: 18px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display:grid;
  place-items:center;
  background: rgba(255,255,255,.18);
  border:1px solid rgba(255,255,255,.20);
  font-size: 20px;
}

body.pb .pb-hubbank{ margin-top: 16px; border-top:1px solid rgba(255,255,255,.06); padding-top: 16px; }
body.pb .pb-hubbanktitle{ font-weight: 950; font-size: 18px; }
body.pb .pb-hubbankempty{ margin: 12px 0; display:flex; align-items:center; gap: 12px; }
body.pb .pb-hubghost{ font-size: 44px; opacity: .35; }

/* Right panel (chat) – portrait avatar like the video */
body.pb .pb-profimg{ aspect-ratio: 3 / 4; }



/* Persona (Ma personnalité) */

body.pb.persona-open .pb-profileinner > :not(#personaPanel):not(#closeProfileBtn){
  display:none;
}
body.pb.persona-open #personaPanel{ display:block; }

body.pb .pb-persona{ padding-top: 6px; }
body.pb .pb-persona-head{ margin: 10px 0 10px; }
body.pb .pb-persona-title{ font-size: 18px; font-weight: 950; }
body.pb .pb-persona-sub{ font-size: 13px; opacity: .85; margin-top: 4px; }
body.pb .pb-persona-actions{ margin: 10px 0 10px; }
body.pb .pb-persona-list{ display:flex; flex-direction:column; gap: 10px; }

body.pb .pb-personacard{
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  border-radius: 16px;
  padding: 12px;
}
body.pb .pb-personacard.active{
  outline: 2px solid rgba(99,102,241,.55);
}
body.pb .pb-persona-top{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
body.pb .pb-persona-name{ font-weight: 950; }
body.pb .pb-persona-badges{ display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
body.pb .pb-badge{
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  opacity: .95;
}
body.pb .pb-persona-desc{ margin-top: 8px; font-size: 13px; opacity:.92; white-space: pre-wrap; }
body.pb .pb-persona-actionsrow{ display:flex; gap: 8px; flex-wrap:wrap; margin-top: 10px; }
body.pb .pb-mini-btn{
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: white;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}
body.pb .pb-mini-btn.danger{ border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.08); }
body.pb .pb-mini-btn.primary{ border-color: rgba(99,102,241,.50); background: rgba(99,102,241,.22); }
body.pb .pb-mini-btn:disabled{ opacity:.55; cursor: default; }

/* checkbox row style (reuse) */
body.pb .pb-check{ display:flex; align-items:center; gap:8px; user-select:none; }
body.pb .pb-check input{ transform: translateY(1px); }




/* =======================================================================
   PolyBuzz LOOK override (v3.4.11)
   - supprime l'effet néon/blur
   - palette dark + accent bleu comme PolyBuzz
   ======================================================================= */
body.pb{
  --bg0:#0b0b0d;
  --bg1:#0b0b0d;
  --panel:#111114;
  --panel2:#141417;
  --border:#26262b;
  --border2:#2f2f36;
  --text:#f2f2f3;
  --muted:#a1a1aa;
  --muted2:#7c7c86;
  --accent:#4f7cff;
  --accent2:#2f6bff;
  background: var(--bg0);
  color: var(--text);
}

/* barres / panneaux : flat */
body.pb .pb-sidebar,
body.pb .pb-profile{
  background: var(--panel) !important;
  border-color: var(--border) !important;
}
body.pb .pb-main{ background: var(--bg0) !important; }

body.pb .pb-topbar,
body.pb .pb-chipbar,
body.pb .pb-footer,
body.pb .pb-composer{
  background: var(--bg0) !important;
  border-color: var(--border) !important;
  backdrop-filter:none !important;
}

/* boutons/pills */
body.pb .pb-pill,
body.pb .pb-mini,
body.pb .pb-iconbtn,
body.pb .pb-back,
body.pb .pb-avatarbtn,
body.pb .pb-select,
body.pb .pb-search{
  background: var(--panel2) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  box-shadow:none !important;
}
body.pb .pb-pill:hover,
body.pb .pb-mini:hover,
body.pb .pb-iconbtn:hover,
body.pb .pb-back:hover,
body.pb .pb-avatarbtn:hover{
  background: #1a1a1c !important;
  border-color: var(--border2) !important;
  transform:none !important;
}

/* chips */
body.pb .pb-chip{
  border-color: rgba(79,124,255,.70) !important;
  background: transparent !important;
  color: rgba(180,210,255,.95) !important;
}

/* cartes conversations/personas */
body.pb .pb-convcard,
body.pb .pb-personacard{
  background: rgba(255,255,255,.02) !important;
  border-color: var(--border) !important;
  box-shadow:none !important;
}
body.pb .pb-convcard.active,
body.pb .pb-personacard.active{
  background: #1a1a1c !important;
  border-color: var(--border2) !important;
}

/* bulles couleurs PolyBuzz */
body.pb .bubble{
  background: #1a1a1c !important;
  border-color: rgba(255,255,255,.08) !important;
}
body.pb .bubble.me{
  background: var(--accent) !important;
  border-color: rgba(79,124,255,.70) !important;
}


/* =======================================================================
   PolyBuzz bubble sizing & alignment override (v3.4.11)
   - bulles user plus compactes
   - largeur et spacing proches de PolyBuzz
   ======================================================================= */
body.pb .pb-messages{
  padding: 22px 20px 16px;
  gap: 14px;
}

body.pb .msgrow{
  max-width: 760px;
  gap: 12px;
}

/* avatars légèrement plus petits */
body.pb .msgava{
  width:32px;
  height:32px;
}

/* bulles */
body.pb .bubble{
  border-radius: 14px;
  padding: 12px 14px 11px;
  font-size: 14px;
}

/* assistant: plus large, mais pas pleine page */
body.pb .bubble.ai{
  max-width: min(88%, 760px);
  background: rgba(255,255,255,.03);
}

/* user: plus compacte, comme PolyBuzz */
body.pb .bubble.me{
  max-width: min(52%, 340px);
  padding: 10px 12px 9px;
}

/* meta plus discret/serré */
body.pb .meta{
  margin-top: 6px;
  font-size: 11px;
}

/* images générées dans le chat : plus petites comme PolyBuzz */
body.pb .bubble img{
  /* évite les images "pleine largeur" quand la bulle AI est large */
  max-width: min(300px, 100%);
  max-height: 420px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  margin: 10px 0 8px;
}

/* user : encore un peu plus compact */
body.pb .bubble.me img{
  max-width: min(260px, 100%);
}

