/* ==========================================================================
   NEON CYBERPUNK VIEW DECK - OPTIMIZED WITH SMOOTH CROSSFADE
   ========================================================================= */

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

:root {
    --primary: #ec4899;
    --primary-glow: rgba(236, 72, 153, 0.4);
    --bg-dark: #06060b;
    --card-bg: rgba(21, 21, 34, 0.7);
    --card-border: rgba(236, 72, 153, 0.15);
    /* 优化后的白色字体层级 */
    --text-glow: #f8fafc;
    --text-main: #e2e8f0;
    --text-muted: rgba(241, 245, 249, 0.55);
}

body, html {
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
    perspective: 1000px; /* 为 3D 视差做准备 */
}

/* 1. 霓虹环境光背景特效 */
.ambient-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
    background: 
        radial-gradient(circle at 10% 20%, rgba(236, 72, 153, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(37, 99, 235, 0.06) 0%, transparent 40%);
    filter: blur(40px);
    animation: ambientPulse 12s ease-in-out infinite alternate;
}

@keyframes ambientPulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.1); opacity: 1; }
}

/* 1. 确保主界面在内容超出时一定会触发滚动，并且允许单独的局部滚动 */
#home-view {
    position: relative;
    width: 100%;
    height: 100%;       /* 撑满父级高度 */
    overflow-y: scroll; /* 强制生成 Y 轴滚动物理特性，防止因隐藏导致页面抖动 */
    padding: 50px 20px;
    z-index: 1;
}

/* 2. Webkit 内核 (Chrome, Safari, Edge) 滚动条常驻与美化 */
#home-view::-webkit-scrollbar,
.style-sidebar::-webkit-scrollbar {
    width: 6px;         /* 宽度 */
    height: 6px;
    display: block !important; /* 确保不被任何底层框架隐藏 */
}

/* 滚动条轨道 */
#home-view::-webkit-scrollbar-track,
.style-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01); /* 给一个极淡的底色，确保轨道物理可见 */
}

/* 滚动条滑块 */
#home-view::-webkit-scrollbar-thumb,
.style-sidebar::-webkit-scrollbar-thumb {
    background: rgba(236, 72, 153, 0.35);  /* 提高默认不透明度 (0.25 -> 0.35) 增强可见性 */
    border-radius: 10px;
    border: 1px solid rgba(236, 72, 153, 0.15);
}

/* 鼠标悬停 */
#home-view::-webkit-scrollbar-thumb:hover,
.style-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(236, 72, 153, 0.7);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* 鼠标按下 */
#home-view::-webkit-scrollbar-thumb:active,
.style-sidebar::-webkit-scrollbar-thumb:active {
    background: rgba(236, 72, 153, 0.9);
}

/* 3. 针对 Firefox 浏览器 */
#home-view,
.style-sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(236, 72, 153, 0.35) rgba(255, 255, 255, 0.01);
}

.title { 
    text-align: center; 
    margin-bottom: 40px; 
    color: var(--primary); 
    font-size: 28px; 
    font-weight: 800;
    letter-spacing: 2px; 
    text-shadow: 0 0 20px rgba(236, 72, 153, 0.4);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 3. 3D 悬浮视差卡片特效 */
.card {
    background: var(--card-bg);
    padding: 28px 16px;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--card-border);
    font-weight: 600;
    font-size: 15px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s, color 0.3s;
    transform-style: preserve-3d;
    transform: perspective(1000px);
}

.card:hover {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 12px 30px rgba(236, 72, 153, 0.25), 0 0 15px rgba(236, 72, 153, 0.1);
    color: #fff;
}

/* 4. 看图页总体布局 */
#viewer-view {
    width: 100%;
    height: 100%;
    display: none;
    position: relative;
    background: #000;
    z-index: 2;
}

.viewer-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

/* 侧边栏 */
.style-sidebar { 
    width: 240px; 
    height: 100%; 
    background: rgba(6, 6, 11, 0.65); 
    backdrop-filter: blur(25px) saturate(180%);       
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-right: 1px solid rgba(255, 255, 255, 0.06); 
    padding: 85px 16px 20px; 
    flex-shrink: 0; 
    overflow-y: auto; 
    z-index: 90; 
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); 
    box-shadow: 15px 0 35px rgba(0,0,0,0.6);
}

.style-sidebar.collapsed { 
    width: 0; padding-left: 0; padding-right: 0; border-right: none; opacity: 0; pointer-events: none; 
}

.sidebar-title {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-weight: 700;
    padding-left: 8px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* 侧边栏流光链接按钮 */
.style-link {
    position: relative;
    display: block;
    padding: 12px 16px;
    color: var(--text-main);
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 8px;
    cursor: pointer;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
}

.style-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateX(4px);
}

.style-link.active {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 20px var(--primary-glow);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.style-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 25%; width: 4px; height: 50%;
    background: #fff;
    border-radius: 0 4px 4px 0;
    animation: barGrow 0.3s ease forwards;
}

@keyframes barGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* 悬浮控制按钮 */
.toggle-sidebar-btn, .back-btn { 
    position: fixed; z-index: 100; 
    background: rgba(21, 21, 34, 0.7); 
    border: 1px solid rgba(255, 255, 255, 0.12); 
    color: #fff; cursor: pointer; 
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toggle-sidebar-btn {
    top: 15px; left: 145px; width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 14px;
}

.toggle-sidebar-btn:hover { 
    background: var(--primary); border-color: var(--primary); 
    transform: scale(1.1) rotate(90deg); box-shadow: 0 0 20px var(--primary-glow);
}

.back-btn {
    top: 15px; left: 15px; padding: 10px 22px; border-radius: 30px;
    font-size: 13px; font-weight: 600; letter-spacing: 0.5px;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.15); transform: translateX(-3px);
    border-color: rgba(255,255,255,0.3);
}

/* ==========================================================================
   ⚡ 核心修改：右侧看图主舞台（叠层无缝舞台化）
   ========================================================================= */
#scroll-stage {
    flex-grow: 1; 
    height: 100%; 
    position: relative; /* 建立画卷基础叠层坐标 */
    background: #000;
    overflow: hidden;   /* 彻底移除原生硬滚动条 */
}

/* 现代美化滚动条 (仅对侧边栏有效，主舞台已转为绝对淡入淡出体系) */
.style-sidebar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.style-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.style-sidebar::-webkit-scrollbar-thumb {
    background: rgba(236, 72, 153, 0.25); 
    border-radius: 10px;
    border: 1px solid rgba(236, 72, 153, 0.1);
    transition: background 0.3s ease;
}
.style-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(236, 72, 153, 0.6);
    box-shadow: 0 0 8px var(--primary-glow);
}
.style-sidebar::-webkit-scrollbar-thumb:active {
    background: rgba(236, 72, 153, 0.8);
}
.style-sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(236, 72, 153, 0.25) transparent;
}

/* 5. 绝对定位叠层卡片，配合状态机控制全景淡入淡出 */
.page-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%; 
    height: 100%; 
    display: flex; 
    justify-content: center; 
    align-items: center;
    background: #020204;
    
    /* 默认隐藏状态：完全透明、轻微放大、模糊 */
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    filter: blur(15px);
    transform: scale(1.05);
    
    /* 极致平滑跨电影感混合过渡 */
    transition: opacity 0.8s cubic-bezier(0.33, 1, 0.68, 1),
                transform 0.8s cubic-bezier(0.33, 1, 0.68, 1),
                filter 0.8s cubic-bezier(0.33, 1, 0.68, 1);
}

/* 骨架流光：仅在还未载入、且被处于激活展示态的卡片上渲染 */
.page-item:not(.loaded).active {
    background-image: linear-gradient(90deg, #020204 25%, #0d0d18 45%, #020204 65%);
    background-size: 400% 100%;
    animation: skeletonShimmer 2s infinite linear;
}

@keyframes skeletonShimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 当卡片通过 JS 被赋予 .active 激活状态时触发高亮淡入 */
.page-item.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
    filter: blur(0px);
    transform: scale(1);
}

/* 6. 写真图片渲染状态 */
.page-item img {
    max-width: 100%; 
    max-height: 100vh; 
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    box-shadow: 0 0 60px rgba(0,0,0,0.9);
}

/* 图片完成懒加载后的内部展现 */
.page-item.loaded img {
    opacity: 1;
}

.page-item.loaded {
    background-image: none; /* 完成后移除骨架流光背景 */
}

/* 左下角信息卡（带淡出、淡入延迟联动） */
.info {
    position: absolute; 
    bottom: 25px; 
    left: 25px;
    background: linear-gradient(135deg, rgba(11, 11, 18, 0.9) 0%, rgba(21, 21, 34, 0.7) 100%);
    padding: 12px 20px; 
    border-radius: 14px; 
    font-size: 13px; 
    font-weight: 500;
    border-left: 4px solid var(--primary);
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px);
    pointer-events: none; 
    z-index: 12;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    
    /* 默认隐藏偏移 */
    transform: translateY(15px); 
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 当前处于展示且加载完结状态时，延迟精细滑出 */
.page-item.active.loaded .info {
    transform: translateY(0); 
    opacity: 1;
    transition-delay: 0.25s; 
}

.loading-tip { 
    text-align: center; 
    color: var(--text-muted); 
    margin-top: 60px; 
    font-size: 14px; 
}

@media (max-width: 640px) {
    .style-sidebar { width: 160px; padding-top: 80px; }
    .toggle-sidebar-btn { left: 120px; }
    .info { bottom: 20px; left: 20px; font-size: 12px; padding: 10px 14px; }
    .title { font-size: 24px; }
}