.im-pv {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    flex-direction: column;
    background: transparent;
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-sizing: border-box;
}

.im-pv--on { display: flex; }

html.im-pv-open, html.im-pv-open body { overflow: hidden; }
html.im-pv-open #chat-container { visibility: hidden; }

.im-pv__bgWrap {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background-color: #000;
    z-index: 1;
    overflow: hidden;
    opacity: 0;
}

.im-pv__bg {
    position: absolute;
    top: -100px; right: -100px; bottom: -100px; left: -100px;
    opacity: .6;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    transition: background-image .3s ease;
}

.im-pv--drag .im-pv__bg { transition: none; }

.im-pv__area {
    position: relative;
    overflow: hidden;
    touch-action: none;
    z-index: 2;
    flex: 1;
    min-height: 0;
    display: block;
}

.im-pv__slide {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    contain: layout paint;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.im-pv--drag .im-pv__slide { will-change: transform; }

.im-pv__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 2px;
    position: relative;
    z-index: 2;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: auto;
}

.im-pv__close,
.im-pv__menu,
.im-pv__count,
.im-pv__panel {
    opacity: var(--pv-ui, 1);
    transition: opacity .18s linear;
}

.im-pv__nav { opacity: var(--pv-ui, 1); }

.im-pv--zoomed .im-pv__nav { display: none !important; }
.im-pv--zoomed .im-pv__panel { opacity: 0; pointer-events: none; }
.im-pv__panel { transition: opacity .15s linear; }

.im-pv__close {
    position: absolute;
    top: calc(15px + env(safe-area-inset-top));
    right: calc(15px + env(safe-area-inset-right));
    z-index: 10001;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    background: rgba(0, 0, 0, .3);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    -webkit-tap-highlight-color: transparent;
}

.im-pv__count {
    position: absolute;
    top: calc(24px + env(safe-area-inset-top));
    left: calc(18px + env(safe-area-inset-left));
    z-index: 10001;
    display: none;
    padding: 5px 11px;
    border-radius: 13px;
    background: rgba(0, 0, 0, .35);
    color: #fff;
    font-size: 13px;
    line-height: 1;
}

.im-pv__nav {
    position: absolute;
    top: 0;
    bottom: 60px;
    width: 35%;
    z-index: 10000;
    display: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.im-pv__nav--left  { left: 0; }
.im-pv__nav--right { right: 0; }

.im-pv__spinner {
    position: absolute;
    z-index: 10000;
    top: 50%;
    left: 50%;
    margin: -20px 0 0 -20px;
    width: 40px;
    height: 40px;
    display: none;
    border: 3px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: im-pv-spin 1s infinite linear;
}
@keyframes im-pv-spin { to { transform: rotate(360deg); } }

.im-pv__panel {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 10001;
    display: none;
    padding: calc(40px) 15px calc(15px + env(safe-area-inset-bottom));
    background: linear-gradient(to bottom,
        rgba(0,0,0,0) 0%, rgba(0,0,0,.15) 15%, rgba(0,0,0,.33) 30%,
        rgba(0,0,0,.55) 50%, rgba(0,0,0,.75) 70%, rgba(0,0,0,.8) 85%,
        rgba(0,0,0,.9) 100%);

    pointer-events: none;
}

.im-pv__panel a,
.im-pv__panel .im-pv__desc { pointer-events: auto; }

.im-pv__author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.im-pv__ava {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}
.im-pv__who {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.im-pv .im-pv__name,
.im-pv .im-pv__name:link,
.im-pv .im-pv__name:visited,
.im-pv .im-pv__name:hover {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
.im-pv__time {
    font-size: 12px;
    color: rgba(255, 255, 255, .7);
    text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}

.im-pv__desc {
    font-size: 14px;
    line-height: 1.4;
    color: rgba(255, 255, 255, .9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, .5);

    max-height: 4.2em;
    overflow: hidden;
    word-break: break-word;
}

.im-pv__nav { bottom: 96px; }

.im-pv__menu {
    position: absolute;
    top: calc(15px + env(safe-area-inset-top));
    right: calc(69px + env(safe-area-inset-right));
    z-index: 10001;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    background: rgba(0, 0, 0, .3);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    -webkit-tap-highlight-color: transparent;
}

.im-pv__sheet {
    position: absolute;
    inset: 0;
    z-index: 10002;
}

.im-pv__sheetBack {
    position: absolute;
    inset: 0;
}

.im-pv__menuBox {
    position: absolute;
    top: calc(66px + env(safe-area-inset-top));
    right: calc(12px + env(safe-area-inset-right));
    min-width: 208px;
    max-width: calc(100vw - 24px);
    padding: 6px 0;
    border-radius: 12px;
    background: rgba(30, 30, 30, .92);
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .55);

    transform-origin: 100% 0;
    transform: scale(.85);
    opacity: 0;
    transition: transform .16s cubic-bezier(.2,.9,.3,1), opacity .16s linear;
}
.im-pv__sheet--on .im-pv__menuBox {
    transform: scale(1);
    opacity: 1;
}

.im-pv__item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 16px;
    border: 0;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.im-pv__item:active { background: rgba(255, 255, 255, .1); }

.im-pv__item--bad { color: #ff453a; }

.im-pv__ico {
    flex: 0 0 auto;
    display: block;
    opacity: .9;
}

.im-pv__itemText {
    flex: 1 1 auto;
    min-width: 0;
}

.im-pv__ask[hidden],
.im-pv__sheet[hidden] { display: none !important; }

.im-pv__ask {
    position: absolute;
    inset: 0;
    z-index: 10003;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.im-pv__askBack {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    opacity: 0;
    transition: opacity .2s ease;
}
.im-pv__ask--on .im-pv__askBack { opacity: 1; }

.im-pv__askBox {
    position: relative;
    width: 100%;
    max-width: 320px;
    padding: 18px 18px 10px;
    border-radius: 14px;
    background: #1c1c1e;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
    transform: scale(.92);
    opacity: 0;
    transition: transform .18s cubic-bezier(.2,.9,.3,1), opacity .18s linear;
}
.im-pv__ask--on .im-pv__askBox {
    transform: scale(1);
    opacity: 1;
}

.im-pv__askTitle {
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
}
.im-pv__askText {
    color: rgba(255, 255, 255, .7);
    font-size: 14px;
    line-height: 1.4;
}

.im-pv__check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
}
.im-pv__check input {
    width: 20px;
    height: 20px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: #ff453a;
}

.im-pv__askFoot {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 14px;
}
.im-pv__askBtn {
    padding: 10px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #0a84ff;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.im-pv__askBtn:active { background: rgba(255, 255, 255, .08); }
.im-pv__askBtn--bad { color: #ff453a; }

@media (hover: none) and (pointer: coarse) {
    .im-pv:not(.im-pv--touchnav) .im-pv__nav { display: none !important; }
}
