/* Палитра 1:1 с core/ui/theme/MayasColorScheme.kt (DarkMayasColorScheme) */
  :root{
    --background:#0A0A0C;
    --surface:#14141A;
    --surfaceVariant:#1E1E26;
    --elevatedSurface:#0A0807;

    --textPrimary:#F1F1F3;
    --textSecondary:#9898A0;

    --bubbleMine:#413662;
    --bubbleOther:#1E1E26;

    --divider:#25252E;
    --outline:rgba(255,255,255,0.12);
    --linkColor:#C5B4E3;

    --accent:#6D37FF;
    --accentLight:#9B6DFF;
    --accentCyan:#22D3EE;

    --error:#AF3A3A;
    --success:#54FF36;
    --online:#8B5CF6;

    --radius:14px;
  }
  *{box-sizing:border-box;}
  html,body{height:100%;}
  :focus-visible{outline:2px solid var(--accentCyan); outline-offset:2px;}
  ::selection{background:var(--accent); color:#fff;}
  body{
    margin:0;
    background:var(--background);
    color:var(--textPrimary);
    font-family:'Inter',sans-serif;
    overflow:hidden;
  }
  h1,h2,h3,.brand,.nick{font-family:'Manrope',sans-serif;}

  /* ---------- auth screen ---------- */
  #auth{
    height:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:24px;
    background:radial-gradient(circle at 30% 20%, #1A102B 0%, var(--background) 60%);
  }
  .auth-card{
    width:100%;
    max-width:380px;
    background:var(--surface);
    border:1px solid var(--divider);
    border-radius:12px;
    padding:32px 28px;
  }
  .auth-card .brand{
    font-size:26px;
    font-weight:800;
    letter-spacing:-0.01em;
    margin:0 0 2px;
  }
  .auth-card .brand span{color:var(--accentLight);}
  .auth-card .tagline{
    color:var(--textSecondary);
    font-size:13px;
    margin:0 0 22px;
  }
  .field{margin-bottom:13px;}
  .field label{
    display:block;
    font-size:12px;
    color:var(--textSecondary);
    margin-bottom:6px;
  }
  .field input{
    width:100%;
    background:var(--surfaceVariant);
    border:1px solid var(--divider);
    border-radius:8px;
    padding:11px 12px;
    color:var(--textPrimary);
    font-size:14px;
    font-family:inherit;
    outline:none;
    transition:border-color .15s;
  }
  .field input:focus{border-color:var(--accentLight);}
  .btn{
    width:100%;
    border:none;
    border-radius:10px;
    padding:12px;
    font-size:14px;
    font-weight:700;
    font-family:'Manrope',sans-serif;
    cursor:pointer;
    transition:filter .15s, transform .1s;
  }
  .btn:active{transform:scale(.98);}
  .btn-primary{background:linear-gradient(135deg,var(--accentLight),var(--accentCyan));color:#fff;}
  .btn-primary:hover{filter:brightness(1.08); transform:translateY(-2px); box-shadow:0 10px 24px -10px rgba(155,109,255,.65);}
  .btn-primary:disabled{opacity:.5;cursor:default;}
  .switch-mode{
    text-align:center;
    margin-top:16px;
    font-size:13px;
    color:var(--textSecondary);
  }
  .switch-mode a{color:var(--linkColor);cursor:pointer;text-decoration:none;font-weight:600;}
  .switch-mode a:hover{text-decoration:underline;}
  .auth-error{
    background:rgba(175,58,58,.14);
    border:1px solid rgba(175,58,58,.4);
    color:#e79c9c;
    font-size:12.5px;
    padding:9px 11px;
    border-radius:8px;
    margin-bottom:14px;
    display:none;
  }

  /* ---------- app shell ---------- */
  #app{display:none; height:100%;}
  #app.active{display:flex;}

  #sidebar{
    width:360px;
    min-width:360px;
    max-width:360px;
    background:var(--surface);
    border-right:1px solid var(--divider);
    display:flex;
    flex-direction:column;
  }
  #sidebar .side-head{
    padding:18px 18px 14px;
    border-bottom:1px solid var(--divider);
    display:flex;
    align-items:center;
    justify-content:space-between;
  }
  #sidebar .side-head .brand{font-size:18px;font-weight:800;}
  #sidebar .side-head .brand span{color:var(--accentLight);}
  .web-badge{
    font-family:'Manrope',sans-serif;
    font-size:10px;
    font-weight:800;
    letter-spacing:0.02em;
    color:var(--accentLight);
    background:rgba(109,55,255,0.16);
    border:1px solid rgba(155,109,255,0.4);
    border-radius:6px;
    padding:2px 6px;
    text-transform:uppercase;
    white-space:nowrap;
  }
  #new-chat-btn{
    background:var(--surfaceVariant);
    border:1px solid var(--divider);
    color:var(--accentLight);
    width:30px;height:30px;
    border-radius:8px;
    font-size:16px;
    cursor:pointer;
    display:flex;align-items:center;justify-content:center;
  }
  #new-chat-btn:hover{border-color:var(--accentLight);}

  .avatar img{width:100%;height:100%;border-radius:50%;object-fit:cover;}
  .me{cursor:pointer;}
  .me:hover{background:var(--surfaceVariant);}
  #chat-head{cursor:pointer;}
  #chat-head:hover .nick{color:var(--accentLight);}

  .profile-avatar-big{
    width:76px;height:76px;border-radius:50%;
    background:linear-gradient(135deg,var(--accentLight),var(--accentCyan));
    display:flex;align-items:center;justify-content:center;
    font-weight:800;font-size:28px;color:#fff;
    margin:0 auto 14px;
    overflow:hidden;
  }
  .profile-avatar-big img{width:100%;height:100%;object-fit:cover;}
  .profile-center{text-align:center;}
  .profile-name{font-size:18px;font-weight:800;font-family:'Manrope',sans-serif;margin:0 0 2px;}
  .profile-username{font-size:13px;color:var(--linkColor);margin:0 0 4px;}
  .profile-status{font-size:12px;margin:0 0 16px;}
  .profile-status.online{color:var(--success);}
  .profile-status.offline{color:var(--textSecondary);}
  .profile-row{
    border-top:1px solid var(--divider);
    padding:12px 0;
    font-size:13.5px;
  }
  .profile-row .label{color:var(--textSecondary);font-size:11.5px;margin-bottom:3px;}
  .field textarea{
    width:100%;
    background:var(--surfaceVariant);
    border:1px solid var(--divider);
    border-radius:10px;
    padding:11px 12px;
    color:var(--textPrimary);
    font-size:14px;
    font-family:inherit;
    outline:none;
    resize:vertical;
    min-height:60px;
  }
  .field textarea:focus{border-color:var(--accentLight);}
  .field .readonly-val{
    background:var(--elevatedSurface);
    border:1px solid var(--divider);
    border-radius:10px;
    padding:11px 12px;
    color:var(--textSecondary);
    font-size:13.5px;
  }
  /* ---------- иконки (inline SVG, цвет = currentColor) ---------- */
  svg.i{ width:1.2em; height:1.2em; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; vertical-align:-0.22em; pointer-events:none; }
  svg.i-lead{ margin-right:.55em; }
  #msg-menu button, #chat-ctx-menu button{ display:flex; align-items:center; }
  .voice-play-btn svg.i{ width:15px; height:15px; margin-left:1px; }
  .voice-play-btn svg.i.i-pause{ margin-left:0; }
  .circle-msg-play svg.i{ width:1em; height:1em; margin-left:.08em; }
  #send-btn svg.i, #attach-btn svg.i, #mic-btn svg.i, #circle-btn svg.i, #effect-toggle-btn svg.i{ width:1.15em; height:1.15em; }
  .modal-close svg.i, #circle-close svg.i{ width:1.1em; height:1.1em; }
  .msg-ticks svg.i{ width:1.05em; height:1.05em; vertical-align:-0.2em; }
  .lb-btn svg.i{ margin-right:.4em; vertical-align:-0.25em; }
  #pinned-bar .pinned-ico, .chat-item .pin-ico{ display:inline-flex; align-items:center; }
  .chat-item .pin-ico svg.i{ width:1.15em; height:1.15em; }
  .modal-close{
    position:absolute; top:14px; right:14px;
    background:none; border:none; color:var(--textSecondary);
    font-size:18px; cursor:pointer; line-height:1;
  }
  .modal{position:relative;}

  .tabs{
    display:flex; gap:6px;
    margin:0 0 16px;
    background:var(--surfaceVariant);
    border-radius:10px;
    padding:3px;
  }
  .tab-btn{
    flex:1;
    background:none; border:none;
    color:var(--textSecondary);
    font-family:'Manrope',sans-serif;
    font-size:12.5px; font-weight:700;
    padding:8px 4px;
    border-radius:8px;
    cursor:pointer;
    transition:background .15s ease, color .15s ease;
  }
  .tab-btn.active{ background:var(--surface); color:var(--textPrimary); }
  .tab-pane{ display:none; }
  .tab-pane.active{ display:block; animation:fadeIn .18s ease; }

  .checkbox-row{
    display:flex; align-items:center; gap:8px;
    font-size:13px; color:var(--textSecondary);
    margin:2px 0 16px;
    cursor:pointer;
  }
  .checkbox-row input{ accent-color:var(--accent); width:15px; height:15px; }

  .divider-line{
    display:flex; align-items:center; gap:10px;
    margin:18px 0 14px;
    color:var(--textSecondary); font-size:11.5px;
  }
  .divider-line::before, .divider-line::after{
    content:''; flex:1; height:1px; background:var(--divider);
  }

  .type-badge{
    display:inline-block;
    font-size:10px; font-weight:800;
    text-transform:uppercase;
    letter-spacing:.02em;
    padding:2px 6px;
    border-radius:6px;
    margin-left:6px;
    vertical-align:middle;
  }
  .type-badge.group{ background:rgba(109,55,255,.16); color:var(--accentLight); }
  .type-badge.channel{ background:rgba(197,180,227,.16); color:var(--linkColor); }

  #ci-members{ font-size:13px; color:var(--textSecondary); line-height:1.7; max-height:160px; overflow-y:auto; }
  #ci-members .member-row{ display:flex; align-items:center; gap:8px; padding:4px 0; }
  #ci-members .member-row .avatar{ width:26px; height:26px; font-size:11px; }
  #ci-members .member-row .m-name{ color:var(--textPrimary); font-weight:600; font-size:12.5px; }
  #ci-members .member-row .m-role{ margin-left:auto; font-size:10.5px; color:var(--accentLight); }

  .no-post-note{
    padding:12px 22px;
    font-size:12.5px;
    color:var(--textSecondary);
    text-align:center;
    border-top:1px solid var(--divider);
  }

  .me{
    display:flex;
    align-items:center;
    gap:10px;
    padding:14px 18px;
    border-bottom:1px solid var(--divider);
  }
  .avatar{
    width:36px;height:36px;border-radius:50%;
    background:linear-gradient(135deg,var(--accentLight),var(--accentCyan));
    display:flex;align-items:center;justify-content:center;
    font-weight:800;font-size:14px;color:#fff;
    flex-shrink:0;
  }
  .me .nick{font-size:14px;font-weight:700;}
  .me .status{font-size:11.5px;color:var(--online);}
  #logout-btn{
    margin-left:auto;
    background:none;border:1px solid var(--divider);
    color:var(--textSecondary);
    font-size:11.5px;
    padding:6px 10px;
    border-radius:8px;
    cursor:pointer;
    font-family:'Inter',sans-serif;
  }
  #logout-btn:hover{color:var(--error);border-color:var(--error);}

  #chat-list{
    flex:1;
    overflow-y:auto;
    padding:8px;
  }
  .chat-item{
    display:flex;
    align-items:center;
    gap:12px;
    padding:9px 10px;
    border-radius:10px;
    cursor:pointer;
    margin-bottom:1px;
    position:relative;
  }
  .chat-item:hover{background:var(--surfaceVariant);}
  .chat-item.active{background:var(--surfaceVariant); box-shadow: inset 3px 0 0 var(--accentLight);}
  .chat-item.pinned{background:linear-gradient(90deg, rgba(109,55,255,.07), transparent 60%);}
  .chat-item.pinned.active{background:var(--surfaceVariant);}
  .chat-item .avatar{width:46px;height:46px;font-size:17px;}
  .chat-item .row1{display:flex; justify-content:space-between; align-items:baseline; gap:6px;}
  .chat-item .nick{font-size:14px;font-weight:700; display:flex; align-items:center; gap:4px; min-width:0;}
  .chat-item .nick .nick-text{overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
  .chat-item .pin-ico{flex-shrink:0; color:var(--textSecondary); opacity:.75; font-size:11px;}
  .chat-item .time{font-size:10.5px;color:var(--textSecondary);font-family:'JetBrains Mono',monospace; flex-shrink:0;}
  .chat-item .row2{display:flex; align-items:center; justify-content:space-between; gap:6px; margin-top:2px;}
  .chat-item .sub{font-size:12.5px;color:var(--textSecondary); max-width:190px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
  .empty-list{
    color:var(--textSecondary);
    font-size:12.5px;
    text-align:center;
    padding:30px 16px;
    line-height:1.5;
  }

  /* ---------- chat panel ---------- */
  #chat{
    flex:1;
    display:flex;
    flex-direction:column;
    min-width:0;
    background:
      radial-gradient(circle at 85% 0%, rgba(109,55,255,0.06) 0%, transparent 45%),
      var(--background);
  }
  #chat-head{
    padding:16px 22px;
    border-bottom:1px solid var(--divider);
    display:flex;
    align-items:center;
    gap:12px;
  }
  #chat-head .nick{font-size:15px;font-weight:700;}
  #chat-head .sub{font-size:11.5px;color:var(--textSecondary);}

  #messages{
    flex:1;
    overflow-y:auto;
    padding:22px;
    display:flex;
    flex-direction:column;
    gap:3px;
  }
  .msg-row{display:flex; padding:1px 8px;}
  .msg-row.own{justify-content:flex-end;}
  .bubble{
    max-width:60%;
    padding:8px 12px;
    font-size:15px;
    line-height:20px;
    word-wrap:break-word;
    background:var(--bubbleOther);
    border-radius:10px 10px 10px 3px;
  }
  .msg-row.own .bubble{
    background:var(--bubbleMine);
    border-radius:10px 10px 3px 10px;
  }
  .bubble .time{
    display:block;
    text-align:right;
    font-size:10.5px;
    margin-top:3px;
    color:var(--textSecondary);
    font-family:'JetBrains Mono',monospace;
  }
  .bubble .edited-label{font-style:normal; opacity:.75; margin-right:2px;}

  .msg-row.grouped{margin-top:-5px;}
  .msg-row.grouped .bubble{border-radius:10px 10px 10px 3px;}
  .msg-row.grouped.own .bubble{border-radius:10px 10px 3px 10px;}

  .bubble-image{
    display:block; max-width:280px; max-height:340px; width:100%;
    border-radius:8px; object-fit:cover; cursor:zoom-in; background:var(--surfaceVariant);
  }
  .bubble-image-wrap{position:relative; line-height:0; margin:-8px -12px 4px;}
  .bubble-image-wrap img{border-radius:10px 10px 0 0; width:100%; max-height:340px; object-fit:cover;}
  .msg-row.own .bubble-image-wrap img{border-radius:10px 10px 0 0;}
  .bubble-image-loading{
    display:flex; align-items:center; justify-content:center;
    width:220px; height:160px; border-radius:10px 10px 0 0;
    background:var(--surfaceVariant); color:var(--textSecondary); font-size:12px;
    margin:-8px -12px 4px;
  }
  .bubble-file{
    display:flex; align-items:center; gap:10px;
    background:rgba(255,255,255,.04); border:1px solid var(--outline);
    border-radius:8px; padding:8px 10px; margin-bottom:4px; text-decoration:none; color:inherit;
  }
  .bubble-file .f-ico{
    width:32px;height:32px;border-radius:8px;flex-shrink:0;
    background:var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; font-size:15px;
  }
  .bubble-file .f-name{font-size:12.5px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:170px;}
  .bubble-file .f-sub{font-size:10.5px; color:var(--textSecondary);}

  #attach-btn{
    background:none; border:1px solid var(--divider); color:var(--textSecondary);
    width:42px; height:42px; border-radius:10px; cursor:pointer; flex-shrink:0;
    display:flex; align-items:center; justify-content:center; font-size:18px;
    transition:border-color .15s ease, color .15s ease, transform .1s ease;
  }
  #attach-btn:hover{border-color:var(--accentLight); color:var(--accentLight);}
  #attach-btn:active{transform:scale(.92);}

  /* ---------- одинаковый вид доп. кнопок композера (голос/кружок/эффект) ---------- */
  #mic-btn, #circle-btn, #effect-toggle-btn{
    background:none; border:1px solid var(--divider); color:var(--textSecondary);
    width:42px; height:42px; border-radius:10px; cursor:pointer; flex-shrink:0;
    display:flex; align-items:center; justify-content:center; font-size:17px;
    transition:border-color .15s ease, color .15s ease, transform .1s ease;
  }
  #mic-btn:hover, #circle-btn:hover, #effect-toggle-btn:hover{ border-color:var(--accentLight); color:var(--accentLight); }
  #mic-btn:active, #circle-btn:active, #effect-toggle-btn:active{ transform:scale(.92); }
  #attach-progress{
    display:none; align-items:center; gap:8px; padding:8px 22px; font-size:12px; color:var(--textSecondary);
  }
  #attach-progress.active{display:flex;}

  #edit-bar{
    display:none; align-items:center; gap:10px;
    padding:8px 22px; border-top:1px solid var(--divider);
    background:rgba(109,55,255,.08);
    animation:fadeIn .15s ease;
  }
  #edit-bar.active{ display:flex; }
  #edit-bar .reply-bar-line{ background:var(--accentCyan); }

  /* ---------- меню закрепления чата ---------- */
  #chat-ctx-menu{
    display:none; position:fixed; z-index:40;
    background:var(--surface); border:1px solid var(--divider);
    border-radius:10px; box-shadow:0 12px 28px rgba(0,0,0,.4);
    padding:5px; min-width:170px;
  }
  #chat-ctx-menu.active{display:flex; flex-direction:column;}
  #chat-ctx-menu button{
    background:none; border:none; color:var(--textPrimary);
    text-align:left; padding:9px 10px; border-radius:7px;
    font-size:13px; cursor:pointer; font-family:'Inter',sans-serif;
  }
  #chat-ctx-menu button:hover{background:var(--surfaceVariant);}

  #placeholder{
    flex:1;
    display:flex;
    align-items:center;
    justify-content:center;
    flex-direction:column;
    gap:8px;
    color:var(--textSecondary);
    text-align:center;
    padding:40px;
  }
  #placeholder .big{font-size:17px;font-weight:700;color:var(--textPrimary);font-family:'Manrope',sans-serif;}
  #placeholder .small{font-size:13px; max-width:320px; line-height:1.5;}

  #composer{
    display:none;
    padding:16px 22px 20px;
    border-top:1px solid var(--divider);
    gap:10px;
    align-items:flex-end;
  }
  #composer.active{display:flex;}
  #msg-input{
    flex:1;
    resize:none;
    background:var(--surfaceVariant);
    border:1px solid var(--divider);
    border-radius:10px;
    padding:11px 14px;
    color:var(--textPrimary);
    font-family:inherit;
    font-size:14px;
    max-height:120px;
    outline:none;
  }
  #msg-input:focus{border-color:var(--accentLight);}
  #send-btn{
    background:linear-gradient(135deg,var(--accentLight),var(--accentCyan));
    border:none;
    color:#fff;
    width:42px;height:42px;
    border-radius:10px;
    cursor:pointer;
    font-size:17px;
    flex-shrink:0;
    display:flex;align-items:center;justify-content:center;
  }
  #send-btn:disabled{opacity:.4;cursor:default;}

  /* ---------- modal (new chat) ---------- */
  #modal-overlay,
  .modal-overlay-like{
    display:none;
    position:fixed; inset:0;
    background:rgba(0,0,0,.55);
    z-index:10;
    align-items:center; justify-content:center;
  }
  #modal-overlay.active,
  .modal-overlay-like.active{display:flex;}
  .modal{
    width:100%; max-width:340px;
    max-height:86vh;
    overflow-y:auto;
    background:var(--surface);
    border:1px solid var(--divider);
    border-radius:14px;
    padding:22px;
    box-shadow:0 24px 64px rgba(0,0,0,.55);
  }
  #modal-overlay, .modal-overlay-like{ padding:24px; box-sizing:border-box; }
  .modal h3{margin:0 0 4px; font-size:16px;}
  .modal p.hint{margin:0 0 16px; font-size:12.5px; color:var(--textSecondary);}
  .modal .field input{margin-bottom:6px;}
  .modal-actions{display:flex; gap:10px; margin-top:6px;}
  .btn-secondary{background:var(--surfaceVariant); color:var(--textSecondary); border:1px solid var(--divider);}
  .auth-join-hint{display:none; margin:0 0 14px; padding:9px 11px; border-radius:8px; font-size:12.5px; color:var(--textSecondary); background:var(--surfaceVariant); border:1px solid var(--divider);}
  .auth-links{display:flex; justify-content:center; flex-wrap:wrap; gap:6px 18px; margin-top:14px; font-size:12.5px;}
  .auth-links a{color:var(--textSecondary); text-decoration:none;}
  .auth-links a:hover{color:var(--linkColor); text-decoration:underline;}
  #join-overlay .modal{text-align:center;}
  #join-overlay .profile-center{margin-bottom:8px;}
  #join-overlay .join-desc{margin:0 0 14px; font-size:13px; color:var(--textSecondary); line-height:1.45; word-break:break-word; display:none;}
  #join-overlay .modal-actions{margin-top:14px;}

  ::-webkit-scrollbar{width:8px;}
  ::-webkit-scrollbar-thumb{background:var(--divider);border-radius:8px;}

  /* ==================== АНИМАЦИИ ==================== */

  @keyframes fadeInUp{
    from{opacity:0; transform:translateY(14px);}
    to{opacity:1; transform:translateY(0);}
  }
  @keyframes fadeIn{ from{opacity:0;} to{opacity:1;} }
  @keyframes msgIn{
    from{opacity:0; transform:translateY(8px) scale(.98);}
    to{opacity:1; transform:translateY(0) scale(1);}
  }
  @keyframes modalIn{
    from{opacity:0; transform:translateY(10px) scale(.95);}
    to{opacity:1; transform:translateY(0) scale(1);}
  }
  @keyframes overlayIn{ from{opacity:0;} to{opacity:1;} }
  @keyframes badgeGlow{
    0%,100%{box-shadow:0 0 0 0 rgba(155,109,255,.4);}
    50%{box-shadow:0 0 0 5px rgba(155,109,255,0);}
  }
  @keyframes spin{ to{ transform:rotate(360deg); } }
  @keyframes dotBounce{
    0%,80%,100%{ transform:scale(0); opacity:.4; }
    40%{ transform:scale(1); opacity:1; }
  }
  @keyframes pulseDot{
    0%,100%{ box-shadow:0 0 0 0 rgba(84,255,54,.5); }
    50%{ box-shadow:0 0 0 4px rgba(84,255,54,0); }
  }
  @keyframes shake{
    0%,100%{ transform:translateX(0); }
    20%,60%{ transform:translateX(-6px); }
    40%,80%{ transform:translateX(6px); }
  }

  .auth-card{ animation:fadeInUp .4s cubic-bezier(.2,.8,.2,1); }
  .auth-error[style*="block"]{ animation:shake .35s ease; }

  #app.active{ animation:fadeIn .25s ease; }
  #chat-head, #composer.active, #messages{ animation:fadeIn .3s ease; }
  #placeholder{ animation:fadeIn .3s ease; }

  .chat-item{ transition:background .15s ease, transform .12s ease; }
  .chat-item:active{ transform:scale(.98); }
  .chat-item .avatar{ transition:transform .15s ease; }
  .chat-item:hover .avatar{ transform:scale(1.06); }

  .msg-row{ transition:opacity .15s ease; }
  .msg-row.msg-enter{ animation:msgIn .22s cubic-bezier(.2,.8,.2,1); }
  .bubble{ transition:transform .1s ease; }

  #send-btn{ transition:transform .12s cubic-bezier(.3,1.5,.6,1), filter .15s ease; }
  #send-btn:active{ transform:scale(.85) rotate(-6deg); }
  #send-btn:hover{ filter:brightness(1.12); }

  #new-chat-btn{ transition:transform .15s ease, border-color .15s ease; }
  #new-chat-btn:active{ transform:scale(.9) rotate(90deg); }

  .btn-primary{ transition:filter .15s ease, transform .1s ease; }
  .avatar, .profile-avatar-big{ transition:transform .15s ease; }
  .me:hover .avatar{ transform:scale(1.05); }

  #modal-overlay, .modal-overlay-like{
    backdrop-filter:blur(2px);
  }
  #modal-overlay.active, .modal-overlay-like.active{ animation:overlayIn .15s ease; }
  #modal-overlay.active .modal, .modal-overlay-like.active .modal{ animation:modalIn .2s cubic-bezier(.2,.8,.2,1); }

  .web-badge{ animation:badgeGlow 2.6s ease-in-out infinite; }

  .modal-close{ transition:transform .15s ease, color .15s ease; }
  .modal-close:hover{ transform:rotate(90deg); color:var(--error); }

  .spinner-dots{ display:inline-flex; gap:4px; }
  .spinner-dots span{
    width:6px; height:6px; border-radius:50%;
    background:var(--accentLight);
    animation:dotBounce 1.1s infinite ease-in-out;
  }
  .spinner-dots span:nth-child(2){ animation-delay:.15s; }
  .spinner-dots span:nth-child(3){ animation-delay:.3s; }

  .profile-status.online::before{
    content:'';
    display:inline-block;
    width:7px; height:7px;
    border-radius:50%;
    background:var(--success);
    margin-right:5px;
    animation:pulseDot 1.8s infinite;
  }

  #logout-btn{ transition:color .15s ease, border-color .15s ease, transform .1s ease; }
  #logout-btn:active{ transform:scale(.95); }

  .field input, .field textarea{ transition:border-color .15s ease; }

  @media (prefers-reduced-motion: reduce){
    *, *::before, *::after{
      animation-duration:0.001ms !important;
      animation-iteration-count:1 !important;
      transition-duration:0.001ms !important;
    }
  }

  /* ---------- избранное ---------- */
  .saved-item{
    display:flex; align-items:center; gap:10px;
    padding:10px 18px;
    cursor:pointer;
    border-bottom:1px solid var(--divider);
    transition:background .15s ease;
  }
  .saved-item:hover{ background:var(--surfaceVariant); }
  .saved-item.active{ background:var(--surfaceVariant); box-shadow: inset 3px 0 0 var(--accentLight); }
  .saved-avatar{
    background:linear-gradient(135deg,#ffd76b,#ffa100) !important;
    font-size:16px;
  }
  .saved-item .nick{ font-size:13.5px; font-weight:700; }

  /* ---------- reply bar ---------- */
  #reply-bar{
    display:none;
    align-items:center;
    gap:10px;
    padding:8px 22px;
    border-top:1px solid var(--divider);
    animation:fadeIn .15s ease;
  }
  #reply-bar.active{ display:flex; }
  .reply-bar-line{ width:3px; align-self:stretch; background:var(--accentLight); border-radius:2px; }
  .reply-bar-body{ flex:1; min-width:0; }
  .reply-bar-name{ font-size:12px; font-weight:700; color:var(--accentLight); }
  .reply-bar-text{ font-size:12.5px; color:var(--textSecondary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  #reply-bar-close{ background:none; border:none; color:var(--textSecondary); cursor:pointer; font-size:15px; }

  /* ---------- quoted reply внутри бабла ---------- */
  .msg-reply-quote{
    display:block;
    border-left:2px solid var(--accentLight);
    padding:2px 0 2px 8px;
    margin-bottom:5px;
    font-size:12px;
    color:var(--textSecondary);
    opacity:.85;
  }
  .msg-reply-quote b{ display:block; color:var(--accentLight); font-size:11.5px; }

  /* ---------- контекстное меню сообщений ---------- */
  #msg-menu{
    display:none;
    position:fixed;
    z-index:30;
    background:var(--surfaceVariant);
    border:1px solid var(--divider);
    border-radius:12px;
    padding:6px;
    box-shadow:0 8px 24px rgba(0,0,0,.4);
    animation:modalIn .12s ease;
  }
  #msg-menu.active{ display:flex; flex-direction:column; min-width:150px; }
  #msg-menu button{
    background:none; border:none; text-align:left;
    color:var(--textPrimary); font-family:'Inter',sans-serif;
    font-size:13px; padding:8px 10px; border-radius:8px; cursor:pointer;
  }
  #msg-menu button:hover{ background:var(--surface); }
  #msg-menu-delete{ color:var(--danger); }
  .bubble{ cursor:pointer; }

  /* ---------- forward picker ---------- */
  #forward-list .chat-item{ border-radius:10px; }
  #forward-list .chat-item:hover{ background:var(--surfaceVariant); }

  /* ---------- read ticks ---------- */
  .msg-ticks{ margin-left:4px; opacity:.8; }
  .msg-ticks.read{ color:var(--accentLight); opacity:1; }

  /* ---------- реакции (совместимы с Message.reactions из Android: uid -> "emoji1,emoji2") ---------- */
  .reaction-row{
    display:flex; flex-wrap:wrap; gap:4px;
    margin:4px -2px -2px;
  }
  .reaction-chip{
    display:inline-flex; align-items:center; gap:3px;
    background:rgba(255,255,255,.07);
    border:1px solid var(--outline);
    border-radius:11px;
    padding:2px 7px;
    font-size:12.5px;
    line-height:18px;
    cursor:pointer;
    transition:background .12s ease, border-color .12s ease, transform .1s ease;
  }
  .reaction-chip:hover{ transform:scale(1.05); }
  .reaction-chip.mine{
    background:rgba(109,55,255,.22);
    border-color:var(--accentLight);
  }
  .reaction-chip .r-count{ font-size:11px; font-weight:700; color:var(--textSecondary); }
  .reaction-chip.mine .r-count{ color:var(--accentLight); }

  #reaction-picker{
    display:none; position:fixed; z-index:35;
    background:var(--surfaceVariant); border:1px solid var(--divider);
    border-radius:14px; padding:7px 8px;
    box-shadow:0 10px 26px rgba(0,0,0,.4);
    gap:4px; align-items:center;
    animation:modalIn .12s ease;
  }
  #reaction-picker.active{ display:flex; }
  #reaction-picker button{
    background:none; border:none; font-size:21px; line-height:1;
    padding:4px; border-radius:8px; cursor:pointer;
    transition:transform .1s ease, background .12s ease;
  }
  #reaction-picker button:hover{ background:var(--surface); transform:scale(1.18); }

  /* ---------- голосовые сообщения ---------- */
  .voice-msg{
    display:flex; align-items:center; gap:8px;
    min-width:190px; margin:2px 0 4px;
  }
  .voice-play-btn{
    flex-shrink:0; width:32px; height:32px; border-radius:50%;
    border:none; background:var(--accent); color:#fff;
    font-size:13px; cursor:pointer; display:flex; align-items:center; justify-content:center;
  }
  .voice-bar{
    flex:1; height:4px; border-radius:2px; background:rgba(255,255,255,.18);
    cursor:pointer; position:relative; overflow:hidden;
  }
  .voice-bar-fill{ display:block; height:100%; width:0%; background:var(--accentLight); border-radius:2px; }
  .voice-dur{ flex-shrink:0; font-size:11.5px; color:var(--textSecondary); font-variant-numeric:tabular-nums; }

  /* ---------- запись голосового ---------- */
  #voice-record-bar{
    display:none; align-items:center; gap:10px;
    padding:9px 14px;
  }
  #voice-record-bar.active{ display:flex; }
  #voice-record-bar .rec-dot{
    width:10px; height:10px; border-radius:50%; background:var(--error);
    animation:recBlink 1s infinite;
  }
  @keyframes recBlink{ 0%,100%{opacity:1;} 50%{opacity:.25;} }
  #voice-record-time{ font-size:13px; font-variant-numeric:tabular-nums; color:var(--textPrimary); }
  #voice-record-hint{ font-size:12px; color:var(--textSecondary); flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  #voice-record-cancel, #voice-record-send{
    border:none; background:none; cursor:pointer; font-size:19px; padding:4px 6px;
  }
  #voice-record-cancel{ color:var(--textSecondary); }
  #voice-record-send{ color:var(--accentLight); }
  #mic-btn.recording{ color:var(--error); }

  /* ---------- видео-кружочки: запись ---------- */
  #circle-overlay{
    display:none; position:fixed; inset:0; z-index:60;
    background:rgba(10,8,20,.92);
    flex-direction:column; align-items:center; justify-content:center; gap:26px;
  }
  #circle-overlay.active{ display:flex; }
  #circle-close{
    position:absolute; top:16px; right:18px;
    background:none; border:none; color:#fff; font-size:22px; cursor:pointer;
  }
  #circle-preview-wrap{
    position:relative; width:min(70vw, 300px); height:min(70vw, 300px);
    border-radius:50%; overflow:hidden;
    box-shadow:0 0 0 4px var(--accent), 0 12px 40px rgba(0,0,0,.5);
    background:#000;
  }
  #circle-live, #circle-playback{
    width:100%; height:100%; object-fit:cover;
    transform:scaleX(-1); /* зеркалим фронталку, как в большинстве камер */
  }
  #circle-timer{
    position:absolute; bottom:14px; left:50%; transform:translateX(-50%);
    background:rgba(0,0,0,.55); color:#fff; font-size:13px; font-variant-numeric:tabular-nums;
    padding:2px 10px; border-radius:10px;
  }
  #circle-controls{ display:flex; align-items:center; gap:28px; }
  #circle-controls button{
    border:none; cursor:pointer; color:#fff; background:rgba(255,255,255,.12);
    width:46px; height:46px; border-radius:50%; font-size:19px;
    display:flex; align-items:center; justify-content:center;
  }
  #circle-record-toggle{
    width:64px; height:64px; font-size:0;
    background:var(--error);
    box-shadow:0 0 0 4px rgba(255,255,255,.25);
  }
  #circle-record-toggle::before{ content:''; width:22px; height:22px; border-radius:50%; background:#fff; }
  #circle-record-toggle.recording::before{ border-radius:4px; width:18px; height:18px; }
  #circle-send{ background:var(--accent); }

  /* ---------- видео-кружочки: сообщение в чате ---------- */
  .circle-msg-wrap{
    position:relative; width:180px; height:180px; border-radius:50%;
    overflow:hidden; cursor:pointer; background:#000; margin:2px 0;
  }
  .circle-msg-wrap video{ width:100%; height:100%; object-fit:cover; display:block; }
  .circle-msg-play{
    position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
    background:rgba(0,0,0,.28); color:#fff; font-size:34px;
    pointer-events:none;
  }
  .circle-msg-dur{
    position:absolute; bottom:10px; left:50%; transform:translateX(-50%);
    background:rgba(0,0,0,.55); color:#fff; font-size:11px; padding:1px 8px; border-radius:8px;
  }

  /* ---------- эффекты сообщений ---------- */
  .effect-particle{
    position:fixed; z-index:70; font-size:24px; pointer-events:none;
    animation-name:effectRise; animation-timing-function:ease-out; animation-fill-mode:forwards;
    will-change:transform, opacity;
  }
  @keyframes effectRise{
    0%{ transform:translate(0,0) scale(.6); opacity:0; }
    15%{ opacity:1; transform:translate(0,0) scale(1); }
    100%{ transform:translate(var(--drift,0px), var(--rise,-260px)) scale(1.25); opacity:0; }
  }
  .effect-badge{
    display:inline-flex; align-items:center; justify-content:center;
    margin:4px 0 -2px; width:22px; height:22px; border-radius:50%;
    background:rgba(255,255,255,.08); border:1px solid var(--outline);
    font-size:12px; cursor:pointer;
  }
  #effect-picker{
    display:none; position:relative;
    align-items:center; gap:3px; padding:0 4px;
  }
  #effect-picker.active{ display:flex; }
  #effect-picker button{
    background:none; border:none; font-size:19px; cursor:pointer; padding:3px; border-radius:8px;
  }
  #effect-picker button.selected{ background:var(--accent); }
  #effect-toggle-btn.has-effect{ filter:none; text-shadow:0 0 6px var(--accentLight); }

  /* ---------- глобальный поиск ---------- */
  #global-search-results{ display:none; overflow-y:auto; padding-bottom:12px; }
  #global-search-results.active{ display:block; }
  .gsr-section-title{
    padding:10px 14px 4px; font-size:11px; text-transform:uppercase; letter-spacing:.04em;
    color:var(--textSecondary); font-weight:700;
  }
  .gsr-row{
    display:flex; align-items:center; gap:10px; padding:8px 14px; cursor:pointer;
  }
  .gsr-row:hover{ background:var(--surfaceVariant); }
  .gsr-row .avatar{ width:38px; height:38px; font-size:14px; flex-shrink:0; }
  .gsr-row-body{ min-width:0; flex:1; }
  .gsr-row-title{ font-size:13.5px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .gsr-row-sub{ font-size:12px; color:var(--textSecondary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .gsr-empty{ padding:16px 14px; color:var(--textSecondary); font-size:13px; text-align:center; }

  /* ---------- мультиаккаунт (до 3 сессий на устройство — как SessionManager.MAX_SESSIONS) ---------- */
  #my-avatar{ cursor:pointer; }
  #account-switcher{
    display:none; margin:0 14px 6px; background:var(--surfaceVariant);
    border:1px solid var(--divider); border-radius:12px; overflow:hidden;
  }
  #account-switcher.active{ display:block; }
  .acc-row{
    display:flex; align-items:center; gap:9px; padding:8px 10px; cursor:pointer;
    border-bottom:1px solid var(--divider);
  }
  .acc-row:last-child{ border-bottom:none; }
  .acc-row:hover{ background:var(--surface); }
  .acc-row.current{ background:rgba(109,55,255,.14); cursor:default; }
  .acc-row .avatar{ width:30px; height:30px; font-size:12px; flex-shrink:0; }
  .acc-row-body{ min-width:0; flex:1; }
  .acc-row-name{ font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .acc-row-email{ font-size:11px; color:var(--textSecondary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .acc-row-remove{ background:none; border:none; color:var(--textSecondary); font-size:15px; cursor:pointer; padding:2px 6px; }
  .acc-add-row{
    display:flex; align-items:center; gap:8px; padding:9px 10px; cursor:pointer;
    color:var(--accentLight); font-size:13px; font-weight:700;
  }
  .acc-add-row:hover{ background:var(--surface); }
  .acc-switch-pass{
    display:flex; gap:6px; padding:8px 10px; background:var(--surface);
  }
  .acc-switch-pass input{
    flex:1; background:var(--surfaceVariant); border:1px solid var(--divider); border-radius:8px;
    color:var(--textPrimary); padding:6px 8px; font-size:12.5px;
  }
  .acc-switch-pass button{
    background:var(--accent); border:none; color:#fff; border-radius:8px; padding:0 12px; font-size:12.5px; cursor:pointer;
  }

  /* ---------- уведомления ---------- */
  #notif-settings-btn{
    background:none; border:none; color:var(--textPrimary); font-size:17px; cursor:pointer;
    padding:4px 8px; border-radius:8px;
  }
  #notif-settings-btn:hover{ background:var(--surfaceVariant); }
  .toggle-field{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 0; }
  .toggle-field label{ font-size:13.5px; }
  .toggle-field input[type="checkbox"]{ width:38px; height:22px; accent-color:var(--accent); cursor:pointer; }

  /* ---------- закреплённые сообщения (chats/{id}/pinnedMessages) ---------- */
  #pinned-bar{
    display:none; align-items:center; gap:9px; padding:8px 16px;
    background:var(--surfaceVariant); border-bottom:1px solid var(--divider);
    cursor:pointer;
  }
  #pinned-bar.active{ display:flex; }
  #pinned-bar .pinned-ico{ font-size:15px; flex-shrink:0; }
  .pinned-bar-body{ min-width:0; flex:1; }
  .pinned-bar-count{ font-size:10.5px; color:var(--accentLight); font-weight:700; text-transform:uppercase; }
  .pinned-bar-text{ font-size:12.5px; color:var(--textPrimary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  #pinned-bar-unpin{
    background:none; border:none; color:var(--textSecondary); font-size:15px; cursor:pointer;
    padding:4px 6px; flex-shrink:0; display:none;
  }
  #pinned-bar-unpin.visible{ display:block; }

  /* ---------- аватар: загрузка файла ---------- */
  .avatar-upload-row{ display:flex; align-items:center; gap:10px; margin-bottom:14px; justify-content:center; }
  .avatar-upload-btn{
    font-size:11.5px; color:var(--linkColor); background:var(--surfaceVariant);
    border:1px solid var(--divider); border-radius:8px; padding:6px 10px;
    cursor:pointer; font-family:'Inter',sans-serif;
  }

  /* ---------- member actions (управление каналом) ---------- */
  .member-actions{ display:flex; gap:6px; margin-left:auto; }
  .member-actions button{
    background:var(--surfaceVariant); border:1px solid var(--divider);
    color:var(--textSecondary); font-size:10px; padding:3px 7px;
    border-radius:6px; cursor:pointer; font-family:'Inter',sans-serif;
  }
  .member-actions button:hover{ color:var(--textPrimary); border-color:var(--accentLight); }
  .member-actions button.danger:hover{ color:var(--danger); border-color:var(--danger); }

  .unread-badge{
    background:var(--accent);
    color:#fff;
    font-size:10.5px;
    font-weight:800;
    min-width:18px;
    height:18px;
    border-radius:9px;
    display:flex; align-items:center; justify-content:center;
    padding:0 5px;
    margin-left:6px;
    flex-shrink:0;
  }
  .chat-item{ align-items:center; }

  .day-divider{
    text-align:center;
    font-size:11px;
    color:var(--textSecondary);
    background:var(--surfaceVariant);
    padding:3px 10px;
    border-radius:8px;
    align-self:center;
    margin:10px 0;
  }

  /* ---------- папки чатов (users/{uid}/chatFolders) ---------- */
  #folder-tabs{
    display:flex; gap:6px; overflow-x:auto;
    padding:8px 14px 4px;
    scrollbar-width:none;
  }
  #folder-tabs::-webkit-scrollbar{ display:none; }
  .folder-tab{
    flex-shrink:0;
    background:var(--surfaceVariant);
    border:1px solid var(--divider);
    color:var(--textSecondary);
    font-size:12px; font-weight:700; font-family:'Manrope',sans-serif;
    padding:6px 12px;
    border-radius:20px;
    cursor:pointer;
    white-space:nowrap;
    transition:background .15s ease, color .15s ease, border-color .15s ease;
  }
  .folder-tab.active{ background:var(--accent); color:#fff; border-color:var(--accent); }
  .folder-tab.add-folder{ color:var(--accentLight); border-style:dashed; }
  .folder-check-row{
    display:flex; align-items:center; gap:9px;
    padding:7px 8px; border-radius:8px; cursor:pointer;
    font-size:13px;
  }
  .folder-check-row:hover{ background:var(--surfaceVariant); }
  .folder-check-row input{ accent-color:var(--accent); width:15px; height:15px; flex-shrink:0; }
  .folder-check-row .avatar{ width:26px; height:26px; font-size:11px; }

  #chat-search-wrap{ padding:10px 14px 6px; }
  #chat-search{
    width:100%;
    background:var(--surfaceVariant);
    border:1px solid var(--divider);
    border-radius:10px;
    padding:8px 12px;
    color:var(--textPrimary);
    font-size:13px;
    font-family:'Inter',sans-serif;
    outline:none;
  }
  #chat-search:focus{ border-color:var(--accentLight); }

  #scroll-bottom-btn{
    position:absolute;
    right:26px; bottom:90px;
    width:36px; height:36px;
    border-radius:50%;
    background:var(--surfaceVariant);
    border:1px solid var(--divider);
    color:var(--textPrimary);
    cursor:pointer;
    display:none;
    align-items:center; justify-content:center;
    font-size:15px;
    box-shadow:0 4px 12px rgba(0,0,0,.3);
    z-index:5;
  }
  #scroll-bottom-btn.active{ display:flex; animation:fadeIn .15s ease; }
  #chat{ position:relative; }

  /* ---------- планшет: чуть уже сайдбар, чат остаётся рядом ---------- */
  @media (max-width:1080px){
    #sidebar{width:300px; min-width:300px; max-width:300px;}
  }
  @media (max-width:860px){
    #sidebar{width:264px; min-width:264px; max-width:264px;}
    .chat-item .sub{max-width:120px;}
    #messages{padding:18px;}
  }

  /* ---------- телефон: список и чат — отдельные экраны ---------- */
  @media (max-width:700px){
    #sidebar{
      position:absolute; z-index:5; inset:0; height:100%;
      width:100%; min-width:0; max-width:100%;
      transform:translateX(0);
      transition:transform .22s cubic-bezier(.2,.8,.2,1);
      box-shadow:6px 0 28px rgba(0,0,0,.35);
    }
    #sidebar.hide-mobile{transform:translateX(-100%);}
    #app.active{position:relative;}
    #app{overflow:hidden;}
    #chat{width:100%;}
    .chat-item .sub{max-width:none;}
    .bubble{max-width:82%;}
    #back-btn{display:inline-flex !important;}
    #messages{padding:14px;}
    #composer{padding:10px 12px 16px; gap:7px;}
    #chat-head{padding:12px 14px;}
    #scroll-bottom-btn{right:16px; bottom:82px;}
    #attach-btn, #mic-btn, #circle-btn, #effect-toggle-btn, #send-btn{ width:38px; height:38px; font-size:16px; }
    #folder-tabs{ padding:6px 10px 2px; }
    .folder-tab{ font-size:11.5px; padding:5px 10px; }
  }
  @media (max-width:400px){
    .bubble{max-width:88%;}
    #chat-search-wrap{padding:8px 10px 4px;}
    #composer{gap:5px; padding:8px 8px 14px;}
    #attach-btn, #mic-btn, #circle-btn, #effect-toggle-btn, #send-btn{ width:34px; height:34px; font-size:15px; border-radius:8px; }
    #msg-input{ padding:9px 10px; font-size:13.5px; }
    #circle-preview-wrap{ width:78vw; height:78vw; }
    .acc-row-email, .gsr-row-sub{ max-width:150px; }
  }
  #back-btn{
    display:none;
    background:none;border:none;color:var(--textSecondary);
    font-size:18px;cursor:pointer;padding:4px 6px 4px 0;
  }

  .avatar, .profile-avatar-big{ position:relative; }
  .mv-frame-ring{
    position:absolute; inset:-4px; border-radius:50%;
    -webkit-mask:radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
    mask:radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
    animation:mvFrameSpin 3s linear infinite;
  }
  .mv-frame-ring.black{ box-shadow:0 0 6px 1px rgba(255,255,255,.25); }
  @keyframes mvFrameSpin{ to{ transform:rotate(360deg); } }
  .mv-avatar-inner{
    position:relative; z-index:1; width:100%; height:100%;
    border-radius:50%; display:flex; align-items:center; justify-content:center;
    box-sizing:border-box; overflow:hidden;
  }

  .mv-picker-label{ font-size:11.5px; color:var(--textSecondary); margin:2px 0 8px; }
  .mv-frame-grid{ display:flex; flex-wrap:wrap; gap:10px; margin-bottom:16px; }
  .mv-frame-swatch{
    width:42px; height:42px; border-radius:50%; cursor:pointer;
    display:flex; align-items:center; justify-content:center;
    background:var(--surfaceVariant); border:2px solid var(--divider);
    color:var(--textSecondary); font-size:10.5px; position:relative;
    transition:border-color .15s ease, transform .15s ease;
  }
  .mv-frame-swatch:hover{ transform:scale(1.07); }
  .mv-frame-swatch.selected{ border-color:var(--accentCyan); }
  .mv-glow-grid{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px; }
  .mv-glow-swatch{
    width:26px; height:26px; border-radius:50%; cursor:pointer;
    border:2px solid transparent; transition:transform .15s ease, border-color .15s ease;
  }
  .mv-glow-swatch:hover{ transform:scale(1.15); }
  .mv-glow-swatch.selected{ border-color:#fff; box-shadow:0 0 0 1px var(--accentCyan); }

  .call-btn{
    background:var(--surfaceVariant); border:1px solid var(--divider);
    color:var(--accentLight); width:34px; height:34px; border-radius:8px;
    cursor:pointer; display:flex; align-items:center; justify-content:center;
    margin-left:6px; transition:border-color .15s ease, transform .1s ease, color .15s ease;
  }
  .call-btn:hover{ border-color:var(--accentCyan); color:var(--accentCyan); }
  .call-btn:active{ transform:scale(.92); }
  .call-btn svg{ width:17px; height:17px; }
  #call-actions{ display:none; margin-left:auto; }
  #call-actions.active{ display:flex; }

  #incoming-call, #call-screen{
    display:none; position:fixed; inset:0; z-index:60;
    background:rgba(6,6,10,.92); backdrop-filter:blur(6px);
    align-items:center; justify-content:center; flex-direction:column;
    color:var(--textPrimary); text-align:center; padding:24px;
  }
  #incoming-call.active, #call-screen.active{ display:flex; animation:overlayIn .2s ease; }
  .call-title{ font-family:'Manrope',sans-serif; font-weight:800; font-size:20px; margin:18px 0 4px; }
  .call-sub{ color:var(--textSecondary); font-size:13px; font-family:'JetBrains Mono',monospace; margin-bottom:30px; }
  .call-avatar{ width:104px; height:104px; }
  .call-avatar .mv-avatar-inner{ font-size:34px; }
  .call-actions-row{ display:flex; gap:22px; align-items:center; }
  .call-round-btn{
    width:60px; height:60px; border-radius:50%; border:none; cursor:pointer;
    display:flex; align-items:center; justify-content:center; color:#fff;
    transition:transform .12s ease, filter .15s ease;
  }
  .call-round-btn:hover{ filter:brightness(1.1); }
  .call-round-btn:active{ transform:scale(.9); }
  .call-round-btn svg{ width:24px; height:24px; }
  .call-round-btn.accept{ background:linear-gradient(135deg,#54FF36,#22D3EE); }
  .call-round-btn.decline, .call-round-btn.hangup{ background:linear-gradient(135deg,#FF5252,#AF3A3A); }
  .call-round-btn.toggle{ background:var(--surfaceVariant); border:1px solid var(--divider); }
  .call-round-btn.toggle.off{ color:#FF5252; border-color:#FF5252; }
  #call-videos{ position:relative; width:100%; max-width:640px; aspect-ratio:16/10; margin-bottom:22px; display:none; }
  #call-videos.active{ display:block; }
  #call-remote-video{ width:100%; height:100%; object-fit:cover; border-radius:12px; background:#000; }
  #call-local-video{
    position:absolute; right:12px; bottom:12px; width:96px; height:132px;
    object-fit:cover; border-radius:8px; border:1px solid var(--divider); background:#000;
  }
  .call-small{ font-size:11.5px; color:var(--textSecondary); margin-top:16px; max-width:320px; }
  .vbadge{display:inline-flex; vertical-align:-0.18em; margin-left:5px; flex:none; line-height:0;}
  .vbadge svg{width:1.05em; height:1.05em;}
  .vbadge.v{color:var(--accentLight);}
  .vbadge.p{color:#F5B93A;}
  .side-tools{display:flex; align-items:center; flex-wrap:wrap; gap:6px; padding:8px 18px; border-bottom:1px solid var(--divider);}
  .tool-pill{display:inline-flex; align-items:center; gap:6px; height:28px; padding:0 11px; border-radius:999px; background:var(--surfaceVariant); border:1px solid var(--divider); color:var(--textSecondary); font:inherit; font-size:12px; cursor:pointer; transition:border-color .15s ease,color .15s ease;}
  .tool-pill:hover{border-color:var(--accentLight); color:var(--textPrimary);}
  .tool-pill[hidden]{display:none;}
  .tool-pill svg{width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round;}
  .lang-mini{height:28px; padding:0 8px; border-radius:999px; background:var(--surfaceVariant); border:1px solid var(--divider); color:var(--textSecondary); font:inherit; font-size:12px; cursor:pointer; margin-left:auto;}
  .auth-links .lang-mini{margin-left:0;}
  #head-tools{display:flex; align-items:center; gap:6px; margin-left:auto;}
  #call-actions.active + #head-tools{margin-left:0;}
  #chat-timer-btn.on{color:var(--accentLight); border-color:var(--accentLight);}
  #timer-note{display:none; align-items:center; gap:8px; padding:6px 22px; font-size:12px; color:var(--textSecondary); border-bottom:1px solid var(--divider); background:rgba(155,109,255,0.06);}
  #timer-note.active{display:flex;}
  #timer-note svg{width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round;}
  #chat-find-bar{display:none; align-items:center; gap:8px; padding:8px 22px; border-bottom:1px solid var(--divider); background:var(--surface);}
  #chat-find-bar.active{display:flex;}
  #chat-find-input{flex:1; min-width:0; height:34px; padding:0 12px; border-radius:10px; border:1px solid var(--divider); background:var(--surfaceVariant); color:var(--textPrimary); font:inherit; font-size:13px; outline:none;}
  #chat-find-input:focus{border-color:var(--accentLight);}
  .find-count{min-width:56px; text-align:center; font-size:12px; color:var(--textSecondary);}
  .find-btn{width:32px; height:32px; display:inline-flex; align-items:center; justify-content:center; border-radius:10px; border:1px solid var(--divider); background:var(--surfaceVariant); color:var(--textSecondary); cursor:pointer;}
  .find-btn:hover:not(:disabled){color:var(--textPrimary); border-color:var(--accentLight);}
  .find-btn:disabled{opacity:.4; cursor:default;}
  .find-btn svg{width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round;}
  .bubble.find-hit{outline:1px solid rgba(155,109,255,0.5);}
  .bubble.find-current{outline:2px solid var(--accentLight); box-shadow:0 0 0 4px rgba(155,109,255,0.2);}
  #timer-menu{position:fixed; display:none; z-index:60; min-width:190px; padding:6px; border-radius:12px; background:var(--surface); border:1px solid var(--divider); box-shadow:0 18px 50px rgba(0,0,0,0.5);}
  #timer-menu.active{display:block;}
  #timer-menu button{display:block; width:100%; text-align:left; padding:9px 12px; border:0; border-radius:8px; background:none; color:var(--textPrimary); font:inherit; font-size:13px; cursor:pointer;}
  #timer-menu button:hover{background:var(--surfaceVariant);}
  #timer-menu button.selected{color:var(--accentLight); font-weight:700;}
  .qs-overlay{align-items:flex-start; padding-top:12vh;}
  .qs-modal{max-width:460px; padding:14px;}
  #qs-input{width:100%; height:42px; padding:0 14px; border-radius:12px; border:1px solid var(--divider); background:var(--surfaceVariant); color:var(--textPrimary); font:inherit; font-size:14px; outline:none;}
  #qs-input:focus{border-color:var(--accentLight);}
  .qs-list{max-height:50vh; overflow:auto; margin-top:8px;}
  .qs-item{display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:10px; cursor:pointer;}
  .qs-item.active{background:var(--surfaceVariant);}
  .qs-item .avatar{width:36px; height:36px; font-size:14px; flex:none;}
  .qs-item .saved-avatar{background:#F5B93A; color:#0A0A0C; display:flex; align-items:center; justify-content:center; border-radius:50%;}
  .qs-name{flex:1; min-width:0; display:flex; align-items:center; gap:6px; font-weight:600; overflow:hidden;}
  .qs-name .nick-text{overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
  .qs-empty{padding:18px; text-align:center; color:var(--textSecondary); font-size:13px;}
  .qs-hint{margin-top:8px; text-align:center; font-size:11.5px; color:var(--textSecondary);}
  #paste-preview{display:block; max-width:100%; max-height:300px; margin:0 auto 12px; border-radius:10px;}
  .admin-modal,.shop-modal{max-width:560px; text-align:left;}
  .shop-modal{max-width:720px;}
  .admin-tabs,.shop-tabs{display:flex; flex-wrap:wrap; gap:6px; margin:10px 0 12px;}
  .admin-tab{height:30px; padding:0 14px; border-radius:999px; border:1px solid var(--divider); background:var(--surfaceVariant); color:var(--textSecondary); font:inherit; font-size:12.5px; cursor:pointer;}
  .admin-tab.active{background:var(--accent); border-color:var(--accent); color:#fff;}
  .admin-row{display:flex; gap:8px; margin-bottom:10px;}
  .admin-row input{flex:1; min-width:0;}
  .admin-modal input[type=text],.admin-modal input[type=number],.admin-modal textarea{width:100%; padding:9px 12px; border-radius:10px; border:1px solid var(--divider); background:var(--surfaceVariant); color:var(--textPrimary); font:inherit; font-size:13px; outline:none;}
  .admin-modal textarea{font-family:ui-monospace,Menlo,Consolas,monospace; resize:vertical;}
  .admin-card{margin-top:10px; padding:14px; border-radius:14px; border:1px solid var(--divider); background:var(--surface);}
  .admin-card-head{display:flex; align-items:center; gap:12px; margin-bottom:12px;}
  .admin-card-head .avatar{width:44px; height:44px; flex:none;}
  .admin-name{font-weight:700; display:flex; align-items:center;}
  .admin-sub{font-size:12px; color:var(--textSecondary); word-break:break-all;}
  .admin-lbl{display:block; margin:10px 0 4px; font-size:12px; color:var(--textSecondary);}
  .admin-check{display:flex; align-items:center; gap:8px; font-size:13px; cursor:pointer;}
  .admin-msg{display:none; margin:8px 0; padding:8px 10px; border-radius:8px; font-size:12.5px;}
  .admin-msg.ok{background:rgba(70,200,130,0.12); color:#7BE0A4;}
  .admin-msg.err{background:rgba(255,90,90,0.12); color:var(--error,#FF6B6B);}
  .admin-list{display:grid; gap:8px;}
  .admin-promo{display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 12px; border-radius:12px; border:1px solid var(--divider); background:var(--surface);}
  .admin-promo-main{min-width:0; display:flex; flex-direction:column; gap:2px;}
  .admin-promo-main span{font-size:12px; color:var(--textSecondary); overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
  .admin-promo-actions{display:flex; gap:6px; flex:none;}
  .admin-promo-actions button{height:28px; padding:0 10px; border-radius:8px; border:1px solid var(--divider); background:var(--surfaceVariant); color:var(--textPrimary); font:inherit; font-size:12px; cursor:pointer;}
  .admin-promo-actions button.danger{color:var(--error,#FF6B6B);}
  .shop-head{display:flex; align-items:center; gap:10px; margin:6px 0 4px;}
  .shop-coins{display:flex; align-items:center; gap:6px; padding:5px 12px; border-radius:999px; background:rgba(245,185,58,0.14); color:#F5B93A; font-weight:700;}
  .shop-plus{padding:5px 12px; border-radius:999px; font-size:12px; font-weight:600;}
  .shop-plus.on{background:rgba(245,185,58,0.14); color:#F5B93A;}
  .shop-plus.off{background:var(--surfaceVariant); color:var(--textSecondary);}
  .shop-banner{display:flex; flex-direction:column; gap:2px; padding:12px 14px; margin:8px 0; border-radius:12px; background:linear-gradient(135deg,rgba(139,92,246,0.25),rgba(79,124,255,0.18)); border:1px solid var(--divider);}
  .shop-banner span{font-size:12.5px; color:var(--textSecondary);}
  .shop-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(130px,1fr)); gap:10px;}
  .shop-card{display:flex; flex-direction:column; align-items:center; gap:4px; padding:12px 8px; border-radius:14px; border:1px solid var(--divider); background:var(--surface); text-align:center; cursor:default;}
  .shop-ico{width:52px; height:52px; display:flex; align-items:center; justify-content:center; font-size:30px;}
  .shop-ico img{max-width:100%; max-height:100%; border-radius:10px;}
  .shop-name{font-size:13px; font-weight:600; word-break:break-word;}
  .shop-rarity{font-size:11px; color:var(--accentLight);}
  .shop-price{font-size:13px; font-weight:700; color:#F5B93A;}
  .shop-raw{margin-top:10px; padding:10px; border-radius:10px; background:var(--surfaceVariant); font-size:11.5px; white-space:pre-wrap; word-break:break-all; max-height:200px; overflow:auto;}
  .admin-row .btn{width:auto; flex:none; padding:0 20px; min-height:38px;}

.load-older{align-self:center;margin:8px auto 12px;padding:8px 16px;border-radius:999px;border:1px solid rgba(179,157,255,0.25);background:transparent;color:var(--textSecondary,#9A94AE);font:inherit;font-size:13px;cursor:pointer;}
.load-older:hover{color:var(--text,#F5F3FA);border-color:rgba(179,157,255,0.5);}

.msg-link{color:inherit;text-decoration:underline;text-underline-offset:2px;word-break:break-all;}
.app-version{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 0 14px;font-size:12px;color:var(--textSecondary);}
.link-btn{background:none;border:0;padding:0;font:inherit;font-size:12px;color:var(--primary,#B39DFF);cursor:pointer;text-decoration:underline;}
.link-btn:disabled{opacity:.6;cursor:default;text-decoration:none;}
.toast-host{position:fixed;left:50%;bottom:calc(24px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);z-index:100000;display:flex;flex-direction:column;gap:8px;align-items:center;pointer-events:none;max-width:calc(100vw - 32px);}
.toast{background:rgba(30,24,50,.96);color:#F5F3FA;border:1px solid rgba(179,157,255,.3);padding:10px 16px;border-radius:12px;font-size:13.5px;box-shadow:0 8px 24px rgba(0,0,0,.35);transition:opacity .3s,transform .3s;}
.toast.out{opacity:0;transform:translateY(6px);}
