/* Виджет чата поддержки: пузырь в правом нижнем углу и разворачивающаяся панель.
   z-index 120 — ниже игровой оболочки (150): поверх слота чат висеть не должен. */
.support-widget{
  position:fixed;right:24px;bottom:24px;z-index:120;
  display:flex;flex-direction:column;align-items:flex-end;gap:12px;
  font-family:Inter,system-ui,sans-serif;
  transition:transform .25s;
}
/* Тост выходит из того же угла и перекрывает пузырь — на время его показа приподнимаемся. */
.support-widget.has-toast{transform:translateY(-58px)}

/* ——— Кнопка-пузырь ——— */
.support-launcher{
  position:relative;flex:none;width:56px;height:56px;border-radius:50%;
  display:grid;place-items:center;
  background:linear-gradient(145deg,var(--violet-2),#6d36d7);
  border:1px solid rgba(255,255,255,.2);color:#fff;
  box-shadow:0 20px 46px -16px rgba(139,92,246,.9);
  transition:transform .2s,filter .2s;
}
.support-launcher:hover{transform:translateY(-2px);filter:brightness(1.12)}
.support-launcher svg{width:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
/* Иконка меняется на крестик, когда панель раскрыта: кнопка остаётся единственным переключателем. */
.support-widget.is-open .icon-chat,
.support-launcher .icon-close{display:none}
.support-widget.is-open .support-launcher .icon-close{display:block}

.support-launcher-badge{
  position:absolute;top:-3px;right:-3px;
  min-width:21px;height:21px;padding:0 5px;border-radius:11px;
  display:grid;place-items:center;
  background:var(--lime);border:2px solid var(--bg,#08060f);
  color:#0b0810;font:800 11px/1 Manrope,sans-serif;
}
.support-launcher-badge[hidden]{display:none}

/* Одиночная пульсация — сигнал о новом сообщении при закрытой панели. */
.support-launcher.is-pulse{animation:support-pulse 1s ease-out 1}
@keyframes support-pulse{
  0%{box-shadow:0 20px 46px -16px rgba(139,92,246,.9),0 0 0 0 rgba(182,245,66,.5)}
  70%{box-shadow:0 20px 46px -16px rgba(139,92,246,.9),0 0 0 16px rgba(182,245,66,0)}
  100%{box-shadow:0 20px 46px -16px rgba(139,92,246,.9),0 0 0 0 rgba(182,245,66,0)}
}

/* ——— Панель ——— */
.support-panel{
  position:relative;display:flex;flex-direction:column;
  width:380px;height:540px;max-height:calc(100vh - 140px);
  background:linear-gradient(160deg,rgba(25,19,37,.96),rgba(12,9,20,.97));
  border:1px solid rgba(255,255,255,.13);
  box-shadow:0 24px 60px -28px rgba(139,92,246,.8),0 34px 90px rgba(0,0,0,.6);
  backdrop-filter:blur(18px);
  /* Видимость задана базовым стилем, а не концом анимации: если та не проиграется
     (замороженная вкладка, отключённые анимации), панель всё равно должна быть видна. */
  opacity:1;
  animation:support-in .22s ease-out;
}
.support-panel[hidden]{display:none}
.support-panel:before{
  content:"";position:absolute;left:0;right:0;top:-1px;height:1px;
  background:linear-gradient(90deg,transparent,rgba(183,136,255,.7),rgba(182,245,66,.4),transparent);
}
@keyframes support-in{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}

.support-head{
  display:flex;align-items:center;gap:12px;flex:none;
  padding:14px 12px 14px 18px;
  border-bottom:1px solid var(--line);background:rgba(255,255,255,.03);
}
.support-head-text{flex:1;min-width:0}
.support-head h2{margin:0;font:700 15px Manrope,sans-serif;letter-spacing:-.01em}
.support-presence{
  display:flex;align-items:center;gap:7px;margin-top:4px;
  color:var(--muted);font-size:11px;
}
.support-presence i{width:6px;height:6px;border-radius:50%;background:#4b4557;flex:none}
.support-presence.is-online{color:#a9d97a}
.support-presence.is-online i{background:var(--lime);box-shadow:0 0 9px var(--lime)}

.support-close{
  width:34px;height:34px;flex:none;display:grid;place-items:center;
  background:transparent;border:1px solid transparent;color:var(--muted);
  transition:color .2s,border-color .2s,background .2s;
}
.support-close:hover{color:#fff;background:rgba(255,255,255,.06);border-color:var(--line)}
.support-close svg{width:15px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}

/* ——— Лента ——— */
.support-log{
  flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;
  display:flex;flex-direction:column;gap:14px;
  padding:16px;
  scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.16) transparent;
}
.support-log::-webkit-scrollbar{width:8px}
.support-log::-webkit-scrollbar-thumb{background:rgba(255,255,255,.14)}

.support-day{
  display:flex;align-items:center;gap:12px;
  color:#7d768c;font-size:10px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;
}
.support-day:before,.support-day:after{content:"";flex:1;height:1px;background:var(--line)}

.support-group{display:flex;flex-direction:column;gap:4px;align-items:flex-start;max-width:84%}
.support-group.is-player{align-self:flex-end;align-items:flex-end}

.support-line{
  padding:9px 12px;
  background:rgba(255,255,255,.05);border:1px solid var(--line);
  font-size:13px;line-height:1.55;color:#eceaf2;
  white-space:pre-wrap;overflow-wrap:anywhere;
}
.support-group.is-player .support-line{
  background:linear-gradient(135deg,rgba(139,92,246,.9),rgba(112,53,221,.9));
  border-color:rgba(183,136,255,.45);color:#fff;
}
.support-line.is-sending{opacity:.55}
.support-line.is-failed{
  background:rgba(255,99,124,.12);border-color:rgba(255,99,124,.45);color:#ffb3c0;
}
.support-time{font-size:10px;color:#7d768c;letter-spacing:.04em}

.support-retry{
  display:block;margin-top:6px;padding:0;
  background:none;border:0;color:#ff91a3;font-size:11px;text-decoration:underline;
}
.support-retry:hover{color:#fff}

.support-system{
  align-self:center;max-width:90%;text-align:center;
  color:#7d768c;font-size:11px;line-height:1.55;
}

/* ——— Пустое состояние ——— */
.support-empty{margin:auto 0;display:grid;gap:16px;text-align:center}
.support-empty b{font:700 15px Manrope,sans-serif;color:#fff}
.support-empty p{margin:6px 0 0;color:var(--muted);font-size:12px;line-height:1.6}
.support-quick{display:grid;gap:8px}
.support-quick button{
  padding:10px 12px;text-align:left;
  background:rgba(255,255,255,.04);border:1px solid var(--line);color:#cfc9dc;
  font-size:12px;transition:color .2s,border-color .2s,background .2s;
}
.support-quick button:hover{color:#fff;border-color:rgba(183,136,255,.4);background:rgba(139,92,246,.14)}

/* ——— Поле ввода ——— */
.support-form{
  display:flex;align-items:flex-end;gap:8px;flex:none;
  padding:12px;border-top:1px solid var(--line);background:rgba(255,255,255,.02);
}
.support-input{
  flex:1;min-width:0;height:42px;max-height:96px;resize:none;overflow-y:auto;
  padding:11px 12px;
  background:#0a0810;border:1px solid var(--line);color:#fff;
  font:400 13px/1.45 Inter,system-ui,sans-serif;outline:0;
}
.support-input:focus{border-color:var(--violet)}
.support-input::placeholder{color:#716b7f}
.support-send{
  width:42px;height:42px;flex:none;display:grid;place-items:center;
  background:linear-gradient(135deg,#9a65ff,#7035dd);border:0;color:#fff;
  box-shadow:0 10px 30px -12px rgba(121,61,229,.9);
  transition:filter .2s,opacity .2s;
}
.support-send:hover:not(:disabled){filter:brightness(1.13)}
.support-send:disabled{opacity:.4;cursor:default}
.support-send svg{width:18px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}

/* На узком экране панель занимает весь экран: 380px там некуда поставить. */
@media (max-width:650px){
  .support-widget{right:14px;bottom:14px}
  .support-widget.has-toast{transform:translateY(-54px)}
  .support-widget.is-open{
    inset:0;right:0;bottom:0;gap:0;transform:none;
  }
  .support-widget.is-open .support-panel{
    width:100%;height:100%;height:100dvh;max-height:none;border:0;
  }
  /* Панель на весь экран уже содержит крестик — дублирующий пузырь только мешает. */
  .support-widget.is-open .support-launcher{display:none}
  .support-launcher{width:52px;height:52px}
}

@media (prefers-reduced-motion:reduce){
  .support-widget,.support-panel,.support-launcher{animation:none!important;transition:none!important}
}
