/* 视频内容模型：列表（卡片/瀑布流）+ 详情 + 发帖 */

.feed-style-video {
    display: block;
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: visible;
}

.feed-style-video .empty-card {
    width: 100%;
    break-inside: avoid;
    column-span: all;
}

.feed-video-card .video-masonry {
    display: none;
}

.feed-video-masonry .video-cards {
    display: none;
}

/* 卡片 / 瀑布流：CSS 多列（自上而下填列），避免 grid/flex 换行留下空洞 */
.feed-video-card .video-cards,
.feed-video-masonry .video-masonry {
    display: block !important;
    width: 100%;
    column-count: 4;
    column-gap: 8px;
    column-fill: balance;
}

html.feed-cols-2 .feed-stack.feed-style-video {
    display: block;
    grid-template-columns: none;
}

.video-post-card {
    display: block;
    width: 100%;
    float: none;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    margin: 0 0 8px;
    padding: 8px;
    background: var(--card);
    border-radius: 10px;
    overflow: visible;
    box-shadow: var(--card-shadow);
    transition: box-shadow .2s ease;
}

.video-post-card:hover {
    box-shadow: var(--card-shadow-hover);
}

.vpc-cover {
    position: relative;
    display: block;
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: var(--chip, #0f172a);
    text-decoration: none;
    flex: 0 0 auto;
    line-height: 0;
}

.vpc-cover img {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: min(70vh, 520px);
    object-fit: cover;
    object-position: center top;
    display: block;
    vertical-align: top;
    border-radius: 10px;
    transition: transform .35s ease;
}

.vpc-cover:hover img {
    transform: scale(1.03);
}

.vpc-cover-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 120px;
    aspect-ratio: auto;
    border-radius: 10px;
    color: #94a3b8;
    font-size: 36px;
    line-height: normal;
}

.vpc-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, .18);
    color: #fff;
    font-size: 36px;
    transition: background .2s ease;
    pointer-events: none;
}

.vpc-cover:hover .vpc-play {
    background: rgba(15, 23, 42, .32);
}

.vpc-duration {
    position: absolute;
    right: 6px;
    bottom: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(15, 23, 42, .78);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    z-index: 2;
}

.vpc-flags {
    position: absolute;
    top: 6px;
    left: 6px;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    z-index: 2;
    pointer-events: none;
}

.vpc-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 2px 4px;
    min-width: 0;
}

.vpc-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.4;
    margin: 0;
}

.vpc-title:hover {
    color: var(--accent);
}

.vpc-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.vpc-meta-avatar .uc-avatar-img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.vpc-meta-text {
    flex: 1;
    min-width: 0;
}

.vpc-username {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-soft, #64748b);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vpc-username:hover {
    color: var(--accent);
}

.vpc-meta-sub {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    font-size: 11px;
    color: var(--muted);
    line-height: 1.2;
}

.vpc-dot {
    opacity: .7;
}

.vpc-time {
    white-space: nowrap;
}

/* 瀑布流纯图项 */
.vm-item {
    display: block;
    width: 100%;
    float: none;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    margin: 0 0 8px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--chip);
    position: relative;
}

.vm-item-link {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    background: var(--chip, #0f172a);
    line-height: 0;
}

.vm-item-link img {
    width: 100%;
    height: auto;
    max-width: 100%;
    /* 限制极端竖图高度，避免单列被拉得过长、视觉上像「断层」 */
    max-height: min(70vh, 520px);
    object-fit: cover;
    object-position: center top;
    display: block;
    vertical-align: top;
    border-radius: 12px;
    transition: transform .4s ease;
}

.vm-item:hover .vm-item-link img {
    transform: scale(1.04);
}

.vm-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 34px;
    background: rgba(15, 23, 42, .2);
    pointer-events: none;
    z-index: 1;
}

.vm-duration {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 2;
    display: inline-block;
    padding: 3px 7px;
    border-radius: 6px;
    background: rgba(15, 23, 42, .72);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    pointer-events: none;
}

.vm-flags {
    position: absolute;
    top: 8px;
    left: 8px;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    z-index: 3;
    pointer-events: none;
}

.vm-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 24px 10px 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, .6) 0%, rgba(0, 0, 0, 0) 100%);
    opacity: 0;
    transition: opacity .25s ease;
    z-index: 2;
    pointer-events: none;
    color: #fff;
}

.vm-item:hover .vm-overlay {
    opacity: 1;
}

.vm-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vm-avatar .uc-avatar-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.vm-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.vm-user-line {
    display: flex;
    align-items: center;
    gap: 5px;
}

.vm-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.vm-time {
    font-size: 11px;
    color: rgba(255, 255, 255, .75);
}

.vm-title {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 650;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 工具栏切换按钮（与图库一致） */
.video-view-btn {
    height: 30px;
    padding: 0 11px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    transition: color .15s ease, background .15s ease;
}

.video-view-btn i {
    font-size: 14px;
}

.video-view-btn:hover {
    color: var(--text);
}

.video-view-btn.on {
    background: var(--accent);
    color: var(--accent-ink);
}

/* 详情页 */
.video-detail-panel {
    margin: 20px 0 16px;
}

.video-detail-locked {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #0f172a;
}

.video-detail-locked img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
}

.video-detail-cover-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 220px;
    aspect-ratio: 16 / 9;
    color: #94a3b8;
    font-size: 48px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-radius: 12px;
}

.vpc-cover.is-locked .vpc-play,
.vm-item.is-locked .vm-play {
    display: none;
}

.vpc-cover .gallery-unlock-btn,
.vm-item .gallery-unlock-btn,
.video-detail-locked .gallery-unlock-btn,
.vms-video-locked .gallery-unlock-btn {
    pointer-events: auto;
}

.video-modal-player .vms-video-locked {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 0;
    border-radius: 0;
    overflow: hidden;
    background: transparent;
}

.video-modal-player .vms-video-locked img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    object-fit: cover;
    object-position: center;
}

.video-modal-player .vms-video-locked .video-detail-cover-fallback {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
}

.video-detail-player,
.video-detail-embed iframe {
    width: 100%;
    border: 0;
    border-radius: 12px;
    background: #000;
}

.video-detail-player {
    display: block;
    max-height: 72vh;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: #0f172a;
}

.video-detail-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
}

.video-detail-embed iframe {
    position: absolute;
    inset: 0;
    height: 100%;
}

.video-detail-fallback {
    padding: 24px;
    text-align: center;
    border-radius: 12px;
    background: var(--chip);
}

/* 发帖 */
.compose-video-source-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.compose-video-source-tabs {
    display: inline-flex;
    flex-shrink: 0;
    gap: 8px;
    margin-bottom: 0;
    padding: 4px;
    border-radius: 12px;
    background: var(--chip, #f1f5f9);
}

.compose-video-source-field {
    flex: 1 1 auto;
    min-width: 0;
}

.compose-video-source-field .compose-video-url-item {
    width: 100%;
}

.compose-video-source-field .input {
    width: 100%;
    height: 42px;
    box-sizing: border-box;
}

#compose-video-local-panel .btn {
    width: 100%;
    height: 42px;
    justify-content: center;
    box-sizing: border-box;
}

.compose-video-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    min-height: 0;
    margin-top: 0;
}

.compose-video-meta:has(.compose-video-file-name:not(:empty)),
.compose-video-meta:has(.compose-video-status:not([hidden])) {
    margin-top: 8px;
}

.compose-video-file-name:empty {
    display: none;
}

.compose-video-source-tab {
    height: 34px;
    padding: 0 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.compose-video-source-tab.on {
    background: var(--card, #fff);
    color: var(--text);
    box-shadow: 0 1px 4px rgba(15, 23, 42, .08);
}

.compose-video-file-name {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    word-break: break-all;
}

.compose-video-status {
    font-size: 12px;
    color: var(--muted);
}

.compose-video-status[data-type="ok"] {
    color: #15803d;
}

.compose-video-status[data-type="warn"] {
    color: #b45309;
}

.compose-video-status[data-type="error"] {
    color: #b91c1c;
}

.compose-video-grid {
    display: grid;
    gap: 12px;
}

.compose-video-url-item {
    grid-column: 1 / -1;
}

.compose-video-cover-box {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px dashed var(--line);
    border-radius: 12px;
    background: var(--chip);
    overflow: hidden;
    position: relative;
    cursor: default;
}

.compose-video-cover-box.has-image {
    border-style: solid;
}

.compose-video-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.compose-video-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 960px) {
    .feed-video-card .video-cards,
    .feed-video-masonry .video-masonry {
        column-count: 3;
        column-gap: 6px;
    }

    .video-post-card,
    .vm-item {
        margin-bottom: 6px;
        border-radius: 10px;
    }
}

@media (max-width: 640px) {
    .feed-video-card .video-cards,
    .feed-video-masonry .video-masonry {
        column-count: 2;
        column-gap: 6px;
    }

    .vpc-body {
        padding: 8px 0 4px;
    }

    .vpc-title {
        font-size: 13px;
    }
}

html.feed-cols-2 .feed-video-card .video-cards,
html.feed-cols-2 .feed-video-masonry .video-masonry {
    column-count: 2;
}

@media (max-width: 720px) {
    .compose-video-grid {
        grid-template-columns: 1fr;
    }

    .compose-video-source-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .compose-video-source-tabs {
        display: flex;
        width: 100%;
        gap: 4px;
    }

    .compose-video-source-tab {
        flex: 1 1 0;
        min-width: 0;
        padding: 0 8px;
        text-align: center;
    }
}

.video-modal {
    position: fixed;
    inset: 0;
    z-index: 12050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.video-modal[hidden] {
    display: none !important;
}

.video-modal.open {
    display: flex;
}

.video-modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .72);
    backdrop-filter: blur(4px);
}

.video-modal-panel {
    position: relative;
    z-index: 1;
    --vms-pad: 15px;
    --vms-col-max: 420px;
    --vms-frame-h: min(760px, calc(min(88vh, 860px) - var(--vms-pad) * 2));
    --vms-col-w: min(var(--vms-col-max), calc(var(--vms-frame-h) * 9 / 16));
    width: calc(var(--vms-col-w) * 2);
    max-width: min(calc(var(--vms-col-max) * 2), calc(100vw - 48px));
    max-height: min(88vh, 860px);
    background: var(--card, #fff);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(15, 23, 42, .35);
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.video-modal-close {
    display: none;
}

.video-modal-stage-bar {
    display: none;
}

@media (max-width: 900px) {
    .video-modal-close,
    .video-modal.is-compact .video-modal-close {
        display: none !important;
    }

    .video-modal-stage-bar,
    .video-modal.is-compact .video-modal-stage-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        z-index: 40;
        padding: max(10px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) 0 max(10px, env(safe-area-inset-left, 0px));
        box-sizing: border-box;
        pointer-events: none;
        isolation: isolate;
        transform: translateZ(0);
    }

    .video-modal-player-shell {
        position: relative;
        z-index: 1;
    }

    .video-modal-stage-login[hidden] {
        display: none !important;
    }

    .video-modal-stage-login[hidden] + .video-modal-stage-close {
        margin-left: auto;
    }

    .video-modal-stage-login,
    .video-modal-stage-close {
        pointer-events: auto;
        flex: 0 0 auto;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 0;
        border-radius: 999px;
        background: rgba(15, 23, 42, .58);
        color: #fff;
        font-size: 18px;
        font-weight: 700;
        line-height: 1;
        cursor: pointer;
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 10px rgba(15, 23, 42, .28);
        transition: background .15s ease, transform .15s ease;
    }

    .video-modal-stage-login:hover,
    .video-modal-stage-close:hover {
        background: rgba(15, 23, 42, .78);
        transform: scale(1.04);
    }

    .video-modal-stage-login i {
        font-size: 20px;
        line-height: 1;
        color: #fff;
    }

    .video-modal-stage-glyph {
        display: block;
        font-size: 16px;
        font-weight: 700;
        line-height: 1;
        color: #fff;
        -webkit-text-fill-color: #fff;
    }

    .video-modal-stage-close .video-modal-stage-glyph {
        font-size: 26px;
        font-weight: 400;
        transform: translateY(-1px);
    }
}

/* JS compact class: same toolbar even if media query cache mismatches */
.video-modal.is-compact .video-modal-stage-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    padding: max(10px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) 0 max(10px, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
    pointer-events: none;
    isolation: isolate;
    transform: translateZ(0);
}

.video-modal.is-compact .video-modal-stage-login[hidden] {
    display: none !important;
}

.video-modal.is-compact .video-modal-stage-login[hidden] + .video-modal-stage-close {
    margin-left: auto;
}

.video-modal.is-compact .video-modal-stage-login,
.video-modal.is-compact .video-modal-stage-close {
    pointer-events: auto;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, .58);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .28);
}

.video-modal.is-compact .video-modal-stage-login i {
    font-size: 20px;
    line-height: 1;
    color: #fff;
}

.video-modal.is-compact .video-modal-stage-glyph {
    display: block;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
}

.video-modal.is-compact .video-modal-stage-close .video-modal-stage-glyph {
    font-size: 26px;
    font-weight: 400;
    transform: translateY(-1px);
}

.video-modal.is-compact .video-modal-close {
    display: none !important;
}

.video-modal-layout {
    display: flex;
    align-items: stretch;
    align-self: stretch;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    max-height: min(88vh, 860px);
    flex: 1 1 auto;
}

.video-modal-layout.is-booting .video-modal-stage {
    flex: 0 0 auto;
}

.video-modal-stage {
    flex: 1 1 0;
    width: 50%;
    min-width: 0;
    max-width: 50%;
    align-self: stretch;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
}

/* 播放壳基础布局（圆角仅 PC :not(.is-compact)） */
.video-modal-player-shell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-sizing: border-box;
}

/* PC：左侧外壳固定 9:16；内层按视频真实比例，控制条落在画面内并圆角 */
.video-modal:not(.is-compact) .video-modal-player-shell,
.video-modal:not(.is-compact) .video-modal-player-shell.is-landscape,
.video-modal:not(.is-compact) .video-modal-player-shell.is-portrait,
.video-modal:not(.is-compact).is-landscape-video .video-modal-player-shell,
.video-modal:not(.is-compact).is-portrait-video .video-modal-player-shell {
    --shell-ar: 0.5625; /* 9/16 */
    --video-ar: 0.5625;
    width: 100%;
    aspect-ratio: 9 / 16;
    max-width: 100%;
    max-height: var(--vms-frame-h);
    height: auto !important;
    min-height: 0;
    flex-shrink: 0;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
}

.video-modal:not(.is-compact).is-landscape-video .video-modal-stage,
.video-modal:not(.is-compact).is-portrait-video .video-modal-stage {
    align-self: stretch;
    flex: 1 1 0;
    width: 50%;
    max-width: 50%;
    height: auto;
    max-height: none;
    padding: 15px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* PC 内层播放器：跟视频比例，原生控制条贴在画面底边 */
.video-modal:not(.is-compact) .video-modal-player,
.video-modal:not(.is-compact) .video-modal-player-shell.is-landscape .video-modal-player,
.video-modal:not(.is-compact) .video-modal-player-shell.is-portrait .video-modal-player {
    position: relative;
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    max-height: 100%;
    aspect-ratio: var(--video-ar, 0.5625);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
}

.video-modal:not(.is-compact) .video-modal-player video,
.video-modal:not(.is-compact) .video-modal-player iframe,
.video-modal:not(.is-compact) .video-modal-player .vms-boot-poster,
.video-modal:not(.is-compact) .video-modal-player .vms-boot-placeholder,
.video-modal:not(.is-compact) .video-modal-player .vms-video-locked,
.video-modal:not(.is-compact) .video-modal-player-shell.is-landscape .video-modal-player video,
.video-modal:not(.is-compact) .video-modal-player-shell.is-landscape .video-modal-player iframe,
.video-modal:not(.is-compact) .video-modal-player-shell.is-portrait .video-modal-player video,
.video-modal:not(.is-compact) .video-modal-player-shell.is-portrait .video-modal-player iframe {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #000;
    border-radius: 16px;
}

.video-modal-player {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    line-height: 0;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
}

.video-modal.is-compact .video-modal-player {
    border-radius: 0 !important;
    background: transparent;
}

.vms-pending-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity .2s ease;
    background: transparent;
}

.vms-pending-video.is-ready {
    opacity: 1;
}

.vms-boot-poster {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 16px;
    object-fit: contain;
    object-position: center;
}

.video-modal-layout.is-booting .video-modal-player,
.video-modal-player:has(iframe),
.video-modal-player:has(video),
.video-modal-player:has(.vms-video-locked),
.video-modal-player:has(.vms-boot-poster),
.video-modal-player:has(.vms-boot-placeholder) {
    width: 100%;
    height: 100%;
}

.video-modal:not(.is-compact) .video-modal-player:has(iframe),
.video-modal:not(.is-compact) .video-modal-player:has(video),
.video-modal:not(.is-compact) .video-modal-player:has(.vms-video-locked),
.video-modal:not(.is-compact) .video-modal-player:has(.vms-boot-poster),
.video-modal:not(.is-compact) .video-modal-player:has(.vms-boot-placeholder),
.video-modal:not(.is-compact) .video-modal-layout.is-booting .video-modal-player {
    height: auto !important;
    max-height: 100%;
    aspect-ratio: var(--video-ar, 0.5625);
    border-radius: 16px;
    overflow: hidden;
}

.video-modal-player video,
.video-modal-player iframe {
    display: block;
    border: 0;
    background: transparent;
    border-radius: 16px;
    vertical-align: top;
    object-fit: contain;
}

.video-modal-player video {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.video-modal-player iframe {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

.vms-boot-placeholder {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 16px;
    background: var(--chip, #f1f5f9);
}

.video-modal-layout.is-booting .vms-boot-poster,
.video-modal-layout.is-booting .vms-boot-placeholder {
    max-height: 100%;
}

.video-modal-side {
    flex: 1 1 0;
    width: 50%;
    min-width: 0;
    max-width: 50%;
    display: flex;
    flex-direction: column;
    background: var(--card, #fff);
    border-left: 1px solid var(--line, #e2e8f0);
    box-sizing: border-box;
    position: relative;
    min-height: 0;
    align-self: stretch;
    padding: var(--vms-pad) 0;
}

.vms-loading {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 3;
    place-items: center;
    color: var(--muted);
    font-size: 28px;
    background: rgba(255, 255, 255, .94);
}

.video-modal-side.is-booting .vms-loading {
    display: grid;
}

.video-modal-side.is-refreshing .vms-content {
    opacity: .94;
    pointer-events: none;
    transition: opacity .15s ease;
}

.vms-loading i {
    animation: vms-spin 1s linear infinite;
}

@keyframes vms-spin {
    to { transform: rotate(360deg); }
}

.vms-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    width: 100%;
    height: 100%;
}

.vms-content.is-guest-reply {
    min-height: 0;
    flex: 1 1 auto;
}

.vms-content.is-guest-reply .vms-head,
.vms-content.is-guest-reply .vms-body,
.vms-content.is-guest-reply .vms-stats {
    flex-shrink: 0;
}

.vms-content.is-guest-reply .vms-body {
    overflow: visible;
}

.vms-content.is-guest-reply .vms-comments {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
}

.vms-reply-footer {
    flex-shrink: 0;
    box-sizing: border-box;
    width: 100%;
    padding: 0 var(--vms-pad) var(--vms-pad);
    border-top: 1px solid var(--line, #e2e8f0);
    background: var(--card, #fff);
}

.vms-content[hidden] {
    display: none !important;
}

.vms-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 var(--vms-pad) var(--vms-pad);
    border-bottom: 1px solid var(--line, #e2e8f0);
    flex-shrink: 0;
    overflow: visible;
}

.vms-author-avatar {
    flex-shrink: 0;
    overflow: visible;
    line-height: 0;
}

.vms-author-avatar .uc-avatar-link,
.vms-author-avatar .uc-avatar {
    display: inline-block;
    overflow: visible;
}

.vms-author-avatar .uc-avatar-img {
    max-width: none;
}

.vms-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.vms-author {
    flex: 1;
    min-width: 0;
}

.vms-author-name {
    display: inline;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
    vertical-align: middle;
}

.vms-author-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.vms-author-line .work-level {
    flex-shrink: 0;
}

.vms-author-line .badge-icons,
.vms-author-line .badge-icons-md,
.vms-author-line .badge-icons-sm {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.vms-author-role {
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.35;
}

.vms-author-name:hover {
    color: var(--accent);
}

.vms-follow {
    height: 32px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink, #fff);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

.vms-follow.on {
    background: var(--chip, #f1f5f9);
    color: var(--muted);
}

.vms-body {
    padding: var(--vms-pad) var(--vms-pad) 0;
    overflow: auto;
}

.vms-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 750;
    line-height: 1.45;
    color: var(--ink);
}

.vms-desc {
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-soft, #64748b);
    white-space: pre-wrap;
    word-break: break-word;
}

.vms-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
}

.vms-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: var(--vms-pad);
    border-top: 1px solid var(--line, #e2e8f0);
    border-bottom: 1px solid var(--line, #e2e8f0);
}

.vms-stat-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.vms-stat-btn.on {
    color: #ef4444;
}

.vms-stat-btn i {
    font-size: 16px;
}

.vms-comments {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: var(--vms-pad);
}

.vms-comments-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: var(--vms-pad);
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
}

.vms-reply-sort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px;
    border-radius: 999px;
    background: var(--chip, #f1f5f9);
}

.vms-reply-sort-tab {
    height: 26px;
    padding: 0 10px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.vms-reply-sort-tab.on {
    background: var(--card, #fff);
    color: var(--ink);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

.vms-comment {
    display: flex;
    gap: 10px;
    margin-bottom: var(--vms-pad);
    padding-bottom: var(--vms-pad);
    border-bottom: 1px solid var(--line, #e2e8f0);
}

.vms-comment:last-child {
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}

.vms-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.vms-comment-main {
    flex: 1;
    min-width: 0;
}

.vms-comment-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.vms-comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.vms-comment-user {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
}

.vms-comment-user:hover {
    color: var(--accent);
}

.vms-comment-op {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink, #fff);
    font-size: 10px;
    font-weight: 700;
    font-style: normal;
}

.vms-comment-dot {
    color: var(--muted);
    font-size: 11px;
}

.vms-comment-floor,
.vms-comment-time {
    font-size: 11px;
    color: var(--muted);
}

.vms-comment-action {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0;
    flex-shrink: 0;
}

.vms-comment-action:hover {
    color: var(--accent);
}

.vms-comment-quote {
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--chip, #f8fafc);
    font-size: 12px;
    color: var(--text-soft, #64748b);
}

.vms-comment-quote-meta {
    font-weight: 700;
    margin-bottom: 2px;
}

.vms-comment-text {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    word-break: break-word;
}

.vms-empty {
    padding: 28px 0;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.vms-empty i {
    display: block;
    font-size: 36px;
    margin-bottom: 8px;
    opacity: .45;
}

.vms-load-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 36px 16px;
}

.vms-comments-loading i {
    animation: vms-spin .8s linear infinite;
}

@keyframes vms-spin {
    to { transform: rotate(360deg); }
}

.vms-load-error p {
    margin: 0;
    color: var(--muted);
}

.vms-player-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    min-height: 180px;
    color: rgba(255, 255, 255, .78);
    font-size: 14px;
    text-align: center;
    background: #0b0b0f;
}

.vms-player-error i {
    font-size: 32px;
    opacity: .7;
}

.vms-reply {
    flex-shrink: 0;
    box-sizing: border-box;
    width: 100%;
    padding: var(--vms-pad);
    border-top: 1px solid var(--line, #e2e8f0);
    background: var(--card, #fff);
}

.vms-reply .reply-compose-box {
    position: relative;
    border: 1px solid var(--line, #e2e8f0);
    border-radius: 12px;
    background: var(--chip, #f8fafc);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.vms-reply .reply-compose-box:focus-within {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    background: var(--card, #fff);
    box-shadow: 0 0 0 3px var(--accent-soft, rgba(59, 130, 246, .12));
}

.vms-reply textarea,
.vms-reply .vms-reply-input {
    display: block;
    width: 100%;
    min-height: 88px;
    margin: 0;
    padding: 10px 12px 42px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    font-size: 13px;
    line-height: 1.45;
    color: var(--ink);
    resize: vertical;
    box-sizing: border-box;
}

.vms-reply textarea:focus,
.vms-reply .vms-reply-input:focus {
    outline: none;
}

.vms-reply .reply-emoji-wrap {
    position: absolute;
    left: 8px;
    bottom: 6px;
    z-index: 2;
}

.vms-reply-login-stage {
    border-top: 0;
}

.vms-stage-guest-login {
    display: none;
}

.vms-reply-footer-side {
    display: block;
}

.vms-reply-login {
    padding: var(--vms-pad) var(--vms-pad) 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--vms-pad);
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

.vms-reply-login-text {
    line-height: 1.5;
}

.vms-reply-login-btn {
    min-width: 132px;
}

.vms-reply-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--vms-pad);
    margin-top: var(--vms-pad);
}

.vms-reply-btns {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.vms-reply-cancel {
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line, #e2e8f0);
    border-radius: 999px;
    background: var(--chip, #f1f5f9);
    color: var(--muted, #64748b);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.vms-reply-cancel:hover {
    background: var(--card, #fff);
    color: var(--ink, #0f172a);
    border-color: var(--muted, #94a3b8);
}

.vms-reply-link {
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
}

.vms-reply-link:hover {
    color: var(--accent);
}

.vms-reply-submit {
    height: 34px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink, #fff);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.vms-captcha {
    display: flex;
    align-items: center;
    gap: var(--vms-pad);
    margin-top: var(--vms-pad);
}

.vms-captcha .input {
    flex: 1;
    min-width: 0;
}

.vms-captcha img {
    height: 38px;
    width: auto;
    min-width: 96px;
    flex-shrink: 0;
    border-radius: 8px;
    cursor: pointer;
    display: block;
}

.vms-fallback-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: var(--vms-pad);
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 15px;
}

/* 自适应：播放框直角，避免桌面圆角/内联样式残留 */
.video-modal.is-compact .video-modal-panel,
.video-modal.is-compact .video-modal-player-shell,
.video-modal.is-compact .video-modal-player-shell.is-landscape,
.video-modal.is-compact .video-modal-player-shell.is-portrait,
.video-modal.is-compact .video-modal-player,
.video-modal.is-compact .video-modal-player video,
.video-modal.is-compact .video-modal-player iframe,
.video-modal.is-compact .video-modal-player .vms-boot-poster,
.video-modal.is-compact .video-modal-player .vms-boot-placeholder,
.video-modal.is-compact .video-modal-player .vms-video-locked,
.video-modal.is-compact .video-modal-player .vms-video-locked img,
.video-modal.is-compact .vms-boot-poster,
.video-modal.is-compact .vms-boot-placeholder {
    border-radius: 0 !important;
}

.video-modal.is-compact .video-modal-stage {
    padding: 0 !important;
}

@media (max-width: 900px) {
    .video-modal {
        padding: 0;
    }

    .video-modal-panel {
        position: relative;
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        height: 100vh;
        height: 100dvh;
        border-radius: 0 !important;
        overflow: hidden;
        --vms-pad: 12px;
        --vms-frame-h: min(56vh, calc(100vw / var(--shell-ar, 1.7778)));
    }

    /* 仅竖屏整页可滚，方便下滑看评论 */
    .video-modal.is-portrait-video .video-modal-panel {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }

    .video-modal-layout {
        flex: 1 1 auto;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        width: 100%;
        max-height: none;
        overflow: hidden;
    }

    .video-modal.is-portrait-video .video-modal-layout {
        flex: 0 0 auto;
        height: auto;
        min-height: 100%;
        overflow: visible;
    }

    .video-modal-stage {
        position: relative;
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 0;
        padding: 0;
        box-sizing: border-box;
        background: transparent;
    }

    /* 宽屏：封面/视频固定顶部，不被下拉带走；舞台不铺黑底以免露边 */
    .video-modal.is-landscape-video .video-modal-stage {
        position: sticky;
        top: 0;
        z-index: 3;
        background: var(--card, #fff);
        overscroll-behavior: none;
        touch-action: manipulation;
    }

    .video-modal.is-landscape-video .video-modal-player-shell {
        touch-action: manipulation;
    }

    .vms-stage-guest-login {
        display: none !important;
    }

    .video-modal-side .vms-reply-footer-side {
        display: none !important;
    }

    .video-modal-player-shell,
    .video-modal-player-shell.is-landscape,
    .video-modal-player-shell.is-portrait {
        --shell-ar: 0.5625;
        width: 100% !important;
        max-width: 100%;
        height: auto !important;
        /* 默认按 9:16，避免点开竖屏时从矮壳瞬间拉高造成闪动 */
        max-height: none;
        aspect-ratio: 9 / 16;
        margin: 0;
        border-radius: 0 !important;
        background: transparent;
    }

    /* 宽屏始终撑满屏幕宽度；用固定高度代替被压缩的 aspect-ratio，避免左右露黑 */
    .video-modal-player-shell.is-landscape,
    .video-modal.is-landscape-video .video-modal-player-shell {
        --shell-ar: 1.7778;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
        aspect-ratio: auto;
        height: min(56vh, calc(100vw * 9 / 16)) !important;
        max-height: min(56vh, calc(100vw * 9 / 16)) !important;
        background: transparent;
    }

    /* 竖屏 9:16：宽度铺满，高度按真实比例，可往下滚看评论 */
    .video-modal.is-portrait-video .video-modal-player-shell,
    .video-modal-player-shell.is-portrait {
        max-height: none !important;
        aspect-ratio: var(--shell-ar, 0.5625);
    }

    .video-modal.is-landscape-video .video-modal-stage,
    .video-modal.is-portrait-video .video-modal-stage {
        width: 100%;
        max-width: 100%;
        flex: 0 0 auto;
        height: auto;
        padding: 0;
    }

    .video-modal-player-shell.is-landscape .video-modal-player,
    .video-modal-player-shell.is-landscape .video-modal-player video,
    .video-modal-player-shell.is-landscape .video-modal-player iframe,
    .video-modal-player-shell.is-portrait .video-modal-player,
    .video-modal-player-shell.is-portrait .video-modal-player video,
    .video-modal-player-shell.is-portrait .video-modal-player iframe {
        width: 100% !important;
        height: 100% !important;
        max-width: none;
        max-height: none;
        object-fit: cover;
        background: transparent;
    }

    .video-modal-player,
    .video-modal-player video,
    .video-modal-player iframe,
    .video-modal-player .vms-boot-poster,
    .video-modal-player .vms-boot-placeholder,
    .video-modal-player .vms-video-locked {
        border-radius: 0 !important;
        background: transparent;
    }

    .video-modal-player video,
    .video-modal-player .vms-boot-poster,
    .video-modal-player .vms-video-locked img,
    .video-modal.is-landscape-video .video-modal-player video,
    .video-modal.is-landscape-video .video-modal-player .vms-boot-poster,
    .video-modal.is-landscape-video .video-modal-player .vms-video-locked img,
    .video-modal-player-shell.is-landscape video,
    .video-modal-player-shell.is-landscape .vms-boot-poster,
    .video-modal-player-shell.is-landscape .vms-video-locked img {
        object-fit: cover !important;
        object-position: center;
        background: transparent;
    }

    .video-modal-side {
        flex: 1 1 0;
        width: 100%;
        max-width: 100%;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        border-left: 0;
        border-top: 1px solid var(--line, #e2e8f0);
        padding: var(--vms-pad) 0 calc(12px + env(safe-area-inset-bottom, 0px));
        background: var(--card, #fff);
    }

    .video-modal.is-portrait-video .video-modal-side {
        flex: 0 0 auto;
        min-height: 48vh;
        overflow: visible;
    }

    .video-modal-side .vms-content {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .video-modal.is-portrait-video .video-modal-side .vms-content {
        flex: 0 0 auto;
        overflow: visible;
    }

    .video-modal-side .vms-content.is-guest-reply {
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    .video-modal-side .vms-content.is-guest-reply .vms-comments {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }

    .video-modal.is-portrait-video .video-modal-side .vms-content.is-guest-reply .vms-comments {
        flex: 0 0 auto;
        overflow: visible;
    }

    .video-modal-side .vms-reply {
        flex-shrink: 0;
        margin-top: 12px;
    }
}
