/* ==========================================================================
   preview.css —— 文件分享预览页（镜音铃二次元风格）
   配色沿用铃主题：应援黄 #FFD93B / 樱花粉 #FF8FC0 / 瞳色青 #4FC3C7 / 奶油白 #FFFDF6
   壁纸沿用站点默认：横屏 bg1.webp / 竖屏 bg2.webp（和桌面「自动」一致）
   ========================================================================== */

:root {
    color-scheme: light;
    --pv-gold:      #FFD93B;
    --pv-gold-deep: #B4800A;
    --pv-pink:      #FF8FC0;
    --pv-teal:      #4FC3C7;
    --pv-cream:     #FFFDF6;
    --pv-ink:       #4A3B27;
    --pv-ink-2:     #7A6852;
    --pv-line:      #FFE9A8;
    --pv-glass:     rgba(255, 253, 246, .92);
    --pv-glass-2:   rgba(255, 253, 246, .78);
    --pv-shadow:    0 10px 30px rgba(196, 154, 40, .18);
    --pv-focus:     #0F7A7E;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --pv-ink:       #F7EFDC;
        --pv-ink-2:     #D8CDB6;
        --pv-glass:     rgba(38, 34, 27, .92);
        --pv-glass-2:   rgba(48, 43, 34, .80);
        --pv-line:      #6E5B3A;
        --pv-shadow:    0 12px 34px rgba(0, 0, 0, .38);
        --pv-focus:     #7FE3D6;
    }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; min-height: 100vh; }
.pv-body {
    position: relative;
    overflow-x: hidden;
    color: var(--pv-ink);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
                 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    background-color: var(--pv-cream);
    background-image: url('/bg2.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}
@media (min-aspect-ratio: 1/1) {
    .pv-body { background-image: url('/bg1.webp'); }
}
/* 奶油薄纱 + 星星点阵，和铃主题一致 */
.pv-body::before,
.pv-body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}
.pv-body::before {
    background:
        radial-gradient(1100px 560px at 12% -12%, rgba(255, 233, 150, .42), transparent 62%),
        radial-gradient(820px 480px at 96% 4%, rgba(255, 183, 214, .34), transparent 62%),
        linear-gradient(180deg, rgba(255, 253, 244, .52), rgba(255, 245, 214, .70));
}
.pv-body::after {
    opacity: .42;
    background-image:
        radial-gradient(circle, rgba(255,255,255,.95) 1.5px, transparent 1.6px),
        radial-gradient(circle, rgba(255,217,59,.7) 1.2px, transparent 1.3px);
    background-size: 128px 128px, 196px 196px;
    background-position: 0 0, 64px 92px;
}
@media (prefers-color-scheme: dark) {
    .pv-body::before {
        background:
            radial-gradient(1000px 520px at 12% -12%, rgba(120, 88, 20, .24), transparent 62%),
            linear-gradient(180deg, rgba(20, 18, 14, .72), rgba(20, 18, 14, .88));
    }
    .pv-body::after { opacity: .22; }
}
.pv-wrap { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 18px 14px 34px; }

:focus-visible { outline: 3px solid var(--pv-focus); outline-offset: 2px; }

/* ---------------- 顶栏 ---------------- */
.pv-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    margin-bottom: 16px;
    background: var(--pv-glass);
    border: 2px solid var(--pv-line);
    border-radius: 20px;
    box-shadow: var(--pv-shadow);
    backdrop-filter: blur(8px);
}
.pv-head-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pv-logo { flex: none; width: 46px; height: 46px; object-fit: contain; border-radius: 13px; }
.pv-title-box { min-width: 0; }
.pv-kicker {
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--pv-gold-deep);
    text-transform: uppercase;
}
.pv-title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--pv-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60vw;
}
.pv-head-r { display: flex; gap: 8px; flex: none; }
.pv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: filter .18s ease, transform .18s ease, box-shadow .18s ease;
}
.pv-btn:hover { filter: brightness(1.03); transform: translateY(-1px); }
.pv-btn:active { transform: scale(.97); }
.pv-btn-ghost {
    background: linear-gradient(140deg, #FFFDF6, #FFF4D2);
    border: 2px solid var(--pv-line);
    color: #8A6208;
}
.pv-btn-main {
    background: linear-gradient(140deg, #FFE985, var(--pv-gold));
    border: 2px solid #E9C84E;
    color: #5A3E00;
    box-shadow: 0 4px 12px rgba(245, 179, 1, .26);
}

/* ---------------- 舞台 ---------------- */
.pv-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.pv-media-box {
    width: 100%;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: var(--pv-glass);
    border: 2px solid var(--pv-line);
    border-radius: 22px;
    box-shadow: var(--pv-shadow);
}
.pv-image, .pv-video {
    max-width: 100%;
    max-height: 72vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    outline: none;
}
.pv-image {
    cursor: zoom-in;
    background: #000 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><rect width="16" height="16" fill="%23161616"/><rect x="0" y="0" width="8" height="8" fill="%23242424"/><rect x="8" y="8" width="8" height="8" fill="%23242424"/></svg>') repeat;
}
.pv-video { background: #000; box-shadow: 0 4px 12px rgba(0,0,0,.15); }

.pv-audio-box { flex-direction: column; gap: 20px; }
.pv-audio-art {
    width: 96px; height: 96px;
    display: grid; place-items: center;
    border-radius: 50%;
    font-size: 46px;
    font-weight: 800;
    color: #FFFDF6;
    background: linear-gradient(140deg, var(--pv-gold), var(--pv-pink));
    box-shadow: 0 8px 22px rgba(245, 179, 1, .30);
}
.pv-audio { width: 100%; max-width: 620px; }

.pv-pdf-box { padding: 0; overflow: hidden; height: 86vh; }
.pv-pdf { width: 100%; height: 100%; border: 0; }

/* ---------------- 信息条 ---------------- */
.pv-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    flex-wrap: wrap;
    padding: 8px 16px;
    background: var(--pv-glass-2);
    border: 1px solid var(--pv-line);
    border-radius: 999px;
    font-size: 12.5px;
    color: var(--pv-ink-2);
    text-align: center;
}
.pv-meta b { color: var(--pv-ink); font-weight: 800; }
.pv-meta-stack { flex-direction: column; border-radius: 14px; gap: 3px; }
.pv-sep { opacity: .5; }

/* ---------------- 画质切换 ---------------- */
.pv-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
}
.pv-pill {
    appearance: none;
    border: 2px solid rgba(79, 195, 199, .45);
    background: var(--pv-glass);
    color: var(--pv-ink);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: all .18s ease;
    min-height: 36px;
}
.pv-pill:hover:not(:disabled) { border-color: var(--pv-teal); background: #F0FBFA; }
.pv-pill[data-active] {
    background: linear-gradient(140deg, #FFE985, var(--pv-gold));
    border-color: #E9C84E;
    color: #5A3E00;
    box-shadow: 0 3px 10px rgba(245, 179, 1, .30);
}
.pv-pill:disabled { opacity: .45; cursor: not-allowed; }

.pv-status {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 16px;
    background: var(--pv-glass-2);
    border: 1px solid var(--pv-line);
    border-radius: 14px;
    font-size: 12.5px;
    color: var(--pv-ink-2);
    text-align: left;
}
.pv-spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(79, 195, 199, .25);
    border-top-color: var(--pv-teal);
    border-radius: 50%;
    animation: pv-spin .9s linear infinite;
    display: inline-block;
    flex: none;
}
@keyframes pv-spin { to { transform: rotate(360deg); } }

.pv-alert {
    flex: 1 1 100%;
    background: linear-gradient(140deg, #FFF4E5, #FFE4C9);
    border: 1.5px solid #F0B357;
    color: #8A4B08;
    font-size: 12.5px;
    line-height: 1.7;
    padding: 10px 14px;
    border-radius: 14px;
    text-align: left;
}

/* ---------------- 文本 ---------------- */
.pv-text {
    width: 100%;
    max-height: 78vh;
    overflow: auto;
    background: var(--pv-glass);
    border: 2px solid var(--pv-line);
    border-radius: 18px;
    padding: 20px 22px;
    font-family: ui-monospace, "Cascadia Code", Consolas, "Microsoft YaHei", monospace;
    font-size: 12.5px;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---------------- 兜底 ---------------- */
.pv-fallback {
    width: 100%;
    padding: 56px 24px;
    text-align: center;
    background: var(--pv-glass);
    border: 2px dashed var(--pv-line);
    border-radius: 22px;
    box-shadow: var(--pv-shadow);
}
.pv-fallback-ico { font-size: 40px; color: var(--pv-gold-deep); }
.pv-fallback h2 { margin: 10px 0 6px; font-size: 18px; }
.pv-fallback p { margin: 0 0 18px; color: var(--pv-ink-2); font-size: 13px; }

/* ---------------- 手机端 ---------------- */
@media (max-width: 720px) {
    .pv-wrap { padding: 10px 10px 24px; }
    .pv-head { padding: 12px 14px; align-items: flex-start; }
    .pv-logo { width: 40px; height: 40px; border-radius: 11px; }
    .pv-title { font-size: 15px; max-width: 52vw; }
    .pv-head-r { flex-direction: column; gap: 6px; }
    .pv-btn { height: 34px; padding: 0 12px; font-size: 12px; }
    .pv-media-box { padding: 10px; min-height: 220px; border-radius: 16px; }
    .pv-pdf-box { padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
