/* ===== 基础变量 ===== */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg: #f6f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
    --shadow-hover: 0 6px 24px rgba(79,70,229,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }

/* ===== 顶部导航 ===== */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 64px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
    flex-shrink: 0;
}
.logo-mark {
    width: 32px; height: 32px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.nav-cats {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav-cats::-webkit-scrollbar { display: none; }
.nav-cats a {
    padding: 6px 14px;
    border-radius: 20px;
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
    transition: all .15s;
}
.nav-cats a:hover { color: var(--primary); background: #eef2ff; }
.nav-cats a.active { color: #fff; background: var(--primary); }

.search-box {
    display: flex;
    background: var(--bg);
    border-radius: 20px;
    padding: 4px 4px 4px 16px;
    flex-shrink: 0;
}
.search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 180px;
    font-size: 14px;
    color: var(--text);
}
.search-box button {
    border: none;
    background: var(--primary);
    color: #fff;
    padding: 6px 16px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 13px;
}
.search-box button:hover { background: var(--primary-hover); }

/* ===== Hero ===== */
.hero {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    padding: 64px 0;
    margin-bottom: 32px;
}
.hero-inner { text-align: center; }
.hero h1 { font-size: 36px; font-weight: 700; margin-bottom: 12px; }
.hero p { opacity: .9; margin-bottom: 24px; }
.hero-search {
    display: inline-flex;
    background: #fff;
    border-radius: 24px;
    padding: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
}
.hero-search input {
    border: none;
    background: transparent;
    outline: none;
    width: 320px;
    padding: 10px 18px;
    font-size: 15px;
    color: var(--text);
}
.hero-search button {
    border: none;
    background: var(--primary);
    color: #fff;
    padding: 10px 24px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}
.hero-search button:hover { background: var(--primary-hover); }

/* ===== Section ===== */
.section { margin: 40px 0; }
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 20px;
}
.section-head h2 { font-size: 22px; font-weight: 600; }

.empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--muted);
    background: var(--card);
    border-radius: var(--radius);
}
.empty a { color: var(--primary); }

/* ===== 软件卡片网格 ===== */
.sw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.sw-card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
}
.sw-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}
.sw-cover {
    position: relative;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.sw-cover img { width: 100%; height: 100%; object-fit: cover; }
.sw-cover-fallback {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary);
    opacity: .5;
}
.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}
.sw-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.sw-body h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.sw-body h3 small { font-size: 12px; color: var(--muted); font-weight: 400; }
.sw-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 8px;
}
.sw-desc {
    font-size: 13px;
    color: var(--muted);
    flex: 1;
    margin-bottom: 12px;
}
.sw-foot {
    display: flex;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

/* ===== 分页 ===== */
.pager {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
}
.pager-link {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--border);
    font-size: 14px;
    color: var(--text);
    transition: all .15s;
}
.pager-link:hover { border-color: var(--primary); color: var(--primary); }
.pager-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 软件详情页 ===== */
.sw-detail { padding: 32px 0; }
.sw-detail-head {
    display: flex;
    gap: 32px;
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 32px;
}
.sw-detail-cover {
    width: 160px;
    height: 160px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sw-detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.sw-cover-fallback.big { font-size: 64px; }
.sw-detail-info { flex: 1; }
.sw-detail-info h1 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.sw-detail-info h1 small { font-size: 14px; color: var(--muted); font-weight: 400; }
.sw-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tag {
    padding: 3px 10px;
    background: var(--bg);
    color: var(--muted);
    font-size: 12px;
    border-radius: 12px;
}
.sw-stats {
    display: flex;
    gap: 20px;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 20px;
}
.sw-download-bar { margin-top: 8px; }
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: #fff;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    transition: background .15s;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline {
    display: inline-flex;
    align-items: center;
    background: #fff;
    color: var(--text);
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 14px;
    transition: all .15s;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.sw-section {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.sw-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.sw-intro { color: #374151; line-height: 1.8; font-size: 15px; word-break: break-word; }
/* 富文本内容排版（wangEditor 输出） */
.sw-intro > *:first-child { margin-top: 0; }
.sw-intro > *:last-child { margin-bottom: 0; }
.sw-intro h1, .sw-intro h2, .sw-intro h3, .sw-intro h4, .sw-intro h5 {
    margin: 1.2em 0 .6em; font-weight: 600; color: var(--text); line-height: 1.4;
}
.sw-intro h1 { font-size: 22px; }
.sw-intro h2 { font-size: 19px; }
.sw-intro h3 { font-size: 17px; }
.sw-intro p { margin: .7em 0; }
.sw-intro ul, .sw-intro ol { margin: .7em 0; padding-left: 1.6em; }
.sw-intro li { margin: .3em 0; }
.sw-intro img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid var(--border);
}
.sw-intro a { color: var(--primary); text-decoration: underline; }
.sw-intro a:hover { color: var(--primary-hover); }
.sw-intro blockquote {
    margin: .8em 0;
    padding: 10px 16px;
    border-left: 4px solid var(--primary);
    background: var(--bg);
    color: var(--muted);
    border-radius: 0 8px 8px 0;
}
.sw-intro code {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: .9em;
}
.sw-intro pre {
    background: #1e1b3a;
    color: #e5e7eb;
    padding: 14px 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: .8em 0;
    font-size: 13px;
    line-height: 1.6;
}
.sw-intro pre code { background: none; border: none; padding: 0; color: inherit; }
.sw-intro table {
    width: 100%;
    border-collapse: collapse;
    margin: .8em 0;
    font-size: 14px;
}
.sw-intro th, .sw-intro td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}
.sw-intro th { background: var(--bg); font-weight: 600; }
.sw-intro hr { border: none; border-top: 1px solid var(--border); margin: 1.2em 0; }

.shots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.shot {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform .15s;
}
.shot:hover { transform: scale(1.02); }
.shot img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }

.dl-list { display: flex; flex-direction: column; gap: 12px; }
.dl-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}
.dl-item-info { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.dl-name { font-weight: 600; font-size: 15px; }
.dl-pwd { font-size: 13px; color: var(--muted); }
.dl-pwd code {
    background: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    color: var(--primary);
    font-weight: 600;
    letter-spacing: 1px;
}

/* ===== Footer ===== */
.site-footer {
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 32px 0;
    margin-top: 64px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}
.site-footer p { margin-bottom: 6px; }
.site-footer a { color: var(--primary); }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .header-inner { flex-wrap: wrap; height: auto; padding: 12px 20px; gap: 12px; }
    .search-box { width: 100%; }
    .search-box input { flex: 1; width: auto; }
    .nav-cats { order: 3; width: 100%; }
    .hero { padding: 40px 0; }
    .hero h1 { font-size: 26px; }
    .hero-search input { width: 200px; }
    .sw-detail-head { flex-direction: column; align-items: center; text-align: center; }
    .sw-detail-cover { width: 120px; height: 120px; }
    .sw-tags, .sw-stats { justify-content: center; }
}
