/* LiveKit / Drops call screens — desktop + mobile */

.tmn-call {
    --tmn-call-bg: #000000;
    --tmn-call-fg: #ffffff;
    --tmn-call-muted: rgba(255, 255, 255, 0.62);
    --tmn-call-speak: #2ee56b;
    --tmn-call-end: #e53935;
    --tmn-call-ctrl: rgba(48, 48, 52, 0.92);
    --tmn-call-ctrl-active: rgba(72, 72, 78, 0.95);
    --tmn-call-bar: rgba(18, 18, 20, 0.72);
    --tmn-call-ripple: rgba(64, 140, 255, 0.35);
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    flex-direction: column;
    background: var(--tmn-call-bg);
    color: var(--tmn-call-fg);
    overflow: hidden;
}

.tmn-call__desktop-brand {
    position: absolute;
    top: 22px;
    left: 28px;
    z-index: 5;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.tmn-call__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
}

.tmn-call__brand img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.tmn-call__top,
.tmn-call__mobile-top .tmn-call__top {
    position: relative;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 8px;
    flex-shrink: 0;
}

.tmn-call--direct-audio .tmn-call__mobile-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 4;
}

.tmn-call__top-left,
.tmn-call__top-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.tmn-call__top-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tmn-call__top-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tmn-call__top-sub {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--tmn-call-muted);
}

.tmn-call__top-sub em {
    font-style: normal;
    color: var(--tmn-call-fg);
}

.tmn-call__count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--tmn-call-muted);
}

.tmn-call__icon-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--tmn-call-fg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.tmn-call__icon-btn:hover,
.tmn-call__icon-btn:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.tmn-call__stage {
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

.tmn-call__stage--direct-audio {
    align-items: center;
    justify-content: center;
    padding: 72px 24px 140px;
    text-align: center;
}

.tmn-call__avatar-wrap {
    position: relative;
    width: 168px;
    height: 168px;
    display: grid;
    place-items: center;
    margin-bottom: 28px;
}

.tmn-call__avatar {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    z-index: 1;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.tmn-call__ripple {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--tmn-call-ripple);
    animation: tmn-call-ripple 2.4s ease-out infinite;
}

.tmn-call__ripple--delay {
    animation-delay: 0.8s;
}

.tmn-call__ripple--delay-2 {
    animation-delay: 1.6s;
}

@keyframes tmn-call-ripple {
    0% {
        transform: scale(0.72);
        opacity: 0.85;
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

.tmn-call__name {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 650;
    letter-spacing: 0.01em;
}

.tmn-call__status {
    margin: 10px 0 0;
    color: var(--tmn-call-muted);
    font-size: 0.95rem;
}

.tmn-call__timer {
    margin: 8px 0 0;
    font-size: 0.95rem;
    color: var(--tmn-call-fg);
    font-variant-numeric: tabular-nums;
}

.tmn-call__stage--direct-video {
    flex: 1;
}

.tmn-call__remote-video,
.tmn-call__video-fill,
.tmn-call__video-fallback {
    position: absolute;
    inset: 0;
}

.tmn-call__video-fill,
.tmn-call__pip-fill,
.tmn-call__tile-media {
    background-size: cover;
    background-position: center;
    background-color: #1a1a1a;
}

.tmn-call__video-fallback {
    display: grid;
    place-items: center;
    background: #0a0a0a;
}

.tmn-call__video-fallback img {
    width: min(42vw, 220px);
    height: min(42vw, 220px);
    border-radius: 50%;
    object-fit: cover;
}

.tmn-call__pip {
    position: absolute;
    right: 18px;
    bottom: 118px;
    width: 118px;
    height: 168px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    z-index: 3;
    background: #111;
}

.tmn-call__pip-fill,
.tmn-call__pip-off {
    width: 100%;
    height: 100%;
}

.tmn-call__pip-off {
    display: grid;
    place-items: center;
    color: var(--tmn-call-muted);
    background: #1c1c1c;
}

.tmn-call__stage--group-audio {
    padding: 12px 24px 128px;
    justify-content: center;
}

.tmn-call__avatar-grid {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    width: min(720px, 100%);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px 18px;
    justify-items: center;
}

.tmn-call__grid-person {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 140px;
}

.tmn-call__grid-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    padding: 3px;
    background: transparent;
}

.tmn-call__grid-person.is-speaking .tmn-call__grid-avatar {
    background: linear-gradient(135deg, var(--tmn-call-speak), #8affb0);
    box-shadow: 0 0 0 4px rgba(46, 229, 107, 0.18), 0 0 24px rgba(46, 229, 107, 0.35);
}

.tmn-call__grid-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 3px solid #000;
}

.tmn-call__grid-name {
    font-size: 0.86rem;
    text-align: center;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.92);
}

.tmn-call__speak-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
    height: 14px;
}

.tmn-call__speak-bars i {
    width: 3px;
    height: 6px;
    border-radius: 2px;
    background: var(--tmn-call-speak);
    display: block;
    animation: tmn-call-bar 0.9s ease-in-out infinite;
}

.tmn-call__speak-bars i:nth-child(2) {
    animation-delay: 0.12s;
    height: 11px;
}

.tmn-call__speak-bars i:nth-child(3) {
    animation-delay: 0.24s;
    height: 8px;
}

.tmn-call__speak-bars i:nth-child(4) {
    animation-delay: 0.36s;
    height: 12px;
}

@keyframes tmn-call-bar {
    0%,
    100% {
        transform: scaleY(0.45);
    }
    50% {
        transform: scaleY(1);
    }
}

.tmn-call__stage--group-video {
    padding: 8px 14px 118px;
}

.tmn-call__video-grid {
    height: 100%;
    display: grid;
    grid-template-columns: repeat(var(--tmn-call-cols, 3), minmax(0, 1fr));
    gap: 8px;
}

.tmn-call__tile {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #151515;
    min-height: 0;
}

.tmn-call__tile.is-speaking {
    box-shadow: inset 0 0 0 2px var(--tmn-call-speak);
}

.tmn-call__tile-media {
    position: absolute;
    inset: 0;
}

.tmn-call__tile-name {
    position: absolute;
    left: 10px;
    bottom: 8px;
    z-index: 1;
    font-size: 0.78rem;
    font-weight: 500;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.tmn-call__footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.55) 38%, rgba(0, 0, 0, 0.85) 100%);
}

.tmn-call__bar {
    margin: 0 auto;
    width: min(560px, 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 18px;
    padding: 14px 18px;
    border-radius: 22px;
    background: var(--tmn-call-bar);
    backdrop-filter: blur(12px);
}

.tmn-call__ctrl {
    border: 0;
    background: transparent;
    color: var(--tmn-call-fg);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0;
    min-width: 56px;
}

.tmn-call__ctrl-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--tmn-call-ctrl);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    transition: background 0.15s ease, transform 0.15s ease;
}

.tmn-call__ctrl.is-active .tmn-call__ctrl-icon {
    background: var(--tmn-call-ctrl-active);
}

.tmn-call__ctrl.is-danger .tmn-call__ctrl-icon {
    width: 64px;
    height: 64px;
    background: var(--tmn-call-end);
    font-size: 1.25rem;
    transform: rotate(135deg);
}

.tmn-call__ctrl.is-large {
    margin: 0 4px;
}

.tmn-call__ctrl-label {
    font-size: 0.72rem;
    color: var(--tmn-call-muted);
    white-space: nowrap;
}

.tmn-call__ctrl:hover .tmn-call__ctrl-icon,
.tmn-call__ctrl:focus-visible .tmn-call__ctrl-icon {
    filter: brightness(1.12);
    outline: none;
}

.tmn-call__more-sheet {
    position: absolute;
    right: 16px;
    bottom: 118px;
    z-index: 6;
    min-width: 180px;
    padding: 8px;
    border-radius: 12px;
    background: rgba(28, 28, 30, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tmn-call__more-sheet button {
    border: 0;
    background: transparent;
    color: #fff;
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
}

.tmn-call__more-sheet button:hover {
    background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 991.98px) {
    .tmn-call__avatar-wrap {
        width: 150px;
        height: 150px;
    }

    .tmn-call__avatar {
        width: 118px;
        height: 118px;
    }

    .tmn-call__name {
        font-size: 1.4rem;
    }

    .tmn-call__stage--direct-audio {
        padding: 96px 20px 150px;
    }

    .tmn-call__pip {
        width: 92px;
        height: 132px;
        right: 14px;
        bottom: 128px;
        border-radius: 12px;
    }

    .tmn-call__avatar-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 20px 10px;
        width: 100%;
    }

    .tmn-call__grid-avatar {
        width: 78px;
        height: 78px;
    }

    .tmn-call__bar {
        gap: 10px;
        padding: 12px 10px;
        width: 100%;
        border-radius: 18px;
    }

    .tmn-call__ctrl {
        min-width: 0;
        flex: 1;
    }

    .tmn-call__ctrl-icon {
        width: 46px;
        height: 46px;
        font-size: 0.95rem;
    }

    .tmn-call__ctrl.is-danger .tmn-call__ctrl-icon {
        width: 56px;
        height: 56px;
    }

    .tmn-call__ctrl-label {
        font-size: 0.65rem;
    }

    .tmn-call__stage--group-video {
        padding: 4px 8px 124px;
    }

    .tmn-call__video-grid {
        gap: 6px;
    }

    .tmn-call__tile {
        border-radius: 8px;
    }

    .tmn-call--direct-video .tmn-call__top,
    .tmn-call--group-audio .tmn-call__top,
    .tmn-call--group-video .tmn-call__top {
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
    }
}

@media (min-width: 992px) {
    .tmn-call--direct-audio .tmn-call__mobile-top {
        display: none;
    }

    .tmn-call--direct-video .tmn-call__top,
    .tmn-call--group-audio .tmn-call__top,
    .tmn-call--group-video .tmn-call__top {
        padding: 28px 32px 12px;
    }

    .tmn-call--direct-video .tmn-call__top-left .tmn-call__icon-btn.d-lg-none,
    .tmn-call--group-audio .tmn-call__top-left .tmn-call__icon-btn.d-lg-none {
        display: none !important;
    }

    .tmn-call__pip {
        width: 140px;
        height: 196px;
        right: 28px;
        bottom: 132px;
    }

    .tmn-call__stage--group-audio {
        padding-top: 48px;
    }

    .tmn-call__grid-avatar {
        width: 110px;
        height: 110px;
    }

    .tmn-call__stage--group-video {
        padding: 8px 24px 130px;
    }

    .tmn-call__video-grid {
        gap: 10px;
    }
}

body:has(.tmn-call) {
    overflow: hidden;
}

.tmn-call__video-el {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #111;
    display: block;
}

.tmn-call__video-el--local {
    transform: scaleX(-1);
}

.tmn-call__remote-video .tmn-call__video-fallback {
    pointer-events: none;
}

.tmn-call__bar--incoming .tmn-call__ctrl:last-child .tmn-call__ctrl-icon {
    background: #2ee56b;
    color: #06140a;
    transform: none;
}

.tmn-call__bar--incoming .tmn-call__ctrl.is-danger .tmn-call__ctrl-icon {
    transform: rotate(135deg);
}

.tmn-call__error {
    margin-top: 12px;
    color: #ff8a80;
    font-size: 0.9rem;
}

.messages-chat__bubble.is-call {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.messages-chat__call-card {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 180px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.messages-chat__bubble.is-mine .messages-chat__call-card {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.18);
    color: inherit;
}

.messages-chat__call-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.08);
}

.messages-chat__call-card.is-missed .messages-chat__call-card-icon,
.messages-chat__call-card.is-declined .messages-chat__call-card-icon {
    color: #e53935;
}

.messages-chat__call-card-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.2;
}

.messages-chat__call-card-meta strong {
    font-size: 0.92rem;
    font-weight: 600;
}

.messages-chat__call-card-meta small {
    opacity: 0.72;
    font-size: 0.75rem;
}

.tmn-call__error--bar {
    max-width: min(560px, 100%);
    margin: 0 auto 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(229, 57, 53, 0.18);
    border: 1px solid rgba(229, 57, 53, 0.35);
    color: #ffc9c6;
    font-size: 0.78rem;
    line-height: 1.35;
    text-align: center;
}

.tmn-call__billing {
    margin: 0 0 10px;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
}

.tmn-call__ctrl.is-disabled,
.tmn-call__ctrl:disabled {
    opacity: 0.45;
    pointer-events: none;
}
