/* ============================================================
   شات الفائز — نفس أسلوب الموقع الحي
   لوح كامل على الموبايل، ونافذة في النص على الديسكتوب
   ============================================================ */
.chat{position:fixed;inset:0;z-index:1400;display:flex;align-items:flex-end;justify-content:center}
.chat[hidden]{display:none}
.chat__bd{position:absolute;inset:0;background:rgba(8,3,20,.72);backdrop-filter:blur(3px)}

.chat__box{
  position:relative;display:flex;flex-direction:column;
  width:100%;max-width:460px;height:min(88vh,660px);
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:22px 22px 0 0;
  overflow:hidden;
  box-shadow:0 -10px 50px rgba(0,0,0,.5);
  animation:chatUp .34s cubic-bezier(.16,1,.3,1);
}
@keyframes chatUp{from{transform:translateY(26px);opacity:0}to{transform:none;opacity:1}}
@media (min-width:560px){
  .chat{align-items:center}
  .chat__box{border-radius:22px;height:min(84vh,640px)}
}

/* ---------- رأس الشات ---------- */
.chat__hd{
  display:flex;align-items:center;gap:11px;
  padding:13px 14px;border-bottom:1px solid var(--line);
  background:linear-gradient(135deg,color-mix(in srgb,var(--gold) 16%,var(--surface)),var(--surface-2));
  flex:0 0 auto;
}
.chat__pz{
  flex:0 0 auto;display:grid;place-items:center;
  width:42px;height:42px;border-radius:50%;overflow:hidden;
  background:radial-gradient(circle at 34% 28%,color-mix(in srgb,var(--gold) 32%,var(--surface)),var(--surface));
  border:2px solid color-mix(in srgb,var(--gold) 48%,transparent);
}
.chat__pz img{width:78%;height:78%;object-fit:contain}
.chat__pz span{font-size:20px;line-height:1}
.chat__in{min-width:0;flex:1}
.chat__in b{display:block;font-size:14.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat__in span{display:block;font-size:11.5px;color:var(--text-2)}
.chat__st{
  flex:0 0 auto;padding:4px 10px;border-radius:999px;font-size:11px;font-weight:800;
  background:color-mix(in srgb,var(--green) 15%,transparent);
  border:1px solid color-mix(in srgb,var(--green) 40%,transparent);color:var(--green);
}
.chat__x{
  flex:0 0 auto;display:grid;place-items:center;width:32px;height:32px;border-radius:9px;
  background:var(--surface);border:1px solid var(--line);cursor:pointer;
}
.chat__x svg{width:16px;height:16px}

/* ---------- الرسائل ---------- */
.chat__body{
  flex:1;overflow-y:auto;overscroll-behavior:contain;
  padding:14px;display:flex;flex-direction:column;gap:9px;
  background:var(--bg);
}
.chat__day{
  align-self:center;padding:3px 12px;border-radius:999px;margin:2px 0 4px;
  background:var(--surface-2);border:1px solid var(--line);
  font-size:11px;font-weight:700;color:var(--text-2);
}
.msg{
  max-width:82%;padding:10px 13px;border-radius:16px;
  font-size:14px;line-height:1.7;word-wrap:break-word;
  border:1px solid var(--line);background:var(--surface);
}
.msg__t{display:block;margin-top:4px;font-size:10.5px;color:var(--text-2)}
/* رسائلي: على الشمال في RTL زي تطبيقات المحادثة */
.msg--me{
  margin-inline-start:auto;
  background:linear-gradient(180deg,color-mix(in srgb,var(--gold) 24%,var(--surface)),color-mix(in srgb,var(--gold) 14%,var(--surface)));
  border-color:color-mix(in srgb,var(--gold) 42%,transparent);
  border-end-end-radius:6px;
}
.msg--admin{margin-inline-end:auto;border-end-start-radius:6px}
.msg--admin::before{
  content:'إدارة مخلوط';
  display:block;font-size:10.5px;font-weight:800;color:var(--brand-2);margin-bottom:3px;
}
.msg--sys{
  align-self:center;max-width:92%;text-align:center;
  background:var(--surface-2);color:var(--text-2);font-size:12.5px;
  border-style:dashed;
}

/* مؤشر بيكتب الآن */
.typing{
  display:inline-flex;align-items:center;gap:4px;
  margin-inline-end:auto;padding:11px 14px;border-radius:16px;
  background:var(--surface);border:1px solid var(--line);
}
.typing i{
  width:6px;height:6px;border-radius:50%;background:var(--text-2);
  animation:td 1.1s infinite ease-in-out;
}
.typing i:nth-child(2){animation-delay:.16s}
.typing i:nth-child(3){animation-delay:.32s}
@keyframes td{0%,60%,100%{opacity:.28;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}

/* ---------- شريط الإرسال ---------- */
.chat__ft{
  flex:0 0 auto;display:flex;align-items:flex-end;gap:8px;
  padding:11px 12px calc(11px + env(safe-area-inset-bottom));
  border-top:1px solid var(--line);background:var(--surface);
}
.chat__ta{
  flex:1;min-width:0;resize:none;
  max-height:104px;padding:11px 13px;border-radius:14px;
  background:var(--surface-2);border:1.5px solid var(--line);
  color:var(--text);font:inherit;font-size:14.5px;line-height:1.6;outline:none;
}
.chat__ta:focus{border-color:var(--gold)}
.chat__send{
  flex:0 0 auto;display:grid;place-items:center;width:44px;height:44px;border-radius:14px;
  border:0;cursor:pointer;
  background:linear-gradient(180deg,var(--gold-2),var(--gold));color:#3a2400;
  box-shadow:0 4px 12px rgba(245,166,35,.34);
}
.chat__send:disabled{opacity:.45;cursor:not-allowed;box-shadow:none}
.chat__send svg{width:19px;height:19px;stroke-width:2.3}
.chat__note{
  flex:0 0 auto;padding:0 14px 10px;font-size:11px;color:var(--text-2);text-align:center;
  background:var(--surface);
}

/* شارة غير مقروء على أيقونة الهيدر */
.icobtn__n--live{animation:pop2 .3s ease}
@keyframes pop2{from{transform:scale(.5)}to{transform:scale(1)}}

@media (prefers-reduced-motion:reduce){
  .chat__box,.typing i,.icobtn__n--live{animation:none !important}
}
