/* ============================================
   海南广播电视总台 · 竖屏短视频分享页
   参考：iqilu share 全屏竖屏风格
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: #000;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
                 "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

a { text-decoration: none; color: inherit; }
button { border: 0; background: none; cursor: pointer; font: inherit; color: inherit; }
em { font-style: normal; }

/* ---------- 主页面容器 ---------- */
.page {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: #000;
}

/* ---------- 视频层（底层） ---------- */
.video-stage {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 1;
}
/* 居中完整显示：宽高由 JS 按视频真实比例计算，兼容忽略 object-fit 的手机原生播放层 */
.video-el {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    object-fit: contain;
    background: #000;
}

/* 视频加载 */
.loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    pointer-events: none;
}
.loading.hide { display: none; }
.spinner {
    width: 44px; height: 44px;
    border: 3px solid rgba(255,255,255,.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 中央大播放按钮 */
.center-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.center-play.show {
    opacity: 1;
    pointer-events: auto;
}
.center-play svg circle { filter: drop-shadow(0 2px 8px rgba(0,0,0,.4));  display: none; }

/* ---------- 顶部渐变遮罩（让顶部字看得清） ---------- */
.page::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 160px;
    background: linear-gradient(180deg, rgba(0,0,0,.55), transparent);
    z-index: 2;
    pointer-events: none;
}
/* 底部渐变遮罩 */
.page::after {
    content: "";
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 280px;
    background: linear-gradient(0deg, rgba(0,0,0,.75) 0%, rgba(0,0,0,.35) 40%, transparent 100%);
    z-index: 2;
    pointer-events: none;
}

/* ---------- 顶部品牌 + 打开App ---------- */
.top-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(env(safe-area-inset-top) + 12px) 14px 0;
}
.brand {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 6px;
    /* background: rgba(0,0,0,.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 20px; */
}
.brand-logo {
    height: 28px;
    width: auto;
    max-width: 140px;
    display: block;
    object-fit: contain;
}
.open-app {
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: #1a80de;
    border-radius: 5px;
    transition: opacity .15s, transform .15s;
}
.open-app:active { transform: scale(.95); opacity: .85; }

/* ---------- 视频上方标题水印 ---------- */
.title-overlay {
    position: absolute;
    top: calc(env(safe-area-inset-top) + 72px);
    left: 18px;
    right: 18px;
    z-index: 5;
    text-align: center;
    pointer-events: none;
    text-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.title-line1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 6px;
    color: #fff;
}
.title-line2 {
    display: inline-block;
    padding: 4px 14px;
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    background: #ffe14d;
    border-radius: 4px;
    letter-spacing: .5px;
}

/* ---------- 右侧竖排互动栏 ---------- */
.side-actions {
    position: absolute;
    right: 10px;
    top: 47%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}
.side-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,.4);
    transition: transform .15s;
}
.side-item:active { transform: scale(.88); }
.side-item.liked .si-icon { color: #ff3b30; }
.side-icon-collected .si-icon { color: #ffd166; }

.si-icon {
    width: 44px; height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    filter: drop-shadow(0 1px 4px rgba(0,0,0,.45));
}
.si-text {
    font-size: 12px;
    color: #fff;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,.5));
}

/* 头像 + 关注按钮（兄弟节点，flex column，➕用负 margin 上叠头像） */
.side-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* 让下方 ➕ 能上叠，不给 overflow:hidden */
}
.avatar-wrap {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.35);
    background: #fff;
    overflow: hidden;
}
.avatar-wrap img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.follow-btn {
    margin-top: -10px;
    width: 20px; height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a80de;
    border-radius: 50%;
    border: 2px solid #fff;
    color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
    transition: background .2s, transform .15s;
    flex-shrink: 0;
}
.follow-btn.followed {
    background: rgba(255,255,255,.35);
}
.follow-btn.followed svg {
    transform: rotate(45deg);
}

/* ---------- 底部信息区 ---------- */
.bottom-info {
    position: absolute;
    left: 0; right: 0;
    bottom: 0;
    z-index: 10;
    padding: 0 18px calc(env(safe-area-inset-bottom) + 16px);
}

/* 文案 */
.info-main {
    padding-right: 72px;  /* 避开右侧按钮栏 */
    margin-bottom: 12px;
}
.author-line {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
    text-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.desc-line {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
    color: rgba(255,255,255,.95);
    text-shadow: 0 1px 3px rgba(0,0,0,.45);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.meta-line {
    display: flex;
    align-items: center;
    gap: 10px;
}
.tag {
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: rgba(255,255,255,.2);
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 4px;
}
.detail-btn {
    font-size: 13px;
    color: rgba(255,255,255,.9);
    padding: 2px 0;
}

/* 进度条 */
.progress-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 6px;
}
.time {
    font-size: 11px;
    color: rgba(255,255,255,.85);
    font-variant-numeric: tabular-nums;
    min-width: 32px;
    text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.progress-track {
    flex: 1;
    position: relative;
    height: 3px;
    background: rgba(255,255,255,.35);
    border-radius: 2px;
    overflow: visible;
    touch-action: none;
    cursor: pointer;
}
/* 扩大触摸热区：3px 细条直接拖很难按准 */
.progress-track::before {
    content: "";
    position: absolute;
    left: 0; right: 0;
    top: -16px; bottom: -16px;
}
.progress-bar {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    width: 0;
    background: #fff;
    border-radius: 2px;
    transition: width .2s linear;
}
.progress-dot {
    position: absolute;
    top: 50%;
    width: 8px; height: 8px;
    margin-left: -4px;
    margin-top: -4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,.4);
    opacity: 0;
    transition: opacity .2s;
}
.progress-wrap:active .progress-dot,
.progress-wrap.dragging .progress-dot { opacity: 1; }
/* 拖动时取消宽度过渡，避免进度条跟不上手指 */
.progress-wrap.dragging .progress-bar { transition: none; }

/* ---------- 详情面板 ---------- */
.detail-panel {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    visibility: hidden;
}
.detail-panel.show {
    pointer-events: auto;
    visibility: visible;
}
.dp-mask {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.5);
    opacity: 0;
    transition: opacity .25s;
}
.detail-panel.show .dp-mask { opacity: 1; }
.dp-body {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    color: #222;
    border-radius: 16px 16px 0 0;
    padding: 20px 20px calc(env(safe-area-inset-bottom) + 24px);
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.3,.8,.3,1);
}
.detail-panel.show .dp-body { transform: translateY(0); }
.dp-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.dp-author { font-size: 13px; color: #888; margin-bottom: 12px; }
.dp-full-desc { font-size: 14px; line-height: 1.7; color: #333; margin-bottom: 14px; }
.dp-meta {
    display: flex; gap: 20px;
    font-size: 12px; color: #999;
    margin-bottom: 16px;
}
.dp-meta em { color: #333; font-weight: 600; margin-left: 4px; }
.dp-download {
    display: block;
    text-align: center;
    padding: 12px;
    color: #fff;
    background: linear-gradient(90deg, #c8161d, #ff5a3c);
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
}
.dp-close {
    width: 100%;
    padding: 11px;
    font-size: 15px;
    color: #555;
    background: #f2f2f2;
    border-radius: 24px;
}

/* ---------- 分享面板 ---------- */
.share-sheet {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    visibility: hidden;
}
.share-sheet.show {
    pointer-events: auto;
    visibility: visible;
}
.sheet-mask {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.5);
    opacity: 0;
    transition: opacity .25s;
}
.share-sheet.show .sheet-mask { opacity: 1; }
.sheet-body {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 10px 20px calc(env(safe-area-inset-bottom) + 20px);
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.3,.8,.3,1);
}
.share-sheet.show .sheet-body { transform: translateY(0); }
.sheet-handle {
    width: 36px; height: 4px;
    margin: 0 auto 14px;
    background: #ddd;
    border-radius: 2px;
}
.sheet-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}
.sheet-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #333;
    font-size: 12px;
}
.si {
    width: 48px; height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
}
.si.wechat { background: #07c160; }
.si.moments { background: #07c160; }
.si.weibo { background: #e6162d; }
.si.link { background: #666; }

.sheet-cancel {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    color: #333;
    background: #f5f5f5;
    border-radius: 24px;
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 20px;
    font-size: 14px;
    color: #fff;
    background: rgba(0,0,0,.75);
    border-radius: 8px;
    z-index: 200;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
    max-width: 80%;
    text-align: center;
}
.toast.show { opacity: 1; }

/* ---------- 爱心爆裂动画 ---------- */
@keyframes heartPop {
    0% { transform: scale(1); }
    30% { transform: scale(1.35); }
    60% { transform: scale(.9); }
    100% { transform: scale(1); }
}
.heart-pop { animation: heartPop .35s ease; }

/* 分享按钮旋转 */
@keyframes shareSpin {
    0% { transform: rotate(0); }
    50% { transform: rotate(180deg); }
    100% { transform: rotate(0); }
}
.share-spin { animation: shareSpin .5s ease; }

/* ---------- 桌面预览时居中显示 ---------- */
@media (min-width: 480px) {
    body {
        display: flex;
        align-items: center;
        justify-content: center;
        background: #111;
    }
    .page {
        width: 420px;
        height: 100vh;
        max-height: 900px;
        border-radius: 0;
        box-shadow: 0 0 40px rgba(0,0,0,.6);
        position: relative;
    }
}
