:root{
  --bg-deep: #0b0a08;
  --panel: #17140f;
  --panel-2: #1e1a13;
  --line: #362f21;
  --pink: #a3272c;
  --cyan: #7c8c6a;
  --lilac: #d9d2c1;
  --lilac-dim: #8f8672;
  --danger: #ff3b3b;
}

*::-webkit-scrollbar{
  display: none;              /* Chrome / Safari / Edge */
}

*{ box-sizing: border-box; }

body{
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% -10%, #241f13 0%, var(--bg-deep) 55%);
  color: var(--lilac);
  font-family: 'Inter', system-ui, sans-serif;
}
html, body {
  overflow-x: hidden;
  overscroll-behavior-x: none; /* also stops the edge-swipe back/forward gesture on mobile Chrome/Edge */
   touch-action: pan-y;
   max-width: 100%;
}html, body {
    max-width: 100%;
    overflow-x: hidden;
}
button.voice-play.playing {
    word-spacing: -2px !important;
    font-weight: bolder;
}
button#photoBtn {
    padding-bottom: 3px!important;
}
h1, h2, .brand{
  font-family: 'Press Start 2P', system-ui, sans-serif;
}


a{ color: var(--cyan); }

/* ---------- Auth pages ---------- */
.auth-wrap{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
   background-image: linear-gradient(rgb(0 0 0 / 90%), rgb(20 17 10 / 62%)), url(?asset=spiral.webp);
    background-size: auto;
    background-position: center;
    background-repeat: no-repeat;
}
#connStatus {
    opacity: 0;
}

@media (max-width: 640px) {
    .wallpaper-btn::before {
        content: "ï¸";
        font-size: 14px;
        margin-top: -17px;opacity:0!important;
    }
}

@media (max-width: 420px) {
   .group-toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 38px 4px!important;
}
}
form#groupHandleForm {
        margin: -10px 19px -11px 17px;
}
form#groupRenameForm {
    margin: -20px 19px -1px 17px;
}
form#groupInviteForm {
    margin: 0px 17px -21px 19px;
}
form#groupPasswordForm {
    margin: -30px 13px 9px 17px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid var(--line);
    border-radius: 16px;
    background-color: #32000080;
    padding: 32px 28px;
    box-shadow: 0 0 40px rgba(255, 95, 168, 0.08);
}
.auth-card .brand {
    font-size: 19px;
    color: #2d0002;
    text-align: center;
    margin: 0 0 8px;
    letter-spacing: 1px;
    text-shadow: 0 0 18px rgb(255 0 0 / 55%), 0 0 2px rgb(255 0 0 / 80%);
}
.auth-card h1 {
    font-size: 11px;
    color: var(--cyan);
    text-align: center;
    margin: 0 0 28px;
    font-weight: 400;
    text-shadow: 0 0 18px rgb(255 255 255 / 55%), 0 0 2px rgb(255 0 0 / 80%);
}
span.lock-badge {
    font-size: 9px;
    opacity: 0.4;
    color: #4cff4c;
    
}

label{
  display: block;
  font-size: 12px;
  color: var(--lilac-dim);
  margin: 16px 0 6px;
}

input[type=text], input[type=password]{
  width: 100%;
  padding: 12px 14px;
  background: #0b0a0800;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--lilac);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
input[type=text]:focus, input[type=password]:focus{
  border-color: var(--pink);
}

.btn{
  width: 100%;
  margin-top: 24px;
  padding: 12px 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--pink), #5c1418);
  color: var(--lilac);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s;
}
.btn:hover{ box-shadow: 0 0 20px rgba(255, 95, 168, 0.35); }
.btn:active{ transform: scale(0.98); }

.btn.secondary{
  background: transparent;
  border: 1px solid var(--line);
  color: var(--cyan);
}

.switch-link{
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--lilac-dim);
}
div#messages {
    background-image: linear-gradient(rgb(0 0 0 / 90%), rgb(20 17 10 / 62%)), url(?asset=spiral.webp);
    background-size: auto;
    background-position: center;
    background-repeat: no-repeat;
}

.error{
  background: rgba(255, 95, 95, 0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-top: 16px;
}

/* ---------- Chat page ---------- */
.chat-shell{
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Sidebar (conversation list) ---------- */
.sidebar{
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.sidebar-header{
  padding: 16px 20px;
}

.sidebar-header .brand{
  font-size: 13px;
  color: var(--pink);
  margin: 0 0 10px;
}

.sidebar-header .who{
  font-size: 12px;
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.my-profile{
  display: flex;
  align-items: center;
  gap: 10px;
}

.my-avatar{
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  color: var(--lilac);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.my-avatar:hover{ border-color: var(--pink); }
.my-avatar img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.my-username-link{
  background: none;
    border: none;
    text-shadow: 0 0 15px #ffffff33;
    padding: 0;
    margin: 0;
    font-size: 16px !important;
    font: icon;
    /* font-family: fantasy; */
    color: inherit;
    cursor: pointer;
}
.my-username-link:hover{ color: var(--pink);text-shadow: 1px 1px 10px #aaaaaa; }

.avatar-error{
  color: var(--danger);
  font-size: 11px;
  margin-top: 8px;
  
}

.new-chat{
  padding: 0 20px 14px;
  
}


.new-chat-toggle{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-deep);
  color: var(--cyan);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.new-chat-toggle:hover{ border-color: var(--cyan); }

.new-chat-form{
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.new-chat-form input[type=text]{
  flex: 1;
  padding: 9px 12px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--lilac);
  font-size: 16px;
  font-family: inherit;
  outline: none;
}
.new-chat-form input[type=text]:focus{ border-color: var(--pink); }

.btn-small{
  border: none;
  border-radius: 8px;
  padding: 0 14px;
  background: linear-gradient(135deg, var(--pink), #5c1418);
  color: var(--lilac);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.new-chat-error{
  color: var(--danger);
  font-size: 11px;
  margin-top: 8px;
}

.conv-list{
  flex: 1;
  overflow-y: auto;
}

.conv-empty{
  padding: 24px 20px;
  color: var(--lilac-dim);
  font-size: 13px;
  text-align: center;
}

.conv-item{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  position: relative;
  transition: padding-right .15s, background .15s;
}
.conv-item:hover{ background: var(--panel-2); }
.conv-item.active{ background: var(--panel-2); border-left: 3px solid var(--pink); padding-left: 17px; }
.conv-item.selected{ background: rgba(78,236,236,0.09); }
.conv-list.selecting .conv-item{ padding-right: 46px; }

.conv-check{
  position: absolute;
  right: 25px;
  top: 65%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 2px solid var(--line);
  background: var(--bg-deep);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s, border-color .15s;
  padding: 0;
  flex-shrink: 0;
}
.conv-item:hover .conv-check,
.conv-list.selecting .conv-check{ opacity: 1; }
.conv-item.selected .conv-check{
  opacity: 1;
  background: #2bcf85;
  border-color: #2bcf85;
  
}
.conv-item.selected .conv-check::after{
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid var(--bg-deep);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.conv-selection-bar{
  border-top: none;
  border-bottom: 1px solid var(--line);
}

.conv-item.unread .conv-username{
  color: #fff;
  font-weight: 800;
}
.conv-item.unread .conv-preview{
  color: var(--lilac);
  font-weight: 600;
}
.conv-item.unread .conv-time{
  color: var(--cyan);
}
.conv-unread-dot{
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 8px rgba(255, 95, 168, 0.7);
  flex-shrink: 0;
}

.conv-avatar{
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  color: var(--lilac);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.conv-avatar img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.conv-body{
  flex: 1;
  min-width: 0;
}

.conv-top{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.conv-name-wrap{
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.conv-username{
  color: var(--lilac);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-time{
  font-size: 11px;
  color: var(--lilac-dim);
  flex-shrink: 0;
}

.conv-preview{
  font-size: 12px;
  color: var(--lilac-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* ---------- Chat panel ---------- */
.chat-panel{
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-placeholder{
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--lilac-dim);
  font-size: 14px;
}

.chat-active{
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: -17px;
}

.back-btn{
  display: none;
  border: none;
  background: transparent;
  color: var(--cyan);
  font-size: 18px;
  cursor: pointer;
  margin-right: 4px;
}

.peer-name{ color: var(--cyan); }

.peer-info{
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  margin-bottom: -28px;
}
.peer-info .peer-name {
    margin: 0px 0px 6px 0;
    top: 21px;
    cursor: pointer;
    /* margin-bottom: 4px!important; */
    position: fixed;
    font-size: 14px;
}
.peer-presence-text {
    margin: 1px 4px 0;
    font-size: 12px;
    position: fixed;
    top: 39px;
    color: #888;
}
.peer-presence-text.is-online{ color: #3ddc84; }

.peer-typing {
    margin: 0;
    font-size: 12px;
    color: #777;
    /* display: flex; */
    align-items: center;
    position: fixed;
    top: 27px;
    margin-left: 2px;
}margin-bottom: 29px; */
}
.peer-typing .dots span{
  animation: peer-typing-blink 1.4s infinite both;
}
.peer-typing .dots span:nth-child(2){ animation-delay: .2s; }
.peer-typing .dots span:nth-child(3){ animation-delay: .4s; }
@keyframes peer-typing-blink{
  0%, 80%, 100% { opacity: .2; }
  40% { opacity: 1; }
}
button#myUsernameBtn {
    font-weight: bold;
    font-size: 20px !important;
}
.peer-avatar-inner{
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  color: var(--lilac);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.peer-avatar-inner img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-header{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 19px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position:relative;
}

.wallpaper-controls{
  margin-left: auto;
  display: flex;
 
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.wallpaper-btn{
  background: transparent;
  color: var(--lilac-dim);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}
.wallpaper-btn:hover{ border-color: var(--pink); color: var(--pink); }

.wallpaper-reset {
    background: transparent;
    color: var(--lilac-dim);
    border: 1px solid var(--line);
    width: 26px;
    height: 26px;
    padding-top: 5px;
    border-radius: 8px;
    padding-left: 7px;
    font-size: 12px;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.wallpaper-reset:hover{ border-color: var(--pink); color: var(--pink); }

@media (min-width: 758px) {
.conn-status {
   
}
    .status-pc {
        left: 97px !important;
        top: 35px !important;
    }
     .status-phone {
       
    }

}


@media (max-width: 758px) {
.conn-status {
   
}
    .status-pc {
        left: 97px !important;
        top: 35px !important;
    }
     .status-phone {
        
    }

}


@media (max-width: 640px) {
  .wallpaper-btn{        display: grid;
        width: 80px;
        height: 25px;
        justify-content: center;
        justify-items: center;
        align-content: center;
        grid-auto-flow: row;}
  .wallpaper-btn::before{
    content: "ï¸";
    font-size: 14px;
    margin-top: -17px;
  }
  .status-pc {
        
    }
    .wallpaper-reset {
               padding-left: 8px!Important;
        padding-bottom: 19px !important;
        padding-top: 2px!Important;
        font-size: 15px!Important;
    }
  .conn-status{    background: none!important;backdrop-filter:blur(0px)!important;}
  button#photoBtn {
    padding-bottom: 4px!important;
}
button#myUsernameBtn {
    font-weight: bold;
    font-size: 20px !important;
}
.my-username-link{
  background: none;
    border: none;
    text-shadow: 0 0 15px #ffffff33;
    padding: 0;
    margin: 0;
    font-size: 25px !important;
    font: icon;
    /* font-family: fantasy; */
    color: inherit;
    cursor: pointer;
}

}

.logout-link{
  color: var(--lilac-dim);
  text-decoration: none;
  font-size: 12px;
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 8px;
}
.logout-link:hover{ border-color: var(--pink); color: var(--pink); }

.messages{
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;

  /* Wallpaper: drop your image at assets/wallpaper.jpg (or change the
     filename below). The dark gradient on top just dims it a bit so
     it doesn't fight with the message bubbles â€” tweak the 0.55 opacity
     or delete that layer entirely if you want it at full brightness. */
  background-image: linear-gradient(rgba(10,6,18,0.55), rgba(10,6,18,0.55)), none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Wraps #messages so the scroll-to-bottom arrow can be pinned to the
   visible viewport of the (scrolling) message list, instead of scrolling
   away with the content. */
.messages-wrap{
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
}
.messages-wrap .messages{
  flex: 1;
}

.scroll-bottom-btn{
  position: absolute;
  right: 20px;
  bottom: 16px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--cyan);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  z-index: 5;
  transition: border-color .15s, transform .15s;
}
.scroll-bottom-btn:hover{
  border-color: var(--pink);
  transform: translateY(-2px);
}
.scroll-bottom-arrow{
  font-size: 18px;
  line-height: 1;
}
.scroll-bottom-badge{
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--pink);
  color: var(--lilac);
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 2px!important;
}

.msg-outer{
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 10px;
  transition: background .15s, padding .15s;
}
.msg-outer.mine{ align-items: flex-end; }
.msg-outer.theirs{ align-items: flex-start; }
.msg-outer:hover{ background: rgba(255,255,255,0.035); }
.msg-outer.selected{ background: rgba(78,236,236,0.09); }

/* Room for the react/select buttons is only added while it's actually
   needed — on hover, or while multi-select mode is on (the checkbox has
   to stay visible then even without hovering) — so idle messages use
   their full row width instead of permanently losing 50px to padding. */
.msg-outer.mine:hover,
.messages.selecting .msg-outer.mine{ padding-right: 50px; }
.msg-outer.theirs:hover,
.messages.selecting .msg-outer.theirs{ padding-left: 50px; }

@keyframes flashHighlight {
  0% { background: rgba(255,95,168,0.35); }
  100% { background: transparent; }
}
.msg-outer.flash{ animation: flashHighlight 1.2s ease; }

.msg-hover-actions {
    position: absolute;
    right: 7px;
    top: 36%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity .15s;
}
.msg-outer.theirs .msg-hover-actions{ right: auto; left: 5px; }
.msg-outer:hover .msg-hover-actions{ opacity: 1; }
.messages.selecting .msg-hover-actions{ opacity: 1; }
.messages.selecting .msg-react-btn{ display: none; }

.msg-react-btn{
  border: none;
  background: var(--bg-deep);
  color: var(--lilac-dim);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.msg-react-btn:hover{ background: var(--panel-2); color: var(--cyan); }

.msg-check {
    position: relative;
    width: 16px;
    height: 16px;
    border-radius: 6px;
    border: 2px solid var(--line);
    background: var(--bg-deep);
    cursor: pointer;
    transition: background .15s, border-color .15s;
    padding: 0;
    flex-shrink: 0;
}
.msg-outer.selected .msg-check{
  background: #2bcf85;
  border-color: #2bcf85;
}
.msg-outer.selected .msg-check::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 3px;
    height: 6px;
    border: solid var(--bg-deep);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.reaction-row{
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.msg-outer.mine .reaction-row{ justify-content: flex-end; }
.reaction-pill{
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 12px;
  cursor: pointer;
  color: var(--lilac-dim);
  line-height: 1.6;
}
.reaction-pill.mine{ border-color: var(--cyan); color: var(--cyan); }
.msg-outer.mine .reaction-pill.mine{ border-color: var(--pink); color: var(--pink); }

.reaction-picker{
  position: fixed;
  z-index: 40;
  display: flex;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.reaction-picker button{
  border: none;
  background: transparent;
  font-size: 19px;
  cursor: pointer;
  padding: 2px;
  border-radius: 50%;
  transition: transform .1s;
}
.reaction-picker button:hover{ transform: scale(1.25); }
.reaction-add-btn{
  color: var(--lilac-dim);
  font-size: 17px !important;
  font-weight: 700;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line) !important;
  border-radius: 50% !important;
}
.reaction-add-btn:hover{ color: var(--cyan); border-color: var(--cyan) !important; }
.reaction-custom-input{
  width: 64px;
  height: 26px;
  border: 1px solid var(--line);
  background: var(--bg-deep);
  color: var(--lilac);
  border-radius: 999px;
  padding: 0 10px;
  font-size: 15px;
  outline: none;
}
.reaction-custom-input:focus{ border-color: var(--cyan); }

.msg-edited-tag{ color: var(--lilac-dim); font-size: 10.5px; margin-left: 4px; font-style: italic; }

.msg-sender-name{
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cyan);
  margin: 0 2px 3px;
  max-width: 70%;
}
.msg-outer.mine .msg-sender-name{ display: none; }

.msg-outer.system{
  align-items: center;
  margin: 6px 0;
  position: relative;
}
.system-bubble{
  display: inline-block;
  max-width: 80%;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--lilac-dim);
  font-size: 12px;
  text-align: center;
}
.sys-check{
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity .15s;
}
.msg-outer.system:hover .sys-check,
.messages.selecting .sys-check{ opacity: 1; }

.group-avatar-icon{
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
}

.group-public-id{ display: flex; align-items: center; gap: 6px; }
.group-copy-btn{
  border: none;
  background: transparent;
  color: var(--lilac-dim);
  cursor: pointer;
  font-size: 13px;
  padding: 2px;
}
.group-copy-btn:hover{ color: var(--cyan); }

.group-section-title{
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--lilac-dim);
  margin: 14px 4px 6px;
}
.group-inline-form{
  display: flex;
  gap: 8px;
  padding: 0 4px;
  
}
.group-inline-form input{
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--bg-deep);
  color: var(--lilac);
  border-radius: 10px;
  padding: 8px 10px;
  /* Keep this at 16px or higher: anything smaller makes iOS Safari
     auto-zoom the whole page when the field is focused, which looks like
     everything "expanding" and makes it hard to type. */
  font-size: 16px;
  outline: none;
}
.group-inline-form input:focus{ border-color: var(--cyan); }
.group-inline-form button{
  border: none;
  background: var(--cyan);
  color: var(--bg-deep);
  font-weight: 600;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.group-inline-form button:hover{ filter: brightness(1.08); }

/* Small pill buttons for Invite / Change id / Change name, sitting in one
   row so they take almost no vertical space. Tapping one opens its form
   below; the panel stays compact until you actually need to edit something. */
.group-toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 70px 4px;
}
.group-toggle-btn{
  display: inline-flex;
  align-items: center;
  width: auto;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: var(--bg-deep);
  color: var(--lilac);
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.group-toggle-btn:hover{ filter: brightness(1.12); }
.group-toggle-btn.open{ color: var(--cyan); border-color: var(--cyan); }

.group-member-row{
  display: flex;
  align-items: center;
  gap: 10px;
      padding: 8px 23px;
  border-bottom: 1px solid #4a4127;
}
.group-member-row:last-child{ border-bottom: none; }
.group-member-name{
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.group-member-name span:first-child{
  font-size: 13.5px;
  color: var(--lilac);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-member-role{ font-size: 11.5px; color: var(--lilac-dim); text-transform: capitalize; }

.group-leave-btn {
    display: block;
    /* width: calc(85%); */
        margin: 15px 90px -1px 90px;
    padding: 10px;
    border: 0px solid var(--danger);
    background: transparent;
    color: var(--danger);
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
}
.group-leave-btn:hover{ background: rgba(255, 95, 95, .12); }

.group-member-manage-btn{
  border: none;
  background: transparent;
  color: var(--lilac-dim);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 8px;
}
.group-member-manage-btn:hover{ color: var(--cyan); background: rgba(255,255,255,.06); }

button#groupCallBtn {
    position: fixed;
    top: 16px;
    font-size: 18px;
    /* margin-bottom: -26px; */
    left: 347px;
}
.group-action-btn {
    display: block;
    width: calc(100% - 8px);
    margin: 4px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    background: var(--bg-deep);
    color: var(--lilac);
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}
div#groupPasswordStatus {
    margin-top: -14px;
}
button#groupInfoCallBtn {
    height: 24px;
    padding: 2px;
    border: 1px solid #3a3220!important;
    background-color: #a3272c38;
}
div#groupMemberMenu {
    background-color: #f0f8ff00;
}
button.group-action-btn {
    display: flex;
    border-radius: 30px;
    justify-content: center;
}
button#groupCallBtn {
    position: fixed;
    top: 16px;
    display: none!important;
    opacity: 0;
    font-size: 18px;
    /* margin-bottom: -26px; */
    left: 287px;
}
.group-action-btn:hover{ filter: brightness(1.12); }
.group-action-btn-danger{ color: var(--danger); border-color: rgba(255,95,95,.3); }
.group-action-btn-danger:hover{ background: rgba(255, 95, 95, .12); }

.group-privilege-row{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 23px;
  font-size: 13px;
  color: var(--lilac);
  cursor: pointer;
}

.group-primary-btn {
    display: block;
    width: 145px;
    margin: 14px 4px 4px;
    padding: 8px 0px 8px 0px;
    border: none;
    margin: 10px 69px 11px 75px;
    background: var(--cyan);
    color: var(--bg-deep);
    border-radius: 20px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}
.group-primary-btn:hover{ filter: brightness(1.08); }

.group-invite-link-row{
  display: flex;
  gap: 8px;
  padding: 0 4px;
  margin: 0px 17px;
  align-items: center;
  margin-bottom: -27px;
}
div#groupMembersTitle {
    margin-top: -20px;
}
.group-invite-link-row input{
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--bg-deep);
  color: var(--lilac-dim);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 16px;
}

.pinned-bar{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.pinned-bar-icon{ color: var(--cyan); font-size: 14px; flex-shrink: 0; }
.pinned-bar-body{ flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pinned-bar-label{ font-size: 11px; color: var(--cyan); font-weight: 600; }
.pinned-bar-text{ font-size: 12px; color: var(--lilac-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pinned-bar-count{ font-size: 11px; color: var(--lilac-dim); flex-shrink: 0; }
.pinned-bar-unpin{ border: none; background: transparent; color: var(--lilac-dim); cursor: pointer; font-size: 13px; flex-shrink: 0; }
.pinned-bar-unpin:hover{ color: var(--pink); }

.msg-row{
  display: flex;
  flex-direction: column-reverse;
  max-width: 70%;
}
.msg-outer.mine .msg-row{ align-items: flex-end; }
.msg-outer.theirs .msg-row{ align-items: flex-start; }
.msg-meta{
  font-size: 11px;
  color: var(--lilac-dim);
  margin-bottom: 4px;
}
.msg-meta .uname{ color: var(--cyan); }
.msg-row.mine .msg-meta .uname{ color: var(--pink); }

.msg-status{
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  vertical-align: -1px;
  color: var(--lilac-dim);
}
.msg-status.read{ color: var(--cyan); }

/* Group read receipts: a small row of readers' avatars tucked under a
   message I sent, revealed on hover (mirrors .msg-hover-actions). */
.msg-read-receipts{
  position: absolute;
  right: 4px;
  bottom: 0px;
  margin-bottom:10px;
  display: flex;
  right:30px;
  align-items: center;
  gap: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 2;
}
.msg-outer.mine:hover .msg-read-receipts{ opacity: 1; }
.msg-read-avatar{
  width: 15px;
  height: 15px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid var(--bg-deep);
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  color: var(--lilac);
  font-size: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -4px;
}
.msg-read-avatar:first-child{ margin-left: 0; }
.msg-read-avatar img{ width: 100%; height: 100%; object-fit: cover; }
.msg-read-more{
  font-size: 10px;
  color: var(--lilac-dim);
  margin-left: 3px;
}

.bubble{
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
  border: 1px solid var(--line);
  background: var(--panel-2);
}
.msg-row.mine .bubble {
    background: linear-gradient(156deg, rgb(74 99 86 / 59%), rgb(144 112 112 / 62%));
    border-color: rgb(80 80 80);
}

.bubble-text{ white-space: pre-wrap;color:white; }

/* Photos and videos ship as bare media, not inside a chat bubble â€” only
   text (and file/voice) messages keep the bubble treatment. */
.bubble.bubble-media{
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 10px;
}
.msg-row.mine .bubble.bubble-media{
  background: transparent;
  border: none;
}
span.mention-link {
    color: #d9a942;
    font-weight: bold;
    cursor: pointer;
}

.reply-quote{
  border-left: 3px solid var(--cyan);
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 5px 9px;
  margin-bottom: 6px;
  cursor: pointer;
}
.reply-quote-user{ color: var(--cyan); font-weight: 600; font-size: 12px; margin-bottom: 1px; }
.msg-outer.mine .reply-quote{ border-left-color: var(--pink); }
.msg-outer.mine .reply-quote .reply-quote-user{ color: var(--pink); }
.reply-quote-text{
  color: var(--lilac-dim);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.bubble img.chat-photo{
  max-width: 260px;
  max-height: 260px;
  border-radius: 10px;
  display: block;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

.bubble video.chat-video{
  max-width: 260px;
  max-height: 320px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  border-radius: 10px;
  display: block;
}

.file-chip{
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--lilac);
  font-size: 13px;
}
.file-chip .ext{
  background: var(--cyan);
  color: var(--lilac);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 6px;
}
.file-chip .fname{ text-decoration: underline; }
.file-chip .fsize{ color: var(--lilac-dim); font-size: 11px; }

.voice-bubble{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}
.voice-play{
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  background: var(--cyan);
  color: var(--lilac);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 6px; /* optically center the â–¶ glyph */
}
.voice-play.playing{ padding-left: 0; background: var(--pink); }
.msg-outer.mine .voice-play{ background: var(--pink); }
.msg-outer.mine .voice-play.playing{ background: var(--cyan);
padding-left: 6px;}

.voice-play.playing {
    padding-left: 6px;
    font-size: 17px;
    background: var(--pink);
}
.voice-track{
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.voice-progress{
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: var(--cyan);
  border-radius: 999px;
}
.msg-outer.mine .voice-progress{ background: var(--pink); }

.voice-time{
  font-size: 11px;
  color: var(--lilac-dim);
  flex-shrink: 0;
  min-width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.reply-preview{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--panel-2);
  border-top: 1px solid var(--line);
}
.reply-preview-bar{
  width: 3px;
  align-self: stretch;
  background: var(--cyan);
  border-radius: 2px;
  flex-shrink: 0;
}
.reply-preview-body{
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.reply-preview-label{
  font-size: 12px;
  color: var(--cyan);
  font-weight: 600;
}
.reply-preview-text{
  font-size: 12px;
  color: var(--lilac-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-preview-cancel{
  border: none;
  background: transparent;
  color: var(--lilac-dim);
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}
.reply-preview-cancel:hover{ color: var(--pink); }

.selection-bar{
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.sel-cancel{
  border: none;
  background: transparent;
  color: var(--lilac);
  font-size: 16px;
  cursor: pointer;
}
.sel-count{
  color: var(--lilac);
  font-weight: 600;
  font-size: 14px;
}
.sel-actions{
  margin-left: auto;
  display: flex;
  gap: 20px;
}
.sel-action{
  border: none;
  background: transparent;
  font-size: 19px;
  cursor: pointer;
  color: var(--lilac);
  padding: 0;
}
.sel-action:hover{ transform: scale(1.12); }
.sel-action:disabled{ opacity: 0.3; cursor: not-allowed; transform: none; }

.composer{
  padding: 14px 16px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  display:block!important;
  margin-bottom: 16px;
}

.composer-normal{
    margin: 0 15px 6px 10px!important;
}
.composer-normal,
.composer-recording{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom:6px!important;
}

.composer input[type=text]{
  flex: 1;
  margin: 0;padding: 9px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 10px;
    border: 0px solid var(--line);
    background: #0b0a0800;
    color: var(--cyan);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover{ border-color: var(--cyan); }

.attach-wrap{
  position: relative;
  flex-shrink: 0;
}

.attach-menu{
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  z-index: 20;
}

.attach-menu-item{
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  color: var(--lilac);
  font-size: 14px;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
}
.attach-menu-item:hover{ background: var(--panel); }
.attach-menu-icon{ font-size: 17px; }

.send-btn{
  border: none;
  border-radius: 10px;
  padding: 0 10px;
  height: 40px;
  background: linear-gradient(135deg, var(--pink), #5c1418);
  color: var(--lilac);
  font-weight: 600;
  cursor: pointer;
}

.composer-recording {
    background: #0b0a0800;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 0px!important;
    height: 40px;
    max-width: 369PX;
    margin: 0px 20px 0 23px;
}
button#recCancel {
    padding-left: 7px;
}
.rec-cancel,
.rec-send{
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--lilac-dim);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rec-cancel:hover{ color: var(--danger); }
.rec-send{
    transform: rotate(270deg);
  margin-left: auto;
  background: linear-gradient(135deg, var(--pink), #5c1418);
  color: var(--lilac);
}

.rec-send {
    margin-left: auto;
    background: linear-gradient(135deg, var(--pink), #5c1418);
    padding: 0px 0 0 0;
    height: -webkit-fill-available;
    color: var(--lilac);
    width: 38px;
}
.rec-dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
  animation: rec-pulse 1.2s infinite;
}
@keyframes rec-pulse{
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.rec-timer{
  font-variant-numeric: tabular-nums;
  color: var(--lilac);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.rec-hint{
  color: var(--lilac-dim);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--lilac-dim);
  padding: 0 16px 8px;
}

.upload-ring{
  flex-shrink: 0;
  transform: rotate(-90deg);
}

.upload-ring-bg{
  fill: none;
  stroke: rgba(255,255,255,0.15);
  stroke-width: 3;
}

.upload-ring-fg{
  fill: none;
  stroke: var(--pink);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.15s ease;
}

.upload-progress-text{
  font-size: 12px;
}

.hint{
  font-size: 10px;
  color: var(--lilac-dim);
  padding: 0 16px 10px;
  display:none!important;
}

/* ---------- Mobile: list <-> chat toggle ---------- */
@media (max-width: 760px){
  .sidebar{
    width: 100%;
    border-right: none;
  }
  .chat-panel{
    position: fixed;
    inset: 0;
    transform: translateX(100%);
    transition: transform .2s ease;
    background: var(--bg-deep);
  }
  .chat-shell.show-chat .sidebar{
    display: none;
  }
  .chat-shell.show-chat .chat-panel{
    transform: translateX(0);
  }
  .back-btn{
    display: block;
  }
}

/* ---------- Profile popup ---------- */
.clickable-avatar{ cursor: pointer; }
.clickable-avatar:hover{ filter: brightness(1.15); }

.profile-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgb(11 0 0 / 72%);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.profile-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    max-height: 88vh;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 29px;
    padding: 32px 24px 14px 24px;
    box-shadow: 0 0 40px rgb(255 0 0 / 12%);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.profile-close{
  position: absolute;
  top: 15px;
  right: 18px;
  border: none;
  background: transparent;
  color: var(--lilac-dim);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.profile-close:hover{ color: var(--pink); }

.profile-avatar-wrap{
  position: relative;
  width: 88px;
  height: 88px;
  margin-bottom: 16px;
}

.profile-avatar{
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  color: var(--lilac);
  font-weight: 700;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}
.profile-avatar:hover{ filter: brightness(1.1); }
.profile-avatar-inner{
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-avatar-inner img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-edit{
     position: absolute;
    bottom: -2px;
    right: -2px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--panel);
    background: linear-gradient(135deg, #000000, #5c595a);
    color: var(--lilac);
    font-size: 13px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.profile-avatar-edit:hover{ filter: brightness(1.1); }

.profile-username{
  font-size: 13px;
  color: var(--cyan);
  margin: 0 0 4px;
}

.profile-member-since{
  font-size: 11px;
  color: var(--lilac-dim);
  margin: 0 0 6px;
}

.profile-presence-text{
  
  color: #888;
  margin: 0 0 6px;
      font-size: 14px;
}
.profile-presence-text.is-online{ color: #3ddc84; }

/* ---------- Profile info list (mobile / username / date of birth / bio) ---------- */
/* Shared "row" system — one rounded card containing each field, divided
   by thin lines, matching a Telegram-style profile: label on the left,
   value on the right, an Edit link that swaps the row for an inline form. */

.profile-info-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--panel-2);
    border: 0px solid var(--line);
    border-radius: 19px;
    margin-top: 1px;
}
button#profileMessageBtn {
    border-color: pink;
    margin-top: 8px;
    border-radius: 21px;
    border: 0px solid var(--pink);
    font-weight: bold;
    cursor: pointer;
    font-size: 15px;
    color: var(--lilac);
    background-color: var(--panel-2);
}
button#profileMessageBtn:hover {
   color: #e8dcc4;
}
.profile-row{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  
}
.profile-info-list .profile-row:last-child{ border-bottom: none; }

.profile-row-bio{ align-items: flex-start; }

.profile-row-label{
  font-size: 11px;
  color: var(--lilac-dim);
  text-align: left;
  flex-shrink: 0;
}

.profile-row-value{
  font-size: 13px;
  color: var(--lilac);
  flex: 1;
  text-align: right;
  word-break: break-word;
}

.profile-bio-value{
  text-align: right;
  white-space: pre-wrap;
}

.profile-row-edit-btn{
  border: none;
  background: transparent;
  color: var(--cyan);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.profile-row-edit-btn:hover{ color: var(--pink); }

.profile-row-edit{
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line);
}
.profile-info-list .profile-row-edit:last-child{ border-bottom: none; }

.profile-row-edit label{
  margin: 0;
  text-align: left;
  font-size: 11px;
  color: var(--lilac-dim);
}

.profile-row-edit input,
.profile-row-edit textarea{
  width: 100%;
  padding: 9px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--lilac);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  color-scheme: dark;
  resize: vertical;
}
.profile-row-edit input:focus,
.profile-row-edit textarea:focus{ border-color: var(--pink); }

.profile-row-edit-actions{
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.profile-row-cancel{
  border: 1px solid var(--line);
  background: transparent;
  color: var(--lilac-dim);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 13px;
  cursor: pointer;
}
.profile-row-cancel:hover{ border-color: var(--pink); color: var(--lilac); }

.profile-error {
    color: var(--danger);
    font-size: 11px;
    margin-top: 10px;
    min-height: 0;
    opacity: 0;
}

/* ---------- Search this conversation ---------- */
span.profile-message-icon {
    margin-right: 6px;
}
.profile-search-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 14px;
    padding: 7px 13px;
    border-radius: 999px;
    border: 0px solid var(--panel-2);
    background: var(--panel);
    font-size: 15px;
    font-weight: bold;
    color: var(--cyan);
    cursor: pointer;
}

.profile-search-toggle:hover{     color: #008484; }
.profile-search-icon{ font-size: 15px; 
    margin-right: 6px;
}

.profile-search-panel{
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.profile-search-panel input{
  width: 100%;
  padding: 9px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--lilac);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.profile-search-panel input:focus{ border-color: var(--pink); }

.profile-search-results{
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-search-result{
  display: flex;
  align-items: baseline;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--bg-deep);
  border-radius: 8px;
  cursor: pointer;
  color: var(--lilac);
}
.profile-search-result:hover{ border-color: var(--cyan); }

.profile-search-result-who{
  font-size: 11px;
  color: var(--cyan);
  flex-shrink: 0;
}
.profile-search-result-text{
  font-size: 12px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-search-result-time{
  font-size: 10px;
  color: var(--lilac-dim);
  flex-shrink: 0;
}

.profile-search-empty{
  font-size: 11px;
  color: var(--lilac-dim);
  padding: 6px 2px;
}

/* Briefly highlights a message bubble that was jumped to from search. */
.msg-outer.msg-highlight .bubble{
  box-shadow: 0 0 0 2px var(--pink);
  transition: box-shadow 0.3s ease;
}

/* ---------- Shared media / files ---------- */

.profile-media-section{
  width: 100%;
  margin-top: 18px;
}

.profile-media-tabs{
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.profile-media-tab{
  flex: 1;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: var(--lilac-dim);
  font-size: 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.profile-media-tab.active{
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.profile-media-grid{
  width: 100%;
  min-height: 40px;
}

.profile-media-grid-thumbs{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.profile-media-thumb{
  position: relative;
  aspect-ratio: 1 / 1;
  border: none;
  padding: 0;
  overflow: hidden;
  background: var(--bg-deep);
  cursor: pointer;
  border-radius: 6px;
}
.profile-media-thumb img,
.profile-media-thumb video{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-media-video-badge{
  position: absolute;
  bottom: 4px;
  right: 6px;
  color: #fff;
  font-size: 12px;
  text-shadow: 0 0 4px rgba(0,0,0,0.8);
}

.profile-media-grid-list{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-media-file{
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--lilac);
}
.profile-media-file:hover{ border-color: var(--cyan); }

.profile-media-file-icon{ font-size: 16px; flex-shrink: 0; }

.profile-media-file-info{
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  text-align: left;
}
.profile-media-file-name{
  font-size: 12px;
  color: var(--lilac);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-media-file-meta{
  font-size: 10px;
  color: var(--lilac-dim);
}

.profile-media-loading,
.profile-media-empty{
  font-size: 11px;
  color: var(--lilac-dim);
  padding: 10px 2px;
}

/* ---------- Online/offline presence dots ---------- */
.peer-avatar{
  position: relative;
  flex-shrink: 0;
}

.avatar-wrap{
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
}

.presence-dot{
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--bg-deep);
  background: #6b6f80;
  box-sizing: content-box;
}
.presence-dot.online{
  background: #3ddc84;
  box-shadow: 0 0 6px rgba(61, 220, 132, 0.65);
}
.presence-dot.offline{
  background: #6b6f80;
}

.header-presence-dot{
  border-color: var(--panel);
  width: 10px;
  height: 10px;
}

/* ---------- Photo viewer (Telegram-style full-screen gallery) ---------- */
.photo-viewer-overlay{
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(6, 4, 12, 0.94);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.photo-viewer-top{
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
}

.photo-viewer-username{
  color: var(--cyan);
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-viewer-counter{
  color: var(--lilac-dim);
  font-size: 12px;
  flex-shrink: 0;
}

.photo-viewer-close{
  border: none;
  background: transparent;
  color: var(--lilac-dim);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
  flex-shrink: 0;
}
.photo-viewer-close:hover{ color: var(--pink); }

.photo-viewer-stage{
  position: relative;
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-viewer-img{
  max-width: 100%;
  max-height: 70vh;
  border-radius: 12px;
  object-fit: contain;
  background: var(--panel);
  box-shadow: 0 0 40px rgba(255, 95, 168, 0.15);
}

.photo-viewer-nav{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(23, 15, 40, 0.7);
  color: var(--lilac);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.photo-viewer-nav:hover{ color: var(--pink); border-color: var(--pink); }
.photo-viewer-prev{ left: 6px; }
.photo-viewer-next{ right: 6px; }

.photo-viewer-dots{
  display: flex;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 320px;
}

.photo-viewer-dot{
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
  cursor: pointer;
  border: none;
  padding: 0;
}
.photo-viewer-dot.active{ background: var(--pink); }

.photo-viewer-actions{
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.photo-viewer-action-btn{
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--lilac);
  font-size: 12px;
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
}
.photo-viewer-action-btn:hover{ border-color: var(--cyan); color: var(--cyan); }
.photo-viewer-delete-btn:hover{ border-color: var(--pink); color: var(--pink); }

.photo-viewer-error{
  margin-top: 10px;
  color: var(--pink);
  font-size: 12px;
  min-height: 1em;
}

/* ---------- "Recording a voice messageâ€¦" peer status ---------- */
.peer-typing .mic-wave{
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-right: 2px;
}


.peer-typing {
    margin: 0;
    font-size: 12px;
    color: #777;
    /* display: flex; */
    align-items: center;
    position: fixed;
    top: 39px;
    margin-left: 2px;
}
.peer-typing .mic-wave span{
  display: inline-block;
  width: 2px;
  height: 6px;
  background: #c70000;
  border-radius: 1px;
  animation: mic-wave-bounce 0.9s infinite ease-in-out both;
}
.peer-typing .mic-wave span:nth-child(2){ animation-delay: .15s; }
.peer-typing .mic-wave span:nth-child(3){ animation-delay: .3s; }
.peer-typing .mic-wave span:nth-child(4){ animation-delay: .45s; }
@keyframes mic-wave-bounce{
  0%, 100% { height: 4px; }
  50% { height: 11px; }
}

/* ---------- Connection status pill ---------- */
.conn-status{
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(23, 15, 40, 0.85);
  
  color: var(--lilac);
  backdrop-filter: blur(6px);
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.conn-status .conn-dot{
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lilac-dim);
  flex-shrink: 0;
}

.conn-status.is-connecting .conn-dot{
  background: #c9a15a;
  box-shadow: 0 0 6px rgba(245, 200, 106, 0.7);
  animation: conn-dot-pulse 1s infinite ease-in-out;
}
.conn-status.is-connecting{margin-top: 32px; opacity: 0.3; color: #c97a52; border-color: #c97a52; }

.conn-status.is-connected .conn-dot{
  background: #4be07f;
 
}
.conn-status.is-connected{margin-top: 32px;
    opacity: 0.5;
    backdrop-filter: none;
    background: none;
    color: #4be07f;}

.conn-status.is-offline .conn-dot {
    
    margin-top: -1px;
    
    opacity: 1;
    margin-right: 3px;
    margin-left: -3px;
    color: #b7b7b7;
    
}
.conn-status.is-offline{ margin-top: 32px; opacity: 0.3; color: #b7b7b7; }

@keyframes conn-dot-pulse{
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- Peer-header connection indicator ---------- */
.peer-conn-status { 
    margin: 2px 4px 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #bbbbbb;
    opacity: 0;
    transition: opacity 0.25s ease, color 0.25s ease;
    pointer-events: none;
}
  pointer-events: none;
}
.peer-conn-status.is-visible{ opacity: 1; }
.peer-conn-status.is-online{ color: #4be07f; }


element.style {
    display: inline-flex;
    text-decoration: none;
    align-items: center;
    gap: 4px;
    padding: 1px 2px;
    margin-bottom: -8px;
    border-radius: 20px;
    /* background: rgb(35, 39, 51); */
    color: rgb(226 121 19);
    font-size: 13px;
    font-weight: 600;
}
a#profileE2eBtn:hover {
        color: #d9a35c !important;
}








/* ===================== Voice calls ===================== */
.call-banner{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  color: var(--lilac);
  font-size: 14px;
}
.call-banner-icon{ font-size: 16px; }
.call-banner-text{ flex: 1; }
.call-banner-join{
  border: 1px solid var(--cyan);
  color: var(--cyan);
  background: transparent;
  border-radius: 8px;
  padding: 6px 14px;
  font-weight: 600;
  cursor: pointer;
}
.call-banner-join:hover{ background: rgba(78,236,236,.12); }

.call-panel {
    position: fixed;
    right: 11px;
    top: 77px;
    width: 260px;
    max-width: calc(100vw - 36px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0,0,0,.45);
    padding: 14px;
    z-index: 500;
    color: var(--lilac);
}
.call-panel-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.call-panel-title{ font-weight: 700; font-size: 14px; }
.call-panel-duration{ font-size: 12px; color: var(--lilac-dim); }
.call-panel.is-reconnecting{ border-color: #e27913; animation: call-panel-pulse 1.4s ease-in-out infinite; }
.call-panel.is-reconnecting .call-panel-duration{ color: #e27913; }
@keyframes call-panel-pulse{
  0%, 100% { box-shadow: 0 12px 30px rgba(0,0,0,.45); }
  50% { box-shadow: 0 12px 30px rgba(0,0,0,.45), 0 0 0 2px rgba(226,121,19,.4); }
}
.call-tiles{
  display: flex;
  flex-wrap: wrap;
 
  gap: 10px;
  margin-bottom: 12px;
  max-height: 180px;
 
}
.call-tile{
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 56px;
}
.call-tile-avatar{
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--cyan);
  border: 2px solid transparent;
  position: relative;
  transition: border-color .1s ease, box-shadow .1s ease;
}
.call-tile-avatar img{ width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.call-tile.is-connecting .call-tile-avatar{ border-color: var(--lilac-dim); opacity: .6; }
/* Bright green ring + glow around whoever is currently speaking. */
.call-tile.is-speaking .call-tile-avatar{
  border-color: #35e35b;
  box-shadow: 0 0 0 2px rgba(53, 227, 91, .35), 0 0 10px 1px rgba(53, 227, 91, .55);
}
.call-tile-badges{
  position: absolute;
  bottom: -2px;
  right: -2px;
  display: flex;
  gap: 2px;
}
.call-tile-muted,
.call-tile-deafened{
  position: relative;
  bottom: auto;
  right: auto;
  background: var(--danger);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--panel);
}
.call-tile-deafened{ background: #8a5a00; }
.call-tile-name{
  font-size: 10px;
  color: var(--lilac-dim);
  margin-top: 4px;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.call-controls{
  display: flex;
  gap: 10px;
  justify-content: center;
}
.call-control-btn{
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--lilac);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.call-control-btn:hover{ border-color: var(--cyan); }
.call-control-btn.is-active{ background: var(--cyan); color: var(--bg-deep); }
.call-control-btn.call-hangup{ background: #ff000087;; color: #fff; border-color: var(--danger); }
.call-control-btn.call-hangup:hover{ opacity: .85; }

.conv-call-badge{
  font-size: 11px;
  animation: convCallPulse 1.4s ease-in-out infinite;
}
@keyframes convCallPulse{
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
button#profileCallBtn {
    color: #54ca00;
}
.call-banner-global{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 600;
  justify-content: center;
}
.call-banner-global .call-banner-text{ flex: none; }
.call-banner-global .call-banner-dismiss{
  background: transparent;
  border: none;
  color: var(--lilac-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
}
