:root {
    --bg: #f5f7fb;
    --bg-soft: #eef2f9;
    --card: #ffffff;
    --text: #1b2333;
    --text-soft: #667085;
    --border: #e4e8f0;
    --primary: #3b6dfb;
    --primary-soft: rgba(59, 109, 251, .1);
    --success: #16a34a;
    --danger: #e5484d;
    --shadow: 0 6px 24px rgba(20, 30, 60, .07);
    --radius: 14px;
}

html[data-theme="dark"] {
    --bg: #0f1420;
    --bg-soft: #151b2b;
    --card: #182031;
    --text: #e7ecf5;
    --text-soft: #97a3b8;
    --border: #263048;
    --primary: #5b8cff;
    --primary-soft: rgba(91, 140, 255, .16);
    --shadow: 0 6px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 18px; }
.muted { color: var(--text-soft); }
.main { padding: 26px 18px 60px; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(180%) blur(8px);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 62px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; }
.brand img { height: 30px; width: 30px; border-radius: 8px; object-fit: cover; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 9px; font-size: 14px; color: #fff;
    background: linear-gradient(135deg, #3b6dfb, #7b5cff);
}
.brand-name { white-space: nowrap; }

.search-box { flex: 1; display: flex; max-width: 460px; }
.search-box input {
    flex: 1; height: 38px; padding: 0 14px; font-size: 14px;
    border: 1px solid var(--border); border-right: 0;
    border-radius: 10px 0 0 10px; background: var(--bg-soft); color: var(--text);
    outline: none;
}
.search-box input:focus { border-color: var(--primary); }
.search-box button {
    height: 38px; padding: 0 18px; border: 0; cursor: pointer; color: #fff; font-size: 14px;
    background: linear-gradient(135deg, #3b6dfb, #6a5cff); border-radius: 0 10px 10px 0;
}

.header-nav { display: flex; align-items: center; gap: 16px; font-size: 14px; }

.lang-switch { position: relative; }
.lang-btn {
    border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
    border-radius: 9px; height: 32px; padding: 0 10px; cursor: pointer; font-size: 13px;
}
.lang-menu {
    display: none; position: absolute; right: 0; top: 38px; z-index: 60; min-width: 148px;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow); padding: 6px;
}
.lang-switch.open .lang-menu { display: block; }
.lang-menu a {
    display: block; padding: 7px 10px; border-radius: 8px; font-size: 13px; white-space: nowrap;
}
.lang-menu a:hover { background: var(--bg-soft); }
.lang-menu a.active { color: var(--primary); font-weight: 600; background: var(--primary-soft); }
.header-nav a:hover { color: var(--primary); }
.theme-toggle {
    border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
    border-radius: 9px; height: 32px; width: 36px; cursor: pointer;
}

.notice-bar {
    background: linear-gradient(90deg, rgba(59,109,251,.12), rgba(123,92,255,.12));
    border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-soft);
    padding: 8px 0;
}

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(135deg, #3b6dfb 0%, #6a5cff 55%, #9b5cff 100%);
    color: #fff; padding: 48px 0 60px;
}
.hero-inner { text-align: center; }
.hero h1 { margin: 0 0 10px; font-size: 34px; letter-spacing: 1px; }
.hero p { margin: 0 0 18px; opacity: .92; }
.hero-stats { display: flex; justify-content: center; gap: 26px; font-size: 14px; opacity: .95; flex-wrap: wrap; }
.hero-stats b { font-size: 20px; }

/* ---------- Tabs ---------- */
.cat-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.cat-tab {
    padding: 6px 14px; border-radius: 999px; font-size: 13px;
    background: var(--card); border: 1px solid var(--border); color: var(--text-soft);
}
.cat-tab:hover { border-color: var(--primary); color: var(--primary); }
.cat-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.result-bar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px; font-size: 14px; color: var(--text-soft);
}

/* ---------- Cards ---------- */
.grid {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow); transition: transform .18s ease, border-color .18s ease;
    display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); border-color: var(--primary); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.app-icon {
    width: 52px; height: 52px; border-radius: 14px; object-fit: cover; background: var(--bg-soft);
    display: inline-flex; align-items: center; justify-content: center; font-size: 30px;
}
.app-icon.big { width: 88px; height: 88px; font-size: 46px; border-radius: 20px; }
.icon-fallback { background: linear-gradient(135deg, #3b6dfb, #7b5cff); color: #fff; font-size: 24px; font-weight: 700; }
.card-title { margin: 12px 0 6px; font-size: 16px; }
.card-desc {
    margin: 0 0 10px; font-size: 13px; color: var(--text-soft); min-height: 42px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag {
    font-size: 12px; padding: 2px 8px; border-radius: 6px;
    background: var(--bg-soft); color: var(--text-soft);
}
.tag.platform { background: var(--primary-soft); color: var(--primary); }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.dl-count { font-size: 12px; color: var(--text-soft); }
.badge-hot {
    font-size: 11px; padding: 2px 8px; border-radius: 999px; color: #fff;
    background: linear-gradient(135deg, #ff7a45, #ff4d6d);
}

.btn {
    display: inline-block; padding: 8px 16px; border-radius: 10px; font-size: 14px;
    border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); cursor: pointer;
    transition: .16s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: linear-gradient(135deg, #3b6dfb, #6a5cff); border: 0; color: #fff; }
.btn-primary:hover { color: #fff; filter: brightness(1.06); }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-disabled { opacity: .6; }

/* ---------- Detail ---------- */
.breadcrumb { font-size: 13px; color: var(--text-soft); margin-bottom: 16px; }
.breadcrumb a:hover { color: var(--primary); }

.detail-head {
    display: flex; gap: 20px; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.detail-info h1 { margin: 0 0 8px; font-size: 26px; }
.detail-desc { margin: 0 0 12px; color: var(--text-soft); }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.sub-url { margin-top: 10px; font-size: 13px; color: var(--text-soft); }
.sub-url a { color: var(--primary); }

/* ---------- 醒目下载按钮 ---------- */
.download-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; }
.btn-download {
    display: inline-flex; align-items: center; gap: 12px;
    padding: 12px 26px; border-radius: 12px; color: #fff; font-weight: 700;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 8px 20px rgba(22, 163, 74, .3);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.btn-download:hover {
    color: #fff; transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(22, 163, 74, .38); filter: brightness(1.04);
}
.btn-download:active { transform: translateY(0); }
.btn-download .dl-ico {
    width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .22); font-size: 17px; font-weight: 700;
}
.btn-download .dl-body { display: flex; flex-direction: column; line-height: 1.3; text-align: left; }
.btn-download .dl-title { font-size: 17px; font-weight: 700; }
.btn-download .dl-meta { font-size: 12px; font-weight: 500; opacity: .88; margin-top: 2px; }

.btn-download.ghost {
    background: var(--card); color: var(--text);
    border: 1px solid var(--border); box-shadow: var(--shadow); font-weight: 600;
}
.btn-download.ghost:hover {
    color: var(--primary); border-color: var(--primary);
    box-shadow: 0 10px 24px rgba(59, 109, 251, .16);
}
.btn-download.ghost .dl-ico { background: var(--primary-soft); color: var(--primary); }

.btn-download.sm { padding: 8px 16px; border-radius: 10px; box-shadow: 0 4px 12px rgba(22, 163, 74, .22); }
.btn-download.sm .dl-ico { width: 24px; height: 24px; font-size: 14px; }
.btn-download.sm .dl-title { font-size: 14px; }

@media (max-width: 560px) {
    .download-cta .btn-download { width: 100%; justify-content: flex-start; }
}

.panel {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.panel-title { margin: 0 0 14px; font-size: 17px; }

.link-list { display: flex; flex-direction: column; gap: 12px; }
.link-item {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--bg-soft);
}
.link-title { font-weight: 600; margin-bottom: 4px; }
.link-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.link-note { font-size: 12px; color: var(--text-soft); margin-top: 6px; }

.rich-text { color: var(--text); font-size: 14.5px; }
.delay-box { text-align: center; padding: 40px 20px; }
.delay-box h2 { margin: 14px 0 6px; }
.dl-name { font-weight: 600; }

.empty-box { text-align: center; padding: 70px 20px; color: var(--text-soft); }
.empty-box .btn { margin-top: 14px; }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.page-link {
    min-width: 34px; text-align: center; padding: 6px 10px; border-radius: 9px; font-size: 14px;
    border: 1px solid var(--border); background: var(--card);
}
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--card); padding: 26px 0; text-align: center; }
.footer-links { display: flex; gap: 18px; justify-content: center; font-size: 14px; margin-bottom: 8px; }
.footer-links a:hover { color: var(--primary); }
.copy, .icp { margin: 4px 0; font-size: 13px; color: var(--text-soft); }

/* ---------- Admin ---------- */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-side {
    width: 216px; flex: 0 0 216px; background: var(--card); border-right: 1px solid var(--border);
    padding: 18px 12px;
}
.admin-side .brand { margin-bottom: 22px; padding: 0 8px; }
.admin-menu { display: flex; flex-direction: column; gap: 4px; }
.admin-menu a {
    padding: 9px 12px; border-radius: 10px; font-size: 14px; color: var(--text-soft);
}
.admin-menu a:hover { background: var(--bg-soft); color: var(--text); }
.admin-menu a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.admin-main { flex: 1; min-width: 0; background: var(--bg); }
.admin-top {
    height: 58px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 22px; background: var(--card); border-bottom: 1px solid var(--border);
}
.admin-top .who { font-size: 13px; color: var(--text-soft); }
.admin-content { padding: 22px; }

.stat-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 18px; }
.stat-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
}
.stat-card .label { font-size: 13px; color: var(--text-soft); }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 4px; }

.admin-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.admin-panel h3 { margin: 0 0 14px; font-size: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.panel-head h3 { margin: 0; }

table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.table th, table.table td { padding: 10px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.table th { color: var(--text-soft); font-weight: 600; font-size: 13px; background: var(--bg-soft); }
table.table tbody tr:hover { background: var(--bg-soft); }
.table .app-icon { width: 34px; height: 34px; font-size: 20px; border-radius: 9px; }
td.nowrap { white-space: nowrap; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--text-soft); }
.input, textarea.input, select.input {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg-soft); color: var(--text); font-size: 14px; font-family: inherit; outline: none;
}
.input:focus { border-color: var(--primary); }
textarea.input { min-height: 90px; resize: vertical; }
.form-grid { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.help { font-size: 12px; color: var(--text-soft); margin-top: 4px; }

.alert { padding: 10px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.alert-success { background: rgba(22,163,74,.12); color: var(--success); }
.alert-error { background: rgba(229,72,77,.12); color: var(--danger); }

.badge { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--bg-soft); color: var(--text-soft); }
.badge-on { background: rgba(22,163,74,.14); color: var(--success); }
.badge-off { background: rgba(229,72,77,.14); color: var(--danger); }

.login-wrap { max-width: 380px; margin: 90px auto; padding: 28px; }
.login-wrap h1 { text-align: center; margin: 0 0 20px; font-size: 22px; }

.link-rows { display: flex; flex-direction: column; gap: 12px; }
.link-row { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--bg-soft); }
.link-row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; color: var(--text-soft); }
.link-row .form-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.remove-row { border: 0; background: transparent; color: var(--danger); cursor: pointer; font-size: 13px; }

.cat-head, .cat-row {
    display: flex; gap: 10px; align-items: center;
}
.cat-head { font-size: 13px; color: var(--text-soft); padding: 0 4px 6px; }
.cat-row { padding: 8px 4px; border-bottom: 1px solid var(--border); }
.cat-row > div { flex: 1; min-width: 0; }
.cat-head > div { flex: 1; }

.chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 10px; }
.chart .bar { flex: 1; background: linear-gradient(180deg, #6a5cff, #3b6dfb); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.chart .bar span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text-soft); }
.chart-x { display: flex; gap: 4px; font-size: 10px; color: var(--text-soft); margin-top: 6px; }
.chart-x div { flex: 1; text-align: center; overflow: hidden; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 160px; }

/* ---------- 文章 / 教程 ---------- */
.page-head { margin: 26px 0 18px; }
.page-head h1 { font-size: 28px; margin: 0 0 8px; }
.page-head p { margin: 0; font-size: 14px; }
.post-toolbar { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.post-search { max-width: 430px; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.post-grid.small { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.post-card {
    display: flex; flex-direction: column; background: var(--card);
    border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow);
    transition: transform .18s ease, box-shadow .18s ease;
}
.post-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(15, 23, 42, .12); }
.post-cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--bg-soft); }
.post-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.post-cat {
    display: inline-block; align-self: flex-start; font-size: 12px; padding: 2px 9px;
    border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 600;
}
.post-title {
    font-size: 16px; margin: 0; line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-summary {
    margin: 0; font-size: 13.5px; color: var(--text-soft); line-height: 1.65;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-meta { font-size: 12px; color: var(--text-soft); margin-top: auto; }
.home-posts { margin-top: 42px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.section-head h2 { font-size: 20px; margin: 0; }
.more-link { font-size: 13px; color: var(--text-soft); }
.more-link:hover { color: var(--primary); }

.article-wrap { max-width: 820px; margin: 20px auto 40px; }
.article-head { margin-bottom: 6px; }
.article-head h1 { font-size: 30px; line-height: 1.45; margin: 10px 0; }
.article-cover { margin: 18px 0 24px; }
.article-hero { width: 100%; border-radius: var(--radius); display: block; }
.article-content { font-size: 16px; line-height: 1.9; }
.article-content h2 {
    font-size: 20px; margin: 30px 0 12px; padding-left: 10px;
    border-left: 4px solid var(--primary); line-height: 1.5;
}
.article-content h3 { font-size: 17px; margin: 22px 0 10px; }
.article-content p { margin: 0 0 14px; }
.article-content ul, .article-content ol { padding-left: 22px; margin: 0 0 16px; }
.article-content li { margin-bottom: 6px; }
.article-content code {
    background: var(--bg-soft); padding: 2px 6px; border-radius: 5px; font-size: 14px;
}
.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.article-product {
    display: flex; justify-content: space-between; align-items: center; gap: 14px;
    padding: 16px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-soft); margin: 22px 0;
}
.ap-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.article-back { margin-top: 16px; }

@media (max-width: 720px) {
    .post-grid { grid-template-columns: 1fr; }
    .article-head h1 { font-size: 24px; }
    .article-content { font-size: 15.5px; }
}

@media (max-width: 900px) {
    .admin-wrap { flex-direction: column; }
    .admin-side { width: 100%; flex: none; border-right: 0; border-bottom: 1px solid var(--border); }
    .admin-menu { flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 720px) {
    .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
    .search-box { order: 3; max-width: none; width: 100%; }
    .hero h1 { font-size: 26px; }
    .detail-head { flex-direction: column; align-items: flex-start; }
    .link-item { flex-direction: column; align-items: flex-start; }
}
