/**
 * 前台全局样式：简约高级、微信绿主色、动效
 * 变量与基础
 */
:root {
    --wx: #07c160;
    --wx-dark: #06a050;
    --wx-light: #e8f8ef;
    --bg: #f6f8f7;
    --card: #ffffff;
    --text: #2b2f33;
    --muted: #6b7280;
    --line: #e8ece9;
    --danger: #e53935;
    --shadow: 0 8px 30px rgba(7, 193, 96, 0.08);
    --shadow-hover: 0 16px 48px rgba(7, 193, 96, 0.18);
    --radius: 12px;
    --radius-sm: 8px;
    --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: linear-gradient(180deg, #f0faf4 0%, var(--bg) 32%, #eef1ef 100%);
    min-height: 100vh;
    line-height: 1.6;
    opacity: 0;
    animation: pageIn 0.55s ease forwards;
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.page-fade {
    animation: pageIn 0.6s ease forwards;
}

a {
    color: inherit;
    text-decoration: none;
}

.wrap {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px 64px;
}

.wrap.narrow {
    max-width: 520px;
}

/* 顶栏 */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.0);
    border-bottom: 1px solid var(--line);
    animation: slideDown 0.5s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.header-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wx), #3dd68c);
    box-shadow: 0 0 0 4px var(--wx-light);
}

.nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav a {
    padding: 8px 16px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.95rem;
    transition: color 0.2s, background 0.25s, transform 0.2s;
}

.nav a:hover {
    color: var(--wx);
    background: var(--wx-light);
    transform: translateY(-1px);
}

/* Hero */
.hero {
    text-align: center;
    padding: 48px 16px 28px;
}

.hero h1 {
    margin: 0 0 12px;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.hero p {
    margin: 0 auto;
    max-width: 520px;
    color: var(--muted);
    font-size: 1rem;
}

/* 商品网格 */
.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

@media (max-width: 900px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

.product-card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid rgba(7, 193, 96, 0.08);
    box-shadow: var(--shadow);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

.cover-wrap {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: linear-gradient(145deg, #e8f8ef, #f0f2f1);
}

.cover-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .cover-wrap img {
    transform: scale(1.04);
}

.cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wx);
    font-size: 2.5rem;
    opacity: 0.35;
}

.card-body {
    padding: 18px 18px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
}

.card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.35;
}

.card-desc {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-files-hint {
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.75;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
}

.price {
    color: var(--danger);
    font-weight: 800;
    font-size: 1.25rem;
}

.price small {
    font-size: 0.75rem;
    font-weight: 600;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    transition: transform 0.15s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.2s;
    text-decoration: none;
    user-select: none;
}

.btn:active {
    transform: scale(0.96);
}

.btn-press:active {
    transform: scale(0.94);
}

.btn-primary,
.btn-buy {
    color: #fff;
    background: linear-gradient(135deg, var(--wx), #2dd279);
    box-shadow: 0 6px 20px rgba(7, 193, 96, 0.35);
}

.btn-primary:hover,
.btn-buy:hover {
    background: linear-gradient(135deg, var(--wx-dark), var(--wx));
    box-shadow: 0 8px 26px rgba(7, 193, 96, 0.45);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
    box-shadow: none;
}

.btn-ghost:hover {
    border-color: var(--wx);
    color: var(--wx);
}

.btn-down {
    padding: 14px 36px;
    font-size: 1.05rem;
    margin-top: 8px;
}

/* 关于 */
.section-about {
    margin-top: 56px;
    padding: 40px 24px;
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.section-about h2 {
    margin: 0 0 16px;
    font-size: 1.35rem;
}

.section-about .content {
    color: var(--muted);
    font-size: 0.98rem;
}

/* 页脚 */
.site-footer {
    text-align: center;
    padding: 36px 16px;
    color: var(--muted);
    font-size: 0.85rem;
}

/* 弹窗 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 30, 25, 0.45);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
    transform: translateY(16px) scale(0.98);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    border: 1px solid rgba(7, 193, 96, 0.12);
}

.modal-overlay.show .modal {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--bg);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    color: var(--muted);
    transition: background 0.2s, color 0.2s, transform 0.15s;
}

.modal-close:hover {
    background: var(--wx-light);
    color: var(--wx);
}

.modal-close:active {
    transform: scale(0.92);
}

.modal h3 {
    margin: 0 0 8px;
    font-size: 1.2rem;
}

.modal .pay-amount {
    text-align: center;
    font-size: 2rem;
    font-weight: 800;
    color: var(--danger);
    margin: 12px 0 4px;
}

.modal .pay-amount span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--muted);
}

.pay-hint {
    text-align: center;
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 16px;
}

.qr-frame {
    width: 220px;
    height: 220px;
    margin: 0 auto 16px;
    padding: 12px;
    border-radius: 14px;
    background: linear-gradient(145deg, #fff, #f3faf6);
    border: 2px solid rgba(7, 193, 96, 0.25);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.qr-frame #qrcode {
    width: 100%;
    max-width: 196px;
    max-height: 196px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.qr-frame #qrcode canvas,
.qr-frame #qrcode img,
.qr-frame #qrcode table {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    vertical-align: middle;
}

.qr-loading {
    position: absolute;
    inset: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 10px;
}

.qr-loading.hide {
    display: none;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--line);
    border-top-color: var(--wx);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.pay-error {
    color: var(--danger);
    text-align: center;
    font-size: 0.9rem;
    min-height: 1.2em;
}

/* 通用卡片（错误页等） */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
}

.card-center {
    text-align: center;
    margin-top: 80px;
}

.card-lift {
    animation: liftIn 0.55s ease forwards;
}

@keyframes liftIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.muted {
    color: var(--muted);
}

/* 下载页 */
.page-down .down-bg {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(7, 193, 96, 0.12), transparent 45%),
        radial-gradient(circle at 80% 60%, rgba(45, 210, 121, 0.1), transparent 40%);
    pointer-events: none;
    z-index: 0;
}

.page-down .wrap {
    position: relative;
    z-index: 1;
    padding-top: 72px;
}

.card-down {
    text-align: center;
}

.down-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wx), #3dd68c);
    color: #fff;
    font-size: 2rem;
    line-height: 64px;
    box-shadow: 0 10px 30px rgba(7, 193, 96, 0.35);
    animation: popIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes popIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.down-title {
    margin: 0 0 8px;
    font-size: 1.6rem;
}

.down-sub {
    margin: 0 0 12px;
}

.down-tip {
    font-size: 0.88rem;
    color: var(--muted);
    margin: 0 0 20px;
}

.down-count {
    font-size: 0.88rem;
    margin: -8px 0 16px;
}

.down-exhausted {
    color: var(--danger);
    font-weight: 600;
    margin: 0 0 16px;
}

.down-file-list {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.down-file-list .btn-down {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

/* 输入框（若扩展表单） */
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--wx);
    box-shadow: 0 0 0 3px var(--wx-light);
}

.empty-tip {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}

.admin-link {
    font-size: 0.8rem;
    color: #9ca3af;
}

.admin-link:hover {
    color: var(--wx);
}
