/* ===== CSS Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-tap-highlight-color: transparent;
    height: 100%;
    font-size: 54px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    background: #f5f5f5;
    font-size: 12px;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
}

/* ===== 清除默认样式 ===== */
h1, h2, h3, h4, h5, h6 {
    font-size: 100%;
    font-weight: normal;
}

ul, ol, li {
    list-style: none;
}

a {
    text-decoration: none;
    color: #333;
    outline: none;
}

a:hover {
    text-decoration: none;
    color: #5c5c5c;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

/* ===== 隐藏滚动条 ===== */
::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* ===== 主布局 ===== */
.main-content {
    min-height: 100vh;
    position: relative;
}

/* ===== 主题切换按钮 ===== */
.theme-toggle {
    position: fixed;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 14px;
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-toggle:active {
    transform: scale(0.98);
}

.theme-icon {
    display: block;
    transition: transform 0.3s ease;
}


/* 暗色模式下的主题切换按钮 */
body.dark .theme-toggle {
    background: rgba(33, 38, 45, 0.9);
    color: #e6edf3;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

body.dark .theme-toggle:hover {
    background: rgba(48, 54, 61, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ===== 图片画廊样式 ===== */
.gallery {
    padding: 0 8px;
    margin-bottom: 350px; /* 为下载区域(350px高度)留出空间 */
}

.gallery-container {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    max-width: 100%;
    margin: 0 auto;
}

.gallery-column {
    width: calc(33.333% - 3px);
    height: 100vh;
    max-height: 800px;
    overflow: hidden;
    position: relative;
    border-radius: 4px;
}

.gallery-column:nth-child(2) {
    margin-top: -80px;
}

.gallery-scroll {
    position: absolute;
    left: 0;
    top: 4px;
    width: 100%;
    will-change: transform;
}

.gallery-item {
    width: 100%;
    height: 180px; /* 增加高度以显示竖的长方形 */
    margin-bottom: 4px;
    overflow: hidden;
    border-radius: 4px;
    position: relative;
    background: #f0f0f0;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top; /* 确保图片从顶部开始显示 */
    border-radius: 0.106667rem;
    transition: opacity 0.3s ease;
}

.gallery-item img[data-loaded="false"] {
    opacity: 0.6;
}

.gallery-item img[data-loaded="true"] {
    opacity: 1;
}

/* ===== 下载区域样式 ===== */
.download-section {
    position: fixed;
    bottom: 0; /* 贴底显示，包含footer */
    left: 0;
    right: 0;
    width: 100%;
    height: auto; /* 改为自动高度 */
    min-height: 280px; /* 设置最小高度 */
    background: linear-gradient(rgba(0,0,0,0), white, white);
    cursor: pointer;
    z-index: 10;
    display: flex;
    flex-direction: column; /* 改为垂直布局 */
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
}

.download-content {
    text-align: center;
    padding: 10px;
    max-width: 400px;
    width: 100%;
}

.app-logo {
    display: block;
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    border-radius: 16%;
}

.app-info {
    margin-bottom: 12px;
}

.app-name {
    font-size: 28px;
    font-weight: bold;
    color: #ff9500;
    margin-bottom: 6px;
}

.app-description {
    font-size: 14px;
    font-weight: normal;
    color: #000;
    margin: 0;
}

.download-btn {
    width: 60%;
    max-width: 200px;
    margin-top: 8px;
    padding: 10px 16px;
    font-size: 14px;
    letter-spacing: 3px;
    color: #ffffff;
    background: linear-gradient(180deg, #ff9500, #ff7600);
    border-radius: 20px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.download-btn:hover {
    background: #fc8915;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(240, 80, 110, 0.3);
}

.download-btn:active {
    transform: translateY(0);
}

.download-btn:focus {
    outline: 2px solid #f0506e;
    outline-offset: 2px;
}

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

.btn-loading {
    display: none;
}

.download-btn.loading .btn-text {
    display: none;
}

.download-btn.loading .btn-loading {
    display: inline;
}

/* ===== 页脚样式 ===== */
.page-footer {
    position: relative; /* 改为相对定位，作为下载模块的一部分 */
    text-align: center;
    font-size: 12px;
    color: #bbb;
    padding: 6px 0; /* 减少内边距 */
    background: white; /* 纯白色背景 */
    margin: 0; /* 确保没有外边距 */
    width: 100%; /* 占满宽度 */
    pointer-events: none; /* 不干扰点击事件 */
}

.page-footer p {
    margin: 0;
}

.version-info {
    font-size: 10px;
    color: #999;
    margin-top: 5px;
}

/* ===== 弹窗样式 ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    width: 320px;
    max-width: 85vw;
    height: 320px;
    border-radius: 6px;
    background-color: #fff;
    padding: 15px;
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.qr-code-container {
    width: 180px;
    height: 180px;
    margin: 25px auto 15px;
    border: 1px solid #eee;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
}

.qr-code {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-description {
    font-size: 14px;
    color: #9b9b9b;
    margin: 0;
}

/* ===== 教程弹窗样式 ===== */
.tutorial-modal {
    max-width: 480px;
    max-height: 70vh;
    overflow-y: auto;
    text-align: left;
    width: 85vw;
    height: auto;
    min-height: 320px;
}

.tutorial-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin: 0 0 15px 0;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}

.tutorial-content {
    margin-bottom: 20px;
}

.tutorial-step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

.tutorial-step-number {
    background: #007bff;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    margin-right: 10px;
    flex-shrink: 0;
}

.tutorial-step-content {
    flex: 1;
}

.tutorial-step-title {
    font-size: 13px;
    font-weight: bold;
    color: #333;
    margin: 0 0 5px 0;
}

.tutorial-step-description {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    margin: 0;
}

.tutorial-step-image {
    width: 100%;
    max-width: 250px;
    height: auto;
    border-radius: 4px;
    margin-top: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.tutorial-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.tutorial-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.tutorial-download {
    background: #007bff;
    color: white;
}

.tutorial-download:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.tutorial-close {
    background: #6c757d;
    color: white;
}

.tutorial-close:hover {
    background: #545b62;
    transform: translateY(-1px);
}

/* ===== 加载提示样式 ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #f0506e;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* ===== 错误提示样式 ===== */
.error-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff4757;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    max-width: 90vw;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

.error-toast.show {
    opacity: 1;
    visibility: visible;
}

.error-message {
    margin: 0;
}

/* ===== 响应式设计 ===== */
/* 移动端样式 (默认) - 已在基础样式中定义 */

/* PC端样式 */
@media (min-width: 768px) {
    body {
        max-width: 600px;
        margin: 0 auto;
        position: relative;
    }
    
    .gallery-container {
        max-width: 600px;
        gap: 8px;
    }
    
    .gallery-column {
        width: calc(33.333% - 6px);
    }
    
    .gallery-item {
        height: 245px;
    }
    
    .download-section {
        position: fixed;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 600px;
        max-width: 600px;
        height: auto;
        min-height: 300px;
        margin: 0;
        padding: 0;
        flex-direction: column;
    }
    
    .page-footer {
        position: relative;
        width: 100%;
        padding: 6px 0;
        background: white;
        margin: 0;
        text-align: center;
    }
    
    .download-content {
        padding: 15px;
    }
    
    .app-name {
        font-size: 36px;
    }
    
    .download-btn {
        width: 50%;
        max-width: 200px;
        font-size: 16px;
        padding: 12px 20px;
    }
}

/* ===== 暗色模式支持 ===== */
body.dark {
    background: #1c2128;
    color: #e6edf3;
    
    .gallery-item img {
        opacity: 0.8;
    }
    
    .download-section {
        background: linear-gradient(rgba(0,0,0,0), #1c2128, #1c2128);
    }
    
    .app-description {
        color: #e6edf3;
    }
    
    .page-footer {
        color: #8b949e;
        position: relative; /* 相对定位，作为下载模块的一部分 */
        padding: 6px 0; /* 减少内边距 */
        background: #1c2128; /* 暗色背景 */
        margin: 0; /* 确保没有外边距 */
        width: 100%; /* 占满宽度 */
        text-align: center; /* 居中对齐 */
    }
    
    .modal-content {
        background: #21262d;
        color: #e6edf3;
    }
    
    .qr-code-container {
        background: #30363d;
        border-color: #30363d;
    }
    
    .qr-description {
        color: #8b949e;
    }
    
    .modal-close {
        color: #8b949e;
    }
    
    .modal-close:hover {
        background: #30363d;
        color: #e6edf3;
    }
}

/* ===== 微信提示遮罩层样式 ===== */
.wechat-tip-container {
    text-align: center;
    padding: 15px;
    max-width: 350px;
    width: 100%;
}

.wechat-icon {
    font-size: 36px;
    margin-bottom: 10px;
    display: block;
}

.wechat-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.wechat-message {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
    line-height: 1.3;
}

.wechat-steps {
    margin: 15px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.step {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    text-align: left;
}

.step:last-child {
    margin-bottom: 0;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #f0506e;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    margin-right: 8px;
    flex-shrink: 0;
}

.step-text {
    font-size: 12px;
    color: #333;
    line-height: 1.3;
}

.wechat-qr-tip {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.wechat-qr-tip p {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.wechat-qr-tip .qr-code-container {
    margin: 10px auto;
    width: 100px;
    height: 100px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.wechat-qr-tip .qr-code {
    width: 84px;
    height: 84px;
    object-fit: contain;
}

.wechat-qr-tip .qr-description {
    font-size: 10px;
    color: #999;
    margin-top: 6px;
}

/* 深色模式下的微信提示样式 */
body.dark .wechat-title {
    color: #e6edf3;
}

body.dark .wechat-message {
    color: #8b949e;
}

body.dark .wechat-steps {
    background: #21262d;
    border-color: #30363d;
}

body.dark .step-text {
    color: #e6edf3;
}

body.dark .wechat-qr-tip {
    border-color: #30363d;
}

body.dark .wechat-qr-tip p {
    color: #8b949e;
}

body.dark .wechat-qr-tip .qr-code-container {
    background: #21262d;
    border-color: #30363d;
}

body.dark .wechat-qr-tip .qr-description {
    color: #8b949e;
}

/* ===== iOS下载提示样式 ===== */
.ios-download-container {
    text-align: center;
    padding: 15px;
    max-width: 350px;
    width: 100%;
}

.ios-icon {
    font-size: 36px;
    margin-bottom: 10px;
    display: block;
}

.ios-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.ios-message {
    font-size: 12px;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.3;
}

.ios-steps {
    margin: 15px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.ios-actions {
    margin-top: 15px;
    display: flex;
    gap: 8px;
    justify-content: center;
}

.ios-download-btn {
    background: #007AFF;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.ios-download-btn:hover {
    background: #0056CC;
}

.ios-cancel-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.ios-cancel-btn:hover {
    background: #545b62;
}

/* 深色模式下的iOS下载提示样式 */
body.dark .ios-title {
    color: #e6edf3;
}

body.dark .ios-message {
    color: #8b949e;
}

body.dark .ios-steps {
    background: #21262d;
    border-color: #30363d;
}

body.dark .step-text {
    color: #e6edf3;
}

/* ===== 动画优化 ===== */
.gallery-scroll {
    animation: scrollUp linear infinite;
}

@keyframes scrollUp {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-50%);
    }
}

/* ===== 可访问性增强 ===== */
@media (prefers-reduced-motion: reduce) {
    .gallery-scroll {
        animation: none;
    }
    
    .download-btn {
        transition: none;
    }
    
    .modal-overlay,
    .loading-overlay,
    .error-toast {
        transition: none;
    }
}

/* ===== 打印样式 ===== */
@media print {
    .download-section,
    .modal-overlay,
    .loading-overlay,
    .error-toast {
        display: none !important;
    }
    
    .gallery {
        margin-bottom: 0;
    }
    
    body {
        background: white;
        color: black;
    }
}
