/* ============================================================
   APP 下载页面样式
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --theme-start: #6a11cb;
    --theme-end: #2575fc;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: #fff;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    min-height: 100dvh;   /* 动态视口高度：手机地址栏收起/展开时不跳动、不裁切 */
    display: flex;
    align-items: center;
    justify-content: center;
    /* 兼顾刘海屏 / 底部横条安全区 */
    padding: calc(24px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right))
             calc(24px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
    background: linear-gradient(135deg, var(--theme-start), var(--theme-end));
    position: relative;
    overflow: hidden;
}

/* ---------- 背景装饰圆 ---------- */
.bg-decoration { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    filter: blur(2px);
    animation: float 8s ease-in-out infinite;
}
.c1 { width: 220px; height: 220px; top: -60px; left: -60px; }
.c2 { width: 160px; height: 160px; bottom: -40px; right: -30px; animation-delay: 2s; }
.c3 { width: 120px; height: 120px; top: 40%; right: 12%; animation-delay: 4s; }

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-24px) scale(1.06); }
}

/* ---------- 卡片主体 ---------- */
.card {
    position: relative;
    z-index: 1;
    width: 100%;
    /* 流式宽度：小屏占满(留边距)，大屏封顶 440px，中间平滑过渡 */
    max-width: min(440px, 100%);
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: clamp(22px, 6vw, 30px);
    /* 内边距随视口平滑变化，不再断点跳变 */
    padding: clamp(28px, 7vw, 44px) clamp(20px, 6vw, 34px) clamp(22px, 5vw, 32px);
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: cardIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(30px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Logo ---------- */
.logo-wrap { display: flex; justify-content: center; margin-bottom: 18px; }
.logo {
    width: clamp(80px, 22vw, 104px);
    height: clamp(80px, 22vw, 104px);
    border-radius: clamp(20px, 5vw, 26px);
    object-fit: cover;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background: #fff;
}
.logo-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    font-size: clamp(38px, 10vw, 48px);
    font-weight: 700;
    color: var(--theme-end);
    background: #fff;
}

/* ---------- 文本信息 ---------- */
.app-name { font-size: clamp(22px, 6.5vw, 28px); font-weight: 700; letter-spacing: 0.5px; }
.slogan { margin-top: 8px; font-size: clamp(14px, 4vw, 16px); opacity: 0.9; }

.meta {
    margin-top: 14px;
    font-size: 13px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.meta-dot { opacity: 0.6; }

/* ---------- 自动执行提示 ---------- */
.auto-tip {
    margin: 20px auto 0;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: 90%;
}
.spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 按钮 ---------- */
.btn-group { margin-top: clamp(20px, 6vw, 28px); display: flex; flex-direction: column; gap: 14px; }
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: clamp(13px, 3.8vw, 16px) 20px;
    border-radius: clamp(14px, 4vw, 18px);
    font-size: clamp(15px, 4.2vw, 17px);
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s;
    border: none;
    cursor: pointer;
}
.btn:active { transform: scale(0.97); }
.btn-icon { width: clamp(22px, 6vw, 26px); height: clamp(22px, 6vw, 26px); flex-shrink: 0; }

.btn-android {
    background: linear-gradient(135deg, #3ddc84, #12b76a);
    box-shadow: 0 8px 20px rgba(18, 183, 106, 0.4);
}
.btn-ios {
    background: linear-gradient(135deg, #4a4a4a, #1c1c1e);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

/* 高亮当前设备推荐按钮 */
.btn.recommended { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 8px 20px rgba(255, 255, 255, 0.15); }
    50%      { box-shadow: 0 8px 30px rgba(255, 255, 255, 0.55); }
}
.btn.dimmed { opacity: 0.55; }

/* ---------- 设备提示 ---------- */
.device-hint {
    margin-top: 18px;
    font-size: 13px;
    opacity: 0.9;
    min-height: 18px;
    line-height: 1.5;
}

/* ---------- 内置浏览器引导遮罩 ---------- */
.wechat-mask {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 20px 30px;
}
/* 菜单在底部的 App（百度 / Telegram）：整体靠下对齐 */
.wechat-mask.mask-align-bottom {
    justify-content: flex-end;
    align-items: flex-end;
    padding-bottom: 30px;
}

/* 顶部的「误判请忽略」小字，居中显示 */
.mask-ignore {
    position: absolute;
    top: 18px;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    padding: 0 20px;
}

.mask-arrow {
    font-size: 60px;
    color: #fff;
    margin-right: 6px;
    line-height: 1;
    animation: bounce 1.2s ease-in-out infinite;
}
/* 箭头朝下时反向弹跳 */
.mask-arrow-bottom {
    align-self: flex-end;
    margin-right: 10px;
    animation: bounceDown 1.2s ease-in-out infinite;
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-12px); }
}
@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(12px); }
}

.mask-body {
    margin-top: 12px;
    text-align: right;
}
.mask-title {
    color: #fff;
    font-size: 19px;
    font-weight: 600;
    line-height: 1.6;
}
.mask-desc {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    line-height: 1.7;
    margin-top: 8px;
}
.mask-desc b, .mask-title b { color: #ffd76a; }

/* ---------- 二维码（电脑访问） ---------- */
.qr-box { margin-top: 22px; animation: cardIn 0.5s ease; }
.qr-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    opacity: 0.85;
    margin-bottom: 16px;
}
.qr-divider::before,
.qr-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
}
.qr-code {
    width: 180px;
    height: 180px;
    margin: 0 auto;
    padding: 12px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.qr-code img,
.qr-code canvas { display: block; width: 100%; height: 100%; }
.qr-tip { margin-top: 14px; font-size: 13px; opacity: 0.85; line-height: 1.6; }

/* ---------- iOS Safari 提示横幅 ---------- */
.safari-tip {
    margin: 18px 0 0;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.55;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
    animation: cardIn 0.4s ease;
}
.safari-tip b { color: #ffd76a; }
.safari-tip-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
    opacity: 0.9;
}
.safari-tip-close {
    margin-left: auto;
    flex-shrink: 0;
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    align-self: center;
}
.safari-tip-close:hover { color: #fff; }

/* ---------- 页脚 ---------- */
.footer {
    margin-top: 26px;
    font-size: 12px;
    opacity: 0.7;
    line-height: 1.6;
}

/* ============================================================
   自适应说明：尺寸/间距/字号已用 clamp() 随视口平滑缩放，
   以下媒体查询只处理"布局形态"变化（按钮排布、横屏矮屏）。
   ============================================================ */

/* ---------- 手机端：卡片全屏铺满（无留白、无圆角、无悬浮感） ----------
   竖屏手机(≤639px)下，卡片撑满整个视口。
   布局分两区：主内容(.card-body)在中部垂直居中，页脚(.footer)贴屏幕最底。 */
@media (max-width: 639px) {
    body { padding: 0; }
    .card {
        max-width: none;
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: transparent;          /* 用 body 的渐变做底，卡片本身透明 */
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        /* 主体与页脚分列两端：主体占上方大部分空间，页脚被推到最底 */
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: calc(24px + env(safe-area-inset-top)) clamp(24px, 8vw, 40px)
                 calc(18px + env(safe-area-inset-bottom));
    }
    /* 主内容占据“页脚以上”的全部空间，内部各区块等距铺开(均匀分布) */
    .card-body {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        justify-content: space-evenly;
        width: 100%;
    }
    /* 清零各区块自带的 margin-top，间距完全交给 space-evenly 统一均分 */
    .card-body > * { margin-top: 0; }
    .auto-tip { margin-top: 0; }
    /* 页脚不参与均分，自己稳稳贴在卡片底部 */
    .footer { margin-top: 0; }
    /* 全屏后适当放大主视觉，填充更饱满 */
    .logo { width: clamp(88px, 26vw, 120px); height: clamp(88px, 26vw, 120px); }
    .app-name { font-size: clamp(24px, 8vw, 32px); }
}

/* ---------- 平板及以上：卡片略放宽，双按钮横向并排 ---------- */
@media (min-width: 640px) {
    .card { max-width: 520px; }
    .btn-group { flex-direction: row; gap: 16px; }
    .btn { flex: 1; }
    .qr-code { width: 200px; height: 200px; }
}

/* ---------- 横屏 / 矮屏手机（高度受限）：压缩纵向间距，避免溢出滚动 ----------
   例如手机横放、或分屏时视口很矮的情况。 */
@media (max-height: 560px) and (orientation: landscape) {
    body { align-items: flex-start; }
    .card { padding: 22px 26px; max-width: 560px; }
    .logo-wrap { margin-bottom: 10px; }
    .logo { width: 64px; height: 64px; }
    .btn-group { flex-direction: row; margin-top: 16px; }
    .btn { flex: 1; padding: 12px 16px; }
    .footer { margin-top: 16px; }
    /* 横屏空间紧张，隐藏纯装饰的背景圆，减少视觉拥挤 */
    .bg-decoration { display: none; }
}
