/* =========================================
   1. 全局重置与变量 (Global & Variables)
   ========================================= */
   :root {
    --primary-color: #2563eb;       /* 主题蓝 */
    --primary-dark: #1d4ed8;        /* 深蓝 (点击态) */
    --accent-color: #FF6B6B;        /* 强调色 (提示/红) */
    --text-primary: #1e293b;        /* 主标题色 */
    --text-secondary: #64748b;      /* 副标题色 */
    --bg-gradient-start: #e0f2fe;   /* 背景渐变始 */
    --bg-gradient-end: #f0f9ff;     /* 背景渐变终 */
    
    /* 安全区域 (适配 iPhone X+ 系列) */
    --safe-bottom: env(safe-area-inset-bottom, 20px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    /* 适配刘海屏，防止内容被底部黑条遮挡 */
    padding-bottom: var(--safe-bottom);
    overscroll-behavior-y: none; /* 防止 iOS 橡皮筋效果露出背景 */
    -webkit-font-smoothing: antialiased;
}

/* =========================================
   2. 背景装饰动画 (Background Bubbles)
   ========================================= */
.bg-decoration {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0; overflow: hidden;
}

.bubble {
    position: absolute; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.1) 100%);
    animation: float 20s infinite ease-in-out; filter: blur(1px);
}

.bubble-1 { width: 120px; height: 120px; top: 10%; left: 10%; animation-duration: 25s; }
.bubble-2 { width: 80px; height: 80px; top: 70%; left: 5%; animation-delay: 5s; animation-duration: 20s; }
.bubble-3 { width: 150px; height: 150px; top: 20%; right: 10%; animation-delay: 10s; animation-duration: 30s; }
.bubble-4 { width: 60px; height: 60px; top: 60%; right: 20%; animation-delay: 15s; animation-duration: 22s; }
.bubble-5 { width: 100px; height: 100px; top: 40%; left: 50%; animation-delay: 8s; animation-duration: 28s; }

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.6; }
    50% { transform: translate(-20px, 20px) scale(0.9); opacity: 0.4; }
}

/* =========================================
   3. 主布局容器 (Layout)
   ========================================= */
.container {
    position: relative; z-index: 1;
    max-width: 480px; /* 限制最大宽度，桌面端更好看 */
    margin: 0 auto;
    min-height: 100vh;
    display: flex; flex-direction: column;
}

.main-content {
    flex: 1; padding: 2rem 1.25rem;
    display: flex; flex-direction: column;
    width: 100%;
}

/* =========================================
   4. 提示框 (普通浏览器提示)
   ========================================= */
.tip-section { margin-bottom: 1.5rem; animation: slideDown 0.5s ease; }
.tip-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px; padding: 12px 16px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 107, 107, 0.2);
}
.tip-title { font-size: 0.9rem; font-weight: 700; color: var(--accent-color); margin-bottom: 2px; }
.tip-text { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.3; margin: 0; }

/* =========================================
   5. 品牌区域 (Brand)
   ========================================= */
.brand-section { text-align: center; margin-bottom: 2rem; }

.brand-logo-img {
    width: 88px; height: 88px;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.15);
    margin-bottom: 0.5rem;
}

.brand-name {
    font-size: 1.75rem; font-weight: 800;
    color: var(--text-primary);
    margin: 0.5rem 0 0.25rem 0;
    letter-spacing: -0.5px;
}

.brand-tagline { font-size: 1rem; color: var(--text-secondary); margin: 0; }

/* =========================================
   6. 下载区域 (Download Buttons)
   ========================================= */
.download-section { width: 100%; }
.download-container { display: flex; flex-direction: column; gap: 1rem; }

/* 通用按钮样式 */
.download-btn {
    position: relative;
    display: flex; align-items: center;
    width: 100%; padding: 0.9rem 1.5rem;
    border: none; border-radius: 16px;
    cursor: pointer; transition: transform 0.1s;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.download-btn:active { transform: scale(0.96); }

.btn-icon { margin-right: 1rem; display: flex; align-items: center; }
.btn-content { flex: 1; }
.btn-text { font-size: 0.8rem; opacity: 0.9; margin-bottom: 2px; }
.btn-store { font-size: 1.1rem; font-weight: 700; }
.recommended-badge {
    position: absolute; top: -8px; right: 12px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white; font-size: 0.7rem; font-weight: 600;
    padding: 3px 8px; border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* 版本号徽章 - 显示在备用下载按钮右方 */
.version-badge {
    font-family: 'SF Mono', 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    padding: 4px 10px;
    border-radius: 8px;
    white-space: nowrap;
    margin-left: auto;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.1);
}

/* 特定按钮颜色 */
.ios-btn { background: #000; color: #fff; }
.honor-btn, .xiaomi-btn { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; }
.local-btn { background: #fff; color: var(--text-primary); border: 1px solid rgba(0,0,0,0.05); }

/* 加载占位符 */
.loading-placeholder { text-align: center; color: var(--text-secondary); padding: 2rem; }
.loading-spinner {
    width: 24px; height: 24px; margin: 0 auto 10px;
    border: 2px solid #dbeafe; border-top-color: var(--primary-color);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}

/* =========================================
   7. 救援卡片 (Rescue Card)
   ========================================= */
.help-card {
    background: #fff; border-radius: 12px;
    padding: 12px 16px; margin-top: 12px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.04);
    cursor: pointer; transition: transform 0.1s, background-color 0.2s;
    animation: fadeIn 0.6s ease-out;
}
.help-card:active { transform: scale(0.98); background: #f8fafc; }

.help-thumbnail {
    width: 44px; height: 70px; /* 竖屏截图比例 */
    border-radius: 6px; border: 1px solid #e2e8f0;
    object-fit: cover; object-position: top;
    flex-shrink: 0;
}
.help-content { flex: 1; }
.help-title { font-size: 0.95rem; font-weight: 700; color: #ef4444; margin-bottom: 4px; }
.help-desc { font-size: 0.8rem; color: var(--text-secondary); margin: 0; line-height: 1.3; }
.help-arrow { color: #cbd5e1; display: flex; }

/* =========================================
   8. 华为状态提示条 (Status Tip)
   ========================================= */
.status-tip {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 12px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    animation: fadeIn 0.5s ease;
    border: 1px solid rgba(0,0,0,0.03);
}

.status-dot {
    width: 6px; height: 6px;
    background-color: #f59e0b;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

/* =========================================
   9. 快捷链接 & 页脚 (Quick Links & Footer)
   ========================================= */
.quick-links { padding: 1rem 1.25rem; }
.quick-links-title { font-size: 1rem; color: var(--text-primary); margin-bottom: 1rem; text-align: center; font-weight: 600; opacity: 0.8; }
.quick-links-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.quick-link-item {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.6); padding: 12px;
    border-radius: 12px; text-decoration: none;
    color: var(--text-primary); transition: background 0.2s;
}
.quick-link-item:hover { background: rgba(255,255,255,0.9); }
.quick-link-icon { font-size: 1.2rem; }
.quick-link-title { font-size: 0.9rem; font-weight: 600; margin: 0; }
.quick-link-item.disabled { opacity: 0.6; cursor: not-allowed; }

.footer { padding: 2rem 1rem; text-align: center; }
.copyright { font-size: 0.75rem; color: var(--text-secondary); opacity: 0.7; }

/* =========================================
   10. 底部弹窗 (Bottom Sheet Modal)
   ========================================= */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex; align-items: flex-end; /* 底部对齐 */
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-sheet {
    background: #fff; width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 24px 20px;
    /* 适配底部安全区 */
    padding-bottom: calc(20px + var(--safe-bottom));
    transform: translateY(100%); 
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh; overflow-y: auto;
}
.modal-overlay.active .modal-sheet { transform: translateY(0); }

/* 弹窗头部 */
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.modal-title { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); margin: 0 0 4px 0; }
.modal-subtitle { font-size: 0.9rem; color: var(--text-secondary); margin: 0; }
.close-btn {
    background: #f1f5f9; border: none; width: 32px; height: 32px;
    border-radius: 50%; font-size: 22px; color: #64748b; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* 轮播图 (Native Scroll) */
.carousel-wrapper {
    position: relative; width: 100%; 
    aspect-ratio: 9/19; /* 保持手机截图比例 */
    max-height: 62vh;   /* 限制最大高度 */
    background: #f1f5f9; border-radius: 12px; 
    overflow: hidden; margin-bottom: 16px;
}

.carousel-track {
    display: flex; height: 100%; width: 100%;
    overflow-x: auto; 
    scroll-snap-type: x mandatory; /* 原生吸附效果 */
    scroll-behavior: smooth;
}
.hide-scrollbar::-webkit-scrollbar { display: none; } 
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; } 

.carousel-slide {
    flex: 0 0 100%; width: 100%; height: 100%;
    scroll-snap-align: center; /* 居中对齐 */
    padding: 6px; 
}

.carousel-img {
    width: 100%; height: 100%; 
    object-fit: contain; /* 保证截图完整显示 */
    display: block;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.05));
}

/* 指示器 */
.carousel-indicators { display: flex; justify-content: center; gap: 6px; margin-bottom: 20px; }
.indicator { width: 6px; height: 6px; background: #cbd5e1; border-radius: 50%; transition: 0.3s; }
.indicator.active { width: 18px; border-radius: 10px; background: var(--primary-color); }

/* 步骤文字 */
.step-box {
    background: #eff6ff; padding: 12px 16px;
    border-radius: 10px; border-left: 4px solid var(--primary-color);
    margin-bottom: 20px;
}
.step-text { margin: 0; color: #1e3a8a; font-weight: 600; font-size: 0.95rem; }

.full-width { width: 100%; justify-content: center; }

/* =========================================
   11. iOS 普通模态框 (Old Modal)
   ========================================= */
.modal-content {
    background: white; border-radius: 16px; padding: 24px;
    width: 85%; max-width: 320px; text-align: center;
    position: relative;
    margin: auto; margin-bottom: auto;
}
.modal-icon { margin-bottom: 1rem; }
.modal-btn {
    background: var(--primary-color); color: white;
    border: none; border-radius: 8px; padding: 0.8rem 2rem;
    font-weight: 600; margin-top: 1rem; cursor: pointer;
}

/* =========================================
   12. 微信全屏蒙层 (WeChat Mask)
   ========================================= */
.wx-mask {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(5px);
    z-index: 9999; overflow: hidden; display: none;
}

.wx-mask-content { position: relative; width: 100%; height: 100%; padding: 20px; box-sizing: border-box; }

.wx-arrow {
    position: absolute; top: 10px; right: 20px; width: 120px; height: 120px;
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.5));
    animation: bounceArrow 1.5s infinite ease-in-out;
}

.wx-text-container { margin-top: 140px; color: white; text-align: center; }
.wx-text-container h3 { font-size: 1.5rem; margin-bottom: 12px; font-weight: 700; }
.wx-text-container p { font-size: 1.1rem; opacity: 0.9; margin: 12px 0; }

/* =========================================
   13. 动画与响应式
   ========================================= */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    70% { transform: scale(1); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}
@keyframes bounceArrow {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(5px, -5px); }
}

@media (max-width: 360px) {
    .brand-name { font-size: 1.5rem; }
    .btn-store { font-size: 1rem; }
    .quick-links-grid { grid-template-columns: 1fr; }
}

/* 备案信息样式优化 */
.footer .copyright {
    text-align: center;
    padding: 1rem 0;
    margin: 0;
    line-height: 1.4;
    color: var(--text-secondary);
    opacity: 0.8;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .footer .copyright {
        font-size: 0.65rem;
        padding: 0.8rem 1rem;
        line-height: 1.3;
        white-space: normal;
        word-break: keep-all;
        overflow: visible;
        text-overflow: unset;
    }
}

@media (max-width: 480px) {
    .footer .copyright {
        font-size: 0.6rem;
        padding: 0.6rem 0.8rem;
        line-height: 1.2;
    }
}

/* 备案信息换行时的处理 */
@media (max-width: 360px) {
    .footer .copyright {
        font-size: 0.55rem;
        padding: 0.5rem 0.6rem;
        line-height: 1.1;
    }
}