/* =====================================================================
   Cytara — Dark Telegram-style UI
   ===================================================================== */

/* ── Smooth theme transitions ── */
html.theme-transition * {
  transition: background-color .38s ease, color .38s ease, border-color .38s ease, box-shadow .38s ease !important;
}

/* Default = dark */
:root {
  --nav-pill-bg:     rgba(16,16,26,0.75);
  --nav-pill-border: rgba(255,255,255,0.10);
  --nav-pill-shadow: 0 8px 32px rgba(0,0,0,0.40), inset 0 1px 0 rgba(255,255,255,0.10), inset 0 -1px 0 rgba(0,0,0,0.25);
  --nav-item-color:  rgba(255,255,255,0.45);
  --bg:       #0E1621;
  --bg2:      #17212B;
  --bg3:      #1F2C3A;
  --text:     #FFFFFF;
  --muted:    #7D8E9A;
  --line:     rgba(255,255,255,0.07);
  --blue:     #3390EC;
  --red:      #FF5252;
  --green:    #4FAD5B;
  --card:     #17212B;
  --input:    #1F2C3A;
  --shadow:   0 4px 24px rgba(0,0,0,0.55);
  --safe-top: calc(env(safe-area-inset-top)    + 14px);
  --safe-bot: calc(env(safe-area-inset-bottom) + 14px);
  --nav-h:    90px;
  --r-xl:     20px;
  --r-lg:     16px;
  --r-md:     12px;
  --r-sm:     8px;
}

[data-theme="light"] {
  --bg:    #F0F2F5;
  --bg2:   #FFFFFF;
  --bg3:   #E4E8ED;
  --text:  #1A1A2E;
  --muted: rgba(26,26,46,0.48);
  --line:  rgba(0,0,0,0.07);
  --blue:  #3390EC;
  --card:  #FFFFFF;
  --input: #E8ECF1;
  --shadow: 0 2px 16px rgba(0,0,0,0.09);
  --nav-pill-bg: rgba(255,255,255,0.88);
  --nav-pill-border: rgba(0,0,0,0.10);
  --nav-pill-shadow: 0 8px 40px rgba(0,0,0,0.15), 0 1px 0 rgba(255,255,255,0.8) inset;
  --nav-item-color: rgba(0,0,0,0.38);
}

/* Reset */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  transition: background .22s, color .22s;
}
/* Prevent browser long-press context menu on UI elements */
.message, .dialog-item, .vb-bubble, .vcircle-bubble, .bubble,
.nav-item, .icon-btn, .attach-btn, .send-btn, .back-btn {
  -webkit-touch-callout: none;
  user-select: none;
}
input, textarea, button, select { font: inherit; color: inherit; }
input, textarea { user-select: text; -webkit-user-select: text; touch-action: auto; }
.wrap { height: 100dvh; width: 100vw; position: relative; overflow: hidden; }
.hidden { display: none !important; }

/* ===== KEYFRAMES ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
@keyframes slideUp {
  from { transform: translateY(18px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes slideDown {
  from { transform: translateY(0);     opacity: 1; }
  to   { transform: translateY(100%);  opacity: 0; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes premiumSheetIn {
  from { transform: translateY(100%) scale(.97); opacity: 0; }
  to   { transform: translateY(0)    scale(1);   opacity: 1; }
}
@keyframes premiumSheetOut {
  from { transform: translateY(0)    scale(1);   opacity: 1; }
  to   { transform: translateY(100%) scale(.97); opacity: 0; }
}
@keyframes messageIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes messageInOwn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dot {
  0%,80%,100% { opacity:.25; transform:scale(.72); }
  40%         { opacity:1;   transform:scale(1); }
}
@keyframes navPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.22); }
  100% { transform: scale(1); }
}
@keyframes shimmer {
  0%   { background-position:-200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes splashDot {
  0%,80%,100% { opacity:.2; transform:scale(.7); }
  40%         { opacity:1;  transform:scale(1); }
}

/* ===== SCREENS (auth/register steps) ===== */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
  transition: opacity .26s cubic-bezier(.2,0,0,1), transform .26s cubic-bezier(.2,0,0,1);
  will-change: opacity, transform;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.screen.hidden { opacity: 0; pointer-events: none; transform: translateX(28px); }

/* Card */
.card {
  flex: 1; display: flex; flex-direction: column;
  padding: var(--safe-top) 22px var(--safe-bot);
  gap: 12px; overflow-y: auto;
}
.card::-webkit-scrollbar { display: none; }

/* Headings */
.h1 {
  font-family: 'Unbounded', sans-serif; font-size: 22px;
  font-weight: 900; letter-spacing: -.5px; color: var(--text); line-height: 1.2;
}
.sub { font-size: 13px; color: var(--muted); margin-top: -4px; }
.form { display: flex; flex-direction: column; gap: 10px; }

/* ===== BUTTONS ===== */
.btn {
  width: 100%; border: 0; padding: 15px;
  background: var(--blue); color: #fff;
  font: 600 16px/1 'Inter', sans-serif;
  border-radius: var(--r-lg); cursor: pointer;
  transition: transform .12s, opacity .14s, background .18s;
  -webkit-appearance: none; appearance: none;
}
.btn:active  { transform: scale(.97); opacity: .88; }
.btn:disabled { opacity: .38; pointer-events: none; }
.btn-ghost   { background: var(--bg3); color: var(--text); }
.btn-outline { background: transparent; border: 1.5px solid var(--blue); color: var(--blue); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--text);
  cursor: pointer; transition: background .14s, transform .1s; flex-shrink: 0;
}
.icon-btn:hover  { background: var(--bg3); }
.icon-btn:active { transform: scale(.9); }

/* Back button (registration) */
.back-btn {
  background: none; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--blue); font-size: 15px; font-weight: 500;
  padding: 2px 0; align-self: flex-start; margin-bottom: 2px;
  transition: opacity .14s;
}
.back-btn:active { opacity: .55; }
.back-btn svg { width: 19px; height: 19px; }

/* ===== INPUTS ===== */
.input, .textarea {
  width: 100%; padding: 13px 16px;
  background: var(--input); border: 1.5px solid transparent;
  border-radius: var(--r-md); color: var(--text);
  font-size: 16px; outline: none;
  transition: border-color .2s, background .2s; -webkit-appearance: none;
}
.input:focus, .textarea:focus { border-color: var(--blue); background: var(--bg2); }
.input::placeholder { color: var(--muted); }
.field-err { font-size: 12px; color: var(--red); min-height: 15px; padding: 0 2px; }

/* Suggestions */
.suggest { display: flex; flex-direction: column; gap: 4px; }
.sug-item {
  padding: 11px 14px; background: var(--bg3);
  border-radius: var(--r-sm); font-size: 14px; cursor: pointer; transition: background .14s;
}
.sug-item:active { background: var(--bg2); }

.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }

/* ===== THEME SELECTOR ===== */
.theme-screen {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 22px; padding: var(--safe-top) 20px var(--safe-bot);
  position: relative;
}
.theme-screen > .back-btn {
  position: absolute;
  top: calc(var(--safe-top) + 4px);
  left: 4px;
}
.ka-logo { font-family:'Unbounded',sans-serif; font-size:26px; font-weight:900; color:var(--blue); letter-spacing:-1px; }
.theme-head { text-align:center; display:flex; flex-direction:column; gap:5px; }
.theme-title { font-family:'Unbounded',sans-serif; font-size:18px; font-weight:700; color:var(--text); }
.theme-sub { font-size:12px; color:var(--muted); }
.theme-cards { display:flex; gap:10px; width:100%; }
.theme-card {
  flex:1; display:flex; flex-direction:column; align-items:center;
  gap:8px; padding:12px 8px 14px; border-radius:var(--r-xl);
  border:2px solid transparent; background:var(--bg3);
  cursor:pointer; font-size:11px; font-weight:600; color:var(--text);
  transition:border-color .18s, transform .1s;
}
.theme-card:active { transform:scale(.94); }
.theme-card.active { border-color:var(--blue); }
.theme-preview {
  width:100%; height:56px; border-radius:8px; padding:7px;
  display:flex; flex-direction:column; gap:4px;
}
.tp-light { background:#fff; border:1px solid rgba(0,0,0,.1); }
.tp-dark  { background:#17212B; border:1px solid rgba(255,255,255,.1); }
.tp-sys   { background:linear-gradient(135deg,#fff 50%,#17212B 50%); border:1px solid rgba(128,128,128,.14); }
.tp-bar  { height:5px; border-radius:3px; background:#3390EC; width:55%; }
.tp-line { height:3px; border-radius:2px; background:rgba(128,128,128,.3); }
.tp-line.s { width:72%; }
.tp-btn  { height:6px; border-radius:3px; background:#3390EC; width:45%; margin-top:auto; opacity:.7; }

/* ===== AUTH ENTRY ===== */
.auth-entry {
  position:absolute; inset:0;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  padding:var(--safe-top) 28px var(--safe-bot);
  background:var(--bg);
}
.auth-logo {
  font-family:'Unbounded',sans-serif; font-size:44px; font-weight:900;
  color:var(--blue); letter-spacing:-2px;
  animation:slideUp .38s cubic-bezier(.2,0,0,1) both;
}
.auth-tagline {
  font-size:14px; color:var(--muted); margin-top:8px; margin-bottom:44px;
  text-align:center;
  animation:slideUp .38s cubic-bezier(.2,0,0,1) .06s both;
}
.auth-btns {
  display:flex; flex-direction:column; gap:10px;
  width:100%; max-width:320px;
  animation:slideUp .38s cubic-bezier(.2,0,0,1) .12s both;
}
.auth-qr-btn {
  display:flex; align-items:center; justify-content:center;
  font-size:14px; padding:11px 20px;
}

/* Privacy select */
.priv-sel {
  background: var(--bg3); border: none; border-radius: 8px;
  color: var(--text); font-size: 14px; padding: 6px 10px;
  outline: none; cursor: pointer; font-family: inherit;
  -webkit-appearance: none; appearance: none;
  min-width: 110px; text-align-last: right;
}

/* ===== METHOD BUTTONS (reg) ===== */
.method-btn {
  display:flex; align-items:center; gap:14px;
  font-size:16px; text-align:left; padding:16px 20px; justify-content:flex-start;
}
.method-btn svg { width:22px; height:22px; flex-shrink:0; }

/* Phone input */
.phone-input-wrap {
  display:flex; align-items:center;
  background:var(--input); border:1.5px solid transparent;
  border-radius:var(--r-md); transition:border-color .2s;
}
.phone-input-wrap:focus-within { border-color:var(--blue); }
.phone-prefix { padding:13px 2px 13px 16px; font-size:16px; user-select:none; flex-shrink:0; }
.phone-inp { border:none !important; background:transparent !important; border-radius:0 !important; flex:1; padding-left:2px !important; }

/* OTP */
.otp-input { text-align:center; font-size:30px; letter-spacing:14px; font-weight:600; }

/* Demo hint */
.demo-hint {
  background:rgba(51,144,236,.11); border:1px solid rgba(51,144,236,.22);
  border-radius:var(--r-sm); padding:10px 14px; font-size:13px; color:var(--blue);
}

/* Avatar picker */
.avatar-picker { display:flex; flex-direction:column; align-items:center; gap:12px; }
.avatar-ring {
  width:104px; height:104px; border-radius:50%;
  border:2.5px dashed rgba(51,144,236,.38); background:var(--bg3);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; overflow:hidden; position:relative;
  transition:border-color .2s, transform .15s;
}
.avatar-ring.has-photo { border-style:solid; border-color:var(--blue); }
.avatar-ring:active { transform:scale(.94); }
.avatar-plus svg { width:32px; height:32px; color:var(--muted); }
.avatar-img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.avatar-label { font-size:13px; color:var(--muted); text-align:center; }

/* ===== CHAT ROOT ===== */
.chat-root {
  position:absolute; inset:0;
  display:flex; flex-direction:column;
  background:var(--bg);
  animation:fadeIn .22s ease;
}

/* ===== MAIN VIEW (dialog list) ===== */
.main-view {
  position:absolute; inset:0;
  display:flex; flex-direction:column;
  background:var(--bg);
}

/* App header */
.app-header {
  display:flex; align-items:center; gap:10px;
  padding:var(--safe-top) 14px 10px;
  flex-shrink:0;
}

/* Story stack */
.story-stack { display:flex; align-items:center; }
.story-item {
  width:38px; height:38px; border-radius:50%;
  padding:2px; flex-shrink:0;
  background:linear-gradient(135deg,#6C5CE7,#3390EC,#00B0B9);
  transition:transform .14s; cursor:pointer;
}
.story-item:active { transform:scale(.88); }
.story-item + .story-item { margin-left:-11px; }
.story-inner {
  width:100%; height:100%; border-radius:50%;
  background:var(--bg2); border:2px solid var(--bg);
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:12px; color:var(--text);
  overflow:hidden;
}
.story-inner img { width:100%; height:100%; object-fit:cover; }
.app-title {
  flex:1; font-family:'Unbounded',sans-serif;
  font-size:20px; font-weight:900; color:var(--text); letter-spacing:-.5px;
}

/* Search bar */
.search-wrap {
  position:relative; padding:0 12px 8px; flex-shrink:0;
}
.search-icon-pos {
  position:absolute; left:24px; top:50%; transform:translateY(-58%);
  width:17px; height:17px; color:var(--muted); pointer-events:none;
}
.search-input {
  width:100%; padding:10px 14px 10px 42px;
  background:var(--bg3); border:none; border-radius:12px;
  color:var(--text); font-size:15px; outline:none;
  -webkit-appearance:none; transition:background .18s;
}
.search-input::placeholder { color:var(--muted); }
.search-input:focus { background:var(--bg2); }

/* Chips */
/* ── Liquid Glass folder chips ── */
.chips-glass-wrap {
  margin: 0 12px 10px;
  background: rgba(16,16,26,.75);
  backdrop-filter: blur(40px) saturate(1.8) brightness(1.08);
  -webkit-backdrop-filter: blur(40px) saturate(1.8) brightness(1.08);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.1);
  padding: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.1), inset 0 -1px 0 rgba(0,0,0,.25);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.chips-glass-wrap::before {
  content: '';
  position: absolute; inset: 0; border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,.04) 0%, transparent 55%);
  pointer-events: none; z-index: 0;
}
.chips-row {
  display: flex; gap: 3px; padding: 0;
  overflow-x: auto; flex-shrink: 0;
  position: relative; z-index: 1;
  scrollbar-width: none;
}
.chips-row::-webkit-scrollbar { display: none; }
.chips-liquid {
  display: block;
  position: absolute;
  top: 4px; height: calc(100% - 8px);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(74,158,255,.2), rgba(107,184,255,.08));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.13), inset 0 0 0 1px rgba(74,158,255,.15);
  transition: left .3s cubic-bezier(.4,0,.2,1), width .3s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
  z-index: 0;
}
.chip {
  flex: 1; min-width: 54px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 8px 10px; border-radius: 14px; border: none;
  background: transparent; color: rgba(255,255,255,.32);
  font-size: 12px; font-weight: 700;
  cursor: pointer; flex-shrink: 0;
  transition: color .25s ease;
  position: relative; z-index: 1;
}
.chip:active { opacity: .7; }
.chip.active { color: #fff; }
.chip-count {
  min-width: 17px; height: 17px; border-radius: 9px; padding: 0 4px;
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: rgba(255,255,255,.15);
}
.chip:not(.active) .chip-count { background: rgba(125,142,154,.2); color: var(--muted); }

/* Dialog list */
.dialog-list { flex:1; overflow-y:auto; list-style:none; padding-bottom:var(--nav-h); }
.dialog-list::-webkit-scrollbar { width:3px; }
.dialog-list::-webkit-scrollbar-thumb { background:var(--bg3); border-radius:2px; }

/* ── Dialog skeleton loader ── */
.dlg-skel-item {
  display:flex; align-items:center; gap:12px;
  padding:10px 14px;
  pointer-events:none;
}
.dlg-skel-av {
  width:54px; height:54px; border-radius:50%; flex-shrink:0;
  background:linear-gradient(90deg,var(--bg2) 25%,var(--bg3) 50%,var(--bg2) 75%);
  background-size:200% 100%; animation:shimmer 1.4s infinite;
}
.dlg-skel-lines { flex:1; display:flex; flex-direction:column; gap:8px; }
.dlg-skel-line {
  height:10px; border-radius:6px;
  background:linear-gradient(90deg,var(--bg2) 25%,var(--bg3) 50%,var(--bg2) 75%);
  background-size:200% 100%; animation:shimmer 1.4s infinite;
}
.dlg-skel-line.short { width:55%; }
.dlg-skel-line.xshort { width:35%; height:8px; }

/* small spinner inside search-wrap */
.search-loader {
  width:16px; height:16px; border-radius:50%; flex-shrink:0;
  border:2px solid var(--bg3); border-top-color:var(--blue);
  animation:spin .7s linear infinite;
  margin-left:6px;
}

.dialog-item {
  display:flex; align-items:center; gap:12px;
  padding:10px 14px; cursor:pointer;
  transition:background .13s;
  contain: content;
  position: relative;
}
/* Indented separator — как в настройках, от аватара до края */
.dialog-item::after {
  content:''; position:absolute;
  bottom:0; left:78px; right:0;
  height:1px; background:var(--line);
  pointer-events:none;
}
.dialog-item:last-child::after { display:none; }
.dialog-item:active { background:var(--bg3); }
.dialog-item.active { background:var(--bg2); }
.dialog-item.is-pinned { background: rgba(51,144,236,.05); }

.dlg-section-sep {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px 4px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  list-style: none;
}
.dlg-section-sep::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

.dialog-av-wrap { position:relative; flex-shrink:0; }
.dialog-avatar {
  width:54px; height:54px; border-radius:50%;
  background:var(--blue); display:flex; align-items:center; justify-content:center;
  color:white; font-weight:700; font-size:18px; overflow:hidden;
}
.online-dot {
  position:absolute; bottom:1px; right:1px;
  width:12px; height:12px; border-radius:50%;
  background:var(--green); border:2.5px solid var(--bg);
}

.dialog-body { flex:1; min-width:0; }
.dialog-row1 { display:flex; justify-content:space-between; align-items:baseline; gap:6px; margin-bottom:3px; }
.dialog-row2 { display:flex; justify-content:space-between; align-items:center; gap:6px; }
.dialog-name { font-size:15px; font-weight:600; color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
.dialog-time { font-size:12px; color:var(--muted); flex-shrink:0; }
.dialog-preview { font-size:14px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
.dialog-badge {
  min-width:20px; height:20px; border-radius:10px; padding:0 6px;
  background:var(--blue); color:#fff; font-size:12px; font-weight:700;
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}

/* Empty state */
.empty-pl {
  flex:1; display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  gap:14px; color:var(--muted); padding:40px 24px; text-align:center;
}
.empty-pl svg { opacity:.35; }
.empty-pl p { font-size:14px; line-height:1.6; max-width:200px; }

/* ===== CHAT VIEW — fixed full-screen, above tab bar ===== */
.chat-view {
  position: fixed;
  inset: 0; /* covers ENTIRE viewport always, including when keyboard is open */
  display: flex; flex-direction: column;
  background: var(--bg);
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.2,0,0,1);
  will-change: transform;
  z-index: 30;
}
.chat-view.open { transform: translateX(0); }

/* On mobile: hide tab bar and block main-view touches when chat is open */
@media (max-width: 767px) {
  .chat-root.is-in-chat .bottom-nav { display: none !important; }
  .chat-root.is-in-chat .main-view  {
    padding-bottom: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important; /* visually hide too, prevents bleed-through */
  }
}

/* Chat header — sticky top, keyboard never pushes it */
.chat-header-bar {
  display: flex; align-items: center; gap: 6px;
  padding: var(--safe-top) 8px 10px;
  background: var(--bg); flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.chat-partner-info  { flex:1; display:flex; align-items:center; gap:10px; min-width:0; cursor:pointer; }
/* Wrapper — holds avatar circle + online dot */
.chat-partner-av {
  width:38px; height:38px; position:relative; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
}
/* The actual circle (with overflow:hidden for clipping content) */
.chat-partner-av-circle {
  width:38px; height:38px; border-radius:50%;
  background:var(--blue);
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:700; font-size:14px;
  overflow:hidden; /* clips img/initials inside */
}
.chat-partner-av-circle img {
  width:100%; height:100%; object-fit:cover; display:block;
}
/* Online dot: absolute to the wrapper (outside overflow:hidden circle) */
.chat-partner-av .online-dot {
  width:11px; height:11px; border-width:2px;
  bottom:-1px; right:-1px; /* overlap edge of circle */
}
.chat-partner-texts { min-width:0; }
.partner-name   { font-size:16px; font-weight:600; line-height:1.2; }
.partner-status { font-size:12px; color:var(--muted); margin-top:1px; }
.partner-status.online { color:var(--green); }

/* Messages scroll container — takes all remaining space */
.messages-container {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  position: relative; /* needed so .message.offsetParent === this container */
}
.messages-container::-webkit-scrollbar { width:3px; }
.messages-container::-webkit-scrollbar-thumb { background:var(--bg3); border-radius:2px; }

/* Inner list — pushes messages to bottom when few */
#messagesList {
  display: flex; flex-direction: column;
  min-height: 100%; padding: 8px 12px 10px;
}
.msgs-spacer { flex: 1; min-height: 8px; }

/* Date separator pill */
.date-sep {
  display: flex; align-items: center; justify-content: center;
  padding: 10px 0 6px;
}
.date-sep-pill {
  background: rgba(0,0,0,.42); color: rgba(255,255,255,.78);
  font-size: 12px; font-weight: 500; line-height: 1.2;
  padding: 4px 12px; border-radius: 12px; user-select: none;
}
[data-theme="light"] .date-sep-pill { background: rgba(0,0,0,.14); color: rgba(0,0,0,.58); }

/* Message rows */
.message {
  display: flex; flex-direction: column;
  max-width: 75%;
  margin-top: 2px;
  align-self: flex-start;
}
.message.new-block { margin-top: 8px; }
.message.own { align-self: flex-end; }

/* Only NEW messages (from WS) get animation — not initial load */
.message.msg-anim {
  animation: messageIn .22s cubic-bezier(.2,.8,.2,1) both;
}
.message.own.msg-anim {
  animation-name: messageInOwn;
}

/* Bubble */
.bubble {
  padding: 8px 12px;
  background: var(--bg3);
  word-break: break-word; font-size: var(--chat-font-size, 15px); line-height: 1.45;
  overflow: hidden;
  border-radius: 18px 18px 18px 4px; /* incoming default: BL=4 (tail side) */
}
.message.own .bubble {
  background: var(--blue); color: #fff;
  border-radius: 18px 18px 4px 18px; /* outgoing default: BR=4 (tail side) */
}

/* ── Message grouping ─────────────────────────────────────────────────────
   msg-f = first in group  (top of stack, like single)
   msg-m = middle          (connected top & bottom on tail side)
   msg-l = last in group   (connected top, tail restored at bottom)
   Tail side = BL for incoming, BR for outgoing
   ──────────────────────────────────────────────────────────────────────── */

/* spacing: first/single of a group gets 8px gap, mid/last stay tight */
.message            { margin-top: 2px; }
.message.msg-f,
.message.new-block  { margin-top: 8px; }

/* incoming middle: TL=4, BL=4 */
.message.msg-m .bubble          { border-radius: 4px 18px 18px 4px; }
/* incoming last: TL=4, BL=18 (tail restored) */
.message.msg-l .bubble          { border-radius: 4px 18px 18px 18px; }

/* outgoing middle: TR=4, BR=4 */
.message.own.msg-m .bubble      { border-radius: 18px 4px 4px 18px; }
/* outgoing last: TR=4, BR=18 (tail restored) */
.message.own.msg-l .bubble      { border-radius: 18px 4px 18px 18px; }
.bubble.bubble-nokey {
  background: transparent;
  border: 1px solid var(--line);
  padding: 5px 10px;
}
.message.own .bubble.bubble-nokey {
  background: transparent;
  border-color: rgba(255,255,255,.25);
}
.msg-nokey {
  font-size: 12px; color: var(--muted);
  display: flex; align-items: center;
}

/* Time + ticks INSIDE bubble via float trick */
.bmeta {
  display: inline-flex; align-items: flex-end; gap: 3px;
  float: right;
  margin: 6px -2px -4px 8px;
  line-height: 1; pointer-events: none;
}
.btime {
  font-size: 11px; white-space: nowrap;
  color: var(--muted); opacity: .9;
}
.message.own .btime { color: rgba(255,255,255,.72); opacity: 1; }
.tick { width: 11px; height: 11px; flex-shrink: 0; opacity: .75; }

/* Typing indicator */
.typing-indicator {
  display: none; /* hidden — typing now shown in partner-status */
}
.typing-dots span {
  display:inline-block; width:6px; height:6px; border-radius:50%;
  background:var(--muted);
  animation:dot 1.1s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay:.18s; }
.typing-dots span:nth-child(3) { animation-delay:.36s; }

/* Inline typing dots in partner-status */
.typing-dots-inline { display:inline-flex; gap:2px; margin-left:2px; vertical-align:middle; }
.typing-dots-inline span {
  display:inline-block; width:4px; height:4px; border-radius:50%;
  background:currentColor; opacity:.7;
  animation:dot 1.1s ease-in-out infinite;
}
.typing-dots-inline span:nth-child(2) { animation-delay:.18s; }
.typing-dots-inline span:nth-child(3) { animation-delay:.36s; }

/* Typing preview in dialog list */
.typing-preview-dots { color:var(--blue); font-size:inherit; }

/* Message form */
.message-form {
  display:flex; gap:6px; align-items:center;
  padding:8px 10px;
  padding-bottom:max(8px, calc(env(safe-area-inset-bottom) + 6px));
  background:var(--bg); flex-shrink:0;
  border-top:1px solid var(--line);
}

/* Attachment button */
.attach-btn {
  width:40px; height:40px; border-radius:50%;
  background:transparent; border:none;
  display:flex; align-items:center; justify-content:center;
  color:var(--muted); cursor:pointer; flex-shrink:0;
  transition:background .14s, transform .1s, opacity .18s;
}
.attach-btn:active { transform:scale(.88); background:var(--bg3); }
.attach-btn.hidden { display:none !important; }
.message-input {
  flex:1; background:var(--bg3); border:none;
  padding:10px 14px; border-radius:22px; color:var(--text);
  font-size:15px; outline:none; font-family:inherit;
  -webkit-appearance:none; transition:background .18s;
  resize:none; overflow:hidden; line-height:1.45;
  min-height:42px; max-height:120px;
  display:block; box-sizing:border-box;
}
.message-input::placeholder { color:var(--muted); }
.message-input:focus { background:var(--bg2); }
.send-btn {
  width:44px; height:44px; border-radius:50%;
  background:var(--blue); color:white; border:none;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; flex-shrink:0;
  transition:transform .12s, opacity .14s;
}
.send-btn:active { transform:scale(.88); }
.send-btn:disabled { background:var(--bg3); opacity:.45; cursor:default; }

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 0; right: 0;
  width: fit-content;
  margin: 0 auto;
  height: 58px;
  background: var(--nav-pill-bg);
  backdrop-filter: blur(40px) saturate(1.8) brightness(1.08);
  -webkit-backdrop-filter: blur(40px) saturate(1.8) brightness(1.08);
  border-radius: 32px;
  border: 1px solid var(--nav-pill-border);
  box-shadow: var(--nav-pill-shadow);
  display: flex;
  align-items: center;
  padding: 0 6px;
  z-index: 1000;
  transition: opacity .28s, bottom .28s;
  overflow: hidden;
}
.bottom-nav::before {
  content: '';
  position: absolute; inset: 0; border-radius: 32px;
  background: linear-gradient(135deg, rgba(255,255,255,.04) 0%, transparent 55%);
  pointer-events: none; z-index: 0;
}
.bottom-nav.hidden-pill {
  bottom: calc(-80px - env(safe-area-inset-bottom));
  opacity: 0;
  pointer-events: none;
}
.bottom-nav.nav-instant {
  transition: none !important;
}

.nav-liquid {
  display: block;
  position: absolute;
  top: 4px; height: calc(100% - 8px);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(74,158,255,.18), rgba(107,184,255,.07));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.13), inset 0 0 0 1px rgba(74,158,255,.14);
  transition: left .3s cubic-bezier(.4,0,.2,1), width .3s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
  z-index: 1;
}

.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; padding: 8px 14px;
  border: none; background: none;
  cursor: pointer; color: var(--nav-item-color);
  position: relative; z-index: 2;
  transition: color .22s ease;
  min-width: 56px;
}
.nav-item:active { opacity: .65; }
.nav-item.active { color: var(--blue); }
.nav-item svg { width: 22px; height: 22px; }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: .01em; }
.nav-badge {
  position:absolute; top:5px; left:50%;
  min-width:18px; height:18px; border-radius:9px;
  background:var(--blue); color:#fff;
  font-size:11px; font-weight:700; padding:0 5px;
  display:flex; align-items:center; justify-content:center;
  transform:translateX(2px);
  transition:opacity .2s;
}

/* ===== MODAL (bottom sheet) ===== */
.modal {
  position:fixed; inset:0; z-index:100;
  background:rgba(0,0,0,.58);
  display:flex; align-items:flex-end; justify-content:center;
  padding-bottom: var(--nav-h);
  animation:fadeIn .18s ease;
}
.modal.hidden { display:none; }
.modal-inner {
  background:var(--bg); border-radius:20px 20px 0 0;
  width:100%; max-width:640px; max-height:82dvh;
  display:flex; flex-direction:column; overflow:hidden;
  animation:slideUp .26s cubic-bezier(.2,0,0,1);
}
.modal-header {
  padding:14px 14px 14px 20px;
  display:flex; align-items:center; justify-content:space-between;
  border-bottom:1px solid var(--line);
  font-size:17px; font-weight:600; flex-shrink:0;
}

/* ===== SETTINGS / PROFILE SCREEN (Telegram style) ===== */
.ps-screen {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 15;
  overflow-y: auto;
  padding-bottom: 100px;
  background: var(--bg);
  animation: fadeIn .2s ease;
}
.ps-screen::-webkit-scrollbar { display: none; }

/* Hero section */
.ps-hero {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  padding: 24px 20px 18px;
}
.ps-av-wrap { position: relative; margin-bottom: 2px; }
.ps-av {
  width: 82px; height: 82px; border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.ps-av-cam {
  position: absolute; bottom: 0; right: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg3); border: 2px solid var(--bg2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s, transform .12s;
  color: var(--text);
}
.ps-av-cam svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }
.ps-av-cam:active { background: var(--blue); color: #fff; transform: scale(.9); }
.ps-hero-name { font-size: 20px; font-weight: 700; color: var(--text); text-align: center; }
.ps-hero-sub  { font-size: 14px; color: var(--muted); text-align: center; }

/* Section label */
.ps-section-label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  padding: 10px 16px 4px;
}

/* Card */
.ps-card {
  margin: 0 12px 10px;
  background: var(--bg2);
  border-radius: 14px;
  overflow: hidden;
}

/* Separator inside card — indented to align with text */
.ps-sep {
  height: 1px; background: var(--line);
  margin-left: 62px; /* icon(36) + gap(12) + padding(14) */
}

/* Row */
.ps-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  cursor: pointer; transition: background .13s;
}
.ps-row:active { background: rgba(255,255,255,.04); }
.ps-row-action { cursor: pointer; }

/* Icon box — colored rounded square */
.ps-icon-box {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ps-icon-box svg { width: 18px; height: 18px; }

/* Mini avatar (Accounts row) */
.ps-mini-av {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* Row body — title + subtitle */
.ps-row-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ps-row-title { font-size: 15px; color: var(--text); line-height: 1.2; }
.ps-row-sub   { font-size: 12px; color: var(--muted); }

/* Row end — chevron + optional badge */
.ps-row-end {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0; color: var(--muted);
}
.ps-row-end svg { stroke: var(--bg3); }

/* Badge (Accounts) */
.ps-badge {
  background: var(--blue); color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
}

/* Danger row */
.ps-row-danger { cursor: pointer; }
.ps-row-danger:active { background: rgba(255,82,82,.07); }

/* Version text */
.ps-version {
  text-align: center; font-size: 13px;
  color: var(--muted); padding: 14px 20px 8px;
}

/* ===== PROFILE SCREEN — parallax collapsing cover ===== */
.pp-screen {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 15;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* ── Floating toolbar — always visible, transparent → solid ── */
.pp-tb {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex; align-items: flex-end; gap: 4px;
  padding: var(--safe-top) 8px 8px;
  background: transparent;
  /* transition handled by JS for scroll-sync */
}
.pp-tb-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none;
  color: rgba(255,255,255,.92); /* white over cover image */
  cursor: pointer; flex-shrink: 0;
  transition: background .14s;
}
.pp-tb-btn:active { background: rgba(255,255,255,.15); }
.pp-tb-mid {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  gap: 1px;
}
.pp-tb-name { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.2; }
.pp-tb-sub  { font-size: 12px; color: var(--green); }

/* ── Scroll area (full height, cover starts at very top) ── */
.pp-scr { flex: 1; overflow-y: auto; overflow-x: hidden; }
.pp-scr::-webkit-scrollbar { display: none; }

/* ── Cover image section ── */
.pp-cover {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

/* Parallax background — taller than cover for parallax room */
.pp-cbg {
  position: absolute;
  top: -25%; left: 0; right: 0;
  height: 150%; /* extra space for parallax upward travel */
  background-size: cover;
  background-position: center;
  will-change: transform;
}

/* Bottom gradient: darkens cover from bottom */
.pp-cgrad {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 70%;
  background: linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,.35) 50%, transparent 100%);
  pointer-events: none;
  will-change: opacity;
}

/* Camera edit button inside cover (top-right, below toolbar) */
.pp-ccam {
  position: absolute;
  top: calc(var(--safe-top) + 48px); right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0,0,0,.38); border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  transition: background .14s;
  will-change: opacity;
}
.pp-ccam:active { background: rgba(0,0,0,.6); }

/* Cover info: avatar circle + name + status at bottom of cover */
.pp-cinfo {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 16px 20px 18px;
  display: flex; flex-direction: column; gap: 4px;
  will-change: transform, opacity;
}
.pp-cav-circle {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; margin-bottom: 6px;
  border: 2.5px solid rgba(255,255,255,.3);
}
.pp-cname {
  font-size: 22px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.45);
  line-height: 1.2;
}
.pp-cstatus {
  font-size: 14px; color: rgba(255,255,255,.82);
}

/* Action buttons */
.pp-actions {
  display: flex; gap: 10px; padding: 0 14px 14px;
}
.pp-act {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 7px; padding: 12px 6px;
  background: var(--bg2); border-radius: 14px;
  border: none; cursor: pointer; color: var(--blue);
  font-size: 12px; font-weight: 500;
  transition: background .13s, transform .1s;
}
.pp-act:active { background: var(--bg3); transform: scale(.95); }
.pp-act-ic {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
}

/* Info card */
.pp-info {
  margin: 0 14px 12px;
  background: var(--bg2); border-radius: 14px; overflow: hidden;
}
.pp-irow { padding: 12px 16px; cursor: pointer; transition: background .13s; }
.pp-irow:active { background: var(--bg3); }
.pp-ival { font-size: 15px; color: var(--text); font-weight: 500; }
.pp-ilbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pp-isep { height: 1px; background: var(--line); margin-left: 16px; }

/* Tabs */
.pp-tabs {
  display: flex; position: relative;
  margin: 0 14px 14px;
  background: rgba(16,16,26,.75);
  backdrop-filter: blur(40px) saturate(1.8) brightness(1.08);
  -webkit-backdrop-filter: blur(40px) saturate(1.8) brightness(1.08);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.1);
  padding: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.1), inset 0 -1px 0 rgba(0,0,0,.25);
  overflow: hidden;
}
.pp-tabs::before {
  content: '';
  position: absolute; inset: 0; border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,.04) 0%, transparent 55%);
  pointer-events: none; z-index: 0;
}
.pp-tabs-liquid {
  display: block; position: absolute;
  top: 4px; height: calc(100% - 8px);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(74,158,255,.2), rgba(107,184,255,.08));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.13), inset 0 0 0 1px rgba(74,158,255,.15);
  transition: left .3s cubic-bezier(.4,0,.2,1), width .3s cubic-bezier(.4,0,.2,1);
  pointer-events: none; z-index: 1;
}
.pp-tab {
  flex: 1; padding: 8px 10px; border: none; background: transparent;
  font-size: 13px; font-weight: 700; color: rgba(255,255,255,.32);
  cursor: pointer; position: relative; z-index: 2;
  transition: color .25s ease; border-radius: 14px;
  white-space: nowrap;
}
.pp-tab:active { opacity: .7; }
.pp-tab.active { color: #fff; }

/* Grid */
.pp-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 2px; transition: opacity .16s;
}
.pp-cell {
  aspect-ratio: 1; cursor: pointer; position: relative; overflow: hidden;
  transition: transform .12s, opacity .12s;
}
.pp-cell:active { transform: scale(.93); opacity: .8; }
.pp-cell-real { border-radius: 4px; }
.pp-cell-views {
  position: absolute; bottom: 5px; left: 5px;
  display: flex; align-items: center; gap: 3px;
  background: rgba(0,0,0,.5); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 5px; border-radius: 6px;
  backdrop-filter: blur(4px);
}
.pp-cell-video-icon {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,.45); border-radius: 50%;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
}
.pp-cell-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 8px; font-size: 11px; font-weight: 600; color: #fff;
  text-align: center; line-height: 1.4;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
}
@keyframes pp-spin { to { transform: rotate(360deg); } }
.pp-grid-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--blue);
  animation: pp-spin .7s linear infinite; margin: 0 auto;
}

/* FAB */
.pp-fab-w {
  position: absolute; bottom: 18px; left: 50%;
  transform: translateX(-50%);
  will-change: transform, opacity; z-index: 5;
}
.pp-fab {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 24px;
  background: var(--blue); color: #fff;
  border: none; font-size: 15px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(51,144,236,.42);
  transition: transform .12s, opacity .14s;
}
.pp-fab:active { transform: scale(.95); }

/* ===== PARTNER PROFILE BOTTOM SHEET ===== */
.pp-sheet {
  background: var(--bg2); border-radius: 24px 24px 0 0;
  width: 100%; max-width: 640px;
  padding-bottom: env(safe-area-inset-bottom, 20px);
  display: flex; flex-direction: column; align-items: center;
  animation: slideUp .28s cubic-bezier(.2,0,0,1);
  overflow: hidden;
}
.pp-drag-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--line); margin: 12px auto 4px;
  flex-shrink: 0;
}
.pp-avatar-wrap { padding: 10px 0 6px; }
.pp-avatar {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--blue); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700; color: #fff;
  border: 3px solid var(--bg);
}
.pp-name {
  font-size: 20px; font-weight: 700; color: var(--text);
  text-align: center; padding: 0 20px; line-height: 1.2;
}
.pp-username { font-size: 14px; color: var(--blue); margin-top: 2px; text-align: center; }
.pp-status { font-size: 13px; color: var(--muted); margin-top: 4px; text-align: center; }
.pp-online { color: var(--green); font-weight: 600; }
.pp-actions {
  display: flex; gap: 12px; padding: 18px 20px 20px; width: 100%;
}
.pp-action-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 8px; border-radius: 16px;
  background: var(--bg3); border: none; cursor: pointer;
  color: var(--blue); font-size: 12px; font-weight: 600; font-family: inherit;
  transition: background .13s, transform .1s;
}
.pp-action-btn:active { transform: scale(.94); background: var(--bg); }
.pp-action-icon {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}

/* ===== CONTACTS PANEL ===== */
/* Contacts quick-action buttons (new group / new channel) */
.cnt-quick-actions {
  display: flex; gap: 8px; padding: 4px 12px 8px; flex-shrink: 0;
}
.cnt-qa-btn {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: var(--bg3); border: none; border-radius: 14px;
  padding: 10px 14px; cursor: pointer; color: var(--text);
  font-size: 14px; font-weight: 500; transition: background .15s;
}
.cnt-qa-btn:active { background: var(--bg2); }
.cnt-qa-ic {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.cnt-srch-w {
  position: relative; padding: 0 12px 8px; flex-shrink: 0;
}
.cnt-srch-ic {
  position: absolute; left: 24px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted); pointer-events: none;
}
.cnt-input {
  width: 100%; padding: 11px 14px 11px 40px;
  background: var(--bg3); border: none; border-radius: 12px;
  color: var(--text); font-size: 15px; outline: none;
  font-family: inherit;
  -webkit-appearance: none;
  transition: background .15s;
}
.cnt-input:focus { background: var(--bg2); }
.cnt-input::placeholder { color: var(--muted); }
.cnt-list { flex: 1; overflow-y: auto; list-style: none; }
.cnt-list::-webkit-scrollbar { display: none; }
.cnt-hint {
  padding: 48px 24px; text-align: center;
  font-size: 14px; color: var(--muted); line-height: 1.5;
}
.cnt-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; cursor: pointer;
  transition: background .12s;
}
.cnt-item:hover { background: var(--bg3); }
.cnt-item:active { background: var(--bg2); }
.cnt-av {
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--blue); display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 18px; overflow: hidden; flex-shrink: 0;
}
.cnt-info { flex: 1; min-width: 0; }
.cnt-name { font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cnt-sub  { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ===== QR CODE MODAL ===== */
.qr-inner {
  background: var(--bg2); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 360px;
  max-height: calc(100dvh - var(--nav-h) * 2 - 24px);
  display: flex; flex-direction: column;
  animation: slideUp .26s cubic-bezier(.2,0,0,1);
  overflow: hidden;
}
.qr-body {
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
  padding: 16px 20px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}
/* QRCode.js generates canvas + hidden img — show only canvas */
#qrCodeEl canvas {
  display: block !important;
  border-radius: 10px;
  width: 224px !important;
  height: 224px !important;
}
/* Hide the img fallback that QRCode.js inserts (prevent double render) */
#qrCodeEl img {
  display: none !important;
}
.qr-url {
  font-size: 14px; font-weight: 600; color: var(--text);
  text-align: center;
}
.qr-hint { font-size: 12px; color: var(--muted); text-align: center; }
/* QR timer */
#qrTimerEl { font-variant-numeric: tabular-nums; }
/* Expired QR overlay */
#qrCodeEl[style*="opacity: 0.25"], #qrCodeEl[style*="opacity:0.25"] {
  filter: blur(2px);
}

/* ===== PUBLIC PROFILE (from /u/ or /p/ links) ===== */
.pub-screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 24px; gap: 8px;
  background: var(--bg);
  animation: fadeIn .3s ease;
}
.pub-av-wrap { margin-bottom: 8px; }
.pub-av {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; border: 3px solid var(--bg3);
}
.pub-name  { font-size: 22px; font-weight: 700; color: var(--text); text-align: center; }
.pub-uname { font-size: 15px; color: var(--muted); }
.pub-actions {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 280px; margin-top: 20px;
}

/* ===== DESKTOP ===== */
@media (min-width:768px) {
  .chat-root { flex-direction:row; max-width:1280px; margin:0 auto; height:100dvh; }
  .main-view { position:relative; width:380px; flex-shrink:0; border-right:1px solid var(--line); padding-bottom:0; height:100%; }
  .chat-view {
    position: relative !important; height: auto !important; flex: 1;
    transform: none !important; transition: none !important; z-index: auto !important;
  }
  .chat-root.is-in-chat .bottom-nav { display: flex !important; }
  .bottom-nav {
    position: relative; flex-direction: column; align-items: stretch;
    width: 72px; height: 100%; border-top: none;
    border-right: 1px solid var(--line);
    padding: 16px 0; order: -1;
    bottom: auto; left: auto; right: auto; margin: 0;
    border-radius: 0;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    background: var(--bg2); box-shadow: none;
  }
  .bottom-nav .nav-liquid { display: none; }
  .bottom-nav .nav-item {
    flex-direction: column; gap: 4px;
    padding: 14px 8px; min-width: auto;
    border-radius: var(--r-md); margin: 2px 8px;
  }
  .bottom-nav .nav-item svg { width: 22px; height: 22px; }
  .bottom-nav .nav-label { font-size: 10px; }
  .nav-badge { position: static; transform: none; margin-left: auto; }
}

/* ===== NEW FEATURES — appended ===== */

/* Forgot password link */
.forgot-link {
  text-align: center; display: block; color: var(--blue);
  font-size: 14px; text-decoration: none; margin-top: 4px;
  opacity: .85; transition: opacity .15s;
}
.forgot-link:active { opacity: .5; }

/* Reply bar */
.reply-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: var(--bg2);
  border-top: 1px solid var(--line);
  animation: slideUp .16s ease;
}
.reply-bar-line {
  width: 3px; height: 36px; background: var(--blue);
  border-radius: 3px; flex-shrink: 0;
}
.reply-bar-body { flex: 1; min-width: 0; }
.reply-bar-name { font-size: 12px; font-weight: 600; color: var(--blue); margin-bottom: 2px; }
.reply-bar-text { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar-close {
  background: none; border: none; color: var(--muted);
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: background .14s;
}
.reply-bar-close:active { background: var(--bg3); }

/* Reply preview inside bubble */
.reply-preview {
  border-left: 3px solid rgba(255,255,255,.5);
  padding: 4px 8px; margin-bottom: 6px;
  border-radius: 4px; background: rgba(0,0,0,.15);
}
.message:not(.own) .reply-preview {
  border-left-color: var(--blue);
  background: rgba(51,144,236,.1);
}
.reply-preview-name { font-size: 11px; font-weight: 700; color: rgba(255,255,255,.8); margin-bottom: 2px; }
.message:not(.own) .reply-preview-name { color: var(--blue); }
.reply-preview-text { font-size: 12px; color: rgba(255,255,255,.65); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message:not(.own) .reply-preview-text { color: var(--muted); }

/* Double tick (read) */
.tick-read { opacity: 1 !important; stroke: rgba(255,255,255,.9); }
.tick-pending { font-size: 11px; opacity: .7; }

/* Voice UI */
.voice-ui {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--bg);
  border-top: 1px solid var(--line); flex-shrink: 0;
}
.voice-cancel {
  border: none; background: none; color: var(--red);
  font-size: 14px; font-weight: 600; cursor: pointer; padding: 4px;
}
.voice-status {
  flex: 1; display: flex; align-items: center; gap: 8px;
  justify-content: center; color: var(--text);
}
.voice-dot {
  color: var(--red); font-size: 16px;
  animation: voicePulse 1s ease-in-out infinite;
}
@keyframes voicePulse {
  0%,100% { opacity: 1; } 50% { opacity: .3; }
}
.voice-time { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.voice-send {
  border: none; background: var(--blue); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 8px 16px; border-radius: 20px;
  transition: transform .1s, opacity .14s;
}
.voice-send:active { transform: scale(.93); }

/* ── Locked recording bar (gesture → lock zone) ── */
.locked-rec-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; background: var(--bg);
  border-top: 1px solid var(--line); flex-shrink: 0;
  animation: slideUp .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.lrb-cancel {
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--red); flex-shrink: 0;
  transition: transform .1s;
}
.lrb-cancel:active { transform: scale(.9); }
.lrb-rec {
  flex: 1; display: flex; align-items: center; gap: 8px;
  justify-content: center;
}
.lrb-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); flex-shrink: 0;
  animation: voicePulse 1s ease-in-out infinite;
}
.lrb-time {
  font-size: 16px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.lrb-pause {
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text); flex-shrink: 0;
  transition: transform .1s;
}
.lrb-pause:active { transform: scale(.9); }
.lrb-stop {
  width: 48px; height: 48px; border-radius: 50%;
  border: none; background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(51,144,236,.45);
  transition: transform .1s;
}
.lrb-stop:active { transform: scale(.9); }

/* ── vcircle locked: extra buttons ── */
.vcircle-controls.locked { gap: 28px; }
.vcircle-flip-btn, .vcircle-pause-btn {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; cursor: pointer;
  transition: background .14s, transform .1s;
}
.vcircle-flip-btn:active, .vcircle-pause-btn:active { transform: scale(.9); }

/* Main menu dropdown */
.main-menu-dropdown {
  position: fixed; top: calc(var(--safe-top) + 46px); right: 10px;
  background: var(--bg2); border-radius: var(--r-lg);
  box-shadow: var(--shadow); z-index: 300; min-width: 200px;
  overflow: hidden; opacity: 0; transform: scale(.9) translateY(-8px);
  transform-origin: top right;
  transition: opacity .15s ease, transform .15s ease;
}
.main-menu-dropdown.open { opacity: 1; transform: scale(1) translateY(0); }
.mmd-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; cursor: pointer; font-size: 15px;
  color: var(--text); transition: background .13s;
}
.mmd-item:active { background: var(--bg3); }
.mmd-sep { height: 1px; background: var(--line); }

/* Theme badge in settings */
.ps-theme-badge {
  font-size: 13px; color: var(--muted); margin-right: 4px;
}

/* ===== NEW GROUP SCREEN ===== */
.ng-screen {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg);
  z-index: 15;
}
.ng-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: var(--safe-top) 8px 10px;
  border-bottom: 1px solid var(--line); flex-shrink: 0;
  background: var(--bg);
}
.ng-title { flex: 1; font-size: 17px; font-weight: 700; color: var(--text); padding-left: 4px; }
.ng-next-btn {
  background: none; border: none; color: var(--blue);
  font-size: 15px; font-weight: 600; cursor: pointer; padding: 6px 12px;
  border-radius: 20px; transition: background .15s;
  font-family: inherit;
}
.ng-next-btn:hover { background: rgba(51,144,236,.1); }
.ng-next-btn:disabled { opacity: .35; pointer-events: none; }

/* Chip row (selected members) */
.ng-sel-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.ng-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(51,144,236,.15); color: var(--blue);
  border-radius: 20px; padding: 5px 10px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .13s;
}
.ng-chip:active { background: rgba(51,144,236,.28); }
.ng-chip svg { opacity: .7; }

/* Contact row check circle */
.ng-check {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--line); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s, border-color .15s;
}
.ng-check-on {
  background: var(--blue); border-color: var(--blue);
}
.ng-contact-row { transition: background .12s; }
.ng-contact-row:hover { background: var(--bg3); }
.ng-contact-row.ng-selected { background: rgba(51,144,236,.07); }

/* Empty contacts placeholder */
.ng-empty-contacts {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; gap: 10px; text-align: center;
  color: var(--muted); font-size: 14px; line-height: 1.5;
}
.ng-empty-contacts svg { opacity: .35; margin-bottom: 4px; }

/* ── Step 2: avatar + name ─── */
.ng-step2-wrap {
  display: flex; align-items: center; gap: 20px;
  padding: 28px 20px 20px;
}
.ng-av-ring {
  position: relative; flex-shrink: 0;
  width: 86px; height: 86px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2.5px dashed var(--blue);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  overflow: visible;
  transition: background .15s;
}
.ng-av-ring:hover { background: rgba(51,144,236,.1); }
.ng-av-inner {
  width: 100%; height: 100%; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; overflow: hidden;
}
.ng-av-label { font-size: 11px; color: var(--muted); }
.ng-av-plus {
  position: absolute; bottom: 0; right: 0;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--blue); color: #fff;
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  pointer-events: none;
}
.ng-step2-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.ng-name-inp {
  width: 100%; padding: 13px 14px;
  background: var(--bg3); border: 2px solid transparent;
  border-radius: 14px; color: var(--text);
  font-size: 16px; font-weight: 500; font-family: inherit;
  outline: none; transition: border-color .18s, background .18s;
}
.ng-name-inp:focus { border-color: var(--blue); background: var(--bg2); }
.ng-name-inp::placeholder { color: var(--muted); }
.ng-name-hint { font-size: 12px; color: var(--muted); padding-left: 2px; }

/* ── Step 3: type cards ─── */
.ng-step3-wrap { padding: 16px; }
.ng-section-label {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 10px;
}
.ng-type-row { display: flex; gap: 10px; }
.ng-type-card {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 18px 12px 14px; border-radius: 16px;
  border: 2px solid var(--line); background: var(--bg3);
  cursor: pointer; transition: border-color .18s, background .18s;
  gap: 6px; position: relative;
}
.ng-type-card:hover { background: var(--bg2); }
.ng-type-active { border-color: var(--blue); background: rgba(51,144,236,.07); }
.ng-type-card-ic { color: var(--muted); margin-bottom: 2px; }
.ng-type-active .ng-type-card-ic { color: var(--blue); }
.ng-type-card-title { font-size: 14px; font-weight: 700; color: var(--text); }
.ng-type-card-sub { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.3; }
.ng-type-radio {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line); margin-top: 4px;
  transition: border-color .18s, background .18s;
}
.ng-type-radio.on { border-color: var(--blue); background: var(--blue); }

/* Username field in step 3 */
.ng-uname-section { overflow: hidden; }
.ng-uname-section.hidden { display: none; }
.ng-uname-field {
  display: flex; align-items: center;
  background: var(--bg3); border-radius: 14px;
  border: 2px solid transparent;
  padding: 0 12px;
  transition: border-color .18s;
}
.ng-uname-field:focus-within { border-color: var(--blue); background: var(--bg2); }
.ng-uname-prefix { font-size: 15px; color: var(--muted); flex-shrink: 0; }
.ng-uname-inp {
  flex: 1; padding: 13px 8px; background: none; border: none;
  color: var(--text); font-size: 15px; font-family: inherit; outline: none;
}
.ng-uname-inp::placeholder { color: var(--muted); }
.ng-uname-status { font-size: 16px; font-weight: 700; flex-shrink: 0; }
.ng-uname-status.ok  { color: var(--green); }
.ng-uname-status.bad { color: var(--red); }

/* Favorites screen */
.fav-screen {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 15; display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg); animation: fadeIn .2s ease;
}
.fav-list { flex: 1; overflow-y: auto; list-style: none; padding: 8px 0; }
.fav-item {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.fav-content { font-size: 15px; color: var(--text); }
.fav-time { font-size: 12px; color: var(--muted); }

/* PWA install banner */
.pwa-banner {
  position: fixed; bottom: calc(var(--nav-h) + 8px); left: 8px; right: 8px;
  background: var(--bg2); border-radius: var(--r-lg);
  box-shadow: var(--shadow); z-index: 500;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  animation: slideUp .3s cubic-bezier(.2,0,0,1);
}
.pwa-banner-text { flex: 1; font-size: 14px; color: var(--text); }
.pwa-banner-btns { display: flex; align-items: center; gap: 8px; }
.pwa-install-btn {
  background: var(--blue); color: #fff; border: none;
  padding: 8px 14px; border-radius: 20px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform .1s;
}
.pwa-install-btn:active { transform: scale(.93); }
.pwa-close-btn {
  background: none; border: none; color: var(--muted);
  font-size: 16px; cursor: pointer; padding: 4px 6px;
}

/* ===== VOICE MESSAGE BUBBLE — clean 2-col layout ===== */
.vb-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 10px;
  background: var(--bg3);
  border-radius: 18px 18px 18px 4px;
  min-width: 200px;
  max-width: 290px;
  user-select: none;
  position: relative;
}
.vb-bubble.vb-own {
  background: linear-gradient(135deg, #2B7FDB 0%, #3390EC 60%, #2196f3 100%);
  border-radius: 18px 18px 4px 18px;
}

/* Play button */
.vb-play-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: #fff; border: none; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #3390EC;
  transition: transform .12s, opacity .14s;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.vb-play-btn:active { transform: scale(.88); opacity: .8; }
.vb-bubble:not(.vb-own) .vb-play-btn { background: var(--blue); color: #fff; }

/* Center column — takes remaining space */
.vb-center {
  flex: 1; display: flex; flex-direction: column;
  gap: 4px; min-width: 0; overflow: hidden;
}

/* Waveform */
.vb-wave {
  display: flex; align-items: center; gap: 2px;
  height: 28px; cursor: pointer; overflow: hidden; width: 100%;
}
.vb-bar {
  width: 3px; border-radius: 2px;
  background: rgba(255,255,255,.4);
  flex-shrink: 0; transition: background .08s;
}
.vb-bubble:not(.vb-own) .vb-bar { background: rgba(51,144,236,.4); }
.vb-bar.vb-bar-played { background: rgba(255,255,255,.95); }
.vb-bubble:not(.vb-own) .vb-bar.vb-bar-played { background: #3390EC; }

/* Bottom row: timer + time + tick */
.vb-bottom-row {
  display: flex; align-items: center; justify-content: space-between;
}
.vb-timer {
  font-size: 12px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,.7); line-height: 1;
}
.vb-bubble:not(.vb-own) .vb-timer { color: var(--muted); }
.vb-unread-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #F4A62A; flex-shrink: 0;
}
.vb-meta {
  display: flex; align-items: center; gap: 3px;
}
.vb-time {
  font-size: 11px; white-space: nowrap;
  color: rgba(255,255,255,.6);
}
.vb-bubble:not(.vb-own) .vb-time { color: var(--muted); }
.vb-meta .tick, .vb-meta .tick-read {
  width: 14px; height: 10px; stroke: rgba(255,255,255,.75);
}

/* Transcript text block */
/* Forwarded header */
.fwd-header {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: rgba(255,255,255,.7);
  margin-bottom: 4px; font-weight: 500;
}
.fwd-header b { font-weight: 700; }
.message:not(.own) .fwd-header { color: var(--blue); opacity: .85; }

/* ===== AUDIO CALL OVERLAY ===== */
/* ── Incoming call banner (mini) ── */
.call-incoming-banner {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 10px);
  left: 12px; right: 12px;
  z-index: 900;
  background: rgba(22,22,34,.92);
  backdrop-filter: blur(30px) saturate(1.8);
  -webkit-backdrop-filter: blur(30px) saturate(1.8);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.1);
  transform: translateY(-120%);
  transition: transform .35s cubic-bezier(.2,0,0,1);
}
.call-incoming-banner.visible { transform: translateY(0); }
.call-inc-av {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg,#4a9eff,#764ba2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.call-inc-info { flex: 1; min-width: 0; }
.call-inc-name { font-size: 15px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-inc-sub  { font-size: 12px; color: rgba(255,255,255,.55); margin-top: 2px; }
.call-inc-btn {
  width: 42px; height: 42px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: transform .12s, opacity .12s;
}
.call-inc-btn:active { transform: scale(.9); opacity: .8; }
.call-inc-reject { background: #e53935; }
.call-inc-accept { background: #43a047; }

/* ===== ACTIVE CALL MINIMIZED BAR ===== */
.call-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  height: 56px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px 0 14px;
  background: #1b7f3a;
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
  cursor: pointer;
  transform: translateY(-100%);
  transition: transform .25s cubic-bezier(.2,0,0,1);
  padding-top: env(safe-area-inset-top, 0px);
}
.call-bar.visible { transform: translateY(0); }
.call-bar-info { flex: 1; min-width: 0; }
.call-bar-name { font-size: 14px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-bar-status { font-size: 12px; color: rgba(255,255,255,.75); margin-top: 1px; }
.call-bar-end {
  width: 36px; height: 36px; flex-shrink: 0;
  background: rgba(255,255,255,.18); border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.call-bar-end:active { opacity: .7; }

/* ===== CALL LOG BUBBLE ===== */
.call-bubble {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 13px;
  border-radius: 18px 18px 18px 4px;
  background: var(--bg3);
  max-width: 270px; min-width: 180px;
  cursor: default; user-select: none;
}
.message.own .call-bubble {
  background: var(--blue);
  border-radius: 18px 18px 4px 18px;
}
.call-bubble-text {
  font-size: 13px; font-weight: 600;
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* time/ticks color inside call bubble */
.call-bubble .bmeta { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; flex-shrink: 0; }
.call-bubble .btime { font-size: 11px; color: var(--muted); }
.message.own .call-bubble .btime { color: rgba(255,255,255,.6); }
.message.own .call-bubble .tick  { stroke: rgba(255,255,255,.6); }
.message.own .call-bubble .tick-read { stroke: #fff; }

.call-overlay {
  position: fixed; inset: 0; z-index: 800;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  background: linear-gradient(160deg, #0a1628 0%, #1a2540 55%, #0d1f35 100%);
  color: #fff;
}
.call-av {
  width: 110px; height: 110px; border-radius: 50%;
  background: var(--blue); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 700; color: #fff;
  position: relative;
}
.call-av img { width: 100%; height: 100%; object-fit: cover; }
@keyframes callPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(51,144,236,.45); }
  50%      { box-shadow: 0 0 0 22px rgba(51,144,236,0); }
}
.call-av.calling { animation: callPulse 1.6s ease-in-out infinite; }
.call-name   { font-size: 26px; font-weight: 700; }
.call-status { font-size: 14px; color: rgba(255,255,255,.55); margin-top: -8px; }
.call-timer  { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; color: rgba(255,255,255,.7); }
.call-btns   { display: flex; gap: 28px; align-items: center; margin-top: 12px; }
.call-btn {
  width: 64px; height: 64px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .12s, opacity .14s;
  color: #fff; font-size: 13px;
}
.call-btn:active { transform: scale(.88); opacity: .8; }
.call-btn-answer  { background: #43a047; box-shadow: 0 4px 16px rgba(67,160,71,.5); }
.call-btn-reject  { background: #e53935; box-shadow: 0 4px 16px rgba(229,57,53,.5); }
.call-btn-end     { background: #e53935; box-shadow: 0 4px 16px rgba(229,57,53,.5); }
.call-btn-mute    { background: rgba(255,255,255,.12); }
.call-btn-mute.active { background: rgba(255,255,255,.3); }
.call-btn-spkr    { background: rgba(255,255,255,.12); }
.call-btn-label {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: rgba(255,255,255,.6);
  white-space: nowrap;
}
.call-btn-label .call-btn { margin: 0; }
.call-btn-label span { max-width: 70px; text-align: center; }

/* Chat/Main menu danger items */
.mmd-danger { color: var(--red) !important; }

/* ===== UPDATE SCREEN ===== */
.upd-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 24px;
  animation: fadeIn .25s ease;
}

/* Spinner ring */
@keyframes spin { to { transform: rotate(360deg); } }
.upd-spinner {
  width: 72px; height: 72px; position: relative;
}
.upd-spinner::before {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%;
  border: 4px solid var(--bg3);
  border-top-color: var(--blue);
  animation: spin .8s linear infinite;
}
.upd-logo {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.upd-logo img { width: 40px; height: 40px; border-radius: 10px; }

/* Status text */
.upd-title { font-size: 20px; font-weight: 700; color: var(--text); text-align: center; }
.upd-sub   { font-size: 14px; color: var(--muted); text-align: center; max-width: 260px; line-height: 1.5; }

/* Progress bar */
.upd-progress-wrap {
  width: 220px; height: 4px; border-radius: 4px;
  background: var(--bg3); overflow: hidden;
}
.upd-progress-bar {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--blue), #60b0ff);
  transition: width .4s ease;
  width: 0%;
}

/* Check icon (success) */
@keyframes checkPop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.upd-check {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(79,173,91,.15);
  display: flex; align-items: center; justify-content: center;
  animation: checkPop .4s cubic-bezier(.2,0,0,1) forwards;
}

/* Update available badge */
.upd-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue); color: #fff;
  border-radius: 20px; padding: 4px 14px;
  font-size: 14px; font-weight: 700;
}

/* Dots loading animation */
@keyframes dotPulse {
  0%,80%,100% { opacity:.25; transform:scale(.75); }
  40%         { opacity:1;   transform:scale(1); }
}
.upd-dots { display: flex; gap: 6px; align-items: center; }
.upd-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--blue); display: block;
  animation: dotPulse 1.1s ease-in-out infinite;
}
.upd-dots span:nth-child(2) { animation-delay: .16s; }
.upd-dots span:nth-child(3) { animation-delay: .32s; }

/* Edited marker */
.edited-mark { font-size: 11px; color: var(--muted); opacity: .75; }
.message.own .edited-mark { color: rgba(255,255,255,.55); }

/* Connection banner (JS creates it inline, but needs .transition) */
#connBanner { transition: transform .3s cubic-bezier(.2,0,0,1); }

/* vcircle-mode-icon in send button */
.vcircle-mode-icon { display: block; }

/* Dialog media preview */
.dlg-media-prev {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--muted); font-size: 13px;
}
.dlg-media-prev svg { flex-shrink: 0; opacity: .7; }

.vb-transcript {
  font-size: 13px;
  color: var(--muted);
  padding: 6px 2px 0;
  font-style: italic;
  line-height: 1.4;
}

/* ===== VIDEO CIRCLE RECORDING OVERLAY ===== */
.vcircle-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,.92);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 28px;
  animation: fadeIn .2s ease;
}
.vcircle-ring {
  width: 240px; height: 240px; border-radius: 50%;
  overflow: hidden; position: relative;
  border: 3px solid rgba(255,255,255,.8);
  background: #111;
  box-shadow: 0 0 0 0 rgba(51,144,236,0);
  animation: vcRingPulse 2s ease-in-out infinite;
}
@keyframes vcRingPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,255,255,.15); }
  50%      { box-shadow: 0 0 0 10px rgba(255,255,255,0); }
}
.vcircle-ring video {
  width: 100%; height: 100%; object-fit: cover;
  transform: scaleX(-1);
}
.vcircle-pulse {
  position: absolute; top: 10px; left: 10px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--red);
  animation: voicePulse 1s ease-in-out infinite;
}
.vcircle-timer {
  font-size: 26px; font-weight: 700; color: #fff;
  font-variant-numeric: tabular-nums; letter-spacing: -1px;
}
.vcircle-controls { display: flex; gap: 52px; align-items: center; }
.vcircle-cancel {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: none;
  color: #fff; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .14s, transform .1s;
}
.vcircle-cancel:active { transform: scale(.9); }
.vcircle-send-btn {
  width: 68px; height: 68px; border-radius: 50%;
  background: var(--blue); border: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; cursor: pointer;
  transition: transform .12s, opacity .14s;
  box-shadow: 0 4px 16px rgba(51,144,236,.5);
}
.vcircle-send-btn:active { transform: scale(.9); }
.vcircle-mode-hint {
  font-size: 13px; color: rgba(255,255,255,.55);
}

/* Mic button mode badge */
.mic-mode-badge {
  position: absolute; bottom: -2px; right: -2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--blue); border: 2px solid var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; color: #fff; pointer-events: none;
}
.send-btn { position: relative; }
.send-btn .mic-icon,
.send-btn .send-icon,
.send-btn .vcircle-mode-icon {
  position: absolute;
  transition: opacity .15s cubic-bezier(.4,0,.2,1), transform .15s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
.send-btn[data-mode="mic"] .mic-icon,
.send-btn[data-mode="send"] .send-icon,
.send-btn[data-mode="vcircle"] .vcircle-mode-icon { opacity: 1; transform: scale(1); }
.send-btn[data-mode="mic"] .send-icon,
.send-btn[data-mode="mic"] .vcircle-mode-icon,
.send-btn[data-mode="send"] .mic-icon,
.send-btn[data-mode="send"] .vcircle-mode-icon,
.send-btn[data-mode="vcircle"] .mic-icon,
.send-btn[data-mode="vcircle"] .send-icon { opacity: 0; transform: scale(0.4); }

/* Video circle message bubble */
.vcircle-bubble {
  width: 180px; height: 180px; border-radius: 50%;
  overflow: hidden; position: relative;
  cursor: pointer; background: #000;
  flex-shrink: 0;
}
.vcircle-bubble video {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.vcircle-bubble-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.28);
  transition: opacity .15s;
}
.vcircle-bubble.playing .vcircle-bubble-play { opacity: 0; }
.vcircle-bubble-meta {
  position: absolute; bottom: 10px; right: 14px;
  display: flex; align-items: center; gap: 3px;
}
.vcircle-bubble-time { font-size: 11px; color: rgba(255,255,255,.85); }

/* ===== YOUR INFO SCREEN ===== */
.yi-screen {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg); display: flex; flex-direction: column;
  animation: slideUp .24s cubic-bezier(.2,0,0,1);
}
.yi-hdr {
  display: flex; align-items: center; gap: 4px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.yi-title { flex: 1; font-size: 17px; font-weight: 700; }
.yi-save {
  width: 40px; height: 40px; border-radius: 50%;
  background: none; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; pointer-events: none;
  transition: opacity .22s ease;
}
.yi-save.visible { opacity: 1; pointer-events: auto; }
.yi-body { flex: 1; overflow-y: auto; padding-bottom: 40px; }
.yi-avatar-section {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 24px 20px 12px;
}
.yi-av-ring {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--blue); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
  transition: opacity .14s;
}
.yi-av-ring:active { opacity: .8; }
.yi-av-ring img { width: 100%; height: 100%; object-fit: cover; }
.yi-av-cam {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,.32);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.yi-av-label { font-size: 13px; color: var(--blue); }
.yi-section { margin: 0 14px 12px; }
.yi-section-label {
  font-size: 12px; color: var(--blue); font-weight: 600;
  margin-bottom: 4px; padding: 0 4px; text-transform: uppercase; letter-spacing: .3px;
}
.yi-card {
  background: var(--card); border-radius: var(--r-lg); overflow: hidden;
}
.yi-row {
  display: flex; flex-direction: column;
  padding: 11px 16px; border-bottom: 1px solid var(--line);
}
.yi-row:last-child { border-bottom: none; }
.yi-row-label { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.yi-row-value { font-size: 15px; color: var(--text); }
.yi-row-value.link { color: var(--blue); }
.yi-row-hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.yi-input {
  width: 100%; background: none; border: none; outline: none;
  font-size: 15px; color: var(--text); padding: 0; margin: 0;
  font-family: inherit;
}
.yi-input::placeholder { color: var(--muted); }
.yi-uname-row { display: flex; align-items: center; gap: 6px; }
.yi-uname-st { font-size: 14px; font-weight: 700; width: 16px; text-align: center; }
.yi-uname-st.ok  { color: var(--green); }
.yi-uname-st.bad { color: var(--red); }
.yi-bio-hint { font-size: 12px; color: var(--muted); margin-top: 6px; padding: 0 4px; line-height: 1.5; }

/* ===== RICH FAVORITES ===== */
.fav-screen {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
.fav-list { flex: 1; overflow-y: auto; list-style: none; padding: 8px 0; }
.fav-item {
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  display: flex; gap: 12px; align-items: flex-start;
  cursor: default;
}
.fav-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg3); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--blue);
}
.fav-body { flex: 1; min-width: 0; }
.fav-type { font-size: 11px; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
.fav-content { font-size: 14px; color: var(--text); line-height: 1.4; word-break: break-word; }
.fav-image { max-width: 100%; max-height: 160px; border-radius: 10px; display: block; margin-top: 4px; }
.fav-time { font-size: 11px; color: var(--muted); margin-top: 4px; }
.fav-del {
  background: none; border: none; color: var(--muted);
  cursor: pointer; padding: 4px; flex-shrink: 0;
  transition: color .14s;
}
.fav-del:active { color: var(--red); }

/* ===== MESSAGE CONTEXT MENU ===== */
.msg-ctx-menu {
  position: fixed; z-index: 350;
  background: var(--bg2); border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
  padding: 4px 0; min-width: 180px;
  animation: fadeIn .14s ease;
}
.msg-ctx-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; font-size: 15px; color: var(--text);
  cursor: pointer; transition: background .12s;
}
.msg-ctx-item:active { background: var(--bg3); }
.msg-ctx-item.danger { color: var(--red); }

/* ===== DIALOG STAGGER ANIMATION ===== */
@keyframes dialogIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dialog-item { animation: dialogIn .22s ease both; }

/* Attach menu sheet */
.attach-sheet {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.5); display: flex; flex-direction: column; justify-content: flex-end;
}
.attach-sheet-inner {
  background: var(--bg2); border-radius: 20px 20px 0 0;
  padding: 12px 0 calc(env(safe-area-inset-bottom) + 12px);
  animation: slideUp .24s cubic-bezier(.2,0,0,1);
}
.attach-sheet-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; padding: 16px 20px;
}
.attach-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; transition: transform .1s;
}
.attach-item:active { transform: scale(.9); }
.attach-item-ic {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px;
}
.attach-item-label { font-size: 12px; color: var(--text); text-align: center; }

/* ===== NOTIFICATION PERMISSION BANNER ===== */
.notif-perm-banner {
  position: fixed;
  bottom: calc(var(--nav-h) + 10px);
  left: 10px; right: 10px;
  z-index: 700;
  background: var(--bg2);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
  padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 10px;
  animation: slideUp .3s cubic-bezier(.2,0,0,1);
  border-left: 3px solid var(--blue);
}
.notif-perm-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--blue); display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; color: #fff;
}
.notif-perm-body { flex: 1; min-width: 0; }
.notif-perm-title { font-size: 14px; font-weight: 600; color: var(--text); }
.notif-perm-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.notif-perm-btns  { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.notif-perm-allow {
  background: var(--blue); color: #fff; border: none;
  padding: 6px 14px; border-radius: 20px; font-size: 13px;
  font-weight: 600; cursor: pointer; transition: opacity .14s;
}
.notif-perm-allow:active { opacity: .8; }
.notif-perm-close {
  background: none; border: none; color: var(--muted);
  font-size: 20px; cursor: pointer; padding: 2px 6px;
  line-height: 1; flex-shrink: 0;
}

/* ===== CALL BUTTON MUTE — CLEAR STATES ===== */
.call-btn-mute {
  background: rgba(255,255,255,.12);
  position: relative;
}
.call-btn-mute .icon-muted { display: none; }
.call-btn-mute.active {
  background: rgba(229,57,53,.28);
  border: 2px solid rgba(229,57,53,.7);
}
.call-btn-mute.active .icon-normal { display: none; }
.call-btn-mute.active .icon-muted  { display: block; }
.call-btn-label span { font-size: 11px; }

/* ===== VIDEO CALL — full redesign ===== */

/* Base audio call layout */
.call-info-block { display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* ===== VIDEO CALL PRE-ANSWER BACKGROUND ===== */
.call-video-bg {
  position: absolute; inset: 0; z-index: 0;
  overflow: hidden;
  transition: opacity .7s ease;
}
.call-video-bg.hidden { opacity: 0; pointer-events: none; }
.call-video-bg-img {
  position: absolute; inset: -50px;
  background-size: cover; background-position: center;
  filter: blur(40px) brightness(.45) saturate(1.6);
  transform: scale(1.12);
}
.call-video-bg-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(8,18,36,.55) 0%, rgba(14,24,50,.45) 100%);
}
.call-video-bg-blob1,
.call-video-bg-blob2,
.call-video-bg-blob3 {
  position: absolute; border-radius: 50%;
  filter: blur(72px);
}
.call-video-bg-blob1 {
  width: 75%; height: 75%; top: -15%; left: -15%;
  background: rgba(51,144,236,.42);
  animation: cvBlob1 7s ease-in-out infinite alternate;
}
.call-video-bg-blob2 {
  width: 65%; height: 65%; bottom: -15%; right: -10%;
  background: rgba(110,55,230,.34);
  animation: cvBlob2 9s ease-in-out infinite alternate;
}
.call-video-bg-blob3 {
  width: 45%; height: 45%; top: 25%; right: 5%;
  background: rgba(0,195,225,.22);
  animation: cvBlob3 11s ease-in-out infinite alternate;
}
@keyframes cvBlob1 {
  0%   { transform: translate(0,0) scale(1); }
  100% { transform: translate(9%,13%) scale(1.13); }
}
@keyframes cvBlob2 {
  0%   { transform: translate(0,0) scale(1); }
  100% { transform: translate(-11%,-9%) scale(1.09); }
}
@keyframes cvBlob3 {
  0%   { transform: translate(0,0) scale(1); }
  100% { transform: translate(-13%,8%) scale(1.16); }
}

/* Video mode: videos fill screen, UI is absolute on top */
.call-overlay.video-mode {
  background: #000;
  justify-content: flex-start;
  align-items: stretch;
  padding: 0;
}

/* Remote video — fullscreen background */
.call-remote-video {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  object-fit: cover; background: transparent;
  opacity: 0; transition: opacity .5s ease;
}
.call-remote-video.active { opacity: 1; }

/* Top gradient — name readable on video */
.call-overlay.video-mode::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 200px;
  background: linear-gradient(to bottom, rgba(0,0,0,.65) 0%, transparent 100%);
  z-index: 2; pointer-events: none;
}

/* Bottom gradient — buttons readable on video */
.call-overlay.video-mode::after {
  content: ''; position: absolute;
  bottom: 0; left: 0; right: 0; height: 220px;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, transparent 100%);
  z-index: 2; pointer-events: none;
}

/* Local video — PiP bottom right above buttons */
.call-local-video {
  position: absolute; z-index: 4;
  bottom: 120px; right: 16px;
  width: 92px; height: 138px;
  border-radius: 16px; overflow: hidden;
  object-fit: cover; background: #333;
  border: 2px solid rgba(255,255,255,.3);
  box-shadow: 0 4px 20px rgba(0,0,0,.6);
  /* mirror handled via JS based on facingMode */
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  display: none;
}
.call-local-video.active { display: block; }
.call-local-video:active { cursor: grabbing; }

/* Info block: name + status at top in video mode */
.call-overlay.video-mode .call-info-block {
  position: absolute; z-index: 3;
  top: 0; left: 0; right: 0;
  align-items: flex-start;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 20px 0;
}
.call-overlay.video-mode .call-av    { display: none; }
.call-overlay.video-mode .call-name  { font-size: 20px; }
.call-overlay.video-mode .call-status{ font-size: 13px; margin-top: -6px; }
.call-overlay.video-mode .call-timer { font-size: 14px; }

/* Buttons at bottom in video mode */
.call-overlay.video-mode .call-btns {
  position: absolute; z-index: 3;
  bottom: 0; left: 0; right: 0;
  padding: 0 24px calc(env(safe-area-inset-bottom, 0px) + 32px);
  justify-content: center;
}

/* Cam-off button state */
.call-cam-off { background: rgba(255,255,255,.1); }

/* PiP swap: local video becomes fullscreen, remote becomes PiP */
.call-local-video.vcall-swapped {
  inset: 0 !important; width: 100% !important; height: 100% !important;
  border-radius: 0 !important; border: none !important; z-index: 1 !important;
  /* transform managed via JS to respect facingMode */
  box-shadow: none !important;
  cursor: default !important;
}
.call-remote-video.vcall-swapped-remote {
  position: absolute !important;
  inset: auto !important; bottom: 120px !important; right: 16px !important;
  width: 92px !important; height: 138px !important;
  border-radius: 16px !important; object-fit: cover !important;
  z-index: 4 !important;
}

/* Incoming video call indicator */
.call-overlay.video-mode.incoming .call-av {
  display: flex;
  width: 80px; height: 80px; font-size: 28px;
}

/* ===== CHAT SEARCH ===== */
.chat-search-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--bg);
  border-bottom: 1px solid var(--line); flex-shrink: 0;
  animation: slideUp .18s ease;
}
.chat-search-input {
  flex: 1; background: var(--bg3); border: none; border-radius: 20px;
  padding: 8px 14px; font-size: 14px; color: var(--text); outline: none;
}
.chat-search-input::placeholder { color: var(--muted); }
.chat-search-nav { display: flex; gap: 2px; flex-shrink: 0; }
.chat-search-nav button {
  width: 32px; height: 32px; border-radius: 50%;
  background: none; border: none; color: var(--muted);
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: background .14s;
}
.chat-search-nav button:active { background: var(--bg3); }
.chat-search-nav button:disabled { opacity: .3; }
.chat-search-count { font-size: 12px; color: var(--muted); flex-shrink: 0; min-width: 36px; text-align: center; }
/* Search match — subtle blue outline */
.message.search-match .bubble {
  box-shadow: 0 0 0 2px rgba(51,144,236,.45);
  border-radius: 18px;
}
/* Current search result — bright orange highlight */
.message.search-current .bubble {
  box-shadow: 0 0 0 2px #f4a62a, 0 2px 16px rgba(244,166,42,.25);
  border-radius: 18px;
}
/* Highlighted text inside bubble */
mark.search-hl {
  background: rgba(244,166,42,.55);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
/* Current match highlighted text — stronger */
.message.search-current mark.search-hl {
  background: #f4a62a;
  color: #000;
}

/* ===== ARCHIVE ===== */
.archive-btn-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; cursor: pointer; transition: background .13s;
  border-bottom: 1px solid var(--line);
}
.archive-btn-row:active { background: var(--bg3); }
.archive-btn-av {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--bg3); display: flex; align-items: center; justify-content: center;
  color: var(--muted); flex-shrink: 0;
}
.archive-btn-name { font-size: 15px; font-weight: 600; color: var(--text); }
.archive-btn-count { font-size: 13px; color: var(--muted); }
.dialog-item.is-archived { opacity: .65; }

/* ── Lock badge on dialog avatar ── */
.dlg-lock-badge {
  position: absolute; bottom: 0; right: 0;
  width: 16px; height: 16px; border-radius: 50%;
  background: linear-gradient(135deg, #4a9eff, #764ba2);
  border: 2px solid var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.dialog-av-wrap { position: relative; }


/* ── Lock auth / setup screen ── */
.lock-auth-screen {
  position: fixed; inset: 0; z-index: 1100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  animation: lockSlideUp .32s cubic-bezier(.2,0,0,1) both;
}
.lock-auth-screen.lock-auth-exit {
  animation: lockSlideDown .3s cubic-bezier(.4,0,1,1) both;
}
.lock-auth-screen.lock-auth-success .lock-auth-inner {
  animation: lockSuccessPop .25s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes lockSlideUp {
  from { opacity:0; transform: translateY(48px) scale(.97); }
  to   { opacity:1; transform: translateY(0)    scale(1); }
}
@keyframes lockSlideDown {
  from { opacity:1; transform: translateY(0)    scale(1); }
  to   { opacity:0; transform: translateY(48px) scale(.97); }
}
@keyframes lockSuccessPop {
  from { transform: scale(1); }
  to   { transform: scale(1.04); }
}
@keyframes lockShake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-10px); }
  40%     { transform: translateX(10px); }
  60%     { transform: translateX(-7px); }
  80%     { transform: translateX(7px); }
}
.lock-shake { animation: lockShake .45s cubic-bezier(.36,.07,.19,.97) both; }
.lock-auth-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 32px 24px; width: 100%; max-width: 340px;
}
.lock-auth-icon {
  width: 80px; height: 80px; border-radius: 24px;
  background: linear-gradient(135deg, rgba(74,158,255,.15), rgba(118,75,162,.15));
  border: 1px solid rgba(74,158,255,.2);
  display: flex; align-items: center; justify-content: center;
  color: var(--blue); margin-bottom: 8px;
}
.lock-auth-title { font-size: 22px; font-weight: 800; }
.lock-auth-sub { font-size: 14px; color: var(--muted); text-align: center; margin-bottom: 8px; }

/* PIN dots */
.lock-pin-dots {
  display: flex; gap: 16px; margin: 12px 0;
}
.lock-pin-dots span {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--muted); transition: background .1s, border-color .1s;
}
.lock-pin-dots span.filled { background: var(--blue); border-color: var(--blue); }
.lock-pin-dots span.error  { background: var(--red);  border-color: var(--red); }

/* PIN grid */
.lock-pin-grid {
  display: grid; grid-template-columns: repeat(3, 76px);
  gap: 10px; margin-top: 8px;
}
.lock-pin-key {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--bg3); border: none; color: var(--text);
  font-size: 24px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.lock-pin-key:active { background: rgba(255,255,255,.15); transform: scale(.92); }
.lock-pin-bio { background: transparent; color: var(--muted); }
.lock-pin-bio:active { background: rgba(255,255,255,.08); }
.lock-pin-del { background: transparent; color: var(--muted); }
.lock-pin-del:active { background: rgba(255,255,255,.08); }

/* Bio text button */
.lock-bio-text-btn {
  margin-top: 4px; padding: 12px 28px;
  background: rgba(74,158,255,.12);
  border: 1px solid rgba(74,158,255,.25);
  border-radius: 14px; color: var(--blue);
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .18s, transform .12s;
  -webkit-tap-highlight-color: transparent;
}
.lock-bio-text-btn:active { background: rgba(74,158,255,.22); transform: scale(.96); }

/* Bio / setup buttons */
.lock-use-pin-btn, .lock-setup-bio-btn {
  width: 100%; padding: 14px; border-radius: 14px;
  background: var(--blue); color: #fff; border: none;
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.lock-setup-bio-btn.secondary {
  background: var(--bg3); color: var(--text);
}
.lock-use-pin-btn { background: var(--bg3); color: var(--blue); margin-top: 4px; }
.lock-cancel-btn {
  margin-top: 8px; background: none; border: none;
  color: var(--muted); font-size: 14px; cursor: pointer; padding: 8px;
}
.video-call-btn { color: var(--green); }

/* ===== SETTINGS SUB-SCREENS ===== */

/* Toggle switch */
.st-toggle {
  position: relative; width: 50px; height: 28px; flex-shrink: 0;
}
.st-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.st-slider {
  position: absolute; inset: 0; border-radius: 14px;
  background: var(--bg3); cursor: pointer;
  transition: background .22s;
  border: 1.5px solid rgba(255,255,255,.06);
}
.st-slider::before {
  content: ''; position: absolute;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; left: 2px; top: 1px;
  transition: transform .24s cubic-bezier(.34,1.4,.64,1);
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.st-toggle input:checked + .st-slider { background: var(--blue); }
.st-toggle input:checked + .st-slider::before { transform: translateX(22px); }

/* Sub-screen row */
.st-row {
  display: flex; align-items: center;
  padding: 14px 16px; gap: 12px; cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background .13s;
}
.st-row:last-child { border-bottom: none; }
.st-row:active { background: var(--bg3); }
.st-row-info { flex: 1; min-width: 0; }
.st-row-title { font-size: 15px; color: var(--text); font-weight: 500; }
.st-row-sub { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.st-val { font-size: 14px; color: var(--muted); flex-shrink: 0; }
.st-chevron { flex-shrink: 0; color: var(--muted); opacity: .5; }
.st-danger .st-row-title { color: var(--red); }

/* Font size selector */
.st-font-pills {
  display: flex; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.st-font-pill {
  flex: 1; padding: 8px 0; border-radius: 10px;
  background: var(--bg3); border: 2px solid transparent;
  font-family: inherit; cursor: pointer; color: var(--text);
  transition: border-color .15s, background .15s;
  text-align: center;
}
.st-font-pill.active { border-color: var(--blue); background: rgba(51,144,236,.1); color: var(--blue); font-weight: 600; }

/* Section label inside sub-screen */
.st-section-label {
  font-size: 12px; color: var(--blue); font-weight: 600;
  padding: 16px 16px 6px; text-transform: uppercase; letter-spacing: .04em;
}
.st-card { background: var(--card); border-radius: var(--r-lg); margin: 0 14px 12px; overflow: hidden; }
.st-footer { font-size: 13px; color: var(--muted); text-align: center; padding: 20px 16px 40px; line-height: 1.5; }

/* Session card */
.st-session {
  background: var(--card); border-radius: var(--r-lg);
  margin: 0 14px 12px; padding: 16px;
  display: flex; gap: 14px; align-items: flex-start;
}
.st-session-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--blue); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.st-session-name { font-size: 15px; font-weight: 700; color: var(--text); }
.st-session-detail { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* Language option */
.st-lang-opt {
  display: flex; align-items: center; padding: 14px 16px;
  border-bottom: 1px solid var(--line); gap: 12px; cursor: pointer;
}
.st-lang-opt:last-child { border-bottom: none; }
.st-lang-name { flex: 1; font-size: 15px; color: var(--text); font-weight: 500; }
.st-lang-check { color: var(--blue); }
.st-lang-soon { font-size: 11px; color: var(--muted); background: var(--bg3); padding: 2px 8px; border-radius: 10px; }

/* Storage bar */
.st-storage-bar {
  height: 6px; border-radius: 3px; background: var(--bg3);
  margin: 12px 16px 4px; overflow: hidden;
}
.st-storage-fill { height: 100%; border-radius: 3px; background: var(--blue); transition: width .4s; }
.st-storage-label { font-size: 12px; color: var(--muted); padding: 0 16px 12px; }

/* ===== REACTIONS ===== */
.msg-reactions {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 4px; padding: 0 2px;
}
.reaction-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg3); border: 1.5px solid transparent;
  border-radius: 12px; padding: 3px 8px;
  font-size: 12px; font-weight: 600; color: var(--text);
  cursor: pointer; transition: all .15s; user-select: none;
}
.reaction-chip.mine { border-color: var(--blue); background: rgba(51,144,236,.12); color: var(--blue); }
.reaction-chip:active { transform: scale(.92); }
.reaction-chip svg { width: 14px; height: 14px; }

/* Reaction picker */
.reaction-picker {
  position: fixed; z-index: 600;
  background: var(--bg2); border-radius: 20px;
  padding: 8px; display: flex; gap: 4px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  animation: slideUp .18s cubic-bezier(.2,0,0,1);
}
.reaction-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .13s, transform .13s;
}
.reaction-btn:hover, .reaction-btn:active { background: var(--bg3); transform: scale(1.2); }
.reaction-btn svg { width: 22px; height: 22px; }

/* ===== SWIPE TO REPLY ===== */
.message { position: relative; }
.swipe-reply-arrow {
  position: absolute; right: -34px; left: auto; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--blue); display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .1s;
  z-index: 2;
}

/* ===== GLOBAL SEARCH ===== */
.gsearch-screen {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg); display: flex; flex-direction: column;
  animation: fadeIn .16s ease;
}
.gsearch-hdr {
  display: flex; align-items: center; gap: 10px;
  padding: var(--safe-top) 12px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0; background: var(--bg);
}
.gsearch-inp {
  flex: 1; background: var(--bg3); border: none; outline: none;
  border-radius: 12px; padding: 9px 14px;
  font-size: 15px; color: var(--text); font-family: inherit;
}
.gsearch-body { flex: 1; overflow-y: auto; }
.gsearch-section { font-size: 12px; color: var(--blue); font-weight: 600;
  padding: 12px 14px 6px; text-transform: uppercase; letter-spacing: .04em; }
.gsearch-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--line);
  transition: background .13s;
}
.gsearch-item:active { background: var(--bg3); }
.gsearch-av { width: 40px; height: 40px; border-radius: 50%; background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0; overflow: hidden; }
.gsearch-av img { width: 100%; height: 100%; object-fit: cover; }
.gsearch-name { font-size: 15px; font-weight: 600; color: var(--text); }
.gsearch-sub  { font-size: 13px; color: var(--muted); margin-top: 2px; }
.gsearch-sub mark { background: rgba(51,144,236,.25); color: var(--text); border-radius: 2px; }

/* ===== DISAPPEARING MESSAGES ===== */
.msg-expire {
  font-size: 10px; color: rgba(255,255,255,.6); margin-left: 4px;
  display: inline-flex; align-items: center; gap: 2px;
}
.message:not(.own) .msg-expire { color: var(--muted); }
.disappear-banner {
  background: rgba(51,144,236,.1); border-bottom: 1px solid rgba(51,144,236,.2);
  padding: 8px 14px; display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--blue); flex-shrink: 0;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

/* ===== @MENTIONS ===== */
.mention-popup {
  position: fixed; z-index: 500;
  background: var(--bg2); border-radius: 14px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
  overflow: hidden; animation: slideUp .16s ease;
  max-height: 220px; overflow-y: auto;
  min-width: 200px;
}
.mention-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer;
  transition: background .13s;
}
.mention-item:active, .mention-item.active { background: var(--bg3); }
.mention-av {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue); display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700; flex-shrink: 0; overflow: hidden;
}
.mention-av img { width: 100%; height: 100%; object-fit: cover; }
.mention-name { font-size: 14px; font-weight: 600; color: var(--text); }
.mention-uname { font-size: 12px; color: var(--muted); }
.msg-mention { color: var(--blue); font-weight: 600; }

/* ===== LINK PREVIEW ===== */
.link-preview {
  margin-top: 6px;
  border-left: 3px solid var(--blue);
  padding: 6px 10px;
  border-radius: 0 8px 8px 0;
  background: rgba(51,144,236,.08);
  cursor: pointer;
  max-width: 280px;
  display: block;
  text-decoration: none;
}
.link-preview-site { font-size: 11px; color: var(--blue); font-weight: 600; margin-bottom: 2px; }
.link-preview-title { font-size: 13px; color: var(--text); font-weight: 700; line-height: 1.3; margin-bottom: 2px; }
.link-preview-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }
.link-preview-img { width: 100%; border-radius: 6px; margin-top: 6px; max-height: 140px; object-fit: cover; display: block; }
.message.own .link-preview { border-left-color: rgba(255,255,255,.6); background: rgba(255,255,255,.1); }
.message.own .link-preview-site { color: rgba(255,255,255,.8); }
.message.own .link-preview-title { color: #fff; }
.message.own .link-preview-desc { color: rgba(255,255,255,.7); }

/* ===== 2FA ===== */
.totp-qr { display:block; margin:16px auto; border-radius:12px; max-width:200px; }
.totp-secret {
  font-family: monospace; font-size:13px; letter-spacing:.08em;
  background:var(--bg3); padding:10px 14px; border-radius:10px;
  text-align:center; word-break:break-all; color:var(--text);
  margin:8px 0;
}
.totp-input {
  width:100%; text-align:center; font-size:24px; font-weight:700;
  letter-spacing:.2em; background:var(--bg3); border:2px solid var(--line);
  border-radius:12px; padding:14px; color:var(--text); font-family:monospace;
  outline:none; transition:border-color .15s;
}
.totp-input:focus { border-color:var(--blue); }

/* ===== DRAG & DROP ===== */
.drop-overlay {
  position:fixed; inset:0; z-index:999;
  background:rgba(51,144,236,.18);
  backdrop-filter:blur(4px);
  display:flex; align-items:center; justify-content:center;
  pointer-events:none;
}
.drop-box {
  background:var(--bg2); border:3px dashed var(--blue);
  border-radius:24px; padding:40px 48px;
  display:flex; flex-direction:column; align-items:center; gap:12px;
  font-size:18px; font-weight:700; color:var(--blue);
}

/* ═══════════════════════════════════════════════════
   FACE REGISTRATION
═══════════════════════════════════════════════════ */

/* Full-screen overlay */
.face-reg-overlay {
  position: fixed; inset: 0; z-index: 900;
  display: flex; flex-direction: column; align-items: center;
  overflow: hidden;
  background: #07090f;
  animation: faceOverlayIn .28s ease both;
}
@keyframes faceOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Info phase ── */
.face-info-phase {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  padding: 0 24px 32px;
  overflow-y: auto;
  animation: facePhaseIn .28s cubic-bezier(.2,0,0,1) both;
}
.face-info-back {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; color: #8899bb;
  font-size: 15px; padding: 20px 0 12px;
  cursor: pointer; align-self: flex-start;
}
.face-info-back svg { opacity: .7; }
.face-info-icon-wrap {
  display: flex; align-items: center; justify-content: center;
  margin: 8px 0 24px;
}
.face-info-icon-wrap svg {
  filter: drop-shadow(0 0 24px rgba(74,158,255,.35));
}
.face-info-title {
  font-size: 22px; font-weight: 700; color: #fff;
  text-align: center; margin: 0 0 12px;
}
.face-info-desc {
  font-size: 15px; line-height: 1.6; color: #8899bb;
  text-align: center; margin: 0 0 24px;
}
.face-info-bullets {
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 24px;
}
.face-info-bullet {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.04); border-radius: 14px;
  padding: 12px 16px;
}
.face-info-bullet-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(74,158,255,.12);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.face-info-bullet-text { font-size: 14px; color: #ccd6e8; line-height: 1.4; }
.face-info-privacy {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 12px 16px; background: rgba(255,255,255,.03);
  border-radius: 12px; margin-bottom: 24px;
  font-size: 12.5px; color: #607090; line-height: 1.5;
}
.face-info-privacy svg { flex-shrink: 0; margin-top: 1px; }
.face-info-agree {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px; border: 1.5px solid rgba(255,255,255,.08);
  border-radius: 14px; cursor: pointer; margin-bottom: 24px;
  font-size: 14px; color: #ccd; line-height: 1.5; user-select: none;
}
.face-info-agree input[type=checkbox] { display: none; }
.face-info-agree-box {
  width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.2); margin-top: 1px;
  background: transparent; transition: all .18s;
  display: flex; align-items: center; justify-content: center;
}
.face-info-agree.checked .face-info-agree-box {
  background: #4a9eff; border-color: #4a9eff;
}
.face-info-continue {
  width: 100%; padding: 16px; border-radius: 16px;
  background: #4a9eff; color: #fff; font-size: 16px; font-weight: 600;
  border: none; cursor: pointer; transition: opacity .15s;
}
.face-info-continue:disabled { opacity: .35; pointer-events: none; }

/* ── Capture phase ── */
.face-capture-phase {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 0;
  animation: facePhaseIn .28s cubic-bezier(.2,0,0,1) both;
}
.face-capture-close {
  position: absolute; top: 20px; right: 20px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: none;
  color: #aaa; display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 10;
}
.face-capture-close:active { background: rgba(255,255,255,.15); }

.face-instruction {
  font-size: 17px; font-weight: 600; color: #fff;
  text-align: center; min-height: 28px;
  margin-bottom: 28px; padding: 0 32px;
  line-height: 1.4;
  transition: opacity .2s;
}
.face-instruction.fade { opacity: 0; }

/* The circle */
.face-circle-wrap {
  position: relative; width: 270px; height: 270px;
}
.face-video-ring {
  position: absolute; inset: 16px; border-radius: 50%;
  overflow: hidden; background: #000;
}
.face-video-ring video {
  width: 100%; height: 100%;
  object-fit: cover; transform: scaleX(-1);
}
.face-video-ring canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  transform: scaleX(-1);
}
.face-ring-svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  transform: rotate(-90deg);
}
.face-ring-track {
  fill: none; stroke: rgba(255,255,255,.08); stroke-width: 4;
}
.face-ring-fill {
  fill: none; stroke: #4a9eff; stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 741;
  stroke-dashoffset: 741;
  transition: stroke-dashoffset .5s cubic-bezier(.4,0,.2,1),
              stroke .3s;
}
.face-ring-spinner {
  fill: none; stroke: rgba(255,255,255,.15); stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 120 621;
  stroke-dashoffset: 0;
  animation: faceRingSpinner 1.4s linear infinite;
}
@keyframes faceRingSpinner {
  to { stroke-dashoffset: -741; }
}
.face-ring-pulse {
  position: absolute; inset: 10px; border-radius: 50%;
  border: 2.5px solid rgba(74,158,255,.4);
  animation: faceRingPulse 1.8s ease-in-out infinite;
}
@keyframes faceRingPulse {
  0%, 100% { opacity: .4; transform: scale(1); }
  50%       { opacity: 1;  transform: scale(1.03); }
}

/* Check dots */
.face-check-dots {
  display: flex; gap: 8px; margin-top: 32px;
}
.face-check-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.15);
  transition: background .3s, transform .25s;
}
.face-check-dot.done { background: #4a9eff; }
.face-check-dot.active {
  background: #fff; transform: scale(1.4);
}

.face-status-msg {
  font-size: 13px; color: #ff6060; margin-top: 16px;
  min-height: 20px; text-align: center; padding: 0 24px;
}

/* ── Processing overlay ── */
.face-processing {
  position: absolute; inset: 0; z-index: 20;
  background: #07090f;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px;
  animation: facePhaseIn .25s ease both;
}
.face-processing-spinner {
  width: 56px; height: 56px; border-radius: 50%;
  border: 3px solid rgba(74,158,255,.2);
  border-top-color: #4a9eff;
  animation: spin .8s linear infinite;
}
.face-processing-text {
  font-size: 16px; font-weight: 500; color: #aabbcc;
}

/* ── Profile phase ── */
.face-profile-phase {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  padding: 0 24px 32px;
  overflow-y: auto;
  animation: facePhaseIn .28s cubic-bezier(.2,0,0,1) both;
}
.face-profile-header {
  display: flex; align-items: center;
  padding: 20px 0 8px; gap: 12px;
}
.face-profile-header-title {
  font-size: 20px; font-weight: 700; color: #fff;
}
.face-profile-success {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px; background: rgba(52,199,89,.12);
  border-radius: 14px; margin-bottom: 24px;
  font-size: 14px; color: #34c759; font-weight: 500;
}
.face-profile-avatar-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; margin-bottom: 24px;
}
.face-profile-avatar-ring {
  width: 88px; height: 88px; border-radius: 50%;
  background: rgba(74,158,255,.15);
  border: 2px dashed rgba(74,158,255,.4);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden; position: relative;
}
.face-profile-avatar-ring img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.face-profile-avatar-label {
  font-size: 13px; color: #4a9eff; font-weight: 500;
}
.face-profile-field {
  margin-bottom: 14px;
}
.face-profile-field label {
  display: block; font-size: 12px; font-weight: 600;
  color: #607090; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 6px;
}
.face-profile-field input,
.face-profile-field textarea {
  width: 100%; padding: 14px 16px;
  background: rgba(255,255,255,.06);
  border: 1.5px solid rgba(255,255,255,.1);
  border-radius: 14px; color: #fff; font-size: 16px;
  outline: none; font-family: inherit;
  transition: border-color .15s;
}
.face-profile-field input:focus,
.face-profile-field textarea:focus {
  border-color: rgba(74,158,255,.6);
}
.face-profile-field textarea {
  resize: none; height: 80px; line-height: 1.5;
}
.face-profile-err {
  font-size: 13px; color: #ff6060; min-height: 18px;
  margin-bottom: 8px;
}
.face-profile-submit {
  width: 100%; padding: 16px; border-radius: 16px;
  background: #4a9eff; color: #fff;
  font-size: 16px; font-weight: 600; border: none;
  cursor: pointer; margin-top: 8px;
  transition: opacity .15s;
}
.face-profile-submit:disabled { opacity: .4; pointer-events: none; }

/* Shared animation */
@keyframes facePhaseIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Face login button */
.login-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--sub); font-size: 13px; margin: 4px 0;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.login-face-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* Hold time hint */
.fr-time-hint {
  display: block; font-size: 12px; font-weight: 400;
  color: rgba(255,255,255,.35); margin-top: 4px;
  letter-spacing: .2px;
}

/* Progress bar */
.face-progress-wrap {
  width: 200px; height: 3px; border-radius: 2px;
  background: rgba(255,255,255,.1); margin-bottom: 20px; overflow: hidden;
}
.face-progress-bar {
  height: 100%; width: 0%; border-radius: 2px;
  background: #4a9eff;
  transition: width .08s linear;
}

/* ── Face already exists screen ── */
.face-exists-phase {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 28px; gap: 0;
  animation: faceExistsIn .45s cubic-bezier(.2,0,0,1) both;
}
@keyframes faceExistsIn {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
.face-exists-icon {
  margin-bottom: 24px;
  animation: faceExistsPulse 2s ease-in-out infinite;
}
@keyframes faceExistsPulse {
  0%,100% { filter: drop-shadow(0 0 12px rgba(255,149,0,.3)); }
  50%     { filter: drop-shadow(0 0 28px rgba(255,149,0,.7)); }
}
.face-exists-title {
  font-size: 22px; font-weight: 700; color: #fff;
  text-align: center; margin-bottom: 12px;
}
.face-exists-sub {
  font-size: 14px; color: #8899bb; text-align: center;
  line-height: 1.6; margin-bottom: 36px; max-width: 280px;
}
.face-exists-login {
  width: 100%; padding: 16px; border-radius: 16px;
  background: #ff9500; color: #fff;
  font-size: 16px; font-weight: 600; border: none;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px; margin-bottom: 12px;
  transition: opacity .15s;
}
.face-exists-login:active { opacity: .8; }
.face-exists-back {
  background: none; border: none; color: #607090;
  font-size: 15px; padding: 12px; cursor: pointer;
}

/* ===== GROUP SETTINGS SCREEN ===== */
.gs-screen {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg); display: flex; flex-direction: column;
  animation: slideUp .24s cubic-bezier(.2,0,0,1);
  overflow-y: auto;
}
.gs-hero {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 20px 16px; gap: 8px;
}
.gs-av {
  width: 86px; height: 86px; border-radius: 50%;
  background: var(--blue); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
  transition: opacity .14s;
}
.gs-av:active { opacity: .8; }
.gs-av img { width: 100%; height: 100%; object-fit: cover; }
.gs-av-cam {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,.32);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.gs-name { font-size: 20px; font-weight: 700; color: var(--text); text-align: center; }
.gs-meta { font-size: 13px; color: var(--muted); text-align: center; }
.gs-desc { font-size: 14px; color: var(--text); text-align: center; max-width: 280px; line-height: 1.4; }
.gs-card {
  margin: 0 12px 10px;
  background: var(--bg2); border-radius: 14px; overflow: hidden;
}
.gs-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.gs-row:last-child { border-bottom: none; }
.gs-row-ic {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.gs-row-body { flex: 1; min-width: 0; }
.gs-row-title { font-size: 15px; color: var(--text); }
.gs-row-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.gs-section-label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  padding: 12px 16px 4px;
}
.gs-member-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.gs-member-row:last-child { border-bottom: none; }
.gs-member-av {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--blue); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.gs-member-av img { width: 100%; height: 100%; object-fit: cover; }
.gs-member-info { flex: 1; min-width: 0; }
.gs-member-name {
  font-size: 15px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.gs-member-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.gs-badge-creator {
  font-size: 11px; color: var(--blue);
  background: rgba(51,144,236,.12); border-radius: 6px; padding: 1px 6px;
}
.gs-badge-admin {
  font-size: 11px; color: #8B5CF6;
  background: rgba(139,92,246,.12); border-radius: 6px; padding: 1px 6px;
}
.gs-badge-title {
  font-size: 11px; color: var(--muted);
  background: var(--bg3); border-radius: 6px; padding: 1px 6px;
}
.gs-member-more {
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: pointer; flex-shrink: 0;
  transition: background .12s;
}
.gs-member-more:active { background: var(--bg3); }
.gs-leave-btn {
  margin: 8px 12px 32px;
  background: rgba(235,64,52,.1); color: var(--red);
  border: none; border-radius: 14px;
  padding: 14px 20px; font-size: 15px; font-weight: 600;
  width: calc(100% - 24px); cursor: pointer; text-align: center;
  transition: background .15s;
}
.gs-leave-btn:active { background: rgba(235,64,52,.2); }

/* ===== INVITE LINKS SCREEN ===== */
.inv-link-card {
  margin: 0 12px 10px;
  background: var(--bg2); border-radius: 14px;
  padding: 14px 16px;
}
.inv-link-url {
  font-size: 14px; color: var(--blue); font-weight: 600;
  word-break: break-all; margin-bottom: 10px;
}
.inv-link-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inv-link-btn {
  flex: 1; padding: 8px 12px; border-radius: 10px;
  border: none; background: var(--bg3);
  font-size: 13px; color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  transition: background .12s;
}
.inv-link-btn:active { background: var(--line); }
.inv-link-btn.danger { color: var(--red); }
.inv-link-item {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.inv-link-item:last-child { border-bottom: none; }
.inv-link-item-label { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.inv-link-item-meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.inv-link-item-actions { display: flex; gap: 6px; }

/* ===== ADMIN PERMISSIONS ===== */
.ap-screen {
  position: fixed; inset: 0; z-index: 310;
  background: var(--bg); display: flex; flex-direction: column;
  animation: slideUp .22s cubic-bezier(.2,0,0,1);
  overflow-y: auto;
}
.ap-title-inp {
  width: 100%; background: none; border: none;
  font-size: 15px; color: var(--text);
  padding: 12px 16px; outline: none;
}

/* ===== JOIN GROUP PAGE ===== */
.join-screen {
  position: fixed; inset: 0; z-index: 500;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .22s ease;
}
.join-inner {
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 24px; width: 100%; max-width: 420px; gap: 8px;
}
.join-av {
  width: 100px; height: 100px; border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; margin-bottom: 8px; flex-shrink: 0;
}
.join-av img { width: 100%; height: 100%; object-fit: cover; }
.join-name {
  font-size: 22px; font-weight: 700; color: var(--text);
  text-align: center;
}
.join-meta {
  font-size: 13px; color: var(--muted);
  text-align: center;
}
.join-desc {
  font-size: 14px; color: var(--text); text-align: center;
  line-height: 1.5; max-width: 300px;
  margin-top: 4px;
}
.join-action-btn {
  width: 100%; padding: 15px 20px;
  background: var(--blue); color: #fff;
  border: none; border-radius: 14px;
  font-size: 16px; font-weight: 600; cursor: pointer;
  margin-top: 16px;
  transition: opacity .15s;
}
.join-action-btn:active { opacity: .82; }
.join-action-btn:disabled { opacity: .5; cursor: default; }
.join-hint {
  font-size: 12px; color: var(--muted);
  text-align: center; margin-top: 8px;
}
.join-err {
  font-size: 13px; color: var(--red);
  text-align: center; min-height: 18px;
  margin-top: 4px;
}

/* ===== GROUP CHAT — sender avatar + name ===== */
.message.group-msg {
  flex-direction: row;
  align-items: flex-end;
  gap: 6px;
  max-width: 82%;
}
.msg-av {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0; overflow: hidden; align-self: flex-end;
  margin-bottom: 2px;
}
.msg-av img { width: 100%; height: 100%; object-fit: cover; }
.msg-av.msg-av-hidden { visibility: hidden; }
.msg-col { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.msg-sender-name {
  font-size: 12px; font-weight: 600;
  margin-bottom: 3px; padding-left: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ===== PUBLIC PROFILE OVERLAY ===== */
.prof-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  overflow-y: auto; overflow-x: hidden;
  animation: slideInRight .28s cubic-bezier(.2,0,0,1);
  padding-bottom: 32px;
}
.prof-overlay.prof-no-anim { animation: none; }
.prof-overlay::-webkit-scrollbar { display: none; }
.prof-hdr {
  position: fixed; top: 0; left: 0; right: 0;
  height: 52px; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px;
  background: linear-gradient(to bottom, rgba(0,0,0,.35), transparent);
  pointer-events: none;
}
.prof-hdr button { pointer-events: auto; color: #fff; }
.prof-cover {
  width: 100%; height: 220px; flex-shrink: 0;
  background: linear-gradient(150deg, #1a6fb5 0%, #6b3faa 60%, #c0386b 100%);
}
.prof-av-wrap {
  display: flex; justify-content: center;
  margin-top: -58px; position: relative; z-index: 2;
}
.prof-av {
  width: 116px; height: 116px; border-radius: 50%;
  background: var(--blue);
  border: 4px solid var(--bg);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.prof-av img { width: 100%; height: 100%; object-fit: cover; }
.prof-av span { font-size: 42px; font-weight: 700; color: #fff; }
.prof-identity {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 10px 20px 4px; text-align: center;
}
.prof-name { font-size: 22px; font-weight: 700; color: var(--text); }
.prof-status { font-size: 13px; color: var(--muted); }
.prof-status.online { color: var(--blue); }

.prof-actions {
  display: flex; justify-content: center; gap: 8px;
  padding: 14px 16px 4px; flex-wrap: wrap;
}
.prof-action-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 5px; padding: 10px 16px;
  background: var(--bg2); border: none; border-radius: 14px;
  color: var(--blue); font-size: 11px; font-weight: 600;
  cursor: pointer; min-width: 64px;
  transition: background .12s;
}
.prof-action-btn:active { background: var(--bg3); }
.prof-action-btn svg { color: var(--blue); }

.prof-card {
  margin: 10px 12px;
  background: var(--bg2); border-radius: 14px; overflow: hidden;
}
.prof-info-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; position: relative;
}
.prof-info-row svg { flex-shrink: 0; }
.prof-info-body { flex: 1; min-width: 0; }
.prof-info-val { font-size: 15px; color: var(--text); word-break: break-word; }
.prof-info-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.prof-sep { height: 1px; background: var(--line); margin-left: 50px; }
.prof-copy-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: pointer; flex-shrink: 0;
  transition: background .12s;
}
.prof-copy-btn:active { background: var(--bg3); }

.prof-section-label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  padding: 14px 16px 4px;
}
.prof-group-av {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--blue); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.prof-group-av img { width: 100%; height: 100%; object-fit: cover; }

.prof-media-section { padding: 0; }
.prof-media-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 2px; margin: 4px 0;
}
.prof-media-cell {
  aspect-ratio: 1; overflow: hidden;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
}
.prof-media-cell img { width: 100%; height: 100%; object-fit: cover; }
.prof-media-video { background: var(--bg3); }

.prof-more-menu {
  position: fixed; right: 12px; top: 52px;
  background: var(--bg2); border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
  z-index: 400; min-width: 200px;
  overflow: hidden; animation: fadeIn .14s ease;
}
.prof-more-item {
  display: block; width: 100%;
  padding: 13px 18px; text-align: left;
  background: none; border: none;
  font-size: 15px; color: var(--text); cursor: pointer;
  transition: background .1s;
  border-bottom: 1px solid var(--line);
}
.prof-more-item:last-child { border-bottom: none; }
.prof-more-item:active { background: var(--bg3); }
.prof-more-item.danger { color: var(--red); }

/* ===== PROFILE TABS ===== */
.prof-tabs {
  display: flex; position: sticky; top: 0; z-index: 3;
  margin: 0 14px 14px;
  background: rgba(16,16,26,.75);
  backdrop-filter: blur(40px) saturate(1.8) brightness(1.08);
  -webkit-backdrop-filter: blur(40px) saturate(1.8) brightness(1.08);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.1);
  padding: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.1), inset 0 -1px 0 rgba(0,0,0,.25);
  overflow: hidden;
}
.prof-tabs::before {
  content: '';
  position: absolute; inset: 0; border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,.04) 0%, transparent 55%);
  pointer-events: none; z-index: 0;
}
.prof-tabs-liquid {
  display: block; position: absolute;
  top: 4px; height: calc(100% - 8px);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(74,158,255,.2), rgba(107,184,255,.08));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.13), inset 0 0 0 1px rgba(74,158,255,.15);
  transition: left .3s cubic-bezier(.4,0,.2,1), width .3s cubic-bezier(.4,0,.2,1);
  pointer-events: none; z-index: 1;
}
.prof-tab {
  flex: 1; min-width: 0; padding: 8px 6px;
  background: transparent; border: none;
  font-size: 12px; font-weight: 700; color: rgba(255,255,255,.32);
  cursor: pointer; transition: color .25s ease;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  position: relative; z-index: 2; border-radius: 14px;
}
.prof-tab:active { opacity: .7; }
.prof-tab.active { color: #fff; }
.prof-tab-content { min-height: 120px; }
.prof-tab-loading, .prof-tab-empty {
  padding: 32px 20px; text-align: center;
  font-size: 14px; color: var(--muted);
}

/* List items (voice, files, links) */
.prof-list { padding: 0; }
.prof-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--line);
  text-decoration: none; color: var(--text);
  cursor: pointer; transition: background .1s;
}
.prof-list-item:last-child { border-bottom: none; }
.prof-list-item:active { background: var(--bg2); }
.prof-list-ic {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(51,144,236,.12);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.prof-file-ic {
  font-size: 10px; font-weight: 700; color: var(--blue);
  background: rgba(51,144,236,.12);
}
.prof-link-ic { background: rgba(51,144,236,.12); }
.prof-list-body { flex: 1; min-width: 0; }
.prof-list-title {
  font-size: 14px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prof-list-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.prof-list-play {
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: rgba(51,144,236,.12);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: background .12s;
}
.prof-list-play:active { background: rgba(51,144,236,.25); }

/* Banner edit button (own profile) */
.prof-cover { position: relative; }
.prof-cover-edit {
  position: absolute; bottom: 10px; right: 12px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,.45); border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; backdrop-filter: blur(4px);
  transition: background .12s;
}
.prof-cover-edit:active { background: rgba(0,0,0,.65); }

/* ===== AVATAR PHOTO VIEWER ===== */
.av-viewer {
  position: fixed; inset: 0; z-index: 1010;
  background: #000;
  display: flex; flex-direction: column;
  animation: fadeIn .18s ease;
}
.av-viewer-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 8px 8px 4px; flex-shrink: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.6), transparent);
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
}
.av-viewer-counter {
  font-size: 15px; font-weight: 600; color: #fff;
}
.av-viewer-actions { display: flex; gap: 4px; }
.av-viewer-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .12s;
}
.av-viewer-btn:active { background: rgba(255,255,255,.25); }
.av-viewer-del { background: rgba(235,64,52,.25); }
.av-viewer-del:active { background: rgba(235,64,52,.5); }
.av-viewer-img-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; cursor: pointer;
}
.av-viewer-img {
  max-width: 100%; max-height: 100%;
  object-fit: contain; user-select: none;
  -webkit-user-drag: none;
}
.av-viewer-dots {
  display: flex; justify-content: center; gap: 5px;
  padding: 12px; flex-shrink: 0;
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,.5), transparent);
}
.av-viewer-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.4); transition: background .2s;
}
.av-viewer-dot.active { background: #fff; }

/* Banner hint when no photo set */
.pp-banner-hint {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; opacity: .85;
}
.pp-banner-hint span {
  font-size: 13px; color: rgba(255,255,255,.85);
  font-weight: 500; white-space: nowrap;
}

/* ── Image Editor Overlay ── */
.img-editor { position:fixed; inset:0; z-index:1030; background:#000; display:flex; flex-direction:column; animation:fadeIn .18s ease; }
.img-editor-hdr { display:flex; align-items:center; gap:8px; padding:10px 12px; flex-shrink:0; background:rgba(0,0,0,.4); }
.img-editor-title { flex:1; text-align:center; font-size:16px; font-weight:600; color:#fff; }
.img-editor-canvas-wrap { flex:1; display:flex; align-items:center; justify-content:center; position:relative; overflow:hidden; }
.img-editor-img { max-width:100%; max-height:100%; object-fit:contain; display:block; transition:filter .15s; }
.img-ed-mask-circle { position:absolute; inset:0; pointer-events:none; }
.img-ed-draw-canvas { position:absolute; touch-action:none; cursor:crosshair; }
.img-editor-filters-panel { background:rgba(23,33,43,.95); padding:14px 20px; flex-shrink:0; }
.img-ed-filter-row { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.img-ed-filter-row:last-child { margin-bottom:0; }
.img-ed-filter-label { font-size:12px; color:rgba(255,255,255,.7); width:80px; flex-shrink:0; }
.img-ed-filter-slider { flex:1; accent-color:#2979FF; height:3px; }
.img-editor-bar-pill {
  margin: 0 16px 16px;
  background: rgba(23,33,43,0.88);
  border-radius: 32px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 8px 8px 8px 12px;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.img-ed-tools-group { display:flex; align-items:center; gap:4px; background:rgba(0,0,0,.3); border-radius:20px; padding:6px 10px; flex:1; justify-content:space-around; }
.img-ed-tool { width:40px; height:40px; border-radius:50%; border:none; background:none; display:flex; align-items:center; justify-content:center; cursor:pointer; color:#fff; opacity:.7; transition:opacity .15s, background .15s; }
.img-ed-tool.active { opacity:1; background:rgba(255,255,255,.18); }
.img-ed-tool:active { opacity:1; }
.img-ed-confirm-btn { width:56px; height:56px; border-radius:50%; background:#2979FF; border:none; display:flex; align-items:center; justify-content:center; cursor:pointer; flex-shrink:0; box-shadow:0 4px 16px rgba(41,121,255,.45); transition:transform .12s; }
.img-ed-confirm-btn:active { transform:scale(.9); }

/* ===== EVAPORATE DELETE ANIMATION ===== */
@keyframes evaporate {
  0%   { opacity:1; transform:scale(1)    translateX(0); filter:blur(0); }
  40%  { opacity:.5; transform:scale(.97) translateX(0); filter:blur(1px); }
  100% { opacity:0; transform:scale(.88) translateX(0); filter:blur(6px); }
}
.msg-evaporate {
  animation: evaporate .38s cubic-bezier(.4,0,1,1) forwards;
  pointer-events: none;
}

/* ===== MULTI-SELECT MODE ===== */
.msg-select-check {
  position: absolute; left: -2px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--blue); background: var(--bg2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s, border-color .15s;
  pointer-events: none;
}
.message.selected .msg-select-check { background: var(--blue); border-color: var(--blue); }
.message { position: relative; transition: padding-left .18s; }
.select-mode .message { padding-left: 32px; cursor: pointer; }
.select-mode .message.selected { background: rgba(10,132,255,.08); border-radius: 10px; }

.select-toolbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 300;
  background: var(--bg2); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 0;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  animation: slideUp .18s cubic-bezier(.2,0,0,1);
}
.select-toolbar-count {
  flex: 1; font-size: 14px; font-weight: 600; padding-left: 8px; color: var(--text);
}
.select-toolbar-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 14px; background: none; border: none; cursor: pointer;
  color: var(--blue); font-size: 11px; font-weight: 500; border-radius: 10px;
  transition: background .12s;
}
.select-toolbar-btn:active { background: var(--bg3); }
.select-toolbar-btn.danger { color: var(--red); }
.select-toolbar-btn.muted { color: var(--muted); opacity: .6; pointer-events: none; }
.select-toolbar-cancel {
  padding: 8px 14px; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 13px; border-radius: 10px; transition: background .12s;
}
.select-toolbar-cancel:active { background: var(--bg3); }

/* ===== UNREAD BADGE IN DIALOG LIST ===== */
.dlg-unread-badge {
  min-width: 20px; height: 20px; border-radius: 10px;
  background: var(--blue); color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px; flex-shrink: 0; margin-left: 4px;
}
.dialog-row2 { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.dialog-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== SYSTEM MESSAGE (join/leave) ===== */
.sys-msg {
  display: flex; justify-content: center; margin: 4px 0;
}
.sys-msg-inner {
  background: var(--bg3); color: var(--muted);
  font-size: 12px; border-radius: 10px;
  padding: 4px 12px; max-width: 80%; text-align: center;
}

/* ===== STORIES ===== */
.stories-bar {
  display: flex; gap: 12px; padding: 10px 14px 6px;
  overflow-x: auto; overflow-y: hidden; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.stories-bar::-webkit-scrollbar { display: none; }
.story-avatar-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  cursor: pointer; flex-shrink: 0; width: 56px;
}
.story-ring {
  width: 52px; height: 52px; border-radius: 50%; padding: 2px;
  background: conic-gradient(var(--blue) 0%, var(--blue) 100%);
  flex-shrink: 0;
}
.story-ring.seen {
  background: var(--bg3);
}
.story-ring.own {
  background: var(--bg3);
  border: 2px dashed var(--blue);
  padding: 1px;
}
.story-ring-inner {
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--bg2); border: 2px solid var(--bg2);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.story-ring-inner img { width: 100%; height: 100%; object-fit: cover; }
.story-ring-inner.no-avatar {
  background: var(--blue);
  font-size: 18px; font-weight: 700; color: #fff;
}
.story-add-btn {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--bg3); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--blue);
}
.story-name {
  font-size: 11px; color: var(--muted); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  width: 56px;
}

/* Story Viewer */
.story-viewer {
  position: fixed; inset: 0; z-index: 9000;
  background: #000; display: flex; flex-direction: column;
}
.story-viewer-header {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  padding: 10px 12px 0;
}
.story-progress-row {
  display: flex; gap: 3px; margin-bottom: 10px;
}
.story-progress-seg {
  flex: 1; height: 2px; background: rgba(255,255,255,.3); border-radius: 2px; overflow: hidden;
}
.story-progress-fill {
  height: 100%; background: #fff; width: 0%;
  transition: width linear;
}
.story-progress-fill.done { width: 100%; transition: none; }
.story-viewer-user {
  display: flex; align-items: center; gap: 10px; padding: 4px 0 8px;
}
.story-viewer-avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  background: var(--blue); display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.story-viewer-name { font-size: 14px; font-weight: 600; color: #fff; }
.story-viewer-time { font-size: 11px; color: rgba(255,255,255,.5); }
.story-viewer-close {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.8); padding: 4px;
}
.story-viewer-media {
  flex: 1; display: flex; align-items: center; justify-content: center;
  position: relative;
}
.story-viewer-media img, .story-viewer-media video {
  max-width: 100%; max-height: 100%; object-fit: contain;
}
.story-viewer-text {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 20px 20px 30px; text-align: center;
  font-size: 20px; font-weight: 600; color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.7);
}
.story-text-only {
  flex: 1; display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: #fff; padding: 20px;
  text-align: center; text-shadow: 0 1px 8px rgba(0,0,0,.5);
}
.story-nav-zone {
  position: absolute; top: 60px; bottom: 0; width: 40%; z-index: 3;
  cursor: pointer;
}
.story-nav-zone.left { left: 0; }
.story-nav-zone.right { right: 0; }
.story-viewer-views {
  position: absolute; bottom: 12px; right: 14px;
  display: flex; align-items: center; gap: 5px;
  color: rgba(255,255,255,.7); font-size: 12px;
}

/* Story Creator */
.story-creator {
  position: fixed; inset: 0; z-index: 8900;
  background: var(--bg1); display: flex; flex-direction: column;
}
.story-creator-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.story-creator-header h3 { flex: 1; font-size: 16px; font-weight: 700; }
.story-type-row {
  display: flex; gap: 8px; padding: 12px 14px;
}
.story-type-btn {
  flex: 1; padding: 10px; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--bg2); color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: border-color .15s, background .15s;
}
.story-type-btn.active { border-color: var(--blue); background: rgba(51,144,236,.1); color: var(--blue); }
.story-creator-body { flex: 1; display: flex; flex-direction: column; padding: 14px; gap: 12px; }
.story-text-input {
  flex: 1; resize: none; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px; color: var(--text); font-size: 18px; font-weight: 600;
  text-align: center; font-family: inherit;
}
.story-text-input:focus { outline: none; border-color: var(--blue); }
.story-bg-row { display: flex; gap: 8px; flex-wrap: wrap; }
.story-bg-swatch {
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: border-color .12s, transform .12s;
}
.story-bg-swatch.active { border-color: var(--blue); transform: scale(1.15); }
.story-media-preview {
  flex: 1; border-radius: 14px; overflow: hidden; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  min-height: 200px;
}
.story-media-preview img, .story-media-preview video { max-width: 100%; max-height: 360px; border-radius: 14px; }
.story-creator-footer { padding: 0 14px 20px; display: flex; flex-direction: column; gap: 8px; }

/* ===== POLLS ===== */
.poll-bubble {
  background: var(--bg2); border-radius: 14px; padding: 14px; min-width: 220px;
}
.poll-question {
  font-size: 15px; font-weight: 700; margin-bottom: 12px; line-height: 1.3;
}
.poll-option {
  position: relative; margin-bottom: 8px; cursor: pointer;
  border-radius: 10px; overflow: hidden; background: var(--bg3);
  border: 1.5px solid transparent; transition: border-color .15s;
  min-height: 38px;
}
.poll-option.voted { border-color: var(--blue); }
.poll-option.winner { border-color: #4FAD5B; }
.poll-option-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(51,144,236,.18); transition: width .4s ease;
  border-radius: 10px;
}
.poll-option.winner .poll-option-fill { background: rgba(79,173,91,.18); }
.poll-option-row {
  position: relative; z-index: 1; display: flex; align-items: center;
  gap: 8px; padding: 8px 12px;
}
.poll-option-check {
  width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--muted);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, background .15s;
}
.poll-option.voted .poll-option-check { border-color: var(--blue); background: var(--blue); }
.poll-option.winner .poll-option-check { border-color: #4FAD5B; background: #4FAD5B; }
.poll-option-text { flex: 1; font-size: 14px; line-height: 1.3; }
.poll-option-pct { font-size: 12px; font-weight: 700; color: var(--muted); }
.poll-option.voted .poll-option-pct { color: var(--blue); }
.poll-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; font-size: 12px; color: var(--muted);
}
.poll-anon-badge {
  font-size: 11px; color: var(--muted); background: var(--bg3);
  padding: 2px 8px; border-radius: 8px;
}

/* Poll Creator */
.poll-creator-modal {
  position: fixed; inset: 0; z-index: 5000;
  background: rgba(0,0,0,.55); display: flex; align-items: flex-end;
}
.poll-creator-sheet {
  background: var(--bg1); border-radius: 20px 20px 0 0;
  width: 100%; padding: 20px 16px 30px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp .22s ease;
}
.poll-creator-sheet h3 { font-size: 17px; font-weight: 700; margin-bottom: 16px; text-align: center; }
.poll-q-input {
  width: 100%; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; color: var(--text);
  font-size: 15px; font-family: inherit; margin-bottom: 12px;
}
.poll-q-input:focus { outline: none; border-color: var(--blue); }
.poll-opts-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.poll-opt-row { display: flex; align-items: center; gap: 8px; }
.poll-opt-input {
  flex: 1; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; color: var(--text); font-size: 14px; font-family: inherit;
}
.poll-opt-input:focus { outline: none; border-color: var(--blue); }
.poll-opt-del {
  background: none; border: none; cursor: pointer; color: var(--muted); padding: 4px;
  border-radius: 6px; display: flex;
}
.poll-add-opt-btn {
  background: none; border: 1.5px dashed var(--border); border-radius: 10px;
  padding: 10px; width: 100%; color: var(--muted); cursor: pointer; font-size: 13px;
  margin-bottom: 14px; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.poll-settings { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.poll-setting-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; color: var(--text);
}

/* ===== MENTIONS ===== */
.mention-highlight {
  color: var(--blue); font-weight: 600; cursor: pointer;
}
.mention-notification {
  display: flex; align-items: center; gap: 8px;
  background: rgba(51,144,236,.12); border-left: 3px solid var(--blue);
  border-radius: 8px; padding: 8px 10px; margin: 4px 0;
  font-size: 13px; cursor: pointer;
}

/* ===== PINNED MESSAGES ===== */
.pinned-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: var(--bg2);
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
  flex-shrink: 0;
}
.pinned-banner:active { background: var(--bg3); }
.pinned-banner-line {
  width: 3px; height: 32px; border-radius: 2px; background: var(--blue); flex-shrink: 0;
}
.pinned-banner-body { flex: 1; min-width: 0; }
.pinned-banner-label { font-size: 11px; color: var(--blue); font-weight: 600; margin-bottom: 2px; }
.pinned-banner-text {
  font-size: 13px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.pinned-banner-close {
  background: none; border: none; cursor: pointer; color: var(--muted);
  padding: 4px; border-radius: 6px; flex-shrink: 0;
}

/* ── Call header buttons ─────────────────────────────────────────────────── */
.call-hdr-btn {
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  background: rgba(51, 144, 236, 0.15) !important;
  color: var(--blue) !important;
  transition: background .15s, transform .1s !important;
}
.call-hdr-btn:active { background: rgba(51,144,236,.3) !important; transform: scale(.92); }
#videoCallBtn.call-hdr-btn { background: rgba(67,233,123,.13) !important; color: #43e97b !important; }
#videoCallBtn.call-hdr-btn:active { background: rgba(67,233,123,.28) !important; }

/* ── Permissions onboarding slide-up ─────────────────────────────────────── */
@keyframes permSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
#permOnboard > div { animation: permSlideUp .32s cubic-bezier(.2,0,0,1); }

/* =====================================================================
   ПЛАТФОРМО-СПЕЦИФИЧНЫЕ СТИЛИ
   ===================================================================== */

/* ── Capacitor (Android APK) ── */
html.is-capacitor .message-input {
  /* Без скруглений — нативнее на Android */
  border-radius: 20px;
  font-size: 16px; /* ≥16px — блокирует zoom при фокусе на iOS/Android */
}

/* Убираем hover-эффекты на тач-устройствах */
html.is-capacitor .dialog-item:hover,
html.is-capacitor .nav-item:hover,
html.is-capacitor .icon-btn:hover {
  background: none;
}

/* ── Desktop ── */
html.is-desktop .chat-area {
  /* Десктоп: чат немного шире */
  max-width: 100%;
}

/* Десктоп: курсор pointer только там где нужно */
html.is-desktop .dialog-item { cursor: pointer; }

/* Десктоп: скроллбар стилизованный */
html.is-desktop ::-webkit-scrollbar { width: 6px; height: 6px; }
html.is-desktop ::-webkit-scrollbar-track { background: transparent; }
html.is-desktop ::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 3px; }
html.is-desktop ::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* =====================================================================
   CHAT FOLDERS
   ===================================================================== */
.folder-row {
  display:flex; align-items:center; gap:12px;
  padding:12px 16px; cursor:pointer;
  transition:background .13s;
}
.folder-row:hover { background:var(--bg3); }
.folder-row-ic {
  width:38px;height:38px;border-radius:12px;
  background:linear-gradient(135deg,#E67E22,#F39C12);
  display:flex;align-items:center;justify-content:center;flex-shrink:0;
}
.folder-row-body { flex:1; min-width:0; }
.folder-row-name { font-size:15px;font-weight:600;color:var(--text); }
.folder-row-sub  { font-size:12px;color:var(--muted);margin-top:2px; }
.folder-row-del  {
  background:none;border:none;cursor:pointer;
  color:var(--muted);padding:8px;border-radius:8px;
  transition:color .15s,background .15s;flex-shrink:0;
}
.folder-row-del:hover { color:var(--red);background:rgba(255,82,82,.1); }

/* Folder dialog item in editor */
.folder-dialog-row {
  display:flex;align-items:center;justify-content:space-between;
  padding:10px 16px;border-top:1px solid var(--line);
  font-size:14px;color:var(--text);
}
.folder-dialog-row:first-child { border-top:none; }
.folder-dialog-del {
  background:none;border:none;cursor:pointer;
  color:var(--muted);padding:4px;
}

/* Folder dialog picker */
.folder-pick-row {
  display:flex;align-items:center;gap:12px;
  padding:10px 16px;cursor:pointer;
  transition:background .13s;
}
.folder-pick-row:hover { background:var(--bg3); }
.folder-pick-av {
  width:44px;height:44px;border-radius:50%;
  background:var(--blue);
  display:flex;align-items:center;justify-content:center;
  font-size:16px;font-weight:700;color:#fff;
  flex-shrink:0;overflow:hidden;
}
.folder-pick-name { flex:1;font-size:15px;color:var(--text); }
.folder-pick-check {
  width:22px;height:22px;border-radius:50%;
  border:2px solid var(--muted);
  display:flex;align-items:center;justify-content:center;
  flex-shrink:0;transition:background .15s,border-color .15s;
}
.folder-pick-check.on { background:var(--blue);border-color:var(--blue); }

/* Folder editor toggle */
.fe-toggle {
  width:42px; height:24px; border-radius:12px;
  background:var(--bg3); border:none; cursor:pointer;
  position:relative; flex-shrink:0; transition:background .2s;
}
.fe-toggle::after {
  content:''; position:absolute;
  width:20px; height:20px; border-radius:50%;
  background:#fff; top:2px; left:2px;
  transition:transform .2s;
  box-shadow:0 1px 4px rgba(0,0,0,.3);
}
.fe-toggle.on { background:var(--blue); }
.fe-toggle.on::after { transform:translateX(18px); }

/* Folder name input */
.folder-name-inp {
  flex:1; background:none; border:none; outline:none;
  font-size:15px; color:var(--text); font-family:inherit;
  padding:12px 0;
}
.folder-name-inp::placeholder { color:var(--muted); }

/* Color dot hover */
.fld-color-dot:hover { transform:scale(1.12); }
.fld-color-dot:active { transform:scale(.92); }

/* Add btn row active */
.fld-add-btn:active { opacity:.7; }
