/* ============================================
   VideoDL v3 组件样式
   解析结果 / 画质选择 / 客户端下载进度 / 广告位
   ============================================ */

.logo-text {
    font-size: 28px;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

/* ============================================
   差异化优势（替代虚构用户评价）
   ============================================ */

.advantage-section {
    margin: 40px 0;
}

.advantage-lead {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 22px;
    max-width: 640px;
}

.advantage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.advantage-card {
    padding: 20px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: border-color var(--transition), transform var(--transition);
}

.advantage-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.advantage-icon {
    font-size: 26px;
    margin-bottom: 10px;
}

.advantage-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
}

.advantage-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.65;
}

/* ============================================
   留存模块：下载历史 / 注册引导 / 下载后二次转化
   ============================================ */

/* ---------------- 下载历史 ---------------- */

.history-box {
    max-width: 640px;
    margin: 16px auto 0;
    text-align: left;
}

.history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding: 0 4px;
}

.history-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    padding: 2px 6px;
    border-radius: 4px;
}

.history-clear:hover {
    color: var(--error);
    background: rgba(255, 82, 94, .1);
}

.history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.history-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 220px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs, 8px);
    background: rgba(255, 255, 255, .03);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: all var(--transition);
}

.history-item:hover {
    border-color: var(--accent);
    background: rgba(108, 99, 255, .08);
}

.history-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.history-meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* ---------------- 注册引导 ---------------- */

.signup-gate {
    margin-top: 16px;
    padding: 16px 18px;
    border-radius: var(--radius-sm, 10px);
    background: rgba(108, 99, 255, .1);
    border: 1px solid rgba(108, 99, 255, .35);
}

.signup-gate-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.signup-gate p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.signup-gate-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.signup-gate-note {
    font-size: 12px;
    color: var(--text-muted);
}

/* ---------------- 下载后二次转化 ---------------- */

.post-download {
    margin: 0 0 40px;
    padding: 22px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    animation: resultIn .35s ease;
}

.post-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--success);
}

.post-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.post-actions .cta-btn {
    width: auto;
}

.post-share {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.post-share p {
    font-size: 13px;
    color: var(--text-secondary);
}

.post-share-row {
    display: flex;
    gap: 8px;
}

.post-share-row input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border-radius: var(--radius-xs, 8px);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
}

.post-share-row button {
    padding: 10px 18px;
    border-radius: var(--radius-xs, 8px);
    border: none;
    background: var(--gradient-2);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .post-actions .cta-btn {
        width: 100%;
    }
}

/* ============================================
   广告位容器
   ------------------------------------------------------------
   固定预留尺寸，避免广告 iframe 加载完成时把下方内容顶下去
   造成 CLS（累积布局偏移），这是 Core Web Vitals 三大指标之一。
   尺寸按常见广告投放规格预留。
   ============================================ */

.ad-slot {
    margin: 28px auto;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ad-box {
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs, 8px);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 728x90 横幅 */
.ad-box.ad-728x90 { width: 728px; max-width: 100%; height: 90px; }

/* 468x60 横幅 */
.ad-box.ad-468x60 { width: 468px; max-width: 100%; height: 60px; }

/* 320x50 小横幅 */
.ad-box.ad-320x50 { width: 320px; max-width: 100%; height: 50px; }

/* 300x250 矩形 */
.ad-box.ad-300x250 { width: 300px; max-width: 100%; height: 250px; }

/* 160x300 竖幅 */
.ad-box.ad-160x300 { width: 160px; max-width: 100%; height: 300px; }

/* 160x600 摩天楼 */
.ad-box.ad-160x600 { width: 160px; max-width: 100%; height: 600px; }

/* 原生广告（容器由广告脚本自行填充） */
.ad-native-embed {
    max-width: 100%;
    margin: 0 auto;
}

@media (max-width: 760px) {
    /* 宽横幅在窄屏压缩高度，避免大片空白 */
    .ad-box.ad-728x90,
    .ad-box.ad-468x60,
    .ad-box.ad-320x50 {
        width: 100%;
        height: auto;
        min-height: 90px;
    }

    /* 窄屏下隐藏过高的竖版广告，兼顾收益与体验 */
    .ad-box.ad-160x600,
    .ad-box.ad-160x300 {
        display: none;
    }
}

/* ---------------- 解析结果 ---------------- */

.result-section {
    margin: 24px 0 40px;
    animation: resultIn .35s ease;
}

@keyframes resultIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

.result-card {
    display: flex;
    gap: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.result-thumb-wrap {
    flex-shrink: 0;
    width: 160px;
    height: 90px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-input);
}

.result-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.result-thumb:not([src]) {
    visibility: hidden;
}

.result-body {
    flex: 1;
    min-width: 0;
}

.result-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

/* ---------------- 画质选择 ---------------- */

.quality-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.quality-item {
    padding: 8px 14px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .04);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.quality-item:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.quality-item.active {
    background: rgba(108, 99, 255, .18);
    border-color: var(--accent);
    color: #fff;
}

.quality-item .q-tag {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 20px;
    background: rgba(0, 230, 118, .15);
    color: var(--success);
    font-weight: 500;
}

.quality-item .q-tag.mux {
    background: rgba(255, 171, 64, .15);
    color: var(--warning);
}

.result-download-btn {
    width: 100%;
    max-width: 320px;
}

.result-download-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

/* ---------------- 下载进度 ---------------- */

.dl-progress {
    margin-top: 12px;
    max-width: 320px;
}

.dl-progress .progress-bar-wrapper {
    height: 8px;
    background: rgba(255, 255, 255, .08);
    border-radius: 20px;
    overflow: hidden;
}

.dl-progress .progress-bar {
    height: 100%;
    width: 0;
    border-radius: 20px;
    background: var(--gradient-1);
    transition: width .25s ease;
}

.dl-progress.indeterminate .progress-bar {
    width: 40% !important;
    animation: indet 1.1s ease-in-out infinite;
}

@keyframes indet {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}

.dl-progress-text {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.result-note {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ---------------- 原生广告位（工具表单上方） ---------------- */

.ad-native {
    max-width: 640px;
    margin: 0 auto 16px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .03);
    position: relative;
}

.ad-label {
    position: absolute;
    top: -8px;
    left: 12px;
    padding: 0 6px;
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-primary);
}

.ad-native-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ad-native-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    color: var(--text-secondary);
}

.ad-native-text strong {
    color: var(--text-primary);
    font-size: 14px;
}

.ad-native-cta {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 50px;
    background: var(--gradient-2);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

/* ---------------- VPN / 隐私工具联盟推荐（下载按钮下方） ---------------- */

.vpn-rec {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.vpn-rec-head {
    margin-bottom: 12px;
}

.vpn-rec-title {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.vpn-rec-sub {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}

.vpn-rec-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.vpn-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .03);
    text-decoration: none;
    transition: all var(--transition);
    position: relative;
}

.vpn-card:hover {
    border-color: var(--accent);
    background: rgba(108, 99, 255, .08);
    transform: translateY(-2px);
}

.vpn-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 20px;
    background: rgba(108, 99, 255, .2);
    color: var(--accent);
    font-weight: 600;
}

.vpn-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.vpn-highlight {
    font-size: 12px;
    color: var(--accent);
}

.vpn-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
}

.vpn-foot {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 11px;
}

.vpn-stars {
    color: #ffab40;
    letter-spacing: -1px;
}

.vpn-rating {
    color: var(--text-muted);
}

.vpn-go {
    margin-left: auto;
    color: var(--accent);
    font-weight: 600;
}

.vpn-disclosure {
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 600px) {
    .result-card {
        flex-direction: column;
    }

    .result-thumb-wrap {
        width: 100%;
        height: 180px;
    }

    .result-download-btn,
    .dl-progress {
        max-width: 100%;
    }

    .ad-native-body {
        flex-direction: column;
        align-items: flex-start;
    }

    .ad-native-cta {
        width: 100%;
        text-align: center;
    }

    .vpn-rec-list {
        grid-template-columns: 1fr;
    }
}
