/* ==========================================================================
   公共前台 SPA 样式（原生 CSS，无框架，无外部依赖）
   主色 #2563eb / 浅色主题 / 卡片式 / 圆角 10-12px / 柔和阴影
   断点：640 / 768 / 1024
   ========================================================================== */

/* ---------- 变量 ---------- */
:root {
    --primary: #2563eb;
    --primary-d: #1d4ed8;
    --primary-l: #eff6ff;
    --text: #1f2937;
    --text-2: #4b5563;
    --text-3: #9ca3af;
    --bg: #f6f8fb;
    --panel: #ffffff;
    --border: #e5e7eb;
    --border-2: #eef1f5;
    --success: #16a34a;
    --warn: #d97706;
    --danger: #dc2626;
    --radius: 12px;
    --radius-sm: 10px;
    --shadow: 0 2px 10px rgba(15, 23, 42, .06);
    --shadow-lg: 0 10px 34px rgba(15, 23, 42, .14);
    --header-h: 64px;
    --maxw: 1200px;
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
/* 始终为滚动条预留槽位：避免不同页面（内容高低不同）滚动条出现/消失导致整页横向位移 */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.35; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
/* href 被迁移到 data-href 的内部链接：保持手型与聚焦样式 */
a[data-href] { cursor: pointer; }
a[data-href]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
a:hover { color: var(--primary-d); }
img { max-width: 100%; display: block; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }
.ic { flex: none; vertical-align: middle; }
::selection { background: #dbeafe; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 38px; padding: 0 18px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: #fff; color: var(--text-2);
    font-size: 14px; line-height: 1; white-space: nowrap;
    transition: .18s; user-select: none;
}
.btn:hover { border-color: #cbd5e1; color: var(--text); background: #f8fafc; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn[disabled], .btn.disabled { opacity: .55; cursor: not-allowed; }
.btn-lg { height: 44px; padding: 0 24px; font-size: 15px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }

/* ---------- 顶部导航 ---------- */
.site-header {
    position: sticky; top: 0; z-index: 60;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    height: var(--header-h); display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.logo-img { height: 34px; width: auto; max-width: 160px; object-fit: contain; }
.logo-mark {
    width: 36px; height: 36px; border-radius: 10px; flex: none;
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    color: #fff; display: flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: .2px; }
.brand-name:hover { color: var(--primary); }

.main-nav { flex: 1; min-width: 0; }
.main-nav > ul { display: flex; align-items: center; gap: 4px; }
.nav-item { position: relative; }
.nav-link {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 8px 12px; border-radius: 8px; color: var(--text-2);
    font-size: 15px; white-space: nowrap; transition: .15s;
}
.nav-link:hover { color: var(--primary); background: var(--primary-l); }
/* 选中态不得改变字重/尺寸：字重变化会改变链接宽度，导致整排导航横向跳动 */
.nav-link.active { color: var(--primary); background: var(--primary-l); box-shadow: inset 0 -2px 0 var(--primary); }
.dropdown {
    position: absolute; top: 100%; left: 0; min-width: 190px; padding: 8px;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(6px);
    transition: .18s; z-index: 70;
}
.nav-item.has-children:hover .dropdown { opacity: 1; visibility: visible; transform: translateY(2px); }
.dropdown a {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-size: 14px;
}
.dropdown a:hover { background: var(--primary-l); color: var(--primary); }
.dd-count { font-size: 12px; color: var(--text-3); }

.header-search { flex: none; display: flex; align-items: center; gap: 8px; }
.search-box {
    display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px;
    background: #f1f5f9; border: 1px solid transparent; border-radius: 999px;
    transition: .18s; color: var(--text-3);
}
.search-box:focus-within { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
/* 隐藏的提交按钮：仅用于让「回车提交搜索」在各浏览器中行为一致（不可用 display:none，否则失去默认按钮作用） */
.sr-submit { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.search-box input {
    border: 0; background: transparent; outline: none; width: 150px;
    font-size: 14px; color: var(--text); font-family: inherit;
}
.search-box input::placeholder { color: var(--text-3); }

.hamburger {
    display: none; width: 40px; height: 40px; border: 0; border-radius: 10px;
    background: transparent; color: var(--text-2); align-items: center; justify-content: center;
}
.hamburger:hover { background: var(--primary-l); color: var(--primary); }

/* ---------- 移动端抽屉 ---------- */
.drawer-mask {
    position: fixed; inset: 0; background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    z-index: 90; opacity: 0; transition: opacity .2s;
}
.drawer-mask.show { opacity: 1; }
.drawer {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: auto; max-width: none; max-height: 80vh;
    background: linear-gradient(180deg, #0b0f1a 0%, #0e1526 55%, #101a33 100%);
    color: #e2e8f0; z-index: 100;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .06);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%); transition: transform .28s cubic-bezier(.32, .72, .24, 1); overflow-y: auto;
    padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
}
/* 顶部拖拽指示条 */
.drawer::before {
    content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 44px; height: 4px; border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}
/* 右上角霓虹光晕装饰 */
.drawer::after {
    content: ""; position: absolute; top: -70px; right: -70px; width: 230px; height: 230px;
    border-radius: 50%; pointer-events: none;
    background: radial-gradient(circle, rgba(59, 130, 246, .28), rgba(139, 92, 246, .12) 45%, transparent 70%);
}
.drawer.show { transform: translateY(0); }
.drawer-head { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.drawer-title {
    font-weight: 700; font-size: 16px; letter-spacing: .5px;
    background: linear-gradient(90deg, #f8fafc 30%, #93c5fd 70%, #c4b5fd);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.drawer-head .tree-toggle { color: #94a3b8; border-radius: 10px; transition: .15s; }
.drawer-head .tree-toggle:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.drawer-search { margin-bottom: 14px; position: relative; z-index: 1; }
.drawer-search .search-box {
    width: 100%; border-radius: 12px;
    background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12);
}
.drawer-search .search-box:focus-within {
    background: rgba(255, 255, 255, .1); border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .25);
}
.drawer-search .search-box input { width: 100%; color: #f1f5f9; }
.drawer-search .search-box input::placeholder { color: #64748b; }
.drawer-nav { position: relative; z-index: 1; }
.drawer-nav ul { display: block; }
.drawer-nav a {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 12px; border-radius: 10px; color: #cbd5e1; font-size: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, .06); transition: .15s;
}
.drawer-nav a:hover {
    background: linear-gradient(90deg, rgba(59, 130, 246, .18), rgba(139, 92, 246, .12));
    color: #fff;
}
.drawer-nav .dd-count {
    font-size: 11px; color: #93c5fd; padding: 1px 9px; border-radius: 999px;
    background: rgba(59, 130, 246, .15); border: 1px solid rgba(59, 130, 246, .3);
}
.drawer-nav .sub a { padding-left: 24px; font-size: 14px; color: #94a3b8; }
.drawer-nav .sub .sub a { padding-left: 38px; }

/* ---------- 主体 ---------- */
.site-main { min-height: 60vh; padding: 22px 0 40px; flex: 1 1 auto; }
/* 页面切换时内容轻微淡入，避免硬切带来的“闪一下”观感 */
#page > * { animation: pageFade .16s ease-out; }
@keyframes pageFade { from { opacity: 0; } to { opacity: 1; } }
/* 骨架屏仅在延迟后出现，容器淡入，避免扫光刚出现就被替换造成的突兀感 */
.sk-card, #browse-grid .sk-card { animation: skFade .2s ease-out; }
@keyframes skFade { from { opacity: 0; } to { opacity: 1; } }

/* 粘性页脚：内容不足一屏时页脚也贴在窗口底部，避免下方出现大片空白 */
#app { display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- 首页 Banner ---------- */
.hero {
    position: relative; overflow: hidden; border-radius: 16px; color: #fff;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 45%, #3b82f6 100%);
    padding: 46px 40px; margin-bottom: 26px;
}
.hero::after {
    content: ""; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px;
    border-radius: 50%; background: rgba(255, 255, 255, .12);
}
.hero::before {
    content: ""; position: absolute; right: 90px; bottom: -120px; width: 220px; height: 220px;
    border-radius: 50%; background: rgba(255, 255, 255, .08);
}
.hero-in { position: relative; z-index: 1; }
.hero h1 { font-size: 30px; margin-bottom: 10px; }
.hero p { font-size: 15px; opacity: .92; max-width: 640px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 26px; }
.hero-stat {
    background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .2);
    border-radius: var(--radius-sm); padding: 10px 18px; min-width: 108px;
    backdrop-filter: blur(4px);
}
.hero-stat b { display: block; font-size: 22px; font-weight: 700; }
.hero-stat span { font-size: 12px; opacity: .88; }

/* ---------- 区块 ---------- */
.section { margin-bottom: 30px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.section-title { font-size: 19px; display: flex; align-items: center; gap: 9px; }
.section-title::before {
    content: ""; width: 4px; height: 18px; border-radius: 3px;
    background: linear-gradient(180deg, var(--primary), #60a5fa);
}
.section-more { font-size: 13px; color: var(--text-3); display: inline-flex; align-items: center; gap: 2px; }
.section-more:hover { color: var(--primary); }

/* ---------- 卡片网格 ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 18px; }
.card {
    display: block; background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; color: inherit;
    box-shadow: var(--shadow); transition: .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #dbeafe; color: inherit; }
.card-cover {
    position: relative; aspect-ratio: 16 / 10; overflow: hidden;
    background: linear-gradient(135deg, #eef2f7, #e2e8f0);
    display: flex; align-items: center; justify-content: center; color: #94a3b8;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.card:hover .card-cover img { transform: scale(1.05); }
.cover-ph { display: flex; align-items: center; justify-content: center; color: #a8b4c4; }
.cover-type {
    position: absolute; top: 8px; left: 8px; z-index: 2;
    background: rgba(15, 23, 42, .62); color: #fff; font-size: 11px;
    padding: 2px 8px; border-radius: 999px; backdrop-filter: blur(4px);
}
.cover-dur {
    position: absolute; right: 8px; bottom: 8px; z-index: 2;
    background: rgba(15, 23, 42, .7); color: #fff; font-size: 11px;
    padding: 2px 7px; border-radius: 5px;
}
.card-body { padding: 12px 13px 14px; }
.card-title {
    font-size: 15px; font-weight: 600; margin-bottom: 6px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 40px;
}
.card:hover .card-title { color: var(--primary); }
.card-summary {
    font-size: 13px; color: var(--text-3); margin-bottom: 9px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-3); }
.card-meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- 标签 chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px;
    background: #fff; border: 1px solid var(--border); border-radius: 999px;
    color: var(--text-2); font-size: 13px; transition: .16s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-l); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.chip-lg { font-size: 15px; padding: 9px 18px; }
.chip-sm { font-size: 12px; padding: 4px 11px; }

/* ---------- 分类快捷卡片 ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.cat-card {
    display: flex; align-items: center; gap: 12px; padding: 15px 16px;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); transition: .2s; color: inherit;
}
.cat-card:hover { transform: translateY(-2px); border-color: #dbeafe; box-shadow: var(--shadow-lg); color: inherit; }
.cat-icon {
    width: 42px; height: 42px; flex: none; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary-l); color: var(--primary); overflow: hidden;
}
.cat-icon img { width: 100%; height: 100%; object-fit: cover; }
.cat-info { min-width: 0; flex: 1; }
.cat-name { display: block; font-size: 15px; font-weight: 600; color: var(--text); }
.cat-desc { display: block; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 列表/分类页布局 ---------- */
.browse { display: grid; grid-template-columns: 246px minmax(0, 1fr); gap: 24px; align-items: start; }
.browse-side {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 14px; position: sticky; top: calc(var(--header-h) + 16px);
    max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto;
}
.side-title { font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; padding: 0 4px; }
.tree-level { }
.tree-row { display: flex; align-items: center; gap: 2px; border-radius: 8px; }
.tree-row.active { background: var(--primary-l); }
.tree-row.active .tree-link { color: var(--primary); font-weight: 600; }
.tree-toggle {
    width: 22px; height: 22px; flex: none; border: 0; background: transparent;
    color: var(--text-3); display: flex; align-items: center; justify-content: center;
    border-radius: 6px; padding: 0;
}
.tree-toggle:hover { background: #eef2f7; color: var(--primary); }
.tree-toggle.open svg { transform: rotate(90deg); }
.tree-toggle svg { transition: transform .18s; }
.tree-dot { width: 22px; flex: none; display: flex; justify-content: center; }
.tree-dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #cbd5e1; }
.tree-link {
    flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 8px 8px; border-radius: 8px; color: var(--text-2); font-size: 14px;
}
.tree-link:hover { background: #f6f8fb; color: var(--primary); }
.tree-count { font-size: 12px; color: var(--text-3); flex: none; }
.tree-children { padding-left: 14px; border-left: 1px dashed var(--border); margin-left: 11px; }
.tree-children[hidden] { display: none; }

.browse-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 18px;
}
.type-tabs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.type-tab {
    padding: 6px 13px; border-radius: 999px; font-size: 13px; color: var(--text-2);
    display: inline-flex; align-items: center; gap: 5px; transition: .15s;
}
.type-tab:hover { background: var(--primary-l); color: var(--primary); }
.type-tab.active { background: var(--primary); color: #fff; }
.type-tab .cnt { font-size: 11px; opacity: .75; }
.toolbar-right { display: flex; align-items: center; gap: 12px; }
.result-count { font-size: 13px; color: var(--text-3); }
.sort-select {
    height: 34px; padding: 0 30px 0 12px; border: 1px solid var(--border); border-radius: 8px;
    background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
    color: var(--text-2); font-size: 13px; font-family: inherit; appearance: none; outline: none; cursor: pointer;
}
.sort-select:focus { border-color: var(--primary); }
.browse-head { display: none; margin-bottom: 16px; }
.filter-toggle { display: none; }

/* ---------- 分类页头部 ---------- */
.cat-head {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; display: flex; gap: 16px; align-items: flex-start;
}
.cat-head .cat-icon { width: 52px; height: 52px; border-radius: 13px; }
.cat-head h1 { font-size: 21px; margin-bottom: 6px; }
.cat-head p { font-size: 13px; color: var(--text-3); line-height: 1.7; }
.cat-children { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- 面包屑 ---------- */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); margin-bottom: 14px; }
.breadcrumb a { color: var(--text-3); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: #cbd5e1; }
.breadcrumb .cur { color: var(--text-2); }

/* ---------- 分页 ---------- */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 26px; }
.page-btn {
    min-width: 36px; height: 36px; padding: 0 11px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text-2);
    font-size: 13px; transition: .15s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn.disabled { opacity: .45; pointer-events: none; }
.page-ellipsis { color: var(--text-3); padding: 0 4px; }

/* ---------- 详情页 ---------- */
.detail { max-width: 920px; }
.detail-head { margin-bottom: 16px; }
.detail-title { font-size: 26px; line-height: 1.4; margin-bottom: 12px; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 13px; color: var(--text-3); margin-bottom: 14px; }
.detail-meta .m { display: inline-flex; align-items: center; gap: 5px; }
.badge {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; background: var(--primary-l); color: var(--primary);
}
.badge.gray { background: #f1f5f9; color: var(--text-2); }
.detail-summary {
    background: #f8fafc; border-left: 3px solid var(--primary); border-radius: 8px;
    padding: 12px 16px; color: var(--text-2); font-size: 14px; line-height: 1.8; margin-bottom: 18px;
}
.detail-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; align-items: center; }
.chips-label { font-size: 13px; color: var(--text-3); margin-right: 2px; }

.media-wrap { margin-bottom: 22px; }
.player { width: 100%; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.audio-list { display: flex; flex-direction: column; gap: 10px; }
.audio-item {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 14px; box-shadow: var(--shadow);
}
.audio-item .a-name { font-size: 13px; color: var(--text-2); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.audio-item audio { width: 100%; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.gallery-item {
    position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden;
    border: 1px solid var(--border); cursor: zoom-in; background: #eef2f7;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery-item:hover img { transform: scale(1.06); }

.doc-frame { width: 100%; height: 72vh; min-height: 420px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.doc-preview, .article-body {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px 24px; box-shadow: var(--shadow); color: var(--text); line-height: 1.85; font-size: 15px;
    overflow-wrap: break-word;
}
.article-body img, .doc-preview img { border-radius: 8px; margin: 8px 0; }
.article-body h1, .article-body h2, .article-body h3, .article-body h4,
.doc-preview h1, .doc-preview h2, .doc-preview h3, .doc-preview h4 { margin: 18px 0 10px; }
.article-body p, .doc-preview p { margin: 10px 0; }
.article-body a, .doc-preview a { text-decoration: underline; }
.doc-preview table, .article-body table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 14px; }
.doc-preview td, .doc-preview th, .article-body td, .article-body th { border: 1px solid var(--border); padding: 7px 10px; }
.doc-preview pre, .article-body pre { background: #f6f8fb; border-radius: 8px; padding: 14px; overflow: auto; font-size: 13px; }
.doc-preview blockquote, .article-body blockquote { border-left: 3px solid var(--border); margin: 12px 0; padding: 4px 14px; color: var(--text-2); }
.svg-preview { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.svg-preview svg { max-width: 100%; height: auto; }

.file-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 22px; text-align: center;
}
.file-card .fc-icon {
    width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 16px;
    background: var(--primary-l); color: var(--primary); display: flex; align-items: center; justify-content: center;
}
.file-card .fc-name { font-weight: 600; margin-bottom: 6px; word-break: break-all; }
.file-card .fc-info { font-size: 13px; color: var(--text-3); margin-bottom: 16px; }
.file-card .fc-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.detail-actions {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 22px;
}
.detail-actions .spacer { flex: 1; }
.like-btn.active { color: var(--danger); border-color: #fecaca; background: #fef2f2; }

.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-row {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.file-row .fr-main { flex: 1; min-width: 0; }
.file-row .fr-name { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .fr-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ---------- 灯箱 ---------- */
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(9, 13, 22, .92); display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 90vw; max-height: 84vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.lb-btn {
    position: absolute; width: 46px; height: 46px; border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .14); color: #fff; display: flex; align-items: center; justify-content: center;
    transition: .16s;
}
.lb-btn:hover { background: rgba(255, 255, 255, .3); }
.lb-close { top: 20px; right: 20px; }
.lb-prev { left: 22px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 22px; top: 50%; transform: translateY(-50%); }
.lb-counter { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px; opacity: .82; }

/* ---------- 页脚 ---------- */
.site-footer { background: #fff; border-top: 1px solid var(--border); padding: 30px 0; margin-top: 20px; }
.footer-in { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.footer-text { font-size: 13px; color: var(--text-3); line-height: 1.9; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; }
.footer-links a { color: var(--text-3); }
.footer-links a:hover { color: var(--primary); }

/* ---------- 空态 / 错误 ---------- */
.empty-state {
    text-align: center; padding: 60px 20px; color: var(--text-3);
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.empty-state .ic { color: #cbd5e1; margin-bottom: 12px; }
.empty-state h3 { font-size: 17px; color: var(--text-2); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 18px; word-break: break-word; }
.empty-state .btn { margin: 0 5px; }

/* ---------- Toast ---------- */
.toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
    background: #1f2937; color: #fff; padding: 11px 20px; border-radius: 999px;
    font-size: 14px; box-shadow: var(--shadow-lg); max-width: 88vw;
    animation: toastIn .22s ease; display: flex; align-items: center; gap: 8px;
}
.toast.success { background: #15803d; }
.toast.error { background: #b91c1c; }
.toast.fade { opacity: 0; transform: translateY(-8px); transition: .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 骨架屏 ---------- */
.sk { background: linear-gradient(90deg, #eef1f5 25%, #e4e9f0 37%, #eef1f5 63%); background-size: 400% 100%; animation: skFade .2s ease-out, sk 1.3s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-card { border-radius: var(--radius); overflow: hidden; background: var(--panel); border: 1px solid var(--border); }
.sk-cover { aspect-ratio: 16 / 10; }
.sk-line { height: 12px; margin: 10px 13px; }
.sk-line.w60 { width: 60%; }

/* ---------- 返回顶部 / 移动底栏 ---------- */
.backtop {
    position: fixed; right: 22px; bottom: 26px; z-index: 80;
    width: 44px; height: 44px; border: 0; border-radius: 50%;
    background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-lg); transition: .2s;
}
.backtop[hidden] { display: none; }
.backtop:hover { background: var(--primary-d); transform: translateY(-2px); }

.mobile-nav {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.mn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 5px 0; border: 0; background: transparent; color: var(--text-3);
    font-size: 11px; border-radius: 10px;
}
.mn-item:hover, .mn-item.active { color: var(--primary); }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 1024px) {
    .main-nav { display: none; }
    .hamburger { display: flex; }
    .browse { grid-template-columns: 1fr; }
    .browse-side {
        position: static; max-height: none; display: none;
    }
    .browse-side.show { display: block; margin-bottom: 16px; }
    .browse-head { display: block; }
    .filter-toggle { display: inline-flex; }
    .header-search { flex: 1; }
    .search-box { width: 100%; }
    .search-box input { width: 100%; }
    .hero { padding: 34px 26px; }
    .hero h1 { font-size: 24px; }
}

@media (max-width: 768px) {
    .container { padding: 0 14px; }
    .site-main { padding: 16px 0 30px; }
    /* 为固定底部导航预留高度：必须包含安全区，否则带 Home 指示条的机型上底部导航会压住页脚 */
    body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
    #app { min-height: calc(100vh - 66px - env(safe-area-inset-bottom)); }
    .mobile-nav { display: flex; }
    .site-footer { display: none; }
    .backtop { right: 14px; bottom: 78px; }
    .hero { border-radius: 12px; padding: 26px 20px; }
    .hero h1 { font-size: 21px; }
    .hero-stat b { font-size: 19px; }
    .detail-title { font-size: 20px; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .card-title { font-size: 14px; min-height: 38px; }
    .cat-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .gallery { grid-template-columns: repeat(auto-fill, minmax(106px, 1fr)); }
    .doc-preview, .article-body { padding: 16px; }
    .browse-toolbar { padding: 10px 12px; }
    .lb-prev { left: 8px; }
    .lb-next { right: 8px; }
    .footer-in { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
    .brand-name { font-size: 16px; }
    .header-inner { gap: 10px; }
    .header-search { display: none; }
    .hamburger { margin-left: auto; }
    .hero-stats { gap: 8px; }
    .hero-stat { flex: 1; min-width: 0; padding: 8px 12px; }
    .section-title { font-size: 17px; }
    .toolbar-right .result-count { display: none; }
    .cat-head { flex-direction: column; }
    .detail-actions { gap: 8px; }
}