/* Окно звонка devandy.me. По умолчанию — в цветах devandy.me: тёмная карточка, лаймовый акцент, светлая тема —
   по настройке системы. Проект переопределяет переменные на своём контейнере, например
     .table-call .dc { --dc-accent: #f2a93b; --dc-bg: transparent; --dc-line: transparent; --dc-pad: 0; }

     --dc-bg, --dc-line            фон и рамка окна; transparent и --dc-pad: 0 — без своей карточки (внутри панели проекта)
     --dc-tile, --dc-tile-2        плитка участника без видео; обычные кнопки
     --dc-fg, --dc-muted           текст: основной и подсказки
     --dc-accent, --dc-on-accent   кнопка входа, подсветка говорящего; текст на кнопке входа
     --dc-danger, --dc-warn        выключенные микрофон и камера, выход; слабая связь
     --dc-radius, --dc-pad         скругление плиток; отступ внутри окна
     --dc-tile-min                 наименьшая ширина плитки, когда участников 7 и больше и в полосе под показанным крупно
     --dc-solo-max                 наибольшая ширина плитки, когда в звонке один
   Шрифт — шрифт страницы. */
.dc {
  --dc-bg: #0E1015;
  --dc-line: rgb(255 255 255 / .08);
  --dc-tile: #171A21;
  --dc-tile-2: rgb(255 255 255 / .08);
  --dc-fg: #F2F3F6;
  --dc-muted: #9AA1B1;
  --dc-accent: #C8F560;
  --dc-on-accent: #0B0D07;
  --dc-danger: #FF5F57;
  --dc-warn: #F2A93B;
  --dc-radius: 16px;
  --dc-pad: 12px;
  --dc-tile-min: 112px;
  --dc-solo-max: 760px;
  /* Производные: подсветка говорящего, светлота цветного фона плитки без видео, подсветка кнопки при наведении */
  --dc-ring: var(--dc-accent);
  --dc-glow: 24%;
  --dc-hover: rgb(255 255 255 / .14);
  --dc-ease: cubic-bezier(.2, .75, .12, 1);
  container: dc / inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: var(--dc-pad);
  border: 1px solid var(--dc-line);
  border-radius: calc(var(--dc-radius) + var(--dc-pad));
  background: var(--dc-bg);
  color: var(--dc-fg);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: light) {
  .dc {
    --dc-bg: #FFFFFF;
    --dc-line: rgb(14 16 22 / .09);
    --dc-tile: #EEEFEA;
    --dc-tile-2: rgb(14 16 22 / .06);
    --dc-fg: #0E1016;
    --dc-muted: #5E6472;
    --dc-danger: #D9372B;
    --dc-warn: #B86E00;
    /* Лайм на светлом почти не виден — подсветка говорящего темнее акцента */
    --dc-ring: color-mix(in srgb, var(--dc-accent) 58%, #000);
    --dc-glow: 86%;
    --dc-hover: rgb(14 16 22 / .1);
  }
}

.dc [hidden] { display: none !important; }
.dc-stage { position: relative; }

/* ---------- значки ---------- */

.dc-i { display: block; flex: none; width: 20px; height: 20px; }
.dc-i svg { display: block; width: 100%; height: 100%; }
.dc-spin svg { animation: dc-rot .8s linear infinite; }

/* ---------- приглашение войти ---------- */

.dc-lobby {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 36px 16px 30px;
  border-radius: var(--dc-radius);
  background: radial-gradient(55% 120% at 50% 0%, color-mix(in srgb, var(--dc-accent) 13%, transparent), transparent 70%);
  text-align: center;
}
.dc-lobby p { margin: 0; }

.dc-lobby-ico {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--dc-accent) 16%, transparent);
  color: var(--dc-ring);
}
.dc-lobby-ico .dc-i { width: 28px; height: 28px; }
/* Расходящиеся круги — «звонок ждёт» */
.dc-lobby-ico::before,
.dc-lobby-ico::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--dc-ring);
  border-radius: 50%;
  opacity: 0;
  animation: dc-ripple 3s var(--dc-ease) infinite;
}
.dc-lobby-ico::after { animation-delay: 1.5s; }
.dc[data-state="connecting"] .dc-lobby-ico::before,
.dc[data-state="connecting"] .dc-lobby-ico::after { animation-duration: 1.4s; }
.dc[data-state="connecting"] .dc-lobby-ico::after { animation-delay: .7s; }
.dc[data-state="error"] .dc-lobby-ico {
  background: color-mix(in srgb, var(--dc-danger) 15%, transparent);
  color: var(--dc-danger);
}
.dc[data-state="error"] .dc-lobby-ico::before,
.dc[data-state="error"] .dc-lobby-ico::after { display: none; }

.dc-lobby-title { font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.dc-lobby-hint { max-width: 30em; color: var(--dc-muted); font-size: 13.5px; }
.dc-lobby .dc-note { max-width: 32em; margin-top: 6px; font-size: 13.5px; }
.dc-lobby .dc-note.is-error { color: var(--dc-danger); }
.dc-lobby .dc-join { margin-top: 16px; }
.dc-join-alt {
  margin-top: 4px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--dc-muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  transition: color .2s;
}
.dc-join-alt:hover { color: var(--dc-fg); }
.dc-join-alt:focus-visible { outline: 2px solid var(--dc-ring); outline-offset: 2px; }

/* ---------- плитки: раскладка по числу участников (data-count ставит widget.js) ----------
   Один — во всю ширину, двое — рядом, трое-четверо — по два в ряд, пятеро-шестеро — по три, больше — сколько влезет
   по --dc-tile-min. На узком экране вдвоём — собеседник крупно, сам окошком в углу */

.dc-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--dc-tile-min), 1fr));
  gap: 8px;
}
.dc-tiles:empty { display: none; }
.dc-tiles[data-count="1"] { grid-template-columns: 1fr; width: 100%; max-width: var(--dc-solo-max); margin-inline: auto; }
.dc-tiles[data-count="2"],
.dc-tiles[data-count="3"],
.dc-tiles[data-count="4"] { grid-template-columns: repeat(2, 1fr); }
.dc-tiles[data-count="5"],
.dc-tiles[data-count="6"] { grid-template-columns: repeat(3, 1fr); }

.dc-tile {
  --dc-hue: 210;
  container: dc-tile / inline-size;
  position: relative;
  isolation: isolate;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--dc-radius);
  /* Без видео — фон в цвет участника, к краям уходит в цвет плитки */
  background: radial-gradient(circle at 50% 45%, hsl(var(--dc-hue) 42% var(--dc-glow)), var(--dc-tile) 78%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: dc-in .45s var(--dc-ease) both;
}
.dc-tile.has-video { background: #0A0B0E; }
/* Рамка и подсветка говорящего — поверх видео (у самой плитки её закрыло бы видео) */
.dc-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .07);
  pointer-events: none;
  transition: box-shadow .2s;
}
.dc-tile.is-speaking::after { box-shadow: inset 0 0 0 2px var(--dc-ring); }
.dc-tile:focus-visible { outline: 2px solid var(--dc-ring); outline-offset: 2px; }

.dc-video {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dc-tile.has-video .dc-video { display: block; }
/* Себя с фронтальной камеры видно как в зеркале; задняя камера — как есть */
.dc-tile.is-mirror .dc-video { transform: scaleX(-1); }

/* Кружок с буквами — когда камера выключена; пульсирует, пока человек говорит */
.dc-ava {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 64px;
  width: clamp(40px, 24cqi, 120px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(140deg, hsl(var(--dc-hue) 82% 76%), hsl(calc(var(--dc-hue) + 40) 72% 60%));
  box-shadow: 0 12px 32px -12px hsl(var(--dc-hue) 70% 25% / .7);
  color: rgb(11 13 7 / .82);
  font-size: 22px;
  font-size: clamp(14px, 8.5cqi, 42px);
  font-weight: 650;
  letter-spacing: .01em;
}
.dc-tile.has-video .dc-ava { display: none; }
/* Пока человек говорит, от кружка расходится тонкое кольцо */
.dc-ava::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 2px solid var(--dc-ring);
  border-radius: 50%;
  opacity: 0;
}
.dc-tile.is-speaking .dc-ava::after { animation: dc-talk 1.4s var(--dc-ease) infinite; }

/* Значки в углу: слабая связь, выключенный микрофон */
.dc-badges {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  gap: 6px;
}
.dc-badges .dc-i {
  display: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgb(10 11 14 / .55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.dc-badges .dc-i svg { width: 15px; height: 15px; }
.dc-tile.is-muted .dc-flag { display: grid; color: #FF8A82; }
.dc-tile.is-poor .dc-weak { display: grid; color: #F7C164; }

/* Подсказка «крупно» — при наведении мышью */
.dc-expand {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgb(10 11 14 / .55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  opacity: 0;
  transform: scale(.85);
  transition: opacity .2s, transform .25s var(--dc-ease);
  pointer-events: none;
}
.dc-expand .dc-i { width: 16px; height: 16px; }
.dc-expand .dc-i + .dc-i,
.dc.has-pin .dc-tile.is-pinned .dc-expand .dc-i:first-child { display: none; }
.dc.has-pin .dc-tile.is-pinned .dc-expand .dc-i + .dc-i { display: block; }
.dc-tiles[data-count="1"] .dc-expand { display: none; }
@media (hover: hover) {
  .dc-tile:hover .dc-expand { opacity: 1; transform: none; }
}
.dc-tile:focus-visible .dc-expand { opacity: 1; transform: none; }

/* Имя: стеклянная плашка; пока человек говорит — бегущие полоски */
.dc-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100% - 16px);
  padding: 4px 10px;
  border-radius: 10px;
  background: rgb(10 11 14 / .5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1.35;
}
.dc-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dc-eq { display: none; flex: none; align-items: flex-end; gap: 2px; height: 11px; }
.dc-eq i {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: var(--dc-accent);
  transform-origin: bottom;
  animation: dc-eq .9s ease-in-out infinite;
}
.dc-eq i:nth-child(2) { animation-delay: -.3s; }
.dc-eq i:nth-child(3) { animation-delay: -.6s; }
.dc-tile.is-speaking .dc-eq { display: flex; }

/* Крупно: во всю ширину и целиком (без обрезки), остальные — маленькими плитками по центру под ним */
.dc.has-pin .dc-tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: none;
}
.dc.has-pin .dc-tile { flex: none; width: clamp(var(--dc-tile-min), 16%, 180px); aspect-ratio: 4 / 3; }
.dc.has-pin .dc-tile.is-pinned { width: 100%; aspect-ratio: 16 / 9; max-height: 68vh; }
.dc.has-pin .dc-tile.is-pinned .dc-video { object-fit: contain; }

/* Вертикальное видео (телефон) на широкой плитке — целиком, по бокам фон */
@container dc (min-width: 480px) {
  .dc-tile.is-portrait .dc-video { object-fit: contain; }
}

/* ---------- узкое окно: телефон или боковая панель ---------- */
@container dc (max-width: 479px) {
  .dc-tile { aspect-ratio: 4 / 3; }
  .dc-tiles[data-count="3"] .dc-tile,
  .dc-tiles[data-count="4"] .dc-tile { aspect-ratio: 3 / 4; }
  .dc-tiles[data-count="5"],
  .dc-tiles[data-count="6"] { grid-template-columns: repeat(2, 1fr); }
  .dc-tiles[data-count="5"] .dc-tile,
  .dc-tiles[data-count="6"] .dc-tile { aspect-ratio: 1; }

  /* Вдвоём — как в обычном видеозвонке: собеседник крупно, себя — окошком в углу */
  .dc:not(.has-pin) .dc-tiles[data-count="2"] { position: relative; grid-template-columns: 1fr; }
  .dc:not(.has-pin) .dc-tiles[data-count="2"] .dc-tile:not(.is-local) { aspect-ratio: 3 / 4; max-height: 62vh; }
  .dc:not(.has-pin) .dc-tiles[data-count="2"] .dc-tile.is-local {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 4;
    width: 30%;
    border-radius: 12px;
    box-shadow: 0 10px 28px -6px rgb(0 0 0 / .6);
  }
  .dc:not(.has-pin) .dc-tiles[data-count="2"] .dc-tile.is-local .dc-label,
  .dc:not(.has-pin) .dc-tiles[data-count="2"] .dc-tile.is-local .dc-badges { display: none; }

  /* Крупно на телефоне: показанный — вертикально, остальные — по три в ряд маленькими квадратами */
  .dc.has-pin .dc-tile { width: calc((100% - 16px) / 3); aspect-ratio: 1; }
  .dc.has-pin .dc-tile.is-pinned { width: 100%; aspect-ratio: 3 / 4; max-height: 58vh; }

  .dc-lobby { padding: 30px 12px 24px; }
  .dc-lobby .dc-join { align-self: stretch; }
}

/* ---------- запись встречи ---------- */

/* «Идёт запись» — видят все участники, пока ведущий записывает */
.dc-recchip {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  background: rgb(10 11 14 / .72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  transform: translateX(-50%);
  pointer-events: none;
}
.dc-recchip::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #FF4D45;
  box-shadow: 0 0 0 0 rgb(255 77 69 / .6);
  animation: dc-recpulse 1.6s ease-out infinite;
}

/* Брошенная запись (вкладка закрылась во время записи): сохранить или удалить */
.dc-recover { display: grid; gap: 8px; }
.dc-recover-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 10px 10px 14px;
  border: 1px solid color-mix(in srgb, var(--dc-warn) 40%, transparent);
  border-radius: var(--dc-radius);
  background: color-mix(in srgb, var(--dc-warn) 10%, transparent);
}
.dc-recover-text { flex: 1 1 240px; margin: 0; font-size: 13.5px; }
.dc-recover-text b { font-weight: 650; }
.dc-recover .dc-save { background: var(--dc-accent); color: var(--dc-on-accent); }
.dc-recover .dc-drop.is-sure { background: var(--dc-danger); color: #fff; }

/* Видео для записи: у каждого участника — свой элемент размером с его клетку на записи. Невидим и не мешает
   нажатиям, но лежит в окне — по его размеру LiveKit выбирает качество видео */
.dc-rec-sinks { position: fixed; left: 0; top: 0; z-index: -1; width: 0; height: 0; opacity: 0; pointer-events: none; }
.dc-rec-sink { position: absolute; left: 0; top: 0; object-fit: cover; }

/* ---------- сообщения ---------- */

.dc-note { margin: 0; color: var(--dc-muted); }
/* В звонке — всплывающей строкой поверх плиток, уходит сама или по нажатию */
.dc-stage > .dc-note {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 6;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 9px 14px;
  border-radius: 12px;
  background: rgb(10 11 14 / .8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px -12px rgb(0 0 0 / .6);
  color: #fff;
  font-size: 13px;
  transform: translateX(-50%);
  cursor: pointer;
  animation: dc-toast .35s var(--dc-ease) both;
}
.dc-stage > .dc-note.is-error {
  box-shadow: inset 0 0 0 1px rgb(255 95 87 / .55), 0 12px 30px -12px rgb(0 0 0 / .6);
  color: #FFC9C4;
}
.dc-stage > .dc-note.is-busy { top: 12px; bottom: auto; cursor: default; }
.dc-note.is-busy::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 9px;
  vertical-align: -1px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: dc-rot .8s linear infinite;
}

/* ---------- панель звонка ---------- */

.dc-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.dc-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding-left: 4px;
  color: var(--dc-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.dc-live {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dc-ring);
  box-shadow: 0 0 10px color-mix(in srgb, var(--dc-ring) 70%, transparent);
}
.dc[data-state="reconnecting"] .dc-live { background: var(--dc-warn); box-shadow: none; animation: dc-blink 1s ease-in-out infinite; }
.dc-time { color: var(--dc-fg); font-weight: 550; }
.dc-count { display: inline-flex; align-items: center; gap: 5px; }
.dc-count .dc-i { width: 16px; height: 16px; }
.dc-controls { display: flex; align-items: center; justify-content: center; gap: 8px; }
.dc-bar .dc-leave { justify-self: end; }

/* ---------- кнопки ---------- */

.dc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--dc-tile-2);
  color: var(--dc-fg);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s, box-shadow .25s, transform .25s var(--dc-ease), filter .2s;
  -webkit-tap-highlight-color: transparent;
}
.dc-btn:focus-visible { outline: 2px solid var(--dc-ring); outline-offset: 2px; }
.dc-btn:active { transform: scale(.95); }
.dc-btn:disabled { cursor: default; opacity: .75; transform: none; }
.dc-ico { width: 46px; padding: 0; }
@media (hover: hover) {
  .dc-ico:not(.is-off):not(.dc-leave):hover { background: var(--dc-hover); }
  .dc-btn.is-off:hover,
  .dc-leave:hover,
  .dc-sound:hover { filter: brightness(1.08); }
  .dc-join:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 36px -12px color-mix(in srgb, var(--dc-accent) 90%, transparent);
  }
}

.dc-join {
  min-height: 48px;
  padding: 0 26px;
  background: var(--dc-accent);
  color: var(--dc-on-accent);
  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--dc-accent) 85%, transparent);
}
.dc-btn.is-off { background: var(--dc-danger); color: #fff; }
.dc-leave { width: 62px; background: var(--dc-danger); color: #fff; }
.dc-leave .dc-i { width: 24px; height: 24px; }
.dc-sound { background: var(--dc-warn); color: #1F1300; }

/* Запись встречи (ведущий): красная точка; во время записи — красная кнопка «■ 12:34» */
.dc-rec .dc-i { color: var(--dc-danger); }
.dc-rec.is-on {
  width: auto;
  gap: 8px;
  padding: 0 16px 0 14px;
  background: var(--dc-danger);
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.dc-rec.is-on .dc-i { width: 16px; height: 16px; color: #fff; }
.dc-btn.dc-rec.is-on:hover { filter: brightness(1.08); }
.dc-sm { min-height: 34px; padding: 0 14px; font-size: 13px; }
.dc-ico.dc-sm { width: 34px; }

@container dc (max-width: 479px) {
  .dc-bar { display: flex; justify-content: center; gap: 10px; }
  .dc-meta { display: none; }
  .dc-btn { min-height: 50px; }
  .dc-ico { width: 50px; }
  .dc-leave { width: 64px; }
}

/* ---------- движение ---------- */

@keyframes dc-in { from { opacity: 0; transform: scale(.96); } }
@keyframes dc-toast { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes dc-rot { to { transform: rotate(360deg); } }
@keyframes dc-blink { 50% { opacity: .35; } }
@keyframes dc-recpulse {
  0% { box-shadow: 0 0 0 0 rgb(255 77 69 / .6); }
  100% { box-shadow: 0 0 0 8px rgb(255 77 69 / 0); }
}
@keyframes dc-ripple {
  0% { opacity: .55; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.9); }
}
@keyframes dc-eq {
  0%, 100% { transform: scaleY(.3); }
  50% { transform: scaleY(1); }
}
@keyframes dc-talk {
  0% { opacity: .9; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.45); }
}

@media (prefers-reduced-motion: reduce) {
  .dc *,
  .dc *::before,
  .dc *::after { animation: none !important; transition: none !important; }
  .dc-spin svg,
  .dc-note.is-busy::before { animation: dc-rot 1.6s linear infinite !important; }
}
