/* VIP-чат рефералов */
body:has(#view-chat:not([hidden])) :is(#support, #bug, footer) { display: none; }      /* на странице чата — только чат */
#view-chat section { padding: 18px 0 20px; }
.cchat { border-color: #f5c542; background: rgba(245, 197, 66, 0.07); }
.cchat .ctk { color: #f5c542; }
.cchat b { font-size: 17px; color: var(--white); }
.cchat em { color: #f5c542; }
.cchat:hover { box-shadow: 0 0 26px rgba(245, 197, 66, 0.25); }

.vchat {
  position: relative; display: flex; flex-direction: column; overflow: hidden; padding: 0;
  /* на широком экране сайт увеличен (см. scale.js), поэтому высоту окна делим на это увеличение — иначе чат выходил за экран */
  height: calc(100vh / var(--zoom, 1) - 190px); height: calc(100dvh / var(--zoom, 1) - 190px); min-height: 420px;
  border-color: rgba(245, 197, 66, 0.55);
  box-shadow: 0 0 50px rgba(245, 197, 66, 0.10), 0 0 0 1px rgba(245, 197, 66, 0.12) inset;
  animation: v-open 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.1) both;
}
@keyframes v-open { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }
.vhead {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  border-bottom: 2px solid var(--line); background: linear-gradient(90deg, rgba(245, 197, 66, 0.14), rgba(0, 231, 1, 0.08) 60%, transparent);
}
.vhead::after {          /* бегущий блик по нижней кромке шапки */
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: linear-gradient(90deg, transparent, #f5c542, var(--green), transparent); background-size: 200% 100%;
  animation: v-run 4s linear infinite;
}
@keyframes v-run { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.vhead b { font-size: 18px; font-weight: 800; }
.vbadge {
  padding: 3px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; letter-spacing: 0.14em; color: #1a1200;
  background: linear-gradient(135deg, #ffe58a, #f5c542 55%, #c9951a); box-shadow: 0 0 18px rgba(245, 197, 66, 0.55);
  animation: v-pulse 2.4s ease-in-out infinite;
}
@keyframes v-pulse { 50% { box-shadow: 0 0 30px rgba(245, 197, 66, 0.9); } }
.vsub { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--muted); }

.vlist { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.vempty { margin: auto; font-size: 15px; font-weight: 600; color: var(--muted); }
.vmsg { display: flex; align-items: flex-end; gap: 8px; max-width: 78%; }
.vmsg.new { animation: v-in 0.25s ease both; }
.vmsg.mine { align-self: flex-end; }
@keyframes v-in { from { opacity: 0; } to { opacity: 1; } }
.vava, .vpava { flex: 0 0 36px; width: 36px; height: 36px; padding: 0; border: 2px solid var(--green); border-radius: 50%; overflow: hidden; background: var(--panel); cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.vava:hover { transform: scale(1.08); box-shadow: 0 0 16px rgba(0, 231, 1, 0.5); }
.vava img, .vpava img { display: block; width: 100%; height: 100%; object-fit: cover; }
.vava i, .vpava i { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-style: normal; font-size: 16px; font-weight: 800; color: var(--green); }
.vbub { min-width: 0; padding: 8px 12px 6px; border-radius: 16px 16px 16px 4px; background: var(--panel); border: 1px solid var(--line); }
.vmsg.mine .vbub { border-radius: 16px 16px 4px 16px; background: rgba(0, 231, 1, 0.14); border-color: rgba(0, 231, 1, 0.45); }
.vname { display: block; padding: 0; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 800; color: var(--green); cursor: pointer; text-align: left; }
.vname:hover { text-decoration: underline; }
.vcrown { margin-left: 4px; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; color: #1a1200; background: #f5c542; vertical-align: 1px; }
.vtext { margin-top: 2px; font-size: 16px; font-weight: 500; line-height: 1.4; word-break: break-word; white-space: pre-wrap; }
.vpic { display: block; margin: 4px 0 2px; }
.vpic img, .vvid { display: block; max-width: 100%; width: 320px; min-height: 120px; max-height: 360px; border-radius: 10px; background: #000; object-fit: contain; }
.vmeta { margin-top: 2px; display: flex; justify-content: flex-end; gap: 10px; font-size: 11px; font-weight: 600; color: var(--muted); }
.vdel { padding: 0; border: 0; background: none; font: inherit; color: var(--muted); cursor: pointer; opacity: 0.7; }
.vdel:hover, .vdel[data-sure] { color: var(--red); opacity: 1; }

.vnote { margin: 0 14px 8px; padding: 8px 12px; border-radius: 10px; border: 2px solid var(--green); font-size: 13px; font-weight: 700; color: var(--green); }
.vnote.bad { border-color: var(--red); color: var(--red); }
.vemoji { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; padding: 8px 12px; border-top: 2px solid var(--line); background: var(--bg-dark); animation: v-up 0.2s ease both; }
@keyframes v-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.vemoji button { padding: 4px 0; border: 0; border-radius: 8px; background: none; font-size: 22px; line-height: 1.2; cursor: pointer; transition: transform 0.12s ease, background 0.12s ease; }
.vemoji button:hover { background: var(--panel); transform: scale(1.25); }
.vfile { display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-top: 2px solid var(--line); font-size: 13px; font-weight: 700; color: var(--green); }
.vfile span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vfile button { margin-left: auto; padding: 0; border: 0; background: none; font: inherit; color: var(--red); cursor: pointer; }
.vform { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 2px solid var(--line); background: var(--bg-dark); }
.vform.busy { opacity: 0.6; pointer-events: none; }
.vbtn { position: relative; flex: 0 0 42px; height: 42px; display: flex; align-items: center; justify-content: center; padding: 0; border: 2px solid var(--line); border-radius: 12px; background: var(--panel); font-size: 20px; cursor: pointer; overflow: hidden; transition: border-color 0.15s ease, transform 0.15s ease; }
.vbtn:hover { border-color: var(--green); transform: translateY(-2px); }
.vbtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.vinput { flex: 1 1 auto; min-width: 0; height: 42px; padding: 0 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--white); font: inherit; font-size: 16px; font-weight: 600; outline: none; }
.vinput:focus { border-color: var(--green); }
.vsend { flex: 0 0 48px; height: 42px; border: 0; border-radius: 12px; background: var(--green); color: #05080a; font-size: 18px; font-weight: 800; cursor: pointer; box-shadow: 0 0 22px rgba(0, 231, 1, 0.4); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.vsend:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 0 34px rgba(0, 231, 1, 0.6); }
.vsend:active { transform: scale(0.94); }

/* профиль участника */
dialog.vprofile { margin: auto; padding: 0; width: calc(100% - 32px); max-width: 360px; border: 2px solid rgba(245, 197, 66, 0.6); border-radius: 18px; background: var(--bg-dark); color: var(--white); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 50px rgba(245, 197, 66, 0.2); }
dialog.vprofile[open] { animation: v-open 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
dialog.vprofile::backdrop { background: rgba(3, 12, 18, 0.8); }
.vpin { padding: 24px 22px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.vpava { flex: 0 0 84px; width: 84px; height: 84px; border-width: 3px; cursor: default; }
.vpava i { font-size: 34px; }
.vpname { margin-top: 6px; font-size: 22px; font-weight: 800; word-break: break-word; }
.vpsub { font-size: 13px; font-weight: 600; color: var(--muted); }
.vptotal { margin: 12px 0 6px; width: 100%; padding: 14px; border: 2px solid var(--green); border-radius: 14px; background: rgba(0, 231, 1, 0.07); }
.vptotal span { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; color: var(--muted); }
.vptotal b { display: block; margin-top: 2px; font-size: 34px; font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }
.vprow { width: 100%; display: flex; justify-content: space-between; gap: 12px; padding: 6px 4px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--muted); }
.vprow b { color: var(--white); font-weight: 800; }
.vpin .btn { margin-top: 12px; width: 100%; padding: 11px; font-size: 15px; }

@media (max-width: 700px) {
  #view-chat section { padding: 10px 0 8px; }
  #view-chat .wrap { padding: 0 8px; }
  .vchat { height: calc(100vh - 150px); height: calc(100dvh - 150px); border-radius: 16px; }
  .vhead { padding: 10px 14px; }
  .vhead b { font-size: 16px; }
  .vlist { padding: 12px 10px 6px; gap: 8px; }
  .vmsg { max-width: 88%; }
  .vava { flex-basis: 32px; width: 32px; height: 32px; }
  .vtext { font-size: 15px; }
  .vpic img, .vvid { width: 240px; max-height: 300px; }
  .vemoji { grid-template-columns: repeat(9, 1fr); }
  .vform { gap: 6px; padding: 8px; }
  .vbtn { flex-basis: 40px; height: 40px; }
  .vsend { flex-basis: 44px; height: 40px; }
  .vinput { height: 40px; padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .vchat, .vmsg, .vemoji, dialog.vprofile[open], .vbadge, .vhead::after { animation: none; }
}
@media (max-width: 900px) { .vchat { min-height: 0; } }

/* телефон: чат — окно во весь видимый экран (верх и высоту выставляет chat.js по видимой области, см. fit) */
.vback { display: none; }
@media (max-width: 900px) {
  html.vchat-open, html.vchat-open body { overflow: hidden; overscroll-behavior: none; }
  /* Пока чат открыт, шапки сайта на странице просто нет, а чат — обычный блок во всю высоту экрана. Раньше он был «приклеен» поверх
     шапки, и iPhone при переходе из кабинета на мгновение показывал шапку раньше, чем успевал поставить приклеенное окно. */
  html.vchat-open header, html.vchat-open .subbar, html.vchat-open .fx-bg { display: none; }
  html.vchat-open #view-chat section { padding: 0; border: 0; }
  html.vchat-open #view-chat .wrap { padding: 0; max-width: none; }
  html.vchat-open .vchat {
    position: relative; z-index: 1; height: 100vh; height: 100dvh; min-height: 0;
    border: 0; border-radius: 0; box-shadow: none; animation: none; background: var(--bg);
  }
  html.vchat-open .vback {
    display: flex; align-items: center; justify-content: center; flex: 0 0 38px; height: 38px;
    border: 2px solid var(--line); border-radius: 11px; background: var(--panel); font-size: 20px; font-weight: 800; color: var(--white);
  }
  html.vchat-open .vhead { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  html.vchat-open .vform { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  html.vchat-open .fx-progress { display: none; }
}

/* голосовые сообщения */
.vaud { display: block; width: 260px; max-width: 100%; height: 40px; margin: 4px 0 2px; }
.vrec { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 2px solid var(--line); background: var(--bg-dark); }
.vrecdot { flex: 0 0 12px; height: 12px; border-radius: 50%; background: var(--red); animation: v-blink 1s ease-in-out infinite; }
@keyframes v-blink { 50% { opacity: 0.25; } }
.vrectime { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.vrechint { flex: 1 1 auto; font-size: 14px; font-weight: 600; color: var(--muted); }
.vrecno { padding: 0 14px; height: 42px; border: 2px solid var(--line); border-radius: 12px; background: var(--panel); font: inherit; font-size: 14px; font-weight: 800; color: var(--red); cursor: pointer; }
@media (max-width: 900px) {
  html.vchat-open .vrec { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .vaud { width: 220px; }
}
@media (max-width: 380px) { .vmic { display: flex; } .vform { gap: 4px; } }
@media (prefers-reduced-motion: reduce) { .vrecdot { animation: none; } }
