*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{--wa-green:#25D366;--wa-dark:#128C7E;--wa-darker:#075E54;--wa-bg:#ECE5DD;--wa-panel:#F0F2F5;--wa-white:#FFFFFF;--wa-border:#E9EDEF;--wa-text:#111B21;--wa-sub:#667781;--wa-blue:#53BDEB;--wa-red:#EA0038;--wa-out:#D9FDD3;--sw:380px;}
html,body{height:100%;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;background:#111B21;color:var(--wa-text);overflow:hidden;}
/* --app-h is set in JS from visualViewport.height so the layout shrinks when the
   mobile soft keyboard opens, keeping the message input visible. dvh/vh are
   progressive fallbacks for browsers without the JS handler. */
#auth{display:flex;height:100vh;height:100dvh;height:var(--app-h,100dvh);align-items:center;justify-content:center;background:linear-gradient(160deg,var(--wa-darker),#1a1a2e);}
.auth-card{background:#fff;border-radius:16px;padding:2.5rem 2rem;width:380px;box-shadow:0 20px 60px rgba(0,0,0,.4);}
.auth-logo{display:flex;align-items:center;gap:10px;justify-content:center;margin-bottom:1.8rem;}
.auth-logo span{font-size:1.4rem;font-weight:700;color:var(--wa-darker);}
.tab-row{display:flex;border-radius:8px;overflow:hidden;border:1.5px solid var(--wa-border);margin-bottom:1.4rem;}
.tab{flex:1;padding:10px;background:#f8f9fa;border:none;cursor:pointer;font-size:14px;font-weight:500;color:var(--wa-sub);transition:all .2s;}
.tab.active{background:var(--wa-dark);color:#fff;}
.auth-card input{display:block;width:100%;padding:11px 14px;margin-bottom:12px;border:1.5px solid var(--wa-border);border-radius:8px;font-size:15px;outline:none;transition:border-color .2s;}
.auth-card input:focus{border-color:var(--wa-dark);}
.btn-wa{width:100%;padding:12px;background:var(--wa-green);color:#fff;border:none;border-radius:8px;font-size:15px;font-weight:600;cursor:pointer;transition:background .2s;}
.btn-wa:hover{background:var(--wa-dark);}.btn-wa:disabled{background:#a8e6c1;cursor:not-allowed;}
.auth-err{color:#e53e3e;font-size:13px;text-align:center;min-height:18px;margin-top:8px;}
.auth-note{font-size:12px;color:var(--wa-sub);text-align:center;margin-top:12px;line-height:1.6;}
#app{display:flex;height:100vh;height:100dvh;height:var(--app-h,100dvh);}
#sidebar{width:var(--sw);min-width:var(--sw);background:var(--wa-white);display:flex;flex-direction:column;border-right:1px solid var(--wa-border);}
#main{flex:1;display:flex;flex-direction:column;background:var(--wa-bg);position:relative;overflow:hidden;}
.s-hdr{display:flex;align-items:center;gap:10px;padding:10px 16px;background:var(--wa-panel);border-bottom:1px solid var(--wa-border);}
.s-av{width:40px;height:40px;border-radius:50%;background:var(--wa-dark);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:15px;cursor:pointer;flex-shrink:0;overflow:hidden;}
.s-av img{width:100%;height:100%;object-fit:cover;}
.s-title{flex:1;font-size:20px;font-weight:700;}
.s-acts{display:flex;gap:2px;}
.icon-btn{width:36px;height:36px;border-radius:50%;border:none;background:none;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--wa-sub);font-size:20px;transition:background .15s;}
.icon-btn:hover{background:var(--wa-border);}
.s-srch{padding:8px 12px;background:var(--wa-panel);}
.srch-bx{display:flex;align-items:center;gap:8px;background:var(--wa-white);border-radius:8px;padding:7px 12px;border:1px solid var(--wa-border);}
.srch-bx input{border:none;outline:none;flex:1;font-size:14px;background:transparent;}
.s-tabs{display:flex;border-bottom:1px solid var(--wa-border);}
.s-tab{flex:1;padding:12px;text-align:center;font-size:13px;font-weight:600;color:var(--wa-sub);cursor:pointer;border-bottom:3px solid transparent;transition:all .2s;letter-spacing:.4px;}
.s-tab.active{color:var(--wa-dark);border-color:var(--wa-dark);}
#chat-list{flex:1;overflow-y:auto;}
.ci{display:flex;align-items:center;gap:12px;padding:10px 16px;cursor:pointer;border-bottom:1px solid #f5f6f6;transition:background .1s;user-select:none;}
.ci:hover,.ci.active{background:#f5f6f6;}
.ci-av{width:49px;height:49px;border-radius:50%;background:var(--wa-dark);color:#fff;display:flex;align-items:center;justify-content:center;font-size:18px;font-weight:700;flex-shrink:0;overflow:hidden;position:relative;}
.ci-av img{width:100%;height:100%;object-fit:cover;}
.on-dot{position:absolute;bottom:1px;right:1px;width:13px;height:13px;border-radius:50%;background:var(--wa-green);border:2px solid #fff;}
.ci-body{flex:1;min-width:0;}
.ci-top{display:flex;justify-content:space-between;align-items:center;}
.ci-name{font-weight:600;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:170px;}
.ci-time{font-size:12px;color:var(--wa-sub);white-space:nowrap;}
.ci-bot{display:flex;justify-content:space-between;align-items:center;margin-top:2px;}
.ci-prev{font-size:14px;color:var(--wa-sub);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:180px;}
.ubadge{background:var(--wa-green);color:#fff;border-radius:50%;min-width:20px;height:20px;font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center;padding:0 4px;}
#empty-state{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;}
.es-icon{font-size:5rem;opacity:.25;}
#empty-state h2{font-size:2rem;font-weight:300;}.e2e-note{font-size:12px;color:var(--wa-sub);display:flex;align-items:center;gap:5px;}
#empty-state p{color:var(--wa-sub);font-size:14px;text-align:center;max-width:340px;line-height:1.8;}
#chat-view{display:none;flex-direction:column;height:100%;}#chat-view.open{display:flex;}
.ch-hdr{display:flex;align-items:center;gap:12px;padding:10px 16px;background:var(--wa-panel);border-bottom:1px solid var(--wa-border);flex-shrink:0;}
.ch-av{width:40px;height:40px;border-radius:50%;background:var(--wa-dark);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:15px;overflow:hidden;flex-shrink:0;cursor:pointer;}
.ch-av img{width:100%;height:100%;object-fit:cover;}
.ch-info{flex:1;min-width:0;cursor:pointer;}.ch-name{font-weight:600;font-size:16px;}.ch-status{font-size:13px;color:var(--wa-sub);}
.ch-acts{display:flex;gap:2px;}
#msgs{flex:1;overflow-y:auto;padding:8px 5%;display:flex;flex-direction:column;gap:1px;background-color:var(--wa-bg);}
.mw{display:flex;flex-direction:column;margin:1px 0;}.mw.me{align-items:flex-end;}.mw.them{align-items:flex-start;}
.bbl{max-width:65%;min-width:80px;padding:6px 10px 4px 9px;border-radius:8px;position:relative;box-shadow:0 1px 0.5px rgba(11,20,26,.12);cursor:context-menu;}
.mw.me .bbl{background:var(--wa-out);border-bottom-right-radius:2px;}.mw.them .bbl{background:var(--wa-white);border-bottom-left-radius:2px;}
.bbl-txt{font-size:14.5px;line-height:1.5;color:var(--wa-text);word-break:break-word;white-space:pre-wrap;}
.bbl-foot{display:flex;align-items:center;justify-content:flex-end;gap:3px;margin-top:1px;}
.msg-time{font-size:11px;color:var(--wa-sub);}.ticks{font-size:12px;}.t-s{color:var(--wa-sub);}.t-r{color:var(--wa-blue);}
.del-msg{color:var(--wa-sub);font-style:italic;font-size:14px;}
.media-bbl{max-width:280px;cursor:pointer;border-radius:6px;overflow:hidden;}
.media-bbl img,.media-bbl video{width:100%;display:block;}
.audio-bbl{display:flex;align-items:center;gap:8px;padding:4px 2px;}
.doc-bbl{display:flex;align-items:center;gap:8px;padding:6px;background:rgba(0,0,0,.05);border-radius:6px;cursor:pointer;}
.doc-ico{font-size:26px;}.doc-nm{font-size:13px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:130px;}.doc-sz{font-size:11px;color:var(--wa-sub);}
.rply{background:rgba(0,0,0,.06);border-left:4px solid var(--wa-dark);border-radius:4px;padding:5px 8px;margin-bottom:4px;cursor:pointer;}
.rply .rr-nm{color:var(--wa-dark);font-weight:600;font-size:12px;}.rply .rr-tx{color:var(--wa-sub);font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.fwd{font-size:11px;color:var(--wa-sub);font-style:italic;margin-bottom:3px;}
.rxns{display:flex;gap:2px;flex-wrap:wrap;margin-top:3px;}
.rxn{background:rgba(0,0,0,.08);border-radius:10px;padding:2px 6px;font-size:13px;cursor:pointer;user-select:none;}
.rxn:hover{transform:scale(1.15);}
.date-div{text-align:center;margin:8px 0;font-size:12px;color:var(--wa-sub);}
.date-div span{background:rgba(255,255,255,.85);padding:4px 12px;border-radius:7px;box-shadow:0 1px 1px rgba(0,0,0,.06);}
.sys-msg{text-align:center;color:var(--wa-sub);font-size:12px;padding:4px 14px;background:rgba(255,255,255,.8);border-radius:7px;align-self:center;margin:6px 0;}
.typing-bbl{padding:10px 14px;}.tdots{display:flex;gap:4px;align-items:center;}
.tdots span{width:8px;height:8px;border-radius:50%;background:var(--wa-sub);animation:bnc 1.2s infinite;}
.tdots span:nth-child(2){animation-delay:.2s;}.tdots span:nth-child(3){animation-delay:.4s;}
@keyframes bnc{0%,80%,100%{transform:translateY(0)}40%{transform:translateY(-7px)}}
#rply-bar{display:none;align-items:center;gap:10px;padding:8px 14px;background:var(--wa-panel);border-top:1px solid var(--wa-border);flex-shrink:0;}
#rply-bar.open{display:flex;}
.rb-cnt{flex:1;background:rgba(0,0,0,.05);border-left:4px solid var(--wa-dark);border-radius:4px;padding:5px 10px;}
.rb-nm{font-size:12px;font-weight:600;color:var(--wa-dark);}.rb-tx{font-size:13px;color:var(--wa-sub);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
#input-area{display:flex;align-items:flex-end;gap:8px;padding:8px 10px;background:var(--wa-panel);border-top:1px solid var(--wa-border);flex-shrink:0;position:relative;}
#attach-btn{width:42px;height:42px;border-radius:50%;background:none;border:none;cursor:pointer;color:var(--wa-sub);font-size:22px;display:flex;align-items:center;justify-content:center;flex-shrink:0;}
#attach-btn:hover{color:var(--wa-dark);}
.input-box{flex:1;display:flex;align-items:flex-end;background:var(--wa-white);border-radius:24px;padding:8px 14px;border:1px solid var(--wa-border);min-height:42px;}
#msg-input{flex:1;border:none;outline:none;font-size:15px;resize:none;max-height:100px;font-family:inherit;background:transparent;color:var(--wa-text);}
#emoji-btn{background:none;border:none;cursor:pointer;font-size:20px;padding:0 4px;flex-shrink:0;}
#send-btn{width:52px;height:52px;border-radius:50%;background:var(--wa-green);color:#fff;border:none;cursor:pointer;font-size:22px;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:background .2s;}
#send-btn:hover{background:var(--wa-dark);}#send-btn:disabled{background:#a8e6c1;}
.ctx-menu{position:fixed;background:#fff;border-radius:8px;box-shadow:0 4px 20px rgba(0,0,0,.2);z-index:1000;min-width:160px;overflow:hidden;display:none;}
.ctx-menu.open{display:block;}
.ctx-item{padding:11px 18px;cursor:pointer;font-size:14px;display:flex;align-items:center;gap:10px;}
.ctx-item:hover{background:#f5f6f6;}.ctx-item.danger{color:var(--wa-red);}
.emoji-tray{position:absolute;bottom:70px;left:10px;background:#fff;border-radius:12px;box-shadow:0 4px 20px rgba(0,0,0,.2);padding:12px;display:none;z-index:100;width:300px;}
.emoji-tray.open{display:block;}
#gif-btn{background:none;border:1.5px solid var(--wa-border);border-radius:14px;cursor:pointer;font-size:11px;font-weight:800;letter-spacing:.5px;color:var(--wa-sub);padding:4px 7px;flex-shrink:0;line-height:1;transition:all .15s;height:26px;align-self:center;}
#gif-btn:hover{color:var(--wa-dark);border-color:var(--wa-dark);}
#gif-modal{display:none;position:fixed;inset:0;background:rgba(17,27,33,.6);z-index:6000;align-items:center;justify-content:center;padding:18px;}
.gif-card{background:#fff;border-radius:16px;box-shadow:0 24px 70px rgba(0,0,0,.35);padding:18px;width:min(460px,94vw);max-height:80vh;display:flex;flex-direction:column;}
.gif-card .profile-head{margin-bottom:12px;}
.gif-search-bx{display:flex;align-items:center;gap:8px;background:var(--wa-panel);border-radius:18px;padding:7px 12px;color:var(--wa-sub);margin-bottom:10px;}
.gif-search-bx input{flex:1;border:none;outline:none;background:transparent;font-size:14px;color:var(--wa-text);}
.gif-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px;overflow-y:auto;flex:1;min-height:140px;}
.gif-cell{border:none;background:#f5f6f6;border-radius:8px;overflow:hidden;cursor:pointer;padding:0;aspect-ratio:1/1;}
.gif-cell img{width:100%;height:100%;object-fit:cover;display:block;}
.gif-cell:hover{outline:2px solid var(--wa-dark);}
.gif-status{grid-column:1/-1;text-align:center;color:var(--wa-sub);font-size:13px;line-height:1.6;padding:24px 8px;}
.gif-credit{text-align:center;font-size:10px;color:var(--wa-sub);margin-top:8px;letter-spacing:.5px;}
.emoji-grid{display:flex;flex-wrap:wrap;gap:3px;max-height:180px;overflow-y:auto;}
.ebtn{font-size:22px;cursor:pointer;border:none;background:none;padding:3px;border-radius:4px;line-height:1;}
.ebtn:hover{background:#f5f6f6;}
.attach-tray{position:absolute;bottom:70px;left:10px;background:#fff;border-radius:12px;box-shadow:0 4px 20px rgba(0,0,0,.2);padding:14px;display:none;z-index:100;}
.attach-tray.open{display:block;}
.attach-grid{display:flex;gap:16px;flex-wrap:wrap;}
.att-item{display:flex;flex-direction:column;align-items:center;gap:5px;cursor:pointer;}
.att-circ{width:50px;height:50px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:22px;}
.att-lbl{font-size:11px;color:var(--wa-sub);}
.notif-banner{position:fixed;top:0;left:50%;transform:translateX(-50%) translateY(-100%);background:#fff;border-radius:0 0 12px 12px;padding:10px 18px;box-shadow:0 4px 12px rgba(0,0,0,.15);z-index:9999;display:flex;align-items:center;gap:12px;cursor:pointer;max-width:380px;width:90%;transition:transform .3s;}
.notif-banner.show{transform:translateX(-50%) translateY(0);}
.nb-av{width:40px;height:40px;border-radius:50%;background:var(--wa-dark);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;flex-shrink:0;}
.nb-body{flex:1;min-width:0;}.nb-name{font-weight:600;font-size:14px;}.nb-txt{font-size:13px;color:var(--wa-sub);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
#img-viewer{display:none;position:fixed;inset:0;background:rgba(0,0,0,.93);z-index:2000;align-items:center;justify-content:center;}
#img-viewer.open{display:flex;}
#img-viewer img,#img-viewer video{max-width:90vw;max-height:90vh;object-fit:contain;border-radius:4px;}
.iv-close{position:absolute;top:16px;right:20px;color:#fff;font-size:32px;cursor:pointer;line-height:1;background:none;border:none;}
.rxn-picker{position:fixed;background:#fff;border-radius:24px;padding:6px 10px;box-shadow:0 4px 20px rgba(0,0,0,.2);z-index:1001;display:none;gap:6px;}
.rxn-picker.open{display:flex;}
.rxn-pick-btn{font-size:22px;cursor:pointer;border:none;background:none;padding:2px;border-radius:50%;transition:transform .1s;}
.rxn-pick-btn:hover{transform:scale(1.3);}
::-webkit-scrollbar{width:5px;}::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:10px;}
@media(max-width:768px){:root{--sw:100vw;}#main{display:none;}#main.mob{display:flex;}#sidebar.mob-hide{display:none;}}

/* Secure archive + logout */
.logout-btn{font-size:18px;color:var(--wa-red);}
.logout-btn:hover{background:rgba(234,0,56,.10);}
.ci.locked .ci-name::after{content:' 🔐';font-size:12px;color:var(--wa-sub);}
.lock-badge{display:inline-flex;align-items:center;gap:4px;font-size:11px;color:var(--wa-sub);}
.archive-lock{align-self:center;max-width:360px;margin:auto;text-align:center;background:rgba(255,255,255,.92);border-radius:14px;padding:24px 22px;box-shadow:0 6px 22px rgba(11,20,26,.12);color:var(--wa-text);}
.archive-lock .lock-ico{font-size:40px;margin-bottom:10px;}
.archive-lock h3{font-size:18px;margin-bottom:8px;}
.archive-lock p{font-size:13px;color:var(--wa-sub);line-height:1.6;margin-bottom:14px;}
.archive-lock button{border:none;border-radius:999px;background:var(--wa-dark);color:#fff;padding:10px 16px;font-weight:600;cursor:pointer;}
.archive-lock button:hover{background:var(--wa-darker);}
#input-area.locked{opacity:.55;pointer-events:none;}

/* Profile display-name editor */
#profile-modal{display:none;position:fixed;inset:0;background:rgba(17,27,33,.55);z-index:3000;align-items:center;justify-content:center;padding:18px;}
#unlock-modal{display:none;position:fixed;inset:0;background:rgba(17,27,33,.6);z-index:6000;align-items:center;justify-content:center;padding:18px;}
#unlock-modal.open{display:flex;}
.unlock-card{max-width:380px;width:100%;}
.unlock-card label{display:block;font-size:13px;font-weight:600;margin:8px 0 4px;color:var(--wa-sub);}
.unlock-card input{display:block;width:100%;padding:11px 14px;border:1.5px solid var(--wa-border);border-radius:8px;font-size:15px;outline:none;}
.unlock-card input:focus{border-color:var(--wa-dark);}
#profile-modal.open{display:flex;}
.profile-card{width:min(420px,94vw);background:#fff;border-radius:16px;box-shadow:0 24px 70px rgba(0,0,0,.35);padding:22px;}
.profile-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;}
.profile-head h3{font-size:20px;font-weight:700;color:var(--wa-text);}
.profile-head button{border:none;background:none;font-size:22px;cursor:pointer;color:var(--wa-sub);}
.profile-avatar{width:72px;height:72px;border-radius:50%;background:var(--wa-dark);color:#fff;display:flex;align-items:center;justify-content:center;font-size:28px;font-weight:800;margin:0 auto 16px;}
.profile-card label{display:block;margin:12px 0 6px;font-size:13px;font-weight:700;color:var(--wa-sub);}
.profile-card input,.profile-card textarea{width:100%;border:1.5px solid var(--wa-border);border-radius:10px;padding:10px 12px;font:inherit;outline:none;resize:none;}
.profile-card input:focus,.profile-card textarea:focus{border-color:var(--wa-dark);}
.profile-sub{font-size:12px;color:var(--wa-sub);margin-top:6px;line-height:1.5;}

/* Read receipts + narrow-phone header fixes */
.receipt{display:inline-flex;align-items:center;gap:2px;vertical-align:middle;margin-left:2px;}
.receipt.read{color:var(--wa-blue);font-weight:600;}
.read-label{font-size:10.5px;line-height:1;color:var(--wa-blue);margin-left:2px;letter-spacing:.1px;}
.ci-prev .receipt{margin-right:4px;margin-left:0;}
.ci-prev .read-label{font-size:10px;}
.ch-acts{flex-shrink:0;}

@media(max-width:768px){
  html,body{height:100dvh;max-width:100vw;overflow:hidden;}
  #app{height:100dvh;width:100vw;max-width:100vw;overflow:hidden;}
  #sidebar,#main{width:100vw;min-width:0;max-width:100vw;}
  .s-hdr{padding:9px 12px;}
  .s-acts{flex-shrink:0;}
  .ch-hdr{gap:8px;padding:8px 8px;min-width:0;max-width:100vw;overflow:hidden;}
  #back-btn{display:flex!important;flex-shrink:0;}
  .ch-av{width:34px;height:34px;font-size:13px;}
  .ch-info{flex:1 1 auto;min-width:58px;overflow:hidden;}
  .ch-name{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .ch-status{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .ch-acts{flex:0 0 auto;max-width:46vw;display:flex;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;gap:1px;padding-bottom:1px;scrollbar-width:none;}
  .ch-acts::-webkit-scrollbar{display:none;}
  .ch-acts .icon-btn{width:32px;height:32px;min-width:32px;font-size:17px;}
  #msgs{padding:8px 10px;}
  .bbl{max-width:86%;}
  #input-area{padding:8px 8px;gap:6px;}
  .input-box{min-width:0;padding:8px 10px;}
  #send-btn{width:44px;height:44px;min-width:44px;}
  #attach-btn{width:38px;height:38px;min-width:38px;}
  #emoji-btn{min-width:32px;}
  .emoji-tray{width:min(300px,calc(100vw - 20px));left:8px;}
  .attach-tray{left:8px;right:8px;}
}
@media(max-width:380px){
  .ch-hdr{gap:6px;padding:7px 6px;}
  .ch-av{width:32px;height:32px;}
  .ch-info{min-width:48px;}
  .ch-acts{max-width:42vw;}
  .ch-acts .icon-btn{width:30px;height:30px;min-width:30px;font-size:16px;}
}

/* ==========================================================
   Spaceship Ultra-Premium Chatbox Theme
   Applied on top of the original chat functionality.
   ========================================================== */
:root{
  --wa-green:#67e8f9;
  --wa-dark:#38bdf8;
  --wa-darker:#0f172a;
  --wa-bg:#020617;
  --wa-panel:rgba(15,23,42,.72);
  --wa-white:rgba(255,255,255,.075);
  --wa-border:rgba(255,255,255,.11);
  --wa-text:#f8fafc;
  --wa-sub:#94a3b8;
  --wa-blue:#67e8f9;
  --wa-red:#fb7185;
  --wa-out:linear-gradient(135deg,#22d3ee 0%,#3b82f6 52%,#8b5cf6 100%);
  --sp-card:rgba(15,23,42,.74);
  --sp-soft:rgba(255,255,255,.06);
  --sp-soft-2:rgba(255,255,255,.095);
  --sp-glow:0 24px 80px rgba(37,99,235,.22);
  --sp-border:1px solid rgba(255,255,255,.12);
}
html,body{
  background:
    radial-gradient(circle at 12% 0%,rgba(59,130,246,.40),transparent 34%),
    radial-gradient(circle at 88% 12%,rgba(139,92,246,.28),transparent 32%),
    linear-gradient(135deg,#020617 0%,#07111f 48%,#020617 100%);
  color:var(--wa-text);
}
body::before{
  content:'';
  position:fixed;
  inset:0;
  pointer-events:none;
  opacity:.20;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,255,255,.035) 1px,transparent 1px);
  background-size:44px 44px;
  mask-image:radial-gradient(circle at center,black 0%,transparent 76%);
}
#auth{
  background:
    radial-gradient(circle at top left,rgba(34,211,238,.28),transparent 34%),
    radial-gradient(circle at bottom right,rgba(139,92,246,.26),transparent 30%),
    linear-gradient(145deg,#020617,#0f172a 55%,#020617);
}
.auth-card{
  width:min(430px,92vw);
  border:var(--sp-border);
  border-radius:30px;
  background:linear-gradient(145deg,rgba(15,23,42,.86),rgba(15,23,42,.58));
  color:#fff;
  box-shadow:0 28px 100px rgba(0,0,0,.52),0 0 80px rgba(37,99,235,.16);
  backdrop-filter:blur(22px);
}
.auth-logo{justify-content:flex-start;margin-bottom:1.55rem;}
.brand-mark,.s-av,.ci-av,.ch-av,.profile-avatar,.nb-av{
  background:linear-gradient(135deg,#22d3ee 0%,#3b82f6 52%,#8b5cf6 100%)!important;
  color:#fff;
  box-shadow:0 14px 30px rgba(37,99,235,.25);
}
.brand-mark{
  width:54px;height:54px;border-radius:19px;
  display:flex;align-items:center;justify-content:center;
  font-size:28px;line-height:1;
  border:1px solid rgba(255,255,255,.18);
}
.brand-copy{display:flex;flex-direction:column;gap:2px;}
.auth-logo span{color:#fff;font-size:1.6rem;letter-spacing:-.035em;}
.brand-copy small{color:#93c5fd;font-size:12px;font-weight:700;letter-spacing:.02em;text-transform:uppercase;}
.tab-row{background:rgba(255,255,255,.045);border:1px solid rgba(255,255,255,.10);border-radius:18px;padding:5px;}
.tab{border-radius:14px;background:transparent;color:#94a3b8;font-weight:800;}
.tab.active{background:linear-gradient(135deg,#22d3ee,#3b82f6,#8b5cf6);color:#fff;box-shadow:0 12px 30px rgba(59,130,246,.22);}
.auth-card input,.profile-card input,.profile-card textarea{
  background:rgba(255,255,255,.075);
  border:1px solid rgba(255,255,255,.13);
  color:#fff;
  border-radius:17px;
}
.auth-card input::placeholder,.profile-card input::placeholder,.profile-card textarea::placeholder,#msg-input::placeholder,.srch-bx input::placeholder{color:#64748b;}
.auth-card input:focus,.profile-card input:focus,.profile-card textarea:focus{
  border-color:rgba(103,232,249,.72);
  box-shadow:0 0 0 4px rgba(34,211,238,.12);
}
.btn-wa,#send-btn,.archive-lock button{
  background:linear-gradient(135deg,#22d3ee,#3b82f6,#8b5cf6)!important;
  color:#fff;
  border:0;
  box-shadow:0 14px 35px rgba(59,130,246,.24);
}
.btn-wa{border-radius:17px;font-weight:850;letter-spacing:.01em;}
.auth-note{color:#94a3b8;}
#app{
  height:100vh;
  padding:18px;
  gap:0;
  background:transparent;
}
#sidebar{
  border:var(--sp-border);
  border-right:1px solid rgba(255,255,255,.10);
  background:rgba(2,6,23,.68);
  backdrop-filter:blur(24px);
  border-radius:30px 0 0 30px;
  overflow:hidden;
  box-shadow:var(--sp-glow);
}
#main{
  border:var(--sp-border);
  border-left:0;
  background:linear-gradient(145deg,rgba(2,6,23,.66),rgba(15,23,42,.46));
  border-radius:0 30px 30px 0;
  overflow:hidden;
  box-shadow:var(--sp-glow);
}
.s-hdr,.s-srch,.ch-hdr,#input-area,#rply-bar{
  background:rgba(15,23,42,.70);
  border-color:rgba(255,255,255,.10);
  backdrop-filter:blur(18px);
}
.s-hdr{padding:16px 16px 14px;gap:12px;}
.s-title{display:flex;flex-direction:column;line-height:1.05;color:#fff;}
.s-title span{font-size:22px;font-weight:900;letter-spacing:-.04em;}
.s-title small{margin-top:5px;color:#7dd3fc;font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.07em;}
.s-acts{gap:7px;}
.icon-btn{
  background:rgba(255,255,255,.065);
  border:1px solid rgba(255,255,255,.10);
  color:#cbd5e1;
  border-radius:15px;
  font-size:18px;
}
.icon-btn:hover{background:rgba(255,255,255,.12);color:#fff;transform:translateY(-1px);}
.logout-btn{color:#fda4af;}
.logout-btn:hover{background:rgba(251,113,133,.14);}
.s-srch{padding:12px 14px;}
.srch-bx{
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.11);
  border-radius:18px;
  color:#94a3b8;
  padding:11px 13px;
}
.srch-bx input{color:#fff;}
.s-tabs{padding:0 12px 10px;border:0;gap:8px;background:rgba(15,23,42,.70);}
.s-tab{
  border:1px solid rgba(255,255,255,.10);
  border-radius:999px;
  padding:9px 11px;
  color:#94a3b8;
  background:rgba(255,255,255,.045);
  font-size:11px;
}
.s-tab.active{
  color:#e0f2fe;
  border-color:rgba(103,232,249,.32);
  background:rgba(34,211,238,.12);
}
#chat-list{padding:10px;}
.ci{
  border:1px solid rgba(255,255,255,.09);
  background:rgba(255,255,255,.045);
  border-radius:22px;
  margin-bottom:9px;
  padding:12px;
  transition:transform .18s ease,background .18s ease,border-color .18s ease,box-shadow .18s ease;
}
.ci:hover,.ci.active{
  transform:translateY(-1px);
  background:rgba(34,211,238,.10);
  border-color:rgba(103,232,249,.24);
  box-shadow:0 16px 32px rgba(8,47,73,.20);
}
.ci-av,.s-av,.ch-av{border-radius:17px;border:1px solid rgba(255,255,255,.17);}
.ci-name,.ch-name{color:#fff;font-weight:850;letter-spacing:-.015em;}
.ci-time,.ci-prev,.ch-status,.msg-time,.doc-sz,.att-lbl{color:#94a3b8;}
.on-dot{background:#34d399;border-color:#020617;box-shadow:0 0 0 4px rgba(52,211,153,.12);}
.ubadge{
  background:linear-gradient(135deg,#22d3ee,#60a5fa);
  color:#020617;
  font-weight:900;
}
#empty-state{
  background:
    radial-gradient(circle at 50% 35%,rgba(59,130,246,.24),transparent 32%),
    linear-gradient(145deg,rgba(2,6,23,.18),rgba(15,23,42,.14));
  color:#fff;
}
.es-icon{
  width:112px;height:112px;border-radius:36px;
  display:flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,rgba(34,211,238,.18),rgba(139,92,246,.18));
  border:1px solid rgba(255,255,255,.12);
  box-shadow:0 24px 70px rgba(37,99,235,.18);
  font-size:4.25rem;opacity:1;
}
#empty-state h2{font-weight:900;font-size:2.35rem;letter-spacing:-.055em;}
#empty-state p{color:#cbd5e1;max-width:520px;}
.e2e-note{
  color:#a5f3fc;
  border:1px solid rgba(103,232,249,.22);
  background:rgba(34,211,238,.10);
  border-radius:999px;
  padding:9px 14px;
  font-weight:800;
}
.ch-hdr{padding:14px 18px;gap:13px;}
.ch-av{width:48px;height:48px;font-size:17px;}
.ch-info{line-height:1.15;}
.ch-status{margin-top:5px;font-size:12px;}
#msgs{
  gap:10px;
  padding:24px clamp(14px,5vw,64px);
  background:
    radial-gradient(circle at 20% 10%,rgba(34,211,238,.12),transparent 26%),
    radial-gradient(circle at 86% 72%,rgba(139,92,246,.13),transparent 28%),
    linear-gradient(145deg,rgba(2,6,23,.35),rgba(15,23,42,.18));
}
#msgs::before{
  content:'';
  position:absolute;
  inset:0;
  pointer-events:none;
}
.bbl{
  border:1px solid rgba(255,255,255,.10);
  border-radius:24px;
  padding:11px 13px 8px;
  max-width:min(72%,720px);
  box-shadow:0 18px 45px rgba(0,0,0,.22);
  backdrop-filter:blur(12px);
}
.mw.me .bbl{
  background:linear-gradient(135deg,#22d3ee 0%,#3b82f6 52%,#8b5cf6 100%);
  border-color:rgba(255,255,255,.18);
  border-bottom-right-radius:7px;
  color:#fff;
}
.mw.them .bbl{
  background:rgba(255,255,255,.075);
  border-bottom-left-radius:7px;
}
.mw.me .bbl-txt,.mw.me .msg-time,.mw.me .ticks,.mw.me .receipt,.mw.me .read-label{color:rgba(255,255,255,.86);}
.bbl-txt{color:#f8fafc;font-size:14.8px;}
.bbl-foot{margin-top:6px;}
.rply,.rb-cnt{
  background:rgba(255,255,255,.09);
  border-left-color:#67e8f9;
  border-radius:13px;
}
.rply .rr-nm,.rb-nm{color:#a5f3fc;}
.rply .rr-tx,.rb-tx{color:#cbd5e1;}
.fwd{color:#bae6fd;}
.rxns .rxn,.rxn{
  background:rgba(255,255,255,.14);
  border:1px solid rgba(255,255,255,.10);
}
.date-div span,.sys-msg{
  background:rgba(15,23,42,.76);
  border:1px solid rgba(255,255,255,.10);
  color:#cbd5e1;
  border-radius:999px;
  box-shadow:0 12px 35px rgba(0,0,0,.20);
}
.sys-msg{padding:8px 16px;}
#input-area{padding:14px;gap:10px;}
.input-box{
  background:rgba(255,255,255,.075);
  border:1px solid rgba(255,255,255,.12);
  border-radius:22px;
  min-height:52px;
  padding:10px 15px;
}
#msg-input{color:#fff;font-size:15px;}
#emoji-btn,#attach-btn{
  width:46px;height:46px;min-width:46px;
  border-radius:17px;
  background:rgba(255,255,255,.065);
  border:1px solid rgba(255,255,255,.10);
  color:#cbd5e1;
}
#emoji-btn:hover,#attach-btn:hover{background:rgba(255,255,255,.12);color:#fff;}
#send-btn{width:52px;height:52px;border-radius:18px;}
.emoji-tray,.attach-tray,.ctx-menu,.rxn-picker,.notif-banner,.profile-card,.archive-lock{
  background:rgba(15,23,42,.92)!important;
  color:#f8fafc;
  border:1px solid rgba(255,255,255,.12);
  box-shadow:0 24px 80px rgba(0,0,0,.45);
  backdrop-filter:blur(22px);
}
.emoji-tray,.attach-tray,.ctx-menu,.notif-banner{border-radius:22px;}
.ebtn:hover,.ctx-item:hover{background:rgba(255,255,255,.10);}
.ctx-item.danger{color:#fda4af;}
.doc-bbl{background:rgba(255,255,255,.10);border:1px solid rgba(255,255,255,.10);border-radius:16px;}
.media-bbl,.media-bbl img,.media-bbl video{border-radius:18px;}
.archive-lock{
  max-width:430px;
  border-radius:30px;
  padding:30px 26px;
}
.archive-lock .lock-ico{
  width:72px;height:72px;margin:0 auto 16px;border-radius:24px;
  display:flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,rgba(251,191,36,.18),rgba(59,130,246,.18));
  border:1px solid rgba(255,255,255,.12);
}
.archive-lock h3{color:#fff;font-size:22px;letter-spacing:-.035em;}
.archive-lock p{color:#cbd5e1;}
#input-area.locked{opacity:.60;filter:saturate(.45);}
.profile-card{border-radius:30px;}
.profile-head h3{color:#fff;}
.profile-head button{color:#cbd5e1;}
.profile-sub,.profile-card label{color:#94a3b8;}
.notif-banner{top:14px;border-radius:22px;}
.read-label,.receipt.read{color:#bfdbfe;}
::-webkit-scrollbar-thumb{background:rgba(148,163,184,.42);}
@media(max-width:768px){
  #app{padding:0;height:100dvh;}
  #sidebar,#main{border-radius:0;border-left:0;border-right:0;border-top:0;border-bottom:0;}
  #chat-list{padding:8px;}
  #msgs{padding:14px 10px;}
  .bbl{max-width:86%;}
  .s-title small{display:none;}
  .ch-hdr{padding:10px 8px;}
  .ch-av{width:38px;height:38px;border-radius:14px;}
  .ch-acts .icon-btn{border-radius:13px;}
  #input-area{padding:10px 8px;}
  #emoji-btn,#attach-btn{width:40px;height:40px;min-width:40px;}
  #send-btn{width:44px;height:44px;border-radius:15px;}
}


/* ==========================================================
   Spaceship Ultra-Premium Chatbox V2 — closer to the sample
   ========================================================== */
#app{padding:22px;background:transparent;}
#sidebar{width:390px;min-width:390px;background:rgba(2,6,23,.74);border-radius:32px 0 0 32px;}
#main{background:linear-gradient(145deg,rgba(2,6,23,.72),rgba(15,23,42,.52));border-radius:0 32px 32px 0;}
.s-hdr{padding:18px 18px 15px;background:rgba(2,6,23,.42);}
.s-av{width:46px;height:46px;border-radius:18px;}
.s-title span{font-size:24px;}
.s-title small{color:#93c5fd;}
.s-premium-cards{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:0 14px 13px;background:rgba(15,23,42,.70);}
.sp-mini-card{border-radius:20px;border:1px solid rgba(255,255,255,.12);padding:12px 12px 11px;box-shadow:0 18px 40px rgba(0,0,0,.16);}
.sp-mini-card strong{display:block;font-size:12px;color:#e0f2fe;line-height:1.1;}
.sp-mini-card small{display:block;margin-top:5px;color:#93c5fd;font-size:10.5px;line-height:1.25;}
.sp-mini-card.secure{background:linear-gradient(145deg,rgba(16,185,129,.16),rgba(34,211,238,.07));border-color:rgba(110,231,183,.20);}
.sp-mini-card.timezone{background:linear-gradient(145deg,rgba(34,211,238,.16),rgba(59,130,246,.08));border-color:rgba(125,211,252,.22);}
.ci{min-height:76px;gap:13px;border-radius:24px;background:rgba(255,255,255,.045);}
.ci-av{width:50px;height:50px;border-radius:18px;}
.ci.active{background:rgba(34,211,238,.12);box-shadow:0 18px 46px rgba(59,130,246,.16),inset 0 0 0 1px rgba(103,232,249,.12);}
.ch-hdr{min-height:78px;background:rgba(2,6,23,.46);}
.ch-av{width:52px;height:52px;border-radius:20px;}
.ch-name{font-size:17px;}
.ch-status.typing-status{color:#67e8f9;font-weight:800;letter-spacing:.01em;}
#msgs{position:relative;gap:12px;padding:28px clamp(18px,5vw,72px);}
.mw{margin:0;}
.bbl{max-width:min(76%,760px);border-radius:26px;padding:12px 14px 9px;}
.mw.me .bbl{border-bottom-right-radius:8px;}
.mw.them .bbl{border-bottom-left-radius:8px;background:rgba(255,255,255,.085);}
.bbl-txt{font-size:15px;line-height:1.58;}
.bbl-foot{gap:5px;margin-top:7px;}
.receipt{display:inline-flex;align-items:center;justify-content:center;margin-left:2px;min-width:18px;}
.receipt .ticks{font-size:13px;font-weight:900;letter-spacing:-3px;font-family:Arial, Helvetica, sans-serif;}
.receipt.sent .ticks,.receipt.delivered .ticks{color:#cbd5e1;}
.receipt.read .ticks,.mw.me .receipt.read .ticks,.ci-prev .receipt.read .ticks{color:#22d3ee!important;text-shadow:0 0 10px rgba(34,211,238,.45);}
.mw.me .receipt.sent .ticks,.mw.me .receipt.delivered .ticks{color:rgba(255,255,255,.74);}
.read-label{display:none!important;}
.typing-row .bbl,.typing-bbl{display:flex;align-items:center;gap:10px;min-width:112px;padding:11px 14px!important;}
.typing-text{color:#cbd5e1;font-size:13px;font-weight:700;}
.tdots span{background:#67e8f9;box-shadow:0 0 10px rgba(103,232,249,.30);}
#input-area{padding:16px;background:rgba(2,6,23,.52);}
.input-box{border-radius:24px;min-height:54px;background:rgba(255,255,255,.08);}
#send-btn{font-size:22px;}
@media(max-width:768px){#app{padding:0}#sidebar{width:100vw;min-width:0;border-radius:0}.s-premium-cards{padding:0 10px 10px}.sp-mini-card{border-radius:17px;padding:10px}#main{border-radius:0}.ch-hdr{min-height:60px}.bbl{max-width:86%}}


/* ==========================================================
   Spaceship Calls + Wallpaper
   ========================================================== */
#msgs.has-wallpaper{
  background-image:
    linear-gradient(145deg,rgba(2,6,23,.74),rgba(15,23,42,.54)),
    var(--chat-wallpaper);
  background-size:cover;
  background-position:center;
  background-attachment:local;
}
#msgs.has-wallpaper::after{
  content:'';
  position:absolute;
  inset:0;
  pointer-events:none;
  background:radial-gradient(circle at 20% 10%,rgba(34,211,238,.13),transparent 28%),radial-gradient(circle at 86% 72%,rgba(139,92,246,.14),transparent 30%);
}
#msgs.has-wallpaper > *{position:relative;z-index:1;}

.call-modal{display:none;position:fixed;inset:0;z-index:5000;align-items:center;justify-content:center;background:#020617;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y;}
.call-modal.open{display:flex;}
.call-card{position:relative;width:min(430px,100vw);height:100dvh;max-height:100dvh;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;background:#020617;color:#f8fafc;text-align:center;box-shadow:0 35px 100px rgba(0,0,0,.55);}
.call-video-grid{position:relative;width:100%;min-height:100dvh;background:#020617;overflow:hidden;isolation:isolate;}
.call-video-grid.voice-only{background:radial-gradient(circle at 50% 22%,rgba(34,211,238,.22),transparent 30%),linear-gradient(160deg,#0f172a,#020617 58%,#111827);}
.call-video-grid video{width:100%;height:100%;background:#020617;object-fit:cover;display:block;}
.local-tile{overflow:visible!important;}
.local-tile video{border-radius:inherit;box-shadow:inherit;}
.remote-tile{overflow:hidden;}
.call-video-tile{position:absolute;overflow:hidden;background:#020617;box-shadow:0 16px 44px rgba(0,0,0,.45);cursor:pointer;transition:all .22s ease;}
.remote-tile{inset:0;z-index:1;border-radius:0;}
.local-tile{right:18px;bottom:132px;width:min(44vw,176px);aspect-ratio:9/16;border-radius:18px;border:1px solid rgba(255,255,255,.24);z-index:4;}
.call-video-grid.focus-local .local-tile{inset:0;width:auto;aspect-ratio:auto;border:0;border-radius:0;z-index:1;}
.call-video-grid.focus-local .remote-tile{right:18px;bottom:132px;left:auto;top:auto;width:min(44vw,176px);height:auto;aspect-ratio:9/16;border-radius:18px;border:1px solid rgba(255,255,255,.24);z-index:4;}
.call-video-grid.voice-only .call-video-tile{display:none;}
.call-tile-label{position:absolute;left:10px;bottom:8px;border-radius:999px;background:rgba(2,6,23,.52);border:1px solid rgba(255,255,255,.10);padding:4px 8px;font-size:10px;font-weight:900;color:#e5e7eb;backdrop-filter:blur(10px);opacity:.88;}
.call-pip-flip{position:absolute;right:-13px;top:-13px;width:58px;height:58px;min-width:58px;min-height:58px;border:3px solid rgba(255,255,255,.92);border-radius:999px;background:rgba(15,23,42,.94);color:#fff;font-size:29px;font-weight:950;box-shadow:0 14px 34px rgba(0,0,0,.50);cursor:pointer;z-index:30;touch-action:manipulation;-webkit-tap-highlight-color:transparent;}
.call-video-grid.focus-local .call-pip-flip{right:18px;top:calc(env(safe-area-inset-top,0px) + 96px);width:62px;height:62px;font-size:31px;z-index:32;}
.call-pip-flip:active{transform:scale(.96);}
.call-top-bar{position:absolute;left:0;right:0;top:0;z-index:8;display:grid;grid-template-columns:58px 1fr 58px;align-items:start;gap:8px;padding:calc(env(safe-area-inset-top,0px) + 14px) 16px 10px;background:linear-gradient(180deg,rgba(2,6,23,.54),rgba(2,6,23,0));pointer-events:none;}
.call-top-bar > *{pointer-events:auto;}
.call-top-btn{width:54px;height:54px;border:0;border-radius:999px;background:rgba(15,23,42,.78);color:#fff;font-size:22px;font-weight:900;box-shadow:0 12px 34px rgba(0,0,0,.30);cursor:pointer;backdrop-filter:blur(12px);}
.call-title-stack{display:flex;flex-direction:column;align-items:center;min-width:0;text-shadow:0 2px 14px rgba(0,0,0,.55);}
.call-title-stack strong{max-width:100%;font-size:17px;font-weight:950;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;filter:blur(2.5px);}
.call-title-stack span{font-size:15px;color:#f8fafc;font-weight:800;}
.call-kicker{display:block!important;border:0;background:transparent;color:#dbeafe;border-radius:0;padding:1px 0 0;font-size:11px!important;font-weight:900;letter-spacing:.04em;text-transform:uppercase;}
.call-orbit{position:absolute;left:50%;top:35%;transform:translate(-50%,-50%);z-index:2;width:128px;height:128px;border-radius:42px;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,#22d3ee,#3b82f6,#8b5cf6);box-shadow:0 22px 70px rgba(59,130,246,.35);font-size:48px;font-weight:900;}
.call-video-grid:not(.voice-only) .call-orbit{display:none;}
#remote-audio{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none;}
.call-actions{position:sticky;left:0;right:0;bottom:0;z-index:10;display:flex;align-items:center;justify-content:center;gap:10px;margin:0 auto;padding:12px 14px calc(env(safe-area-inset-bottom,0px) + 12px);width:min(94vw,360px);background:rgba(3,7,18,.86);border:1px solid rgba(255,255,255,.10);border-radius:26px 26px 0 0;backdrop-filter:blur(18px);box-shadow:0 -12px 35px rgba(0,0,0,.32);}
.call-btn{width:58px;height:58px;border:0;border-radius:999px;display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;color:#fff;cursor:pointer;box-shadow:0 12px 35px rgba(0,0,0,.25);font-weight:900;}
.call-btn span{font-size:21px;line-height:1;}
.call-btn small{font-size:9px;font-weight:900;line-height:1;color:rgba(255,255,255,.94);}
.call-btn:disabled{opacity:.48;cursor:not-allowed;box-shadow:none;}
.call-btn.accept{display:none;background:linear-gradient(135deg,#10b981,#22c55e);}
.call-btn.more,.call-btn.mute{background:rgba(15,23,42,.88);border:1px solid rgba(255,255,255,.10);}
.call-btn.video,.call-btn.speaker{background:#fff;color:#020617;}
.call-btn.video small,.call-btn.speaker small{color:#020617;}
.call-btn.end{background:linear-gradient(135deg,#ef174d,#e11d48);}
.call-btn.active{outline:3px solid rgba(56,189,248,.42);}
.call-more-panel{position:absolute;left:16px;right:16px;bottom:108px;z-index:9;display:none;grid-template-columns:1fr;gap:9px;padding:12px;border-radius:22px;background:rgba(15,23,42,.92);border:1px solid rgba(255,255,255,.12);box-shadow:0 18px 55px rgba(0,0,0,.38);backdrop-filter:blur(18px);}
.call-more-panel.open{display:grid;}
.call-more-item,.call-mini-btn{border:1px solid rgba(255,255,255,.14);border-radius:16px;background:rgba(255,255,255,.10);color:#fff;font-weight:900;padding:12px;cursor:pointer;text-align:left;}
.call-more-item:disabled{opacity:.55;cursor:not-allowed;}
.call-camera-controls{display:none!important;align-items:stretch;justify-content:center;gap:8px;flex-direction:column;color:#cbd5e1;font-size:12px;text-align:left;}
.call-camera-controls label{font-weight:900;color:#e2e8f0;}
.call-camera-controls select{width:100%;border:1px solid rgba(148,163,184,.28);border-radius:16px;background:rgba(2,6,23,.70);color:#f8fafc;padding:11px 12px;outline:none;}
.call-note{margin:10px auto 14px;width:min(92vw,390px);color:#94a3b8;font-size:12px;line-height:1.45;padding-bottom:8px;}
.call-chat-panel{position:fixed;left:50%;bottom:calc(env(safe-area-inset-bottom,0px) + 88px);transform:translate(-50%,18px);z-index:5010;width:min(410px,94vw);max-height:min(58dvh,420px);display:none;flex-direction:column;border:1px solid rgba(148,163,184,.20);background:rgba(15,23,42,.96);border-radius:22px;padding:12px;text-align:left;box-shadow:0 18px 65px rgba(0,0,0,.48);backdrop-filter:blur(18px);}
.call-chat-panel.open{display:flex;transform:translate(-50%,0);}
.call-chat-head{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:8px;margin-bottom:8px;color:#f8fafc;font-size:13px;font-weight:900;}
.call-chat-head small{color:#94a3b8;font-size:11px;font-weight:700;text-align:right;}
.call-chat-close{width:28px;height:28px;border:0;border-radius:999px;background:rgba(255,255,255,.10);color:#fff;cursor:pointer;}
.call-chat-log{min-height:112px;max-height:238px;overflow-y:auto;border-radius:16px;background:rgba(2,6,23,.50);padding:10px;display:flex;flex-direction:column;gap:7px;}
.call-chat-empty{color:#94a3b8;text-align:center;font-size:12px;line-height:1.45;margin:auto;}
.call-chat-msg{max-width:88%;border-radius:16px;padding:8px 10px;font-size:13px;line-height:1.35;color:#e2e8f0;word-break:break-word;}
.call-chat-msg.me{align-self:flex-end;background:linear-gradient(135deg,rgba(34,211,238,.22),rgba(59,130,246,.25));border:1px solid rgba(125,211,252,.22);}
.call-chat-msg.them{align-self:flex-start;background:rgba(255,255,255,.09);border:1px solid rgba(255,255,255,.10);}
.call-chat-msg small{display:block;opacity:.65;font-size:10px;margin-top:3px;}
.call-chat-media{display:block;border:0;background:transparent;padding:0;margin:0;cursor:pointer;max-width:180px;}
.call-chat-media img{display:block;max-width:180px;max-height:160px;border-radius:12px;object-fit:contain;background:rgba(2,6,23,.65);}
.call-chat-compose{display:flex;align-items:center;gap:8px;margin-top:9px;position:relative;}
.call-chat-compose input{flex:1;min-width:0;border:1px solid rgba(148,163,184,.25);border-radius:999px;background:rgba(2,6,23,.55);color:#f8fafc;outline:none;padding:10px 13px;font-size:13px;}
.call-chat-compose input::placeholder{color:#94a3b8;}
.call-chat-compose button{border:0;border-radius:999px;background:linear-gradient(135deg,#22d3ee,#3b82f6);color:#fff;font-weight:900;padding:0 15px;cursor:pointer;min-height:38px;}
.call-chat-compose .call-chat-tool{background:rgba(255,255,255,.10);border:1px solid rgba(255,255,255,.12);padding:0 10px;min-width:40px;}
.call-emoji-tray{position:absolute;left:0;bottom:48px;width:min(340px,88vw);max-height:210px;overflow-y:auto;background:#fff;border-radius:18px;box-shadow:0 18px 55px rgba(0,0,0,.35);padding:12px;display:none;z-index:4;}
.call-emoji-tray.open{display:block;}
@media(min-width:760px){.call-card{width:min(980px,96vw);height:min(860px,96dvh);max-height:96dvh;border-radius:34px;overflow:hidden}.call-video-grid{min-height:100%;height:100%;border-radius:34px}.local-tile,.call-video-grid.focus-local .remote-tile{width:230px;bottom:118px;right:24px}.call-actions{position:absolute;bottom:18px;border-radius:26px}.call-more-panel{left:50%;right:auto;transform:translateX(-50%);width:min(390px,88vw);bottom:104px}.call-chat-panel{bottom:124px}.call-video-grid.focus-local .call-pip-flip{top:96px}.call-title-stack strong{filter:blur(2px)}}
@supports not (height:100dvh){.call-card{height:100vh;max-height:100vh}.call-video-grid{min-height:100vh}}
@media(max-width:700px){.call-card{width:100vw;height:100dvh;max-height:100dvh}.call-actions{width:min(94vw,360px);gap:8px}.call-btn{width:56px;height:56px}.call-chat-compose{gap:6px}.call-chat-compose button{padding:0 11px}.ch-acts{max-width:52vw;}}

/* 2026-06-03f: WhatsApp-style flip/ring refinement */
@media(max-width:700px){
  .local-tile{right:22px;bottom:150px;width:min(44vw,185px);}
  .call-pip-flip{right:-14px;top:-14px;width:60px;height:60px;}
  .call-video-grid.focus-local .call-pip-flip{top:calc(env(safe-area-inset-top,0px) + 92px);right:18px;}
}
