/* ==========================================================
   应用市场 - 前台样式
   想换配色只改下面 :root 里的变量即可
   ========================================================== */

:root {
    --brand: #5b5bd6;
    --brand-dark: #4a4ac4;
    --brand-soft: #ececff;
    --text: #17172b;
    --muted: #6b7280;
    --line: #e7e8f2;
    --bg: #f6f7fb;
    --card: #ffffff;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(20, 20, 43, .04), 0 8px 24px rgba(20, 20, 43, .06);
    --wrap: 1180px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.3; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* ---------------- 顶栏 ---------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 64px;
}

.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.logo-mark {
    width: 30px; height: 30px; border-radius: 9px;
    display: grid; place-items: center;
    color: #fff; font-size: 15px;
    background: linear-gradient(135deg, var(--brand), #a855f7);
}
.logo-text { font-size: 16px; }

.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}
.nav a:hover { background: var(--brand-soft); color: var(--brand); }
.nav a.on { color: var(--brand); background: var(--brand-soft); font-weight: 600; }

.search { display: flex; gap: 8px; }
.search input {
    width: 220px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    outline: none;
}
.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search button {
    padding: 9px 16px;
    border: 0;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}
.search button:hover { background: var(--brand-dark); }

/* ---------------- 提示条 ---------------- */

.flash {
    margin: 16px 0 0;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
}
.flash.success { background: #e9f9f0; color: #0f7b46; }
.flash.error { background: #fdecef; color: #b42318; }

/* ---------------- 首页大图 ---------------- */

.hero {
    margin-top: 28px;
    padding: 56px 24px;
    border-radius: 24px;
    background:
        radial-gradient(900px 320px at 12% -10%, #8b8bff 0%, transparent 60%),
        radial-gradient(700px 300px at 88% 0%, #b388ff 0%, transparent 55%),
        linear-gradient(150deg, #3f3fb5 0%, #5b5bd6 45%, #7c3aed 100%);
    color: #fff;
    text-align: center;
}

.hero h1 { font-size: clamp(26px, 4vw, 40px); letter-spacing: -.5px; }
.hero-sub { margin: 14px auto 0; max-width: 620px; color: rgba(255, 255, 255, .82); font-size: 15px; }

.hero-search { display: flex; gap: 10px; max-width: 560px; margin: 26px auto 0; }
.hero-search input {
    flex: 1;
    padding: 14px 18px;
    border: 0;
    border-radius: 12px;
    font-size: 15px;
    outline: none;
}
.hero-search button {
    padding: 0 24px;
    border: 0;
    border-radius: 12px;
    background: #17172b;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
}
.hero-search button:hover { background: #000; }

.hero-cats { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.chip {
    padding: 7px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .28);
    font-size: 13px;
    color: #fff;
}
.chip:hover { background: rgba(255, 255, 255, .26); }

/* ---------------- 区块 ---------------- */

.section { margin-top: 44px; }
.section-top { margin-top: 26px; }

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.section-head h2 { font-size: 20px; }
.section-sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.section-head .more, .section-head .count { color: var(--muted); font-size: 14px; }
.section-head .more:hover { color: var(--brand); }

/* ---------------- 卡片网格 ---------------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.card {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover {
    transform: translateY(-3px);
    border-color: #d5d6e8;
    box-shadow: var(--shadow);
}

.card-cover {
    position: relative;
    aspect-ratio: 16 / 9;
    background: linear-gradient(140deg,
        hsl(var(--hue), 70%, 62%),
        hsl(calc(var(--hue) + 40), 72%, 52%));
    display: grid;
    place-items: center;
    overflow: hidden;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-cover .ph {
    font-size: 44px;
    font-weight: 700;
    color: rgba(255, 255, 255, .9);
}

.badge-hot {
    position: absolute;
    top: 10px; left: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    color: var(--brand);
    font-size: 12px;
    font-weight: 600;
}

.card-body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { font-size: 16px; }
.card-summary {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}
.card-foot {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
}
.price { color: var(--brand); font-weight: 700; font-size: 17px; }
.version { color: var(--muted); font-size: 12px; }

/* ---------------- 详情 ---------------- */

.crumb {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 22px 0 18px;
    font-size: 13px;
    color: var(--muted);
}
.crumb a:hover { color: var(--brand); }
.crumb-cur { color: var(--text); }

.detail {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.detail-cover {
    aspect-ratio: 16 / 10;
    border-radius: 20px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: linear-gradient(140deg,
        hsl(var(--hue), 70%, 62%),
        hsl(calc(var(--hue) + 40), 72%, 52%));
    border: 1px solid var(--line);
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-cover .ph { font-size: 96px; font-weight: 700; color: rgba(255, 255, 255, .9); }

.detail-info h1 { font-size: clamp(22px, 3vw, 30px); }
.detail-summary { margin: 10px 0 0; color: var(--muted); }

.price-box {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 22px 0;
    padding: 18px 20px;
    border-radius: 14px;
    background: var(--brand-soft);
}
.price-lg { font-size: 30px; font-weight: 800; color: var(--brand); }
.price-tip { color: var(--muted); font-size: 13px; }

.meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 20px;
    margin: 0 0 22px;
}
.meta div { display: flex; gap: 10px; font-size: 14px; }
.meta dt { color: var(--muted); min-width: 56px; }
.meta dd { margin: 0; }

.buy-box { margin-top: 8px; }
.buy-tip { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

.prose {
    padding: 24px;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--line);
    font-size: 15px;
    color: #2b2b3d;
    white-space: normal;
}
.prose br { line-height: 2; }

.mobile-buy { display: none; }

/* ---------------- 按钮 ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: all .15s ease;
}
.btn:hover { border-color: #cfd0e2; background: #fafaff; }
.btn.primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 600;
}
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.lg { padding: 14px 28px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }

/* ---------------- 空状态 ---------------- */

.empty {
    padding: 60px 20px;
    text-align: center;
    background: var(--card);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    color: var(--muted);
}
.empty p { margin: 0 0 16px; }
.empty-code { font-size: 52px; font-weight: 800; color: #dcdcf0; margin: 0 0 8px; }

/* ---------------- 页脚 ---------------- */

.footer {
    margin-top: 64px;
    border-top: 1px solid var(--line);
    background: #fff;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 24px;
    padding-bottom: 24px;
    color: var(--muted);
    font-size: 13px;
}
.footer-links { display: flex; gap: 18px; }
.footer-links a:hover { color: var(--brand); }

/* ---------------- 联系弹窗 ---------------- */

.modal[hidden] { display: none; }
.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 20px;
}
.modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(16, 16, 32, .45);
    backdrop-filter: blur(2px);
}
.modal-box {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 26px 24px 22px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(16, 16, 40, .28);
    animation: pop .18s ease;
}
@keyframes pop {
    from { transform: translateY(8px) scale(.98); opacity: 0; }
    to { transform: none; opacity: 1; }
}
.modal-box h3 { font-size: 19px; }
.modal-sub { margin: 6px 0 18px; color: var(--muted); font-size: 13px; }
.modal-close {
    position: absolute;
    top: 12px; right: 14px;
    width: 30px; height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
}
.modal-close:hover { background: #f1f1f8; color: var(--text); }

.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.contact-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.contact-list .k { color: var(--muted); font-size: 13px; width: 40px; }
.contact-list .v { flex: 1; font-weight: 600; word-break: break-all; }
.copy {
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
}
.copy:hover { border-color: var(--brand); color: var(--brand); }
.modal-tip { margin: 16px 0 0; color: var(--muted); font-size: 12px; }

/* ---------------- 响应式 ---------------- */

@media (max-width: 900px) {
    .detail { grid-template-columns: 1fr; gap: 22px; }
    .detail-cover { aspect-ratio: 16 / 9; }
    .search input { width: 150px; }
}

@media (max-width: 720px) {
    .topbar-inner { height: auto; padding: 12px 0; flex-wrap: wrap; gap: 12px; }
    .nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 2px; }
    .nav::-webkit-scrollbar { display: none; }
    .search { margin-left: auto; }
    .search input { width: 120px; }

    .hero { margin-top: 16px; padding: 36px 18px; border-radius: 18px; }
    .hero-search { flex-direction: column; }
    .hero-search button { padding: 12px; }

    .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .card-body { padding: 12px; }
    .card-body h3 { font-size: 14px; }
    .card-summary { font-size: 12px; }
    .price { font-size: 15px; }

    .meta { grid-template-columns: 1fr; }
    .prose { padding: 18px; }

    /* 移动端底部固定购买栏 */
    .mobile-buy {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 40;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, .96);
        border-top: 1px solid var(--line);
        backdrop-filter: blur(10px);
    }
    .mobile-buy-price { font-weight: 800; color: var(--brand); font-size: 18px; }
    .mobile-buy .btn { flex: 0 0 auto; }

    body { padding-bottom: 76px; }
    .footer { margin-top: 40px; }
}
