/* =========================================================
   Prism Studio — 扩展样式（v1.1.0）
   独立文件：不修改 main.css，升级时不会覆盖既有样式。
   包含：图片 Logo / 视频特效页 / 视频弹窗 / 游戏网格 / 内容块排版
   全部复用 main.css 里的设计变量，明暗主题自动适配。
   ========================================================= */

/* ---------- 变量别名（映射到 main.css 的设计令牌，明暗主题自动跟随） ---------- */
:root,
[data-theme="dark"],
[data-theme="light"] {
    --glass-bg: var(--surface);
    --glass-bg-strong: var(--bg-elevated);
    --glass-border: var(--hairline);
    --glass-border-strong: var(--hairline-strong);
    --accent-violet: var(--violet);
    --accent-pink: var(--pink);
    --accent-cyan: var(--cyan);
    --text-primary: var(--text);
    --text-tertiary: var(--text-muted);
}

/* ---------- 图片 Logo ---------- */
.logo .logo-img {
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: contain;
    flex: 0 0 auto;
}

.site-footer .logo .logo-img {
    width: 32px;
    height: 32px;
}

/* ---------- 视频特效页 ---------- */
.video-section .section-header {
    margin-bottom: 2.5rem;
}

.video-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.video-filter-btn {
    appearance: none;
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    background: var(--glass-bg, rgba(255, 255, 255, 0.04));
    color: var(--text-secondary, #a1a1aa);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.45rem 1.1rem;
    border-radius: 999px;
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease, background-color .2s ease, transform .2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.video-filter-btn:hover {
    color: var(--text-primary, #fafafa);
    border-color: var(--accent-violet, #8b5cf6);
}

.video-filter-btn.is-active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--accent-violet, #8b5cf6), var(--accent-pink, #ec4899));
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.video-card {
    min-width: 0;
}

.video-card[hidden] {
    display: none;
}

.video-card-trigger {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
    text-align: left;
    background: var(--glass-bg, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: var(--radius-lg, 16px);
    overflow: hidden;
    cursor: pointer;
    color: inherit;
    font: inherit;
    transition: transform .3s cubic-bezier(.16, 1, .3, 1), border-color .3s ease, box-shadow .3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.video-card-trigger:hover,
.video-card-trigger:focus-visible {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--accent-violet, #8b5cf6) 60%, transparent);
    box-shadow: 0 18px 40px -18px rgba(139, 92, 246, .45);
}

.video-thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, rgba(139, 92, 246, .18), rgba(236, 72, 153, .14));
    overflow: hidden;
}

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

.video-thumb-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary, #71717a);
}

.video-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    background: rgba(15, 15, 20, .55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .25);
    transition: transform .25s ease, background-color .25s ease;
}

.video-play svg {
    margin-left: 3px;
}

.video-card-trigger:hover .video-play,
.video-card-trigger:focus-visible .video-play {
    transform: translate(-50%, -50%) scale(1.08);
    background: linear-gradient(135deg, var(--accent-violet, #8b5cf6), var(--accent-pink, #ec4899));
}

.video-tag {
    position: absolute;
    left: 0.75rem;
    top: 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: .02em;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    color: #fff;
    background: rgba(15, 15, 20, .6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.video-meta {
    display: block;
    padding: 1.1rem 1.25rem 1.25rem;
}

.video-name {
    display: block;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary, #fafafa);
    margin-bottom: 0.35rem;
}

.video-desc {
    display: block;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary, #a1a1aa);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-empty {
    text-align: center;
    padding: 4rem 1.5rem;
    border: 1px dashed var(--glass-border, rgba(255, 255, 255, 0.14));
    border-radius: var(--radius-lg, 16px);
    color: var(--text-secondary, #a1a1aa);
}

.video-empty svg {
    color: var(--text-tertiary, #71717a);
    margin-bottom: 1rem;
}

.video-empty h3 {
    font-size: 1.125rem;
    color: var(--text-primary, #fafafa);
    margin-bottom: 0.5rem;
}

/* ---------- 视频弹窗（不跳转、不新开页） ---------- */
.video-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 4vw, 2.5rem);
}

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

.video-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 6, 10, .82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: prismFadeIn .2s ease;
}

.video-modal-dialog {
    position: relative;
    width: min(1040px, 100%);
    max-height: calc(100dvh - 3rem);
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated, #16161d);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    border-radius: var(--radius-lg, 16px);
    box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .75);
    overflow: hidden;
    animation: prismModalIn .28s cubic-bezier(.16, 1, .3, 1);
}

@keyframes prismFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes prismModalIn {
    from { opacity: 0; transform: translateY(14px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

.video-modal-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
}

.video-modal-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #fafafa);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-modal-close {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    background: transparent;
    color: var(--text-secondary, #a1a1aa);
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease, background-color .2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.video-modal-close:hover {
    color: var(--text-primary, #fafafa);
    border-color: var(--accent-pink, #ec4899);
}

.video-modal-stage {
    position: relative;
    background: #000;
    aspect-ratio: 16 / 9;
    width: 100%;
    max-height: calc(100dvh - 9rem);
}

.video-modal-stage video,
.video-modal-stage iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #000;
}

.video-modal-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    align-items: center;
    justify-content: center;
    color: #d4d4d8;
    font-size: .9375rem;
    text-align: center;
    padding: 1.5rem;
}

body.prism-modal-open {
    overflow: hidden;
}

/* ---------- 支持的游戏 ---------- */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}

.game-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.65rem;
    padding: 1.75rem 1.25rem;
    background: var(--glass-bg, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: var(--radius-lg, 16px);
    transition: transform .3s cubic-bezier(.16, 1, .3, 1), border-color .3s ease;
}

.game-card:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--accent-cyan, #06b6d4) 55%, transparent);
}

.game-logo {
    width: 62px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(139, 92, 246, .2), rgba(6, 182, 212, .16));
}

.game-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.game-initial,
.game-logo-fallback {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #fafafa);
}

.game-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #fafafa);
    margin: 0;
}

.game-desc {
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--text-secondary, #a1a1aa);
    margin: 0;
}

/* ---------- 内容块（自动排版） ---------- */
.block-richtext-title,
.block-video-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--text-primary, #fafafa);
    margin-bottom: 1rem;
}

.block-video-desc {
    color: var(--text-secondary, #a1a1aa);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.video-frame {
    position: relative;
    border-radius: var(--radius-lg, 16px);
    overflow: hidden;
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
}

.video-frame-trigger {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.video-frame-trigger:hover,
.video-frame-trigger:focus-visible {
    transform: none;
    box-shadow: none;
}

.content-image {
    margin: 0;
    text-align: center;
}

.content-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg, 16px);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
}

.content-image figcaption {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-tertiary, #71717a);
}

.columns-grid {
    display: grid;
    gap: 1.75rem;
    grid-template-columns: 1fr;
}

@media (min-width: 720px) {
    .columns-grid.columns-2 { grid-template-columns: repeat(2, 1fr); }
    .columns-grid.columns-3 { grid-template-columns: repeat(3, 1fr); }
    .columns-grid.columns-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .columns-grid.columns-4 { grid-template-columns: repeat(4, 1fr); }
}

.column-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary, #fafafa);
    margin-bottom: 0.65rem;
}

.page-back-section {
    padding-top: 0;
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
    .video-grid {
        grid-template-columns: 1fr;
    }

    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.9rem;
    }

    .game-card {
        padding: 1.25rem 0.85rem;
    }

    .video-modal {
        padding: 0;
        align-items: flex-end;
    }

    .video-modal-dialog {
        width: 100%;
        max-height: 100dvh;
        border-radius: var(--radius-lg, 16px) var(--radius-lg, 16px) 0 0;
    }

    .video-modal-stage {
        max-height: 60dvh;
    }
}

/* ---------- 明亮主题微调 ---------- */
[data-theme="light"] .video-play {
    background: rgba(255, 255, 255, .72);
    color: #18181b;
    border-color: rgba(0, 0, 0, .1);
}

[data-theme="light"] .video-tag {
    background: rgba(255, 255, 255, .82);
    color: #27272a;
}

[data-theme="light"] .video-modal-backdrop {
    background: rgba(24, 24, 27, .55);
}

/* ---------- 无障碍 / 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
    .video-card-trigger,
    .game-card,
    .video-play {
        transition: none;
    }

    .video-modal-dialog,
    .video-modal-backdrop {
        animation: none;
    }
}

/* =========================================================
   下载中心 · 大版本（v1.4.0）
   /download 版本导航 + /download/{code} 版本页（完整包 / 升级包分组）
   仅新增，不改动 main.css 任何既有规则。
   ========================================================= */

/* 下载中心总览：大版本卡片 */
.dlv-hub {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 18px;
}
.dlv-hub-card {
    display: flex; flex-direction: column; gap: 6px;
    padding: 20px; border-radius: 14px;
    border: 1px solid rgba(127, 127, 160, 0.22);
    background: rgba(127, 127, 160, 0.05);
    text-decoration: none; color: inherit;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.dlv-hub-card:hover {
    border-color: var(--violet, #6D8BFF);
    background: rgba(109, 139, 255, 0.09);
    transform: translateY(-2px);
}
.dlv-hub-name  { font-size: 20px; font-weight: 800; letter-spacing: .02em; }
.dlv-hub-title { font-size: 14px; font-weight: 600; opacity: .82; }
.dlv-hub-desc  { font-size: 13px; line-height: 1.6; opacity: .62; }
.dlv-hub-more  { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--violet, #6D8BFF); }

/* 版本页顶部：大版本切换条 */
.dlv-switch { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; }
.dlv-switch-item {
    display: flex; flex-direction: column; gap: 2px;
    min-width: 128px; padding: 12px 18px; border-radius: 12px;
    border: 1px solid rgba(127, 127, 160, 0.24);
    background: rgba(127, 127, 160, 0.05);
    text-decoration: none; color: inherit; text-align: center;
    transition: border-color .18s ease, background .18s ease;
}
.dlv-switch-item:hover { border-color: var(--violet, #6D8BFF); background: rgba(109, 139, 255, 0.09); }
.dlv-switch-item.is-active {
    border-color: var(--violet, #6D8BFF);
    background: rgba(109, 139, 255, 0.15);
}
.dlv-switch-name  { font-size: 15px; font-weight: 700; }
.dlv-switch-title { font-size: 12px; opacity: .62; }

/* 版本页内的「完整包 / 升级包」分组 */
.dlv-group { margin-bottom: 34px; }
.dlv-group-head { margin-bottom: 12px; }
.dlv-group-title {
    display: flex; align-items: center; gap: 8px;
    margin: 0; font-size: 18px; font-weight: 700;
}
.dlv-group-title svg { color: var(--violet, #6D8BFF); flex-shrink: 0; }
.dlv-group-hint { margin: 6px 0 0; font-size: 13.5px; opacity: .64; }
.dlv-empty {
    padding: 22px; text-align: center; font-size: 14px; opacity: .58;
    border: 1px dashed rgba(127, 127, 160, 0.28); border-radius: 12px;
}
.dlv-notes    { font-size: 13px; opacity: .7; }
.dlv-checksum { font-size: 11.5px; opacity: .45; }
.dlv-back     { margin-top: 8px; }
.section-sub  { margin: 8px 0 0; font-size: 14.5px; opacity: .66; }

@media (max-width: 640px) {
    .dlv-hub { grid-template-columns: 1fr; }
    .dlv-switch-item { flex: 1 1 42%; min-width: 0; }
    .dlv-group { margin-bottom: 26px; }
}
