/* 看大图：角色立绘和聊天照片共用（PD-CLIENT-015）。底色始终是深色，浅色 / 深色模式下都一样 */

.pview {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: calc(56px + env(safe-area-inset-top, 0px)) 14px calc(40px + env(safe-area-inset-bottom, 0px));
    background: rgba(18, 11, 15, 0.95);
    opacity: 0;
    transition: opacity 0.16s ease-out;
    -webkit-tap-highlight-color: transparent;
}

.pview.on {
    opacity: 1;
}

.pview[hidden] {
    display: none !important;
}

.pview-stage {
    position: relative;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 缩放、拖动都由脚本处理，不让浏览器自己缩放整页或回退 */
    touch-action: none;
    cursor: zoom-in;
    overflow: visible;
}

.pview.zoomed .pview-stage {
    cursor: grab;
}

.pview.zoomed .pview-stage:active {
    cursor: grabbing;
}

.pview-img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 14px;
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.62);
    opacity: 0;
    transform: scale(0.985);
    transform-origin: center center;
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    will-change: transform;
}

.pview-img.on {
    opacity: 1;
    transform: scale(1);
}

.pview.zoomed .pview-img {
    border-radius: 0;
}

.pview-spin {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.22);
    border-top-color: rgba(255, 255, 255, 0.9);
    animation: pview-spin 0.9s linear infinite;
}

@keyframes pview-spin {
    to {
        transform: rotate(1turn);
    }
}

.pview-cap {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 2;
    padding: 0 60px;
    color: rgba(255, 255, 255, 0.66);
    font-size: 12.5px;
    letter-spacing: 0.02em;
    text-align: center;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.pview-tools {
    position: absolute;
    top: calc(10px + env(safe-area-inset-top, 0px));
    right: 12px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pview-btn {
    height: 38px;
    min-width: 38px;
    display: grid;
    place-items: center;
    padding: 0 14px;
    border: 0;
    border-radius: 19px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font: inherit;
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}

.pview-close {
    width: 38px;
    padding: 0;
    font-size: 17px;
}

.pview-btn:hover {
    background: rgba(255, 255, 255, 0.26);
}

.pview-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

html.pview-open,
body.pview-open {
    overflow: hidden;
}

/* 头像可点：给个手型和轻微反馈，提示这里能点开 */
.row .ava,
.chat-head .peer-ava {
    cursor: zoom-in;
    transition: transform 0.15s ease-out, filter 0.15s ease-out;
}

.chat-head .peer-name {
    cursor: zoom-in;
}

.row .ava:hover,
.chat-head .peer-ava:hover {
    filter: brightness(1.08);
    transform: scale(1.06);
}

/* 聊天里的照片也能点开看大图；长按 / 右键弹的是自己的菜单（引用、另存为、删除），不弹浏览器的图片菜单 */
.bubble.pic img {
    cursor: zoom-in;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
