/**
 * 前台全局样式：简约高级、微信绿主色、动效
 * 变量与基础
 */
: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;
    --layout-cols: 12;
    --layout-span: 10;
    --layout-max: 1536px;
    --layout-gutter: clamp(16px, 2vw, 32px);
    --layout-main-width: calc(100% * var(--layout-span) / var(--layout-cols));
}

*,
*::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 {
    width: 100%;
    max-width: var(--layout-max);
    margin: 0 auto;
    padding: 0 var(--layout-gutter) 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.wrap > * {
    flex: 0 0 auto;
    width: var(--layout-main-width);
    max-width: var(--layout-main-width);
    min-width: 0;
    box-sizing: border-box;
}

.wrap.narrow {
    display: block;
    max-width: 520px;
    padding-left: 20px;
    padding-right: 20px;
}

.wrap.narrow > * {
    width: 100%;
    max-width: 100%;
}

/* 顶栏 */
.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 {
    width: 100%;
    max-width: var(--layout-max);
    margin: 0 auto;
    padding: 14px var(--layout-gutter);
    display: flex;
    justify-content: center;
    box-sizing: border-box;
}

.header-inner__main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex: 0 0 var(--layout-main-width);
    width: var(--layout-main-width);
    max-width: var(--layout-main-width);
    min-width: 0;
    box-sizing: border-box;
}

.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.is-download-loading {
    pointer-events: none;
    cursor: wait;
    opacity: 0.92;
}

.btn.is-download-loading:active {
    transform: none;
}

.btn.is-download-loading::before {
    content: '';
    display: inline-block;
    width: 0.85em;
    height: 0.85em;
    margin-right: 0.4em;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-download-spin 0.7s linear infinite;
    vertical-align: -0.12em;
}

@keyframes btn-download-spin {
    to {
        transform: rotate(360deg);
    }
}

.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);
}

/* —— 登录 / 注册 —— */
.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: var(--text);
}

.login-tip {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0 0 20px;
    line-height: 1.55;
    text-align: center;
}

.login-error {
    background: #fef2f2;
    color: #b91c1c;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.88rem;
    margin-bottom: 14px;
    line-height: 1.45;
    text-align: center;
}

.login-form .field {
    display: block;
    margin-bottom: 16px;
}

.login-form .field span {
    display: block;
    font-size: 0.85rem;
    color: #4b5563;
    margin-bottom: 6px;
    font-weight: 500;
}

.login-form-actions {
    display: flex;
    justify-content: center;
    margin-top: 22px;
}

.btn-auth-submit {
    width: 100%;
    min-height: 50px;
    padding: 14px 32px;
    font-size: 1rem;
    border-radius: 12px;
    letter-spacing: 0.02em;
}

.auth-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.back-home {
    display: inline-block;
    text-align: center;
    font-size: 0.88rem;
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.2s;
}

.back-home:hover {
    color: var(--wx);
}

.reg-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.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);
}

/* —— 会员中心 —— */
.member-account-wrap {
    max-width: 1280px;
    padding-top: 28px;
    padding-bottom: 56px;
}

.member-account-head {
    margin-bottom: 20px;
}

.member-account-head .front-page-title {
    margin-bottom: 0;
}

.member-account-flash {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(46, 125, 50, 0.12);
}

.member-account-grid {
    display: grid;
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr) minmax(240px, 300px);
    gap: 20px;
    align-items: start;
}

.member-account-panel {
    padding: 24px 22px;
}

.member-account-panel__title {
    margin: 0 0 16px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.member-profile-list {
    margin: 0;
    padding: 0;
}

.member-profile-row {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.member-profile-row:first-child {
    padding-top: 0;
}

.member-profile-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.member-profile-row dt {
    margin: 0 0 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: none;
    letter-spacing: 0.02em;
}

.member-profile-row dd {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    font-size: 0.95rem;
    line-height: 1.45;
}

.member-profile-row__hint {
    display: block;
    width: 100%;
    font-size: 0.8rem;
    line-height: 1.4;
}

.member-account-points {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--wx-dark);
    line-height: 1.2;
}

.member-account-section-lead {
    margin: -8px 0 16px;
    font-size: 0.88rem;
    line-height: 1.5;
}

.member-account-empty {
    margin: 0;
    padding: 28px 12px;
    text-align: center;
    color: var(--muted);
    font-size: 0.92rem;
    background: #fafafa;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--line);
}

.member-unlocked-list,
.member-ledger-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.member-account-panel--unlocked .member-unlocked-list,
.member-account-panel--ledger .member-ledger-list {
    max-height: min(520px, 60vh);
    overflow-y: auto;
    padding-right: 4px;
}

.member-unlocked-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.member-unlocked-item:first-child {
    padding-top: 0;
}

.member-unlocked-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.member-unlocked-item__main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.member-unlocked-item__title {
    font-weight: 600;
    color: var(--text);
    flex: 1;
    min-width: 0;
}

.member-unlocked-item__title:hover {
    color: var(--wx-dark);
}

.member-unlocked-item__meta {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
}

.member-account-panel--ledger {
    min-width: 0;
}

.member-ledger-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.88rem;
}

.member-ledger-item:first-child {
    padding-top: 0;
}

.member-ledger-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.member-ledger-item__delta {
    font-weight: 700;
    min-width: 2.5em;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.member-ledger-item__delta.is-plus {
    color: #2e7d32;
}

.member-ledger-item__delta.is-minus {
    color: #c62828;
}

.member-ledger-item__body {
    flex: 1;
    min-width: 0;
}

.member-ledger-item__reason {
    display: block;
}

.member-ledger-item__meta {
    display: block;
    margin-top: 2px;
    font-size: 0.76rem;
    line-height: 1.35;
}

@media (max-width: 1100px) {
    .member-account-grid {
        grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
    }

    .member-account-panel--ledger {
        grid-column: 1 / -1;
    }
}

@media (max-width: 860px) {
    .member-account-grid {
        grid-template-columns: 1fr;
    }

    .member-account-panel--ledger {
        grid-column: auto;
    }

    .member-account-panel--unlocked .member-unlocked-list,
    .member-account-panel--ledger .member-ledger-list {
        max-height: none;
        overflow: visible;
    }
}

.member-vip-balance {
    margin: 0 0 8px;
    font-size: 0.95rem;
}

.badge-unlocked {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff;
    background: linear-gradient(135deg, var(--wx) 0%, var(--wx-dark) 100%);
    box-shadow: 0 2px 8px rgba(7, 193, 96, 0.35);
}

.product-card .cover-wrap {
    position: relative;
}

.product-card__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
}

.detail-hero-cover {
    position: relative;
}

.detail-unlocked-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
}

.detail-buy-row {
    flex-wrap: wrap;
    gap: 10px;
}

.detail-points-hint {
    flex-basis: 100%;
    margin: 0;
    font-size: 0.88rem;
}

.detail-download-err {
    font-size: 0.88rem;
    color: #c0392b;
    margin: 0;
}

.product-download-err {
    font-size: 0.82rem;
    color: #c0392b;
    margin: 0;
}

.card-actions .product-download-err {
    flex-basis: 100%;
}

.member-unlocked-item__main .product-download-err {
    font-size: 0.8rem;
}

.detail-file-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-file-list__item {
    margin: 0;
}
