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

/* 核心优化：移动端强制全屏，禁止滚动 */
html, body {
    font-family: "Microsoft Yahei", Arial, sans-serif;
    color: #fff;
    overflow-x: hidden;
    background-color: #000;
    height: 100%;
    width: 100%;
    /* 移动端禁止所有滚动 */
    overscroll-behavior: none;
}

/* 针对iOS设备的viewport优化 */
@supports (padding: max(0px)) {
    body {
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }
}

/* 壁纸容器 - 全屏展示 */
.wallpaper-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    /* 确保容器填满屏幕，无溢出 */
    max-height: 100vh;
    max-width: 100vw;
} 

/* 壁纸图片容器 - 用于过渡动画 */
.wallpaper-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#bing-wallpaper {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

#bing-wallpaper.loaded {
    opacity: 1;
}

/* 壁纸切换时的过渡遮罩 */
.wallpaper-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 5;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    pointer-events: none;
}

.wallpaper-overlay.active {
    opacity: 1;
}

/* 控制按钮组 */
.control-buttons {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.ctrl-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ctrl-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
}

/* 移动端信息显示按钮 - 修复位置，确保可见 */
.mobile-info-toggle {
    position: fixed; /* 改为fixed定位，避免被遮挡 */
    bottom: 30px; /* 增加底部间距，避开底部栏 */
    left: 50%;
    transform: translateX(-50%);
    width: 44px; /* 增大按钮尺寸，更容易点击 */
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7); /* 加深背景，提高可见度 */
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99; /* 提高层级，确保不被遮挡 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.3); /* 添加阴影，增强视觉 */
}

/* PC端信息显示按钮（关闭后显示） */
.pc-info-toggle {
    position: absolute;
    bottom: 40px;
    left: 40px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.pc-info-toggle:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
}

/* 切换按钮（上一张/下一张） */
.nav-buttons {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    transform: translateY(-50%);
    z-index: 10;
}

.nav-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.nav-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.7);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.3);
}

/* 信息面板 - 优化移动端位置 */
.info-panel {
    position: absolute;
    bottom: 40px;
    left: 40px;
    max-width: 70%;
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9;
    transition: all 0.3s ease;
}

/* PC端信息面板关闭按钮 */
.info-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.info-close-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.info-panel h1 {
    font-size: 24px;
    margin-bottom: 10px;
    font-weight: normal;
    padding-right: 24px; /* 给关闭按钮留空间 */
}

.info-panel .copyright {
    font-size: 14px;
    line-height: 1.6;
    color: #eee;
    margin-bottom: 12px;
}

/* 下载区域 - 分两行展示 */
.download-area {
    margin: 10px 0;
}

.download-area .title {
    font-size: 14px;
    margin-bottom: 8px;
    color: #ddd;
}

.resolution-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.resolution-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.res-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.res-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.info-panel .date {
    font-size: 12px;
    margin-top: 8px;
    color: #ccc;
}

/* 本站版权信息 */
.site-copyright {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    color: #aaa;
}

.site-copyright a {
    color: #4a90e2;
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-copyright a:hover {
    color: #6bb0ff;
    text-decoration: underline;
}

/* 历史记录面板 - 基础样式，区分端的偏移写在媒体查询里 */
.history-toggle {
    position: fixed;
    top: 30px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 99;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.history-toggle:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.7);
}

/* 历史面板基础样式 - 偏移逻辑移到媒体查询中 */
.history-panel {
    position: fixed;
    top: auto;
    bottom: 90px;
    right: 20px;
    left: 20px;
    width: calc(100% - 40px);
    max-width: none;
    max-height: 60vh;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px;
    overflow-y: auto;
    z-index: 98;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.15);
    /* 初始隐藏（默认移动端） */
    transform: translateY(calc(100% + 50px));
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.history-panel::-webkit-scrollbar {
    width: 8px;
}

.history-panel::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.3);
    border-radius: 4px;
}

.history-panel.show {
    transform: translateY(0);
}

/* 核心修复：历史面板标题栏布局，关闭按钮靠右 */
.history-panel h2 {
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    padding-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-panel h2 .close-btn {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    cursor: pointer;
    opacity: 1;
    transition: all 0.2s ease;
}

.history-panel h2 .close-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* 搜索框样式 - 优化移动端 */
.history-search {
    position: relative;
    margin-bottom: 18px;
}

.history-search input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.history-search input:focus {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.3);
}

.history-search input::placeholder {
    color: rgba(255,255,255,0.5);
}

.history-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

.history-search .clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    cursor: pointer;
    display: none;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
}

.history-search .clear-btn.show {
    display: flex;
}

.history-search .clear-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* 搜索结果提示 */
.search-result-tip {
    text-align: center;
    padding: 20px 0;
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    display: none;
}

.search-result-tip.show {
    display: block;
}

/* 分页加载提示 */
.history-loading {
    text-align: center;
    padding: 12px 0;
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    display: none;
}

.history-loading.show {
    display: block;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    background: rgba(255,255,255,0.05);
}

.history-item.active {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.history-item:hover {
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.history-item img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    transition: opacity 0.3s ease;
    background: rgba(255,255,255,0.05);
    opacity: 0;
}

.history-item img.loaded {
    opacity: 1;
}

.history-item:hover img {
    opacity: 0.95;
}

.history-item .info {
    padding: 10px 12px;
}

.history-item .info .title {
    font-size: 14px;
    margin-bottom: 4px;
    color: #fff;
}

.history-item .info .date {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
}

/* 加载/错误提示 */
.loading, .error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 20px;
    max-width: 90%;
    z-index: 10;
}

.loading {
    font-size: 18px;
    color: #fff;
}

.error h2 {
    margin-bottom: 10px;
    font-size: 20px;
}

.error p {
    font-size: 14px;
    color: #ddd;
}

/* 自动播放提示 */
.play-tip {
    position: absolute;
    top: 80px;
    left: 20px;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: #fff;
    z-index: 10;
    display: none;
}

.play-tip.show {
    display: block;
}

/* 关于本站弹窗样式 */
.about-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 9998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.about-modal-overlay.show {
    display: block;
    opacity: 1;
}

.about-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 600px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9999;
    padding: 0;
    color: #fff;
    display: none;
    transition: transform 0.3s ease;
}

.about-modal.show {
    display: block;
    transform: translate(-50%, -50%) scale(1);
}

.about-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.about-modal-header h3 {
    font-size: 18px;
    font-weight: normal;
    margin: 0;
}

.about-modal-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.about-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.about-modal-content {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
    line-height: 1.6;
}

.about-modal-content p {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #eee;
}

.about-modal-content h4 {
    font-size: 16px;
    margin: 16px 0 8px 0;
    color: #fff;
    font-weight: normal;
}

.about-modal-content ul {
    margin: 0 0 12px 20px;
    padding: 0;
}

.about-modal-content li {
    margin-bottom: 6px;
    font-size: 14px;
    color: #eee;
}

.about-modal-content a {
    color: #4a90e2;
    text-decoration: none;
    transition: color 0.3s ease;
}

.about-modal-content a:hover {
    color: #6bb0ff;
    text-decoration: underline;
}

.about-modal-version {
    margin-top: 20px !important;
    font-size: 12px !important;
    color: #aaa !important;
}

.about-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.about-modal-confirm {
    padding: 8px 24px;
    background: rgba(74, 144, 226, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.about-modal-confirm:hover {
    background: rgba(74, 144, 226, 1);
}

/* ============ 核心：媒体查询区分移动端和PC端 ============ */
/* 移动端适配 (max-width:768px) */
@media (max-width: 768px) {
    html, body {
        overflow: hidden !important;
        touch-action: none;
    }

    .mobile-info-toggle {
        display: flex;
    }

    .pc-info-toggle {
        display: none !important;
    }

    /* 移动端信息面板 */
    .info-panel {
        position: fixed;
        top: 20px;
        bottom: auto;
        left: 20px;
        right: 20px;
        max-width: none;
        width: calc(100% - 40px);
        padding: 18px;
        max-height: 70vh;
        overflow-y: auto;
        transform: translateY(-120%);
        opacity: 0;
        pointer-events: none;
        z-index: 97;
        border-radius: 12px;
        background: rgba(0,0,0,0.8);
        border: 1px solid rgba(255,255,255,0.15);
    }

    .info-panel.show {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
        z-index: 999;
    }

    .control-buttons {
        position: fixed;
        top: 30px;
        left: 20px;
        gap: 8px;
        z-index: 99;
    }

    .ctrl-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }

    .nav-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
        background: rgba(0,0,0,0.7);
        border-color: rgba(255,255,255,0.5);
    }

    .info-panel h1 {
        font-size: 18px;
        padding-right: 0;
        margin-bottom: 8px;
    }

    .info-panel .copyright {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .res-btn {
        padding: 8px 12px;
        font-size: 12px;
        margin-bottom: 4px;
    }

    .resolution-row {
        gap: 6px;
    }

    .about-modal {
        width: 95%;
        max-width: none;
    }
    
    .about-modal-content {
        padding: 15px;
        max-height: 60vh;
    }
    
    .about-modal-header {
        padding: 12px 15px;
    }
    
    .about-modal-footer {
        padding: 12px 15px;
    }

    /* 移动端历史面板：增大隐藏偏移，彻底移出屏幕 */
    .history-panel {
        transform: translateY(calc(100% + 100px));
    }
}

/* 隐藏PC端的信息关闭按钮在移动端不显示 */
@media (max-width: 768px) {
    .info-close-btn {
        display: none;
    }
    .info-panel h1 {
        padding-right: 0;
    }
}

/* PC端适配 (min-width:769px) */
@media (min-width: 769px) {
    .mobile-info-toggle {
        display: none !important;
    }

    html, body {
        overflow: auto;
        touch-action: auto;
    }

    /* PC端历史面板：重置样式，水平偏移隐藏 */
    .history-toggle {
        position: absolute;
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 16px;
        background: rgba(0,0,0,0.5);
        border-color: rgba(255,255,255,0.3);
        box-shadow: none;
    }

    .history-panel {
        position: absolute;
        top: 70px;
        right: 20px;
        bottom: auto;
        left: auto;
        width: 320px;
        max-height: 80vh;
        /* PC端隐藏：水平右移，彻底移出屏幕 */
        transform: translateX(calc(100% + 50px));
    }

    .history-panel.show {
        transform: translateX(0);
    }
}

/* 弹窗滚动条样式 */
.about-modal-content::-webkit-scrollbar {
    width: 6px;
}

.about-modal-content::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.2);
    border-radius: 3px;
}