
.chat-wrap{
  max-width:760px;
  margin:0 auto;
}

.chat-card{
  position:relative;
  border-radius:26px;
  border:1px solid var(--border-strong);
  background:linear-gradient(180deg, rgba(255,255,255,0.035) 0%, rgba(255,255,255,0.006) 100%);
  backdrop-filter:blur(22px) saturate(160%);
  -webkit-backdrop-filter:blur(22px) saturate(160%);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  box-shadow:0 34px 90px -40px rgba(var(--accent-rgb),0.45);
  transition:border-color 0.45s ease, box-shadow 0.55s var(--ease-out);
}
.chat-card:hover{
  border-color:var(--border-strong);
  box-shadow:0 40px 100px -38px rgba(var(--accent-rgb),0.55);
}

.chat-topbar{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  padding:18px 26px;
  border-bottom:1px solid var(--border);
}
.chat-online{
  display:inline-flex;
  align-items:center;
  gap:9px;
  font-size:12.5px;
  font-weight:600;
  color:var(--text-secondary);
  padding:6px 14px;
  border-radius:100px;
  border:1px solid var(--border);
  background:rgba(255,255,255,0.02);
}
.online-dot{
  width:7px;height:7px;border-radius:50%;
  background:#4ade80;
  box-shadow:0 0 8px rgba(74,222,128,0.85);
  animation:pulse-dot 2.4s ease-in-out infinite;
}
.chat-online strong{ color:var(--text-primary); font-weight:700; display:inline-block; }
.chat-online strong.bump{ animation:chat-count-bump 0.4s var(--ease-out); }
@keyframes chat-count-bump{
  0%{ transform:scale(1); }
  40%{ transform:scale(1.28); color:var(--accent-bright); }
  100%{ transform:scale(1); }
}

.chat-pinned{
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding:16px 26px;
  border-bottom:1px dashed var(--border-strong);
  background:rgba(var(--accent-rgb),0.05);
}
.pin-icon{ font-size:16px; line-height:1.5; flex-shrink:0; }
.chat-pinned-text strong{ font-size:13px; font-weight:700; display:block; margin-bottom:3px; }
.chat-pinned-text p{ font-size:12.5px; color:var(--text-secondary); line-height:1.55; }

.chat-messages{
  display:flex;
  flex-direction:column;
  gap:16px;
  padding:24px 26px;
  height:440px;
  overflow-y:auto;
  scroll-behavior:smooth;
}
.chat-messages::-webkit-scrollbar{ width:6px; }
.chat-messages::-webkit-scrollbar-track{ background:transparent; }
.chat-messages::-webkit-scrollbar-thumb{ background:var(--border-strong); border-radius:10px; }

.chat-loading, .chat-empty{
  margin:auto;
  color:var(--text-tertiary);
  font-size:13px;
  font-style:italic;
}

.chat-msg{
  position:relative;
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding:12px 14px;
  border-radius:16px;
  border:1px solid transparent;
  transition:border-color 0.4s ease, box-shadow 0.45s ease, transform 0.4s var(--ease-out);
}
.chat-msg:hover{
  border-color:var(--border-strong);
  box-shadow:0 16px 36px -22px rgba(var(--accent-rgb),0.6);
  transform:translateY(-2px);
}
.chat-msg.own{ background:rgba(var(--accent-rgb),0.05); }

@keyframes chat-msg-in{
  from{ opacity:0; transform:translateY(18px); filter:blur(7px); }
  60%{ box-shadow:0 0 24px -2px rgba(var(--accent-rgb),0.5); }
  to{ opacity:1; transform:translateY(0); filter:blur(0px); box-shadow:none; }
}
.chat-msg.msg-enter{ animation:chat-msg-in 0.5s var(--ease-out) both; }

.chat-avatar{
  width:36px;height:36px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family:var(--font-display);
  font-weight:800;
  font-size:14px;
  color:#fff;
  flex-shrink:0;
  box-shadow:0 0 0 2px rgba(255,255,255,0.06), 0 6px 16px -6px rgba(0,0,0,0.6);
}

.chat-msg-body{ flex:1; min-width:0; }
.chat-msg-head{
  display:flex;
  align-items:baseline;
  gap:9px;
  margin-bottom:4px;
  flex-wrap:wrap;
}
.chat-msg-name{ font-size:13px; font-weight:700; color:var(--text-primary); }
.chat-msg-time{ font-size:11px; color:var(--text-tertiary); }
.chat-msg-text{
  font-size:14px;
  line-height:1.55;
  color:var(--text-secondary);
  word-break:break-word;
  white-space:pre-wrap;
}

.chat-reactions{ display:flex; gap:6px; margin-top:8px; flex-wrap:wrap; }
.chat-reaction{
  display:inline-flex;
  align-items:center;
  gap:5px;
  font-size:12px;
  padding:4px 9px;
  border-radius:100px;
  border:1px solid var(--border);
  background:rgba(255,255,255,0.02);
  transition:border-color 0.3s ease, background 0.3s ease, transform 0.3s var(--ease-out);
}
.chat-reaction:hover{ border-color:var(--border-strong); transform:translateY(-1px); }
.chat-reaction.active{ border-color:var(--border-strong); background:rgba(var(--accent-rgb),0.16); }
.chat-reaction .count{ color:var(--text-tertiary); font-weight:600; min-width:8px; text-align:left; }
.chat-reaction.active .count{ color:var(--accent-bright); }

.chat-typing{
  min-height:20px;
  padding:0 26px;
  font-size:12px;
  font-style:italic;
  color:var(--text-tertiary);
  opacity:0;
  transition:opacity 0.3s ease;
}
.chat-typing.visible{ opacity:1; }

.chat-input-row{
  display:flex;
  align-items:center;
  gap:10px;
  padding:18px 22px;
  border-top:1px solid var(--border);
  background:rgba(255,255,255,0.015);
}
.chat-input{
  flex:1;
  background:rgba(255,255,255,0.03);
  border:1px solid var(--border);
  border-radius:100px;
  padding:13px 20px;
  font-family:var(--font-body);
  font-size:14px;
  color:var(--text-primary);
  transition:border-color 0.3s ease, background 0.3s ease;
}
.chat-input::placeholder{ color:var(--text-tertiary); }
.chat-input:focus{
  outline:none;
  border-color:var(--border-strong);
  background:rgba(255,255,255,0.05);
}

.chat-send-btn{
  width:46px;height:46px;
  padding:0;
  border-radius:50%;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}
.chat-send-btn{
    display:flex;
    align-items:center;
    justify-content:center;
}

.chat-send-btn svg{
    width:22px;
    height:22px;
    display:block;
    stroke:currentColor;
    fill:none;
    flex-shrink:0;
}

.chat-error{
  font-size:12px;
  color:#ff8a8a;
  padding:0 26px 12px;
  min-height:0;
}

@media(max-width:640px){
  .chat-messages{ height:380px; padding:18px; }
  .chat-topbar{ padding:14px 18px; }
  .chat-pinned{ padding:14px 18px; }
  .chat-input-row{ padding:14px 16px; }
  .chat-avatar{ width:32px; height:32px; font-size:12.5px; }
}
