/* ════════════════════════════════════════════
   ArsenX — Global Styles v3
   Dark / Light mode + Telegram chat
   ════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  /* Dark mode (default) */
  --bg:    #08090d;
  --bg2:   #0f1117;
  --card:  #13151e;
  --card2: #1a1d29;
  --border:  rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text:  #f0f2ff;
  --text2: #8b90a7;
  --text3: #5a5f75;
  --shadow: rgba(0,0,0,0.5);
  --g1:#3ecbe0; --g2:#3ecbe0; --g3:#c7f200; --g4:#c7f200;
  --grad: linear-gradient(135deg,#7c3aed,#2563eb,#06b6d4);
  --grad-story: linear-gradient(135deg,#3ecbe0,#c7f200);
  --danger: #f43f5e;
  --online: #25d366;
  --msg-me-bg: linear-gradient(135deg,#6d28d9,#2563eb);
  --msg-other-bg: #1a1d29;
  --msg-me-text: #fff;
  --msg-other-text: #f0f2ff;
  --input-bg: #1a1d29;
  --header-bg: rgba(13,15,23,0.97);
  --skeleton: #1e2130;
  --skeleton-shine: #272b3f;
}

/* ── Light Mode ── */
[data-theme="light"] {
  --bg:    #ffffff;
  --bg2:   #f4f4f5;
  --card:  #ffffff;
  --card2: #f4f4f5;
  --border:  rgba(0,0,0,0.07);
  --border2: rgba(0,0,0,0.12);
  --text:  #0e0e0e;
  --text2: #707579;
  --text3: #a3a7ab;
  --shadow: rgba(0,0,0,0.08);
  --msg-me-bg: linear-gradient(135deg,#6d28d9,#2563eb);
  --msg-other-bg: #ffffff;
  --msg-me-text: #fff;
  --msg-other-text: #0e0e0e;
  --input-bg: #ffffff;
  --header-bg: rgba(255,255,255,0.92);
  --skeleton: #ececec;
  --skeleton-shine: #f7f7f8;
}

/* ── Reset & Base ── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{height:100%;font-size:16px}
body{
  background:var(--bg);
  color:var(--text);
  font-family:'DM Sans',system-ui,-apple-system,sans-serif;
  -webkit-font-smoothing:antialiased;
  min-height:100%;
  transition:background .25s,color .25s;
}

/* ── Uzoq bosishda matn belgilash / "Google'da qidirish" popupini bloklash ──
   JS selectstart eventi mobil brauzerlarda uzoq bosishni har doim ham
   to'xtata olmaydi — shuning uchun CSS darajasida ham bloklaymiz. */
*{
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
}
/* ── Tugma/qator bosilganda chiqadigan "oq burchak" (tap-highlight flash) ──
   Sabab: mobil brauzerlar (ayniqsa iOS Safari va ba'zi Android WebView'lar)
   har qanday bosiladigan elementga standart yarim-shaffof to'rtburchak
   effekt chizadi; radiusli (border-radius) elementlarda bu burchaklardan
   chiqib qolib, "oq burchak" ko'rinishini beradi. Yuqorida global o'chirib,
   pastda esa asosiy interaktiv elementlarga o'zimizning yengil :active
   fikr-bildirishimizni qo'yamiz — sayt bo'ylab (chat, guruh, profil va
   boshqa barcha sahifalarda), chunki bularning hammasi shu style.css ni
   ishlatadi. */
.user-row:active,.sr-row:active,.msg-row:active{background:var(--card2)}
.tba-btn:active,#themeToggle:active{transform:scale(.92)}
.list-tab:active,.pn-allow:active,.cg-submit:active{opacity:.85;transform:scale(.98)}
.pn-skip:active,.cg-cancel:active,.ch-back:active{background:var(--card2)}
.promo-close:active,.search-clear:active{opacity:.7}
button:active,a:active{opacity:.9}

input, textarea, [contenteditable="true"], [contenteditable=""] {
  -webkit-touch-callout: default !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  user-select: text !important;
}

/* ── Scrollbar ── */
::-webkit-scrollbar{width:4px;height:4px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--border2);border-radius:4px}

/* ── Skeleton Loader ── */
@keyframes shimmer{
  0%{background-position:-400px 0}
  100%{background-position:400px 0}
}
.skeleton{
  background:var(--skeleton);
  background-image:linear-gradient(
    90deg,
    var(--skeleton) 0px,
    var(--skeleton-shine) 80px,
    var(--skeleton) 160px
  );
  background-size:400px 100%;
  animation:shimmer 1.4s infinite linear;
  border-radius:6px;
}

/* ── Top bar ── */
.top-bar{
  display:flex;align-items:center;justify-content:center;
  padding:0 16px;height:57px;
  background:var(--header-bg);
  border-bottom:1px solid var(--border);
  position:sticky;top:0;z-index:10;
  backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);
}
.top-bar-inner{max-width:640px;margin:0 auto;width:100%;display:flex;align-items:center;justify-content:space-between}
.search-inner,.list-inner{max-width:640px;margin:0 auto;width:100%}
.top-bar-title{font-size:18px;font-weight:700;color:var(--text)}
.top-bar-actions{display:flex;gap:6px;align-items:center}
.tba-btn{
  width:36px;height:36px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  background:var(--card2);border:1px solid var(--border);
  color:var(--text2);cursor:pointer;text-decoration:none;
  transition:all .2s;font-size:15px
}
.tba-btn:hover{border-color:var(--g2);color:var(--text)}
.my-av{width:34px;height:34px;border-radius:50%;object-fit:cover;border:2px solid var(--g2);cursor:pointer}

/* ── Theme Toggle Button ── */
#themeToggle{
  width:36px;height:36px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  background:var(--card2);border:1px solid var(--border);
  color:var(--text2);cursor:pointer;font-size:17px;
  transition:all .2s;flex-shrink:0;
}
#themeToggle:hover{border-color:var(--g2);color:var(--text)}

/* ── Search ── */
.search-area{
  padding:10px 16px;background:var(--bg);
  border-bottom:1px solid var(--border);
  position:sticky;top:57px;z-index:9;display:flex;justify-content:center
}
.search-wrap{position:relative;width:100%;max-width:none;margin:0;flex:none}
.search-inp{
  width:100%;background:var(--card2);
  border:1.5px solid var(--border);border-radius:22px;
  padding:9px 16px;color:var(--text);font-size:14px;
  outline:none;box-sizing:border-box;transition:border-color .2s
}
.search-inp:focus{border-color:var(--g2)}
.search-clear{
  position:absolute;right:14px;top:50%;transform:translateY(-50%);
  background:none;border:none;color:var(--text3);cursor:pointer;
  font-size:18px;display:none;line-height:1;padding:0
}
.search-results{
  position:absolute;left:0;right:0;top:calc(100% + 4px);
  background:var(--card);border:1px solid var(--border);
  border-radius:14px;z-index:100;overflow:hidden;
  box-shadow:0 8px 32px var(--shadow);
  max-height:60vh;overflow-y:auto;display:none
}
.search-results.show{display:block}

/* ── User rows ── */
.user-row{
  display:flex;align-items:center;gap:12px;padding:12px 16px;
  border-bottom:1px solid var(--border);text-decoration:none;
  color:var(--text);transition:background .15s;cursor:pointer
}
.user-row:hover{background:var(--card2)}
.user-row:last-child{border-bottom:none}
.user-av{width:48px;height:48px;border-radius:15px;object-fit:cover;border:2px solid var(--border2);flex-shrink:0;position:relative}
.user-info{flex:1;min-width:0}
.user-name{font-weight:600;font-size:15px}
.user-last{font-size:13px;color:var(--text3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.user-meta{display:flex;flex-direction:column;align-items:flex-end;gap:4px;flex-shrink:0}
.user-time{font-size:11px;color:var(--text3)}
.unread-badge{background:var(--g4);color:#fff;font-size:11px;font-weight:700;padding:2px 7px;border-radius:10px;min-width:20px;text-align:center}
.online-dot{width:10px;height:10px;border-radius:50%;background:var(--online);border:2px solid var(--bg);position:absolute;bottom:1px;right:1px}
.empty-state{text-align:center;padding:60px 20px;color:var(--text3)}
.empty-state p{margin-top:10px;font-size:14px}

/* ── Push modal ── */
.pn-overlay{position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:9999;display:flex;align-items:flex-end;justify-content:center;padding:0 0 env(safe-area-inset-bottom,0);animation:pnFadeIn .2s ease}
@keyframes pnFadeIn{from{opacity:0}to{opacity:1}}
.pn-sheet{background:var(--card);border-radius:20px 20px 0 0;padding:24px 20px 32px;width:100%;max-width:480px;border-top:1px solid var(--border);animation:pnSlideUp .25s ease}
@keyframes pnSlideUp{from{transform:translateY(60px);opacity:0}to{transform:none;opacity:1}}
.pn-icon{font-size:44px;text-align:center;margin-bottom:12px}
.pn-title{font-size:18px;font-weight:700;color:var(--text);text-align:center;margin-bottom:8px}
.pn-desc{font-size:14px;color:var(--text2);text-align:center;line-height:1.5;margin-bottom:22px}
.pn-btns{display:flex;flex-direction:column;gap:10px}
.pn-allow{background:linear-gradient(135deg,#7c3aed,#2563eb);color:#fff;border:none;border-radius:12px;padding:14px;font-size:15px;font-weight:700;cursor:pointer;width:100%;transition:opacity .2s}
.pn-allow:hover{opacity:.9}
.pn-skip{background:none;border:1.5px solid var(--border);color:var(--text3);border-radius:12px;padding:12px;font-size:14px;font-weight:600;cursor:pointer;width:100%;transition:all .2s}
.pn-skip:hover{border-color:var(--border2);color:var(--text2)}

.search-hint{padding:12px 16px;font-size:12px;color:var(--text3);text-align:center}
.sr-row{display:flex;align-items:center;gap:10px;padding:10px 14px;cursor:pointer;transition:background .15s;text-decoration:none;color:var(--text)}
.sr-row:hover{background:var(--card2)}
.sr-av{width:40px;height:40px;border-radius:50%;object-fit:cover;border:1.5px solid var(--border2);flex-shrink:0;position:relative}
.sr-info{flex:1;min-width:0}
.sr-name{font-size:14px;font-weight:600}
.sr-un{font-size:12px;color:var(--text3)}
.sr-section-lbl{padding:8px 14px 4px;font-size:11px;font-weight:700;color:var(--text3);text-transform:uppercase;letter-spacing:.4px}
.sr-online{font-size:11px;color:var(--online)}

@keyframes slideUp{from{transform:translateY(80px);opacity:0}to{transform:none;opacity:1}}

/* ════════════════════════════════════════════
   TELEGRAM-STYLE CHAT
   ════════════════════════════════════════════ */

/* Chat page container */
.cw{display:flex;flex-direction:column;height:100vh;height:100dvh;overflow:hidden}

/* Header */
.ch{
  position:sticky;top:0;z-index:20;
  display:flex;align-items:center;gap:10px;padding:10px 14px;
  background:var(--header-bg);
  border-bottom:1px solid var(--border);
  flex-shrink:0;
  backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);
  min-height:56px;
}
.ch-back{cursor:pointer;width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:var(--text2);font-size:18px;text-decoration:none;transition:background .2s;flex-shrink:0}
.ch-back:hover{background:var(--card2)}
.ch-av{width:42px;height:42px;border-radius:50%;object-fit:cover;border:2px solid var(--border2);flex-shrink:0}
.ch-info{flex:1;min-width:0}
.ch-name{font-weight:600;font-size:15px;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ch-status{font-size:12px;color:var(--text3);display:flex;align-items:center;gap:4px;margin-top:2px}
.ch-typing{font-size:12px;color:var(--g3);display:flex;align-items:center;gap:6px;margin-top:2px}
.typing-dots{display:inline-flex;gap:3px;align-items:center}
.typing-dots span{width:5px;height:5px;border-radius:50%;background:var(--g3);display:inline-block;animation:tdot 1.2s infinite ease-in-out}
.typing-dots span:nth-child(2){animation-delay:.15s}
.typing-dots span:nth-child(3){animation-delay:.3s}
@keyframes tdot{0%,80%,100%{transform:scale(.6);opacity:.4}40%{transform:scale(1);opacity:1}}
.dot-on{width:7px;height:7px;border-radius:50%;background:var(--online);display:inline-block;animation:pulse-g 2s infinite}
.dot-off{width:7px;height:7px;border-radius:50%;background:var(--text3);display:inline-block}
@keyframes pulse-g{0%,100%{opacity:1}50%{opacity:.5}}

/* Chat body */
.cb{
  flex:1;overflow-y:auto;
  padding:12px 10px;
  display:flex;flex-direction:column;gap:2px;
  scroll-behavior:smooth;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  /* Telegram-like subtle bg pattern */
  background:var(--bg);
}
.cb::-webkit-scrollbar{width:4px}
.cb::-webkit-scrollbar-thumb{background:var(--border2);border-radius:4px}

/* Date separator — Telegram style */
.date-div{
  display:flex;align-items:center;justify-content:center;
  margin:10px 0 4px;
}
.date-div-inner{
  background:var(--card2);
  color:var(--text3);
  font-size:12px;
  padding:3px 12px;
  border-radius:12px;
  border:1px solid var(--border);
}

/* Message rows */
.mrow{
  display:flex;align-items:flex-end;gap:6px;
  max-width:100%;
  animation:msgIn .18s ease both;
}
@keyframes msgIn{from{opacity:0;transform:translateY(6px) scale(.98)}to{opacity:1;transform:none}}
.mrow.me{flex-direction:row-reverse;padding-left:40px}
.mrow.other{padding-right:40px}
.mav{width:28px;height:28px;border-radius:50%;object-fit:cover;flex-shrink:0;border:1.5px solid var(--border2)}

/* Bubble */
.bbl{
  max-width:min(75%,480px);
  padding:8px 12px 5px;
  border-radius:18px;
  font-size:14px;line-height:1.5;
  position:relative;word-break:break-word;
  cursor:default;
}
.mtxt{white-space:pre-wrap}

/* My messages — gradient like Telegram */
.mrow.me .bbl{
  background:var(--msg-me-bg);
  color:var(--msg-me-text);
  border-bottom-right-radius:5px;
  box-shadow:0 2px 8px rgba(109,40,217,.3);
}
/* Other messages */
.mrow.other .bbl{
  background:var(--msg-other-bg);
  border:1px solid var(--border);
  color:var(--msg-other-text);
  border-bottom-left-radius:5px;
  box-shadow:0 1px 4px rgba(0,0,0,.08);
}

/* Reply preview inside bubble */
.rp{
  display:flex;gap:6px;padding:5px 8px;border-radius:8px;
  margin-bottom:5px;background:rgba(0,0,0,.12);
  cursor:pointer;border-left:3px solid rgba(255,255,255,.4);
  overflow:hidden;max-height:52px;
}
.mrow.other .rp{background:var(--border);border-left-color:var(--g3)}
.rp-name{font-size:11px;font-weight:600;color:var(--g3)}
.mrow.me .rp-name{color:rgba(255,255,255,.85)}
.rp-txt{font-size:12px;color:var(--text3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mrow.me .rp-txt{color:rgba(255,255,255,.6)}

/* Chat image — skeleton while loading */
.bimg-wrap{
  position:relative;margin-top:6px;
  border-radius:12px;overflow:hidden;
  min-width:100px;min-height:80px;
  background:var(--skeleton);
  display:inline-block;
}
.bimg-wrap .skeleton-placeholder{
  position:absolute;inset:0;
  background:var(--skeleton);
  background-image:linear-gradient(90deg,var(--skeleton) 0px,var(--skeleton-shine) 80px,var(--skeleton) 160px);
  background-size:400px 100%;
  animation:shimmer 1.4s infinite linear;
  border-radius:12px;
  z-index:1;
}
.bimg{
  max-width:min(260px,65vw);max-height:280px;
  border-radius:12px;display:block;cursor:pointer;
  object-fit:cover;
  opacity:0;transition:opacity .25s ease;
  position:relative;z-index:2;
}
.bimg.loaded{opacity:1}
.bimg.loaded+.skeleton-placeholder,.bimg.loaded~.skeleton-placeholder{display:none}

/* Tail for chat bubbles — Telegram style */
.mrow.me .bbl::after{
  content:'';
  position:absolute;bottom:0;right:-6px;
  width:8px;height:13px;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13'%3E%3Cpath fill='%236d28d9' d='M5 0s1.5 3 2.5 5S9 13 0 13V0Z'/%3E%3C/svg%3E") no-repeat;
  background-size:100%;
}
.mrow.other .bbl::after{
  content:'';
  position:absolute;bottom:0;left:-6px;
  width:8px;height:13px;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13'%3E%3Cpath fill='%231a1d29' d='M3 0S1.5 3 .5 5-1 13 8 13V0Z'/%3E%3C/svg%3E") no-repeat;
  background-size:100%;
}
[data-theme="light"] .mrow.other .bbl::after{
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13'%3E%3Cpath fill='%23ffffff' d='M3 0S1.5 3 .5 5-1 13 8 13V0Z'/%3E%3C/svg%3E") no-repeat;
  background-size:100%;
}

/* Message meta */
.bmeta{
  display:flex;align-items:center;justify-content:flex-end;gap:3px;
  font-size:11px;margin-top:3px;opacity:.7;
}
.mrow.me .bmeta{color:rgba(255,255,255,.9)}
.mrow.other .bmeta{color:var(--text3)}
.tick-r{color:#7dd3fc}
.tick-s{color:rgba(255,255,255,.55)}
.edited-lbl{font-style:italic;margin-right:2px}

/* Action buttons */
.bacts{
  display:none;position:absolute;
  flex-direction:column;gap:3px;
  top:0;z-index:5;pointer-events:none;
}
.mrow.me .bacts{right:calc(100% + 6px)}
.mrow.other .bacts{left:calc(100% + 6px)}
.bbl:hover .bacts,.bbl.touch-act .bacts{display:flex;pointer-events:auto}
.abt{
  width:30px;height:30px;border-radius:50%;
  background:var(--card2);border:1px solid var(--border);
  color:var(--text2);cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:background .15s,color .15s;
  box-shadow:0 2px 6px var(--shadow);
}
.abt:hover{background:var(--card);color:var(--text)}
.abt.del:hover{background:rgba(244,63,94,.18);color:#f43f5e}
.abt svg{pointer-events:none}

/* Edit box */
.edit-box{display:none;margin-top:6px}
.edit-box.show{display:block}
.edit-box input{
  width:100%;background:rgba(0,0,0,.22);
  border:1px solid var(--g3);border-radius:8px;
  padding:5px 9px;color:inherit;font-size:13px;
  outline:none;box-sizing:border-box;font-family:inherit;
}
[data-theme="light"] .edit-box input{background:rgba(0,0,0,.07)}
.edit-btns{display:flex;gap:5px;margin-top:4px}
.e-save,.e-cancel{border:none;border-radius:6px;padding:4px 11px;cursor:pointer;font-size:12px;font-weight:600}
.e-save{background:var(--g4);color:#fff}
.e-cancel{background:var(--card2);color:var(--text2)}

/* Footer */
.cf{
  background:var(--header-bg);
  border-top:1px solid var(--border);
  flex-shrink:0;
  backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);
  padding-bottom:env(safe-area-inset-bottom,0px);
}
.rbar{display:none;padding:8px 14px;background:var(--card2);border-top:1px solid var(--border);align-items:center;gap:10px;border-left:3px solid var(--g3)}
.rbar.show{display:flex}
.rbar-info{flex:1;min-width:0}
.rbar-name{font-size:12px;font-weight:600;color:var(--g3)}
.rbar-txt{font-size:12px;color:var(--text3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rbar-close{background:none;border:none;color:var(--text3);cursor:pointer;font-size:18px;padding:0 4px;line-height:1}
.iprev{display:none;padding:8px 14px;background:var(--card2);border-top:1px solid var(--border);align-items:center;gap:10px}
.iprev.show{display:flex}
.iprev-thumb{width:44px;height:44px;object-fit:cover;border-radius:8px;flex-shrink:0}
.iprev-name{flex:1;font-size:12px;color:var(--text2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.iprev-rm{background:none;border:none;color:var(--text3);cursor:pointer;font-size:18px;line-height:1}

/* Upload progress */
#prog-wrap{display:none;height:18px;background:var(--border);align-items:center;padding:0 10px;gap:8px}
#prog-wrap.show{display:flex}
#prog-track{flex:1;height:3px;background:rgba(255,255,255,.08);border-radius:2px;overflow:hidden;position:relative}
#prog-bar{height:3px;background:var(--grad);width:0;transition:width .15s linear;border-radius:2px}
#prog-bar.indeterminate{width:30% !important;animation:prog-indet 1.1s infinite linear;transition:none}
@keyframes prog-indet{0%{transform:translateX(-100%)}100%{transform:translateX(330%)}}
#prog-pct{font-size:11px;color:var(--text3);flex-shrink:0;min-width:54px;text-align:right}

/* Input area */
.cf-form{display:flex;align-items:center;gap:8px;padding:10px 12px}
.file-lbl{
  width:38px;height:38px;border-radius:50%;
  background:var(--card2);border:1.5px solid var(--border);
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;color:var(--text2);transition:all .2s;flex-shrink:0;
}
.file-lbl:hover,.file-lbl:active{border-color:var(--g2);color:var(--g3)}
.file-lbl.has{border-color:var(--g4);color:var(--g4)}
.msg-inp{
  flex:1;min-width:0;padding:10px 16px;
  background:var(--input-bg);border:1.5px solid var(--border);
  border-radius:22px;color:var(--text);font-size:16px;
  outline:none;transition:border-color .2s;font-family:inherit;
  resize:none;max-height:120px;line-height:1.4;overflow-y:auto;
}
.msg-inp:focus{border-color:var(--g2)}
.msg-inp::placeholder{color:var(--text3)}
.send-btn{
  width:40px;height:40px;border-radius:50%;background:var(--grad);
  border:none;display:flex;align-items:center;justify-content:center;
  cursor:pointer;color:#fff;
  box-shadow:0 3px 14px rgba(109,40,217,.4);
  transition:all .2s;flex-shrink:0;
}
.send-btn:hover{transform:scale(1.08)}
.send-btn:active{transform:scale(.95)}
.send-btn:disabled{opacity:.5;cursor:not-allowed;transform:none}

/* Lightbox */
#lb{
  display:none;position:fixed;inset:0;z-index:9999;
  background:rgba(0,0,0,.95);align-items:center;
  justify-content:center;flex-direction:column;touch-action:pan-y;
}
#lb.show{display:flex}
#lb-img-wrap{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:100%;overflow:hidden}
#lb img{max-width:100vw;max-height:100vh;object-fit:contain;transition:transform .2s ease;user-select:none;-webkit-user-select:none}
#lb-close{position:fixed;top:env(safe-area-inset-top,16px);right:16px;background:rgba(0,0,0,.5);border:none;color:#fff;width:36px;height:36px;border-radius:50%;font-size:20px;cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:10001;backdrop-filter:blur(4px)}

/* Emoji bar */
.bacts{z-index:10}
#eq-bar-global{position:fixed;z-index:10001;display:none;background:var(--card);border:1px solid var(--border);border-radius:999px;padding:4px 8px;box-shadow:0 4px 24px var(--shadow);align-items:center;gap:2px;white-space:nowrap;pointer-events:auto}
#eq-bar-global.show{display:flex}
.eq-ep{font-size:24px;cursor:pointer;padding:3px 5px;border-radius:50%;border:none;background:none;transition:transform .15s;line-height:1}
.eq-ep:active{transform:scale(1.3)}
.eq-more{font-size:16px;cursor:pointer;padding:4px 7px;border-radius:50%;border:1px solid var(--border);background:var(--card2);color:var(--text2)}
#ep-global{position:fixed;z-index:10002;display:none;background:var(--card);border:1px solid var(--border);border-radius:14px;padding:8px;box-shadow:0 8px 32px var(--shadow);grid-template-columns:repeat(8,1fr);gap:2px;width:min(320px,90vw);max-height:260px;overflow-y:auto;pointer-events:auto}
#ep-global.show{display:grid}
.ep-btn{background:none;border:none;font-size:22px;cursor:pointer;padding:5px;border-radius:8px;transition:background .15s;line-height:1;text-align:center;width:34px;height:34px;display:flex;align-items:center;justify-content:center}
.ep-btn:hover,.ep-btn:active{background:var(--card2)}

/* Reactions */
.react-bar{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}
.react-chip{display:inline-flex;align-items:center;gap:3px;background:rgba(255,255,255,.07);border:1px solid rgba(255,255,255,.12);border-radius:12px;padding:2px 8px;font-size:13px;cursor:pointer;transition:all .15s;user-select:none}
[data-theme="light"] .react-chip{background:rgba(0,0,0,.05);border-color:rgba(0,0,0,.1)}
.react-chip.mine{background:rgba(109,40,217,.25);border-color:rgba(109,40,217,.5)}
.react-chip:hover{background:rgba(255,255,255,.13)}
.react-cnt{font-size:12px;color:var(--text2)}

/* Delete chat modal */
.del-modal-bg{position:fixed;inset:0;background:rgba(0,0,0,.7);z-index:9998;display:flex;align-items:flex-end;justify-content:center;padding-bottom:env(safe-area-inset-bottom,0)}
.del-modal{background:var(--card);border-radius:20px 20px 0 0;padding:24px 20px 32px;width:100%;max-width:480px;border-top:1px solid var(--border)}
.del-modal h3{font-size:17px;font-weight:700;margin-bottom:8px;color:var(--text)}
.del-modal p{font-size:13px;color:var(--text2);margin-bottom:16px;line-height:1.5}
.del-modal label{display:flex;align-items:center;gap:10px;font-size:14px;cursor:pointer;padding:10px;border-radius:10px;border:1px solid var(--border);margin-bottom:10px;color:var(--text)}
.del-modal label:hover{background:var(--card2)}
.del-modal label input{width:16px;height:16px;accent-color:var(--g2);cursor:pointer}
.del-modal-btns{display:flex;gap:10px;margin-top:16px}
.del-confirm{flex:1;background:#f43f5e;color:#fff;border:none;border-radius:12px;padding:13px;font-size:15px;font-weight:700;cursor:pointer;transition:opacity .2s}
.del-confirm:hover{opacity:.85}
.del-cancel{flex:1;background:var(--card2);color:var(--text);border:1px solid var(--border);border-radius:12px;padding:13px;font-size:14px;font-weight:600;cursor:pointer}

/* Context menu */
.menu-item{display:block;width:100%;padding:12px 16px;background:none;border:none;color:var(--text);font-size:14px;cursor:pointer;text-align:left;transition:background .15s}
.menu-item:hover{background:var(--card2)}
.menu-item.danger{color:#f43f5e}
.menu-item.danger:hover{background:rgba(244,63,94,.12)}

.like-event{background:rgba(244,63,94,.08);border:1px solid rgba(244,63,94,.25)}
.comment-event{background:rgba(124,58,237,.08);border:1px solid rgba(124,58,237,.25)}

/* Mobile */
@media(max-width:540px){
  .bbl{max-width:88%}
  .ch{padding:8px 10px;min-height:52px}
  .cf-form{padding:8px 10px;gap:6px}
  .file-lbl{width:34px;height:34px}
  .send-btn{width:36px;height:36px}
  .mav{width:24px;height:24px}
}
@media(hover:none){
  .bbl.touch-act .bacts{display:flex}
  .bacts{position:absolute;flex-direction:row;top:-38px;bottom:auto;gap:4px}
  .mrow.me .bacts{right:0;left:auto}
  .mrow.other .bacts{left:0;right:auto}
}

/* ════════════════════════════════════════════
   Auth Pages — Login & Register
   ════════════════════════════════════════════ */

/* Wrapper — full screen centering */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
}

/* Card */
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 28px 32px;
  box-shadow: 0 8px 40px var(--shadow);
}

/* Logo */
.auth-logo {
  font-size: 22px;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-bottom: 20px;
  letter-spacing: -0.3px;
}

/* Title */
.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 6px;
}

/* Subtitle */
.auth-sub {
  font-size: 14px;
  color: var(--text2);
  text-align: center;
  margin-bottom: 24px;
}

/* Input wrapper */
.inp-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.inp-wrap label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
}

/* Input field */
.inp {
  width: 100%;
  padding: 11px 14px;
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.inp:focus {
  border-color: var(--g2);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.inp::placeholder {
  color: var(--text3);
}

/* Password eye button */
.eye-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  padding: 4px;
  color: var(--text3);
  line-height: 1;
  transition: color .15s;
}
.eye-btn:hover { color: var(--text2); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 4px 20px rgba(109,40,217,.35);
}
.btn-primary:hover { opacity: .9; }

.btn-secondary {
  background: var(--card2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border2); }

/* Alert boxes */
.alert-err {
  background: rgba(244,63,94,.12);
  border: 1px solid rgba(244,63,94,.35);
  color: #f43f5e;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.4;
}

.alert-ok {
  background: rgba(16,185,129,.1);
  border: 1px solid rgba(16,185,129,.3);
  color: #10b981;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.4;
}

/* Bottom link */
.auth-link {
  text-align: center;
  font-size: 14px;
  color: var(--text2);
  margin-top: 20px;
}
.auth-link a {
  color: var(--g3);
  font-weight: 600;
  text-decoration: none;
}
.auth-link a:hover { text-decoration: underline; }

/* Mobile */
@media (max-width: 420px) {
  .auth-card {
    padding: 28px 18px 24px;
    border-radius: 16px;
  }
}

/* ════════════════════════════════════════════
   PWA O'rnatish Sahifasi — to'liq ekran, majburiy
   (pwa-install.js orqali boshqariladi)
   ════════════════════════════════════════════ */
.pwa-install-banner{
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .45s ease;
  background:
    radial-gradient(circle at 50% 15%, rgba(124,58,237,.35), transparent 55%),
    radial-gradient(circle at 85% 85%, rgba(6,182,212,.25), transparent 50%),
    rgba(4,5,9,.86);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}
.pwa-install-banner.pwa-show{ opacity: 1; visibility: visible; }
.pwa-install-banner.pwa-hide{ opacity: 0; visibility: hidden; }

.pwa-card{
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,.55), 0 4px 20px rgba(0,0,0,.3);
  padding: 40px 26px calc(28px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  overflow: hidden;
  transform: translateY(24px) scale(.96);
  opacity: 0;
  transition: transform .55s cubic-bezier(.16,1,.3,1), opacity .5s ease;
}
.pwa-show .pwa-card{ transform: translateY(0) scale(1); opacity: 1; }

.pwa-card::before{
  content:'';
  position:absolute; top:0; left:0; right:0; height:4px;
  background: var(--grad);
}

.pwa-close-btn{
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border: none; border-radius: 50%;
  background: var(--card2); color: var(--text3);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, transform .15s;
  z-index: 2;
}
.pwa-close-btn:hover{ background: var(--border2); color: var(--text); }
.pwa-close-btn:active{ transform: scale(.9); }

.pwa-icon-wrap{
  position: relative;
  width: 108px; height: 108px;
  margin: 0 auto 22px;
  display: flex; align-items: center; justify-content: center;
}
.pwa-icon-glow{
  position: absolute; inset: -14px;
  background: var(--grad);
  border-radius: 34px;
  filter: blur(22px);
  opacity: .55;
  animation: pwaPulse 2.6s ease-in-out infinite;
}
@keyframes pwaPulse{
  0%, 100% { opacity: .4; transform: scale(.94); }
  50%      { opacity: .7; transform: scale(1.04); }
}
.pwa-banner-icon{
  position: relative;
  width: 108px; height: 108px;
  border-radius: 26px;
  object-fit: cover;
  box-shadow: 0 12px 30px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.08) inset;
}

.pwa-banner-title{
  font-size: 22px; font-weight: 800; color: var(--text);
  margin-bottom: 8px; letter-spacing: -.2px;
}
.pwa-banner-sub{
  font-size: 14px; color: var(--text2); line-height: 1.55;
  margin-bottom: 24px; padding: 0 6px;
}

.pwa-features{
  display: flex; justify-content: center; gap: 10px;
  margin-bottom: 26px; flex-wrap: wrap;
}
.pwa-feature{
  display: flex; align-items: center; gap: 6px;
  background: var(--card2); border: 1px solid var(--border2);
  border-radius: 999px; padding: 7px 13px;
  font-size: 12px; font-weight: 600; color: var(--text2);
}
.pwa-feature svg{ flex-shrink: 0; color: var(--g3); }

.pwa-install-btn{
  width:100%; background: var(--grad); color:#fff; border:none;
  border-radius:16px; padding:16px; font-size:16px; font-weight:700;
  cursor:pointer; display:flex; align-items:center; justify-content:center; gap:9px;
  box-shadow: 0 10px 26px rgba(37,99,235,.35);
  transition: opacity .2s, transform .15s, box-shadow .2s;
}
.pwa-install-btn:hover{ opacity:.94; box-shadow: 0 14px 32px rgba(37,99,235,.45); }
.pwa-install-btn:active{ transform: scale(.97); }
.pwa-install-btn:disabled{ opacity:.6; cursor:default; }

.pwa-note{
  margin-top:16px; font-size:11.5px; color: var(--text3); line-height:1.5;
}
.pwa-note-warn{
  margin-top:0; margin-bottom:18px; font-size:13px; color: var(--text2);
  background: var(--card2); border: 1px solid var(--border2);
  border-radius: 14px; padding: 13px 15px; text-align:left; line-height:1.55;
}
.pwa-note-warn b{ color: var(--text); }

.pwa-btn-secondary{
  background: var(--card2); color: var(--text2);
  border: 1px solid var(--border2); box-shadow:none;
}
.pwa-btn-secondary:hover{ background: var(--border2); color: var(--text); box-shadow:none; opacity:1; }

.pwa-ios-steps{ display:flex; flex-direction:column; gap:12px; text-align:left; margin-bottom: 22px; }
.pwa-ios-step{
  font-size:13.5px; color: var(--text2); line-height:1.4;
  display:flex; align-items:center; gap:12px;
  background: var(--card2); border: 1px solid var(--border2);
  border-radius: 14px; padding: 12px 14px;
}
.pwa-ios-step svg{ flex-shrink:0; color: var(--g2); }
.pwa-ios-num{
  width:24px; height:24px; border-radius:50%; background: var(--grad);
  color:#fff; font-size:12px; font-weight:700; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
}

body.pwa-lock{ overflow: hidden; }

@media (max-width: 380px){
  .pwa-card{ padding: 34px 20px calc(24px + env(safe-area-inset-bottom, 0px)); border-radius: 22px; }
  .pwa-icon-wrap, .pwa-banner-icon{ width: 92px; height: 92px; }
  .pwa-banner-title{ font-size: 20px; }
}
