body.vseti-media-viewer-open { overflow: hidden !important; }

.vseti-media-viewer {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: #000;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    box-sizing: border-box;
    transition: padding .2s ease;
}

.vseti-media-viewer.is-open { display: grid; }
.vseti-media-viewer [hidden] { display: none !important; }

.vseti-media-viewer__top {
    min-height: 68px;
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr) 50px;
    align-items: center;
    gap: 12px;
    padding: max(10px, env(safe-area-inset-top)) 16px 10px;
    background: #000;
}

.vseti-media-viewer button,
.vseti-media-viewer label { -webkit-tap-highlight-color: transparent; }

.vseti-media-viewer__round,
.vseti-media-viewer__action {
    border: 0;
    color: #fff;
    background: #1d1d1f;
    cursor: pointer;
}

.vseti-media-viewer__round {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 18px;
}

.vseti-media-viewer__counter {
    justify-self: center;
    color: #a7a7ad;
    font-size: 14px;
    font-weight: 700;
}

.vseti-media-viewer__more-wrap { position: relative; }

.vseti-media-viewer__menu {
    position: absolute;
    top: 54px;
    right: 0;
    z-index: 8;
    min-width: 214px;
    overflow: hidden;
    border: 1px solid #343439;
    border-radius: 13px;
    background: #1c1c1e;
    box-shadow: 0 14px 40px rgba(0,0,0,.48);
}

.vseti-media-viewer__menu button {
    width: 100%;
    min-height: 47px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 14px;
    border: 0;
    border-bottom: 1px solid #343439;
    background: transparent;
    color: #fff;
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.vseti-media-viewer__menu button:last-child { border-bottom: 0; }

.vseti-media-viewer__stage,
.vseti-media-viewer__media {
    position: relative;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

.vseti-media-viewer__stage { touch-action: pan-y; }
.vseti-media-viewer__media { display: grid; place-items: center; }

.vseti-media-viewer__media img,
.vseti-media-viewer__media video {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    transform: none !important;
    background: #000;
}

.vseti-media-viewer__arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    background: rgba(29,29,31,.82);
    color: #fff;
    cursor: pointer;
    font-size: 17px;
}

.vseti-media-viewer__arrow--prev { left: 16px; }
.vseti-media-viewer__arrow--next { right: 16px; }

.vseti-media-viewer__bottom {
    width: min(100%, 900px);
    justify-self: center;
    padding: 8px 16px max(12px, env(safe-area-inset-bottom));
    background: #000;
}

.vseti-media-viewer__author {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    padding: 0 2px 7px;
}

.vseti-media-viewer__avatar,
.vseti-media-viewer__composer-avatar,
.vseti-media-viewer__comment-avatar {
    overflow: hidden;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #29292d;
    color: #aaa;
    font-weight: 800;
}

.vseti-media-viewer__avatar { width: 41px; height: 41px; flex: 0 0 41px; }
.vseti-media-viewer__avatar img,
.vseti-media-viewer__composer-avatar img,
.vseti-media-viewer__comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.vseti-media-viewer__author-copy { min-width: 0; }
.vseti-media-viewer__name { display: block; overflow: hidden; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.vseti-media-viewer__username { display: block; margin-top: 2px; color: #96969d; font-size: 13px; }

.vseti-media-viewer__actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.vseti-media-viewer__action {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 999px;
    font-size: 17px;
    font-weight: 800;
}

.vseti-media-viewer__action.is-liked i { color: #ff2d55; }

.vseti-media-viewer__video-controls {
    min-height: 48px;
    display: grid;
    grid-template-columns: 38px auto minmax(80px, 1fr) auto 42px 38px 38px;
    align-items: center;
    gap: 7px;
    margin-top: 7px;
    border-top: 1px solid #29292d;
    padding-top: 7px;
}

.vseti-media-viewer__video-controls button {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
}

.vseti-media-viewer__video-controls [data-video-action="speed"] {
    width: 42px;
    border-radius: 10px;
    font-weight: 800;
}

.vseti-media-viewer__time { color: #c2c2c7; font-size: 12px; font-variant-numeric: tabular-nums; }
.vseti-media-viewer__progress { width: 100%; min-width: 0; accent-color: #fff; cursor: pointer; }

.vseti-media-viewer__comments {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 20;
    width: min(760px, 100%);
    height: min(54dvh, 680px);
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    transform: translate(-50%, 105%);
    overflow: hidden;
    border: 1px solid #303036;
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    background: #111113;
    box-shadow: 0 -20px 60px rgba(0,0,0,.65);
    transition: transform .22s ease-out;
}

.vseti-media-viewer__comments.is-open { transform: translate(-50%, 0); }
.vseti-media-viewer__comments.is-expanded { height: calc(100dvh - 12px); }
.vseti-media-viewer__sheet-handle { width: 38px; height: 4px; margin: 7px auto 2px; border-radius: 999px; background: #56565d; }

.vseti-media-viewer__comments-head {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 14px 7px;
    border-bottom: 1px solid #303036;
}

.vseti-media-viewer__comments-head strong { font-size: 17px; }
.vseti-media-viewer__comments-head strong span { color: #929299; font-size: 13px; font-weight: 650; }
.vseti-media-viewer__comments-tools { display: flex; align-items: center; gap: 2px; }
.vseti-media-viewer__sort-wrap { position: relative; }
.vseti-media-viewer__sort-menu {
    position: absolute;
    z-index: 5;
    top: 40px;
    right: 0;
    min-width: 184px;
    overflow: hidden;
    border: 1px solid #303036;
    border-radius: 13px;
    background: #18181b;
    box-shadow: 0 12px 38px rgba(0,0,0,.55);
}
.vseti-media-viewer__sort-menu[hidden] { display: none; }
.vseti-media-viewer__sort-menu button:hover,
.vseti-media-viewer__sort-menu button.is-active { color: #1d9bf0; background: #202024; }
.vseti-media-viewer__comments-head button,
.vseti-media-viewer__reply button,
.vseti-media-viewer__comment-preview button {
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
}
.vseti-media-viewer__comments-head button { width: 36px; height: 36px; font-size: 19px; }
.vseti-media-viewer__comments-head .vseti-media-viewer__sort-menu button {
    display: block;
    width: 100%;
    height: auto;
    min-height: 42px;
    padding: 11px 13px;
    border-radius: 0;
    font-size: 14px;
    line-height: 1.3;
    text-align: left;
    white-space: nowrap;
}

.vseti-media-viewer__comment-composer {
    padding: 8px 12px;
    border-bottom: 1px solid #303036;
    background: #111113;
}

.vseti-media-viewer__composer-row { display: flex; align-items: flex-end; gap: 8px; }
.vseti-media-viewer__composer-avatar { width: 32px; height: 32px; flex: 0 0 32px; margin-bottom: 3px; font-size: 12px; }

.vseti-media-viewer__composer-box {
    min-width: 0;
    min-height: 40px;
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding: 3px 4px 3px 9px;
    border: 1px solid #3a3a40;
    border-radius: 18px;
    background: #1c1c1f;
}

.vseti-media-viewer__composer-box label,
.vseti-media-viewer__composer-box button {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #929299;
    cursor: pointer;
}

.vseti-media-viewer__composer-box button.is-ready { background: #1d9bf0; color: #fff; }
.vseti-media-viewer__composer-box textarea {
    min-width: 0;
    min-height: 31px;
    max-height: 84px;
    flex: 1;
    padding: 6px 2px 4px;
    border: 0;
    outline: 0;
    resize: none;
    background: transparent;
    color: #fff;
    font: inherit;
    line-height: 1.35;
    user-select: text;
    -webkit-user-select: text;
}

.vseti-media-viewer__reply {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 3px 6px 40px;
    color: #8dcef9;
    font-size: 12px;
}
.vseti-media-viewer__reply span { flex: 1; }

.vseti-media-viewer__comment-preview { position: relative; width: 58px; height: 58px; margin: 0 0 7px 40px; }
.vseti-media-viewer__comment-preview img { width: 100%; height: 100%; border-radius: 10px; object-fit: cover; }
.vseti-media-viewer__comment-preview button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: #303036; }
.vseti-media-viewer__guest { padding: 7px; text-align: center; color: #96969d; font-size: 13px; }

.vseti-media-viewer__comment-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.vseti-media-viewer__comment {
    display: flex;
    gap: 9px;
    padding: 11px 14px;
    border-bottom: 1px solid #29292d;
}
.vseti-media-viewer__comment.reply { margin-left: 38px; padding-left: 9px; border-left: 2px solid #303036; }
.vseti-media-viewer__comment-avatar { width: 36px; height: 36px; flex: 0 0 36px; font-size: 12px; }
.vseti-media-viewer__comment.reply .vseti-media-viewer__comment-avatar { width: 29px; height: 29px; flex-basis: 29px; }
.vseti-media-viewer__comment-body { min-width: 0; flex: 1; }
.vseti-media-viewer__comment-head { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 13px; }
.vseti-media-viewer__comment-head strong { max-width: 38%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vseti-media-viewer__comment-head span,
.vseti-media-viewer__comment-head time { min-width: 0; overflow: hidden; color: #8e8e95; text-overflow: ellipsis; white-space: nowrap; }
.vseti-media-viewer__comment-head time { margin-left: auto; font-size: 11px; }
.vseti-media-viewer__comment-text { margin-top: 3px; overflow-wrap: anywhere; font-size: 14px; line-height: 1.35; }
.vseti-media-viewer__mention { color: #1d9bf0; }
.vseti-media-viewer__comment-photo { max-width: 190px; max-height: 180px; margin-top: 7px; border: 1px solid #303036; border-radius: 11px; object-fit: contain; }
.vseti-media-viewer__comment-actions { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.vseti-media-viewer__comment-action { border: 0; padding: 3px 0; display: inline-flex; align-items: center; gap: 5px; background: transparent; color: #929299; cursor: pointer; font-size: 12px; }
.vseti-media-viewer__comment-action.active { color: #1d9bf0; }
.vseti-media-viewer__comment-action.dislike.active,
.vseti-media-viewer__comment-action.danger { color: #ff453a; }
.vseti-media-viewer__replies { margin: 3px 14px 7px 59px; border: 0; padding: 4px 7px; background: transparent; color: #1d9bf0; cursor: pointer; font-weight: 650; }
.vseti-media-viewer__comments-loading,
.vseti-media-viewer__comments-empty { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: #929299; text-align: center; }
.vseti-media-viewer__comments-empty strong { color: #fff; }

@media (hover: hover) {
    .vseti-media-viewer button:hover { background-color: #2b2b2f; }
    .vseti-media-viewer__comment-action:hover,
    .vseti-media-viewer__replies:hover { background: transparent; color: #55b8f7; }
}

@media (max-width: 700px) {
    .vseti-media-viewer__top { min-height: 60px; padding-left: 12px; padding-right: 12px; }
    .vseti-media-viewer__round { width: 44px; height: 44px; }
    .vseti-media-viewer__arrow { display: none; }
    .vseti-media-viewer__bottom { padding: 7px 12px max(9px, env(safe-area-inset-bottom)); }
    .vseti-media-viewer__actions { gap: 8px; }
    .vseti-media-viewer__action { min-height: 43px; }
    .vseti-media-viewer__video-controls { grid-template-columns: 36px minmax(72px, 1fr) 38px 36px 36px; gap: 5px; }
    .vseti-media-viewer__video-controls [data-video-time] { display: none; }
    .vseti-media-viewer__comments { width: 100%; height: 50dvh; border-inline: 0; border-radius: 22px 22px 0 0; }
    .vseti-media-viewer__comment { padding-inline: 11px; }
    .vseti-media-viewer__comment.reply { margin-left: 28px; }
}

@media (min-width: 901px), (orientation: landscape) and (min-width: 640px) {
    .vseti-media-viewer.comments-open { padding-left: clamp(310px, 29vw, 420px); }
    .vseti-media-viewer__comments,
    .vseti-media-viewer__comments.is-expanded {
        left: 0;
        top: 0;
        bottom: 0;
        width: clamp(310px, 29vw, 420px);
        height: 100dvh;
        transform: translateX(-105%);
        border: 0;
        border-right: 1px solid #303036;
        border-radius: 0 18px 18px 0;
        box-shadow: 18px 0 50px rgba(0,0,0,.45);
    }
    .vseti-media-viewer__comments.is-open { transform: translateX(0); }
    .vseti-media-viewer__sheet-handle { display: none; }
    .vseti-media-viewer__comments-head { padding-top: max(8px, env(safe-area-inset-top)); }
    .vseti-media-viewer__top {
        position: absolute;
        inset: 0 0 auto;
        z-index: 5;
        background: linear-gradient(#000c, transparent);
    }
    .vseti-media-viewer.is-open { grid-template-rows: minmax(0, 1fr) auto; }
    .vseti-media-viewer__stage { grid-row: 1; }
    .vseti-media-viewer__bottom { grid-row: 2; }
}

@media (orientation: landscape) and (max-height: 520px) {
    .vseti-media-viewer__author { display: none; }
    .vseti-media-viewer__bottom { padding-top: 4px; padding-bottom: max(4px, env(safe-area-inset-bottom)); }
    .vseti-media-viewer__action { min-height: 38px; }
}
