/* ==========================================================================
   资源推荐站 · 前台样式（PC / 手机自适应 + 明暗双主题）
   ========================================================================== */

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

:root {
    --primary: #2563eb;
    --primary-rgb: 37, 99, 235;
    --primary-strong: #1d4ed8;
    --primary-soft: rgba(var(--primary-rgb), .10);
    --primary-softer: rgba(var(--primary-rgb), .06);
    --bg: #f4f7fc;
    --bg-grad: radial-gradient(1200px 600px at 50% -200px, rgba(var(--primary-rgb), .14), transparent 70%);
    --surface: #ffffff;
    --surface-2: #f6f8fc;
    --surface-3: #eef2f9;
    --text: #111a2c;
    --text-2: #3d4a60;
    --muted: #6b7a90;
    --border: #e3e9f2;
    --border-strong: #d3dce9;
    --success: #0f9d58;
    --danger: #dc2626;
    --warning: #b45309;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow: 0 2px 6px rgba(16, 24, 40, .05), 0 12px 28px rgba(16, 24, 40, .07);
    --shadow-lg: 0 18px 48px rgba(16, 24, 40, .16);
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --header-h: 64px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
    --primary-soft: rgba(var(--primary-rgb), .18);
    --primary-softer: rgba(var(--primary-rgb), .10);
    --bg: #0b1220;
    --bg-grad: radial-gradient(1200px 600px at 50% -200px, rgba(var(--primary-rgb), .22), transparent 70%);
    --surface: #111b2d;
    --surface-2: #162235;
    --surface-3: #1c2a41;
    --text: #e8eefb;
    --text-2: #c3cfe2;
    --muted: #8b9bb4;
    --border: #223049;
    --border-strong: #2c3d5b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 14px 30px rgba(0, 0, 0, .35);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, .55);
}

@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] {
        --primary-soft: rgba(var(--primary-rgb), .18);
        --primary-softer: rgba(var(--primary-rgb), .10);
        --bg: #0b1220;
        --bg-grad: radial-gradient(1200px 600px at 50% -200px, rgba(var(--primary-rgb), .22), transparent 70%);
        --surface: #111b2d;
        --surface-2: #162235;
        --surface-3: #1c2a41;
        --text: #e8eefb;
        --text-2: #c3cfe2;
        --muted: #8b9bb4;
        --border: #223049;
        --border-strong: #2c3d5b;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 14px 30px rgba(0, 0, 0, .35);
        --shadow-lg: 0 20px 60px rgba(0, 0, 0, .55);
    }
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg) var(--bg-grad) no-repeat;
    min-height: 100vh;
    overflow-x: hidden;
}

img { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-strong); }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; color: var(--text); font-weight: 700; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button { font-family: inherit; }
input, textarea, select, button { font-size: inherit; color: inherit; }
::selection { background: var(--primary); color: #fff; }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 6px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    z-index: 999;
    background: var(--surface);
    color: var(--text);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}
.skip-link:focus { left: 12px; }

.container {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 20px;
}

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.text-danger { color: var(--danger) !important; }
.text-link {
    color: var(--primary);
    font-weight: 600;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}
.text-link:hover { color: var(--primary-strong); }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .12s ease, box-shadow .18s ease;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 16px rgba(var(--primary-rgb), .28);
}
.btn-primary:hover { background: var(--primary-strong); color: #fff; }
.btn-soft {
    background: var(--primary-soft);
    color: var(--primary);
}
.btn-soft:hover { background: rgba(var(--primary-rgb), .18); color: var(--primary-strong); }
.btn-ghost {
    background: var(--surface);
    color: var(--text-2);
    border-color: var(--border);
}
.btn-ghost:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-softer); }
.btn-ghost.is-active { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 13px 24px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
    padding: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: all .18s ease;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip-icon { font-size: 14px; }
.chip.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
}
.badge-vip {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff;
}

/* ---------- 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .form-actions { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field input,
.field select,
.field textarea,
.search-page-form input,
.hero-search input,
.header-search input,
.mobile-search input {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.search-page-form input:focus,
.hero-search input:focus,
.header-search input:focus,
.mobile-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.field input::placeholder,
.header-search input::placeholder,
.mobile-search input::placeholder { color: var(--muted); }

/* ---------- 顶部导航 ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, .86);
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
}
html[data-theme="dark"] .site-header { background: rgba(17, 27, 45, .85); }
@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] .site-header { background: rgba(17, 27, 45, .85); }
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--header-h);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 800;
    flex-shrink: 0;
}
.brand:hover { color: var(--text); }
.brand-logo { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    box-shadow: 0 6px 14px rgba(var(--primary-rgb), .3);
}
.brand-name { font-size: 18px; letter-spacing: .2px; }

.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.main-nav a {
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
    transition: background .18s ease, color .18s ease;
}
.main-nav a:hover { background: var(--surface-2); color: var(--primary); }

.header-search {
    flex: 1 1 auto;
    position: relative;
    max-width: 420px;
    margin-left: auto;
}
.header-search svg {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}
.header-search input {
    padding: 9px 14px 9px 38px;
    border-radius: 999px;
    background: var(--surface-2);
    border-color: transparent;
    font-size: 14px;
}
.header-search input:focus { background: var(--surface); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}
.auth-links { display: flex; align-items: center; gap: 8px; }

.dropdown { position: relative; }
.dropdown summary {
    list-style: none;
    cursor: pointer;
}
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown[open] > summary { background: var(--surface-2); }
.dropdown-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 168px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    z-index: 130;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dropdown-panel a,
.dropdown-panel .dropdown-link {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text-2);
    font-size: 14px;
    text-align: left;
    background: none;
    border: 0;
    cursor: pointer;
}
.dropdown-panel a:hover,
.dropdown-panel .dropdown-link:hover { background: var(--surface-2); color: var(--primary); }
.dropdown-panel a.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.dropdown-panel form { margin: 0; }

.lang-current { font-size: 11px; font-weight: 700; letter-spacing: .3px; }

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: border-color .18s ease;
}
.user-chip:hover { border-color: var(--primary); }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-2); max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.avatar-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }

.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] .theme-toggle .icon-sun { display: block; }
    html[data-theme="auto"] .theme-toggle .icon-moon { display: none; }
}

.mobile-only { display: none; }
.mobile-search { display: none; padding: 0 0 12px; }
.mobile-search form {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: center;
}
.mobile-search svg { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.mobile-search input { padding-left: 38px; border-radius: 10px; background: var(--surface-2); }

.mobile-cats {
    display: none;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.mobile-cats-inner {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 20px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.mobile-cats-inner::-webkit-scrollbar { display: none; }

/* ---------- 抽屉菜单 ---------- */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 15, 28, .48);
    z-index: 190;
    opacity: 0;
    transition: opacity .22s ease;
}
.drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 86vw);
    background: var(--surface);
    z-index: 200;
    transform: translateX(-102%);
    transition: transform .26s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
}
body.is-drawer-open .drawer { transform: translateX(0); }
body.is-drawer-open .drawer-overlay { opacity: 1; }
body.is-drawer-open { overflow: hidden; }
.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}
.drawer-title { font-weight: 800; font-size: 16px; }
.drawer-body { padding: 12px 14px 24px; display: flex; flex-direction: column; gap: 14px; }
.drawer-quick {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.drawer-quick a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 10px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 13.5px;
    font-weight: 600;
    text-align: center;
}
.drawer-quick a:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.drawer-quick .quick-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.drawer-quick .quick-primary:hover { background: var(--primary-strong); color: #fff; }
.drawer-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--muted);
    margin-bottom: 6px;
}
.drawer-langs { display: flex; flex-wrap: wrap; gap: 8px; }
.drawer-logout { margin-top: 4px; }

/* ---------- 提示 ---------- */
.flash-wrap { padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.flash-success { border-color: rgba(15, 157, 88, .3); background: rgba(15, 157, 88, .08); color: #0b7a45; }
.flash-error { border-color: rgba(220, 38, 38, .3); background: rgba(220, 38, 38, .08); color: #b91c1c; }
.flash-info { border-color: rgba(var(--primary-rgb), .3); background: var(--primary-soft); color: var(--primary-strong); }
html[data-theme="dark"] .flash-success { color: #6ee7b7; }
html[data-theme="dark"] .flash-error { color: #fca5a5; }
html[data-theme="dark"] .flash-info { color: #93c5fd; }
.flash-close { background: none; border: 0; font-size: 20px; line-height: 1; color: inherit; cursor: pointer; opacity: .7; }
.flash-close:hover { opacity: 1; }

/* ---------- 主体布局 ---------- */
.site-main { padding: 22px 0 56px; min-height: 50vh; }
.layout {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    gap: 26px;
    align-items: start;
}
.content { min-width: 0; }
.content-wide { max-width: 980px; margin: 0 auto; }

.sidebar {
    position: sticky;
    top: calc(var(--header-h) + 18px);
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100vh - var(--header-h) - 36px);
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-width: thin;
}
.side-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}
.side-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .4px;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 10px;
}

/* 分类树 */
.cat-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.cat-list .cat-list { margin: 2px 0 4px 12px; padding-left: 10px; border-left: 1px solid var(--border); }
.cat-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 9px;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
    transition: background .16s ease, color .16s ease;
}
.cat-link:hover { background: var(--surface-2); color: var(--primary); }
.cat-item.is-active > .cat-link {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
}
.cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count { font-style: normal; font-size: 12px; color: var(--muted); }
.cat-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    flex-shrink: 0;
    overflow: hidden;
    font-size: 13px;
}
html[data-theme="dark"] .cat-icon { background: var(--surface-3); }
.cat-icon img { width: 100%; height: 100%; object-fit: cover; }
.cat-icon-emoji { font-size: 15px; background: transparent; }
.cat-icon-text { font-weight: 700; color: var(--primary); background: var(--primary-soft); }
.cat-empty { color: var(--muted); font-size: 13px; }

/* ---------- 首页 Hero ---------- */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    padding: 40px 34px 32px;
    background:
        radial-gradient(700px 320px at 88% -60%, rgba(255, 255, 255, .22), transparent 65%),
        linear-gradient(135deg, var(--primary) 0%, #4338ca 55%, #6d28d9 100%);
    color: #fff;
    box-shadow: var(--shadow);
}
.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: .35;
    pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 720px; }
.hero-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .22);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .3px;
    margin-bottom: 14px;
}
.hero h1 { font-size: 30px; color: #fff; letter-spacing: -.3px; }
.hero-sub { margin-top: 10px; color: rgba(255, 255, 255, .86); font-size: 15px; max-width: 620px; }
.hero-search {
    display: flex;
    gap: 8px;
    margin-top: 22px;
    padding: 7px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(12, 24, 64, .28);
    position: relative;
    align-items: center;
}
.hero-search svg { position: absolute; left: 20px; color: #8a97ab; pointer-events: none; }
.hero-search input {
    border: 0;
    background: transparent;
    color: #111a2c;
    padding: 10px 12px 10px 42px;
    font-size: 15px;
}
.hero-search input:focus { box-shadow: none; }
.hero-search input::placeholder { color: #98a3b5; }
.hero-search .btn { flex-shrink: 0; padding: 11px 22px; }
.hero-stats { display: flex; gap: 30px; margin-top: 24px; flex-wrap: wrap; }
.hero-stat { display: flex; flex-direction: column; }
.hero-stat strong { font-size: 22px; font-weight: 800; color: #fff; }
.hero-stat span { font-size: 12px; color: rgba(255, 255, 255, .78); }

/* ---------- 区块与卡片 ---------- */
.section { margin-top: 30px; }
.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}
.section-head h2 {
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 9px;
}
.section-head h2::before {
    content: "";
    width: 4px;
    height: 18px;
    border-radius: 999px;
    background: var(--primary);
}
.section-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

.res-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
.res-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    min-width: 0;
}
.res-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: rgba(var(--primary-rgb), .35);
}
.res-card-main {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 16px 48px;
    color: var(--text);
    height: 100%;
    min-height: 148px;
}
.res-card-main:hover { color: var(--text); }
.res-head { display: flex; align-items: center; gap: 11px; min-width: 0; }
.res-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    overflow: hidden;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
html[data-theme="dark"] .res-icon { background: var(--surface-3); }
.res-icon img, .res-icon-img { width: 100%; height: 100%; object-fit: cover; }
.res-icon-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 21px;
    line-height: 1;
}
.res-icon-sm {
    width: 36px;
    height: 36px;
    border-radius: 9px;
}
.res-icon-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    font-weight: 800;
    font-size: 18px;
}
.res-title {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}
.res-desc {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 40px;
}
.res-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--muted);
    margin-top: auto;
    flex-wrap: wrap;
}
.res-cat {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--primary-softer);
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.res-vip {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .4px;
}
.res-visit {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    transition: background .18s ease, color .18s ease;
    z-index: 2;
}
.res-visit:hover { background: var(--primary); color: #fff; }

.cat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}
.cat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.cat-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    color: var(--text);
}
.cat-card-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cat-card-body strong { font-size: 14px; }
.cat-card-body small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-card-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-soft);
    padding: 2px 9px;
    border-radius: 999px;
}

/* ---------- 面包屑 / 页头 ---------- */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 14px;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs [aria-current="page"] { color: var(--text-2); font-weight: 600; }
.crumb-sep { color: var(--border-strong); }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.page-head-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-head h1 { font-size: 24px; }
.page-desc { color: var(--muted); font-size: 14px; margin-top: 6px; }
.page-meta { color: var(--primary); font-size: 13px; font-weight: 600; margin-top: 4px; }

.subcat-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.subcat-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    padding-top: 7px;
    flex-shrink: 0;
}
.subcat-list { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }

.popular-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 18px 0;
    flex-wrap: wrap;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 56px 20px;
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
}

/* 分页 */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 26px 0 8px;
}
.pager-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
}
.pager-link:hover { border-color: var(--primary); color: var(--primary); }
.pager-link.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager-gap { color: var(--muted); padding: 0 4px; }

/* ---------- 资源详情 ---------- */
.detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow-sm);
}
.detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.detail-identity { display: flex; gap: 16px; min-width: 0; }
.detail-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    overflow: hidden;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 26px;
}
.detail-icon img { width: 100%; height: 100%; object-fit: cover; }
.detail-icon .res-icon-emoji { font-size: 30px; }
.detail-icon .res-icon-fallback { font-size: 26px; }
.detail-identity h1 { font-size: 25px; word-break: break-word; }
.detail-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 9px;
    font-size: 13px;
    color: var(--muted);
}
.detail-meta .meta-tag {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
    font-size: 12px;
}
.detail-meta .meta-vip {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff;
    letter-spacing: .3px;
}
.detail-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.favorite-form { margin: 0; }
.detail-lead {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 14.5px;
    border-left: 3px solid var(--primary);
}
.vip-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 11px;
    background: rgba(245, 158, 11, .10);
    border: 1px solid rgba(245, 158, 11, .35);
    color: var(--text-2);
    font-size: 13.5px;
}
.vip-notice strong {
    color: #b45309;
    background: rgba(245, 158, 11, .18);
    padding: 1px 9px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: .4px;
}
html[data-theme="dark"] .vip-notice strong { color: #fcd34d; }
.vip-notice span { flex: 1; min-width: 180px; }
.vip-notice .btn { flex-shrink: 0; }
.tag-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.tag-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.tag {
    padding: 3px 11px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 12px;
}
.tag:hover { border-color: var(--primary); color: var(--primary); }

.prose-wrap { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border); }
.prose-title { font-size: 17px; margin-bottom: 14px; }
.prose { color: var(--text-2); font-size: 15px; line-height: 1.85; word-break: break-word; }
.prose > * + * { margin-top: 14px; }
.prose h1, .prose h2, .prose h3, .prose h4 { color: var(--text); margin-top: 26px; font-size: 19px; }
.prose h3 { font-size: 17px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li + li { margin-top: 6px; }
.prose img { border-radius: 12px; display: block; margin: 18px auto; border: 1px solid var(--border); }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose blockquote {
    margin: 18px 0;
    padding: 12px 16px;
    border-left: 3px solid var(--primary);
    background: var(--surface-2);
    color: var(--text-2);
    border-radius: 0 10px 10px 0;
}
.prose code {
    background: var(--surface-3);
    padding: 2px 6px;
    border-radius: 5px;
    font-size: .9em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.prose pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 12px;
    overflow-x: auto;
}
.prose pre code { background: none; padding: 0; color: inherit; }
.prose table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose th { background: var(--surface-2); }
.prose hr { border: 0; border-top: 1px solid var(--border); }

/* ---------- 文章 ---------- */
.article-list { display: flex; flex-direction: column; gap: 16px; }
.article-card {
    display: flex;
    gap: 18px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.article-card:hover { border-color: rgba(var(--primary-rgb), .35); box-shadow: var(--shadow); }
.article-cover {
    width: 190px;
    height: 128px;
    flex-shrink: 0;
    border-radius: 11px;
    overflow: hidden;
    background: var(--surface-2);
}
.article-cover img { width: 100%; height: 100%; object-fit: cover; }
.article-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.article-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--muted);
}
.article-title { font-size: 18px; }
.article-title a { color: var(--text); }
.article-title a:hover { color: var(--primary); }
.article-summary { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.article-body .text-link { margin-top: auto; font-size: 13px; }

.article-detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-sm);
}
.article-header h1 { font-size: 27px; margin-top: 12px; }
.article-lead { margin-top: 12px; color: var(--muted); font-size: 15px; }
.article-cover-full { margin: 22px 0; border-radius: 14px; overflow: hidden; }
.article-cover-full img { width: 100%; display: block; }
.article-detail .prose { margin-top: 20px; }
.related-list { display: flex; flex-direction: column; gap: 8px; }
.related-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-2);
}
.related-item:hover { border-color: var(--primary); color: var(--primary); }
.related-title { font-weight: 600; font-size: 14px; }
.related-date { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.back-row { margin-top: 22px; }

.page-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
}
.page-card h1 { font-size: 26px; margin-bottom: 18px; }

/* ---------- 搜索 ---------- */
.search-page-form {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}
.search-page-form input { flex: 1; padding: 12px 16px; border-radius: 11px; }
.search-page-form .btn { flex-shrink: 0; padding: 0 24px; }

/* ---------- 登录/注册 ---------- */
.auth-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 34px 0;
}
.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
}
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    font-weight: 800;
    font-size: 20px;
    margin-bottom: 14px;
    box-shadow: 0 10px 24px rgba(var(--primary-rgb), .3);
}
.auth-head h1 { font-size: 22px; }
.auth-head p { color: var(--muted); font-size: 13px; margin-top: 6px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 13.5px; }

/* ---------- 会员中心 ---------- */
.account-hero {
    background: linear-gradient(135deg, var(--primary), #4338ca 60%, #6d28d9);
    border-radius: var(--radius-lg);
    padding: 26px;
    color: #fff;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.account-user { display: flex; align-items: center; gap: 16px; }
.account-user h1 { color: #fff; font-size: 22px; }
.account-vip { color: rgba(255, 255, 255, .88); font-size: 13px; margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.account-hero .badge { background: rgba(255, 255, 255, .18); color: #fff; }
.account-hero .badge-vip { background: linear-gradient(135deg, #f59e0b, #f97316); }

.account-grid {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}
.account-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    position: sticky;
    top: calc(var(--header-h) + 18px);
}
.account-tabs > a {
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
}
.account-tabs > a:hover { background: var(--surface-2); color: var(--primary); }
.account-tabs > a.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.account-logout { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.account-panel { min-width: 0; display: flex; flex-direction: column; gap: 18px; }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}
.panel-title { font-size: 18px; margin-bottom: 6px; }
.panel-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.plan-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}
.plan-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    text-align: center;
}
.plan-name { font-size: 14px; }
.plan-price { font-size: 27px; font-weight: 800; color: var(--primary); line-height: 1.2; }
.plan-price span { font-size: 15px; font-weight: 600; margin-right: 2px; }
.plan-days { font-size: 12px; color: var(--muted); }
.plan-desc { font-size: 12.5px; color: var(--muted); flex: 1; }
.plan-card .btn { margin-top: 6px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; font-size: 13.5px; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table thead th { background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.table-actions form { margin: 0; }
.status {
    display: inline-flex;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface-3);
    color: var(--text-2);
}
.status-0 { background: rgba(245, 158, 11, .14); color: #b45309; }
.status-1 { background: rgba(15, 157, 88, .14); color: #0b7a45; }
.status-2 { background: var(--surface-3); color: var(--muted); }

.notice {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 11px;
    background: var(--primary-softer);
    border: 1px solid rgba(var(--primary-rgb), .22);
    color: var(--text-2);
    font-size: 13.5px;
}
.notice strong { display: block; margin-bottom: 6px; color: var(--text); }
.notice p + p { margin-top: 6px; }

/* ---------- 订单 ---------- */
.order-card {
    max-width: 640px;
    margin: 20px auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow-sm);
}
.order-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.order-head h1 { font-size: 21px; }
.order-details { display: flex; flex-direction: column; margin: 18px 0; }
.order-details > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 14px;
}
.order-details > div:last-child { border-bottom: 0; }
.order-details dt { color: var(--muted); }
.order-details dd { margin: 0; text-align: right; }

/* ---------- 广告 ---------- */
.ad-slot { margin: 16px 0; }
.ad-header { margin: 16px 0 0; }
.ad-footer { margin: 0 0 10px; }
.ad-sidebar { margin: 0; }
.ad-item {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.ad-label {
    position: absolute;
    top: 6px;
    left: 8px;
    font-size: 10px;
    letter-spacing: .5px;
    color: var(--muted);
    background: var(--surface-2);
    border-radius: 4px;
    padding: 1px 6px;
    z-index: 1;
    opacity: .9;
}
.ad-link { display: block; }
.ad-link img { display: block; width: 100%; }
.ad-html { padding: 10px; }
.sidebar .ad-item { margin-bottom: 0; }

/* ---------- 弹窗推荐 ---------- */
.popup { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; }
.popup[hidden] { display: none; }
.popup-mask { position: absolute; inset: 0; background: rgba(8, 14, 26, .58); backdrop-filter: blur(3px); }
.popup-panel {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: 86vh;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 22px;
    animation: popupIn .28s ease;
}
@keyframes popupIn {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to { opacity: 1; transform: none; }
}
.popup-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.popup-head h3 { font-size: 20px; }
.popup-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.popup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.popup-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-2);
}
.popup-item-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    color: var(--text);
}
.popup-item-main:hover { color: var(--primary); }
.popup-item .res-icon-img,
.popup-item .res-icon-fallback {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    flex-shrink: 0;
    object-fit: cover;
}
.popup-item-text { display: flex; flex-direction: column; min-width: 0; }
.popup-item-text strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popup-item-text small { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popup-foot { margin-top: 14px; }

/* ---------- 错误页 ---------- */
.error-page { text-align: center; padding: 70px 20px; }
.error-code {
    font-size: 76px;
    font-weight: 900;
    letter-spacing: -3px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
}
.error-page h1 { margin-top: 12px; font-size: 24px; }
.error-page p { color: var(--muted); margin: 10px 0 22px; }

/* ---------- 页脚 ---------- */
.site-footer {
    margin-top: 30px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}
.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
    gap: 26px;
    padding-top: 34px;
    padding-bottom: 28px;
}
.footer-col { min-width: 0; }
.footer-text { color: var(--muted); font-size: 13px; margin-top: 12px; max-width: 300px; line-height: 1.7; }
.footer-title { font-size: 13px; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: var(--muted); font-size: 13px; }
.footer-links a:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid var(--border); padding: 16px 0; }
.footer-bottom-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 12.5px;
}
.footer-bottom-inner a { color: var(--muted); }
.footer-bottom-inner a:hover { color: var(--primary); }

.back-top {
    position: fixed;
    right: 20px;
    bottom: 24px;
    z-index: 90;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(var(--primary-rgb), .35);
    transition: transform .18s ease, background .18s ease;
}
.back-top:hover { transform: translateY(-2px); background: var(--primary-strong); }
.back-top[hidden] { display: none; }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 1199px) {
    .res-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .main-nav { display: none; }
    .mobile-only { display: inline-flex; }
    .header-search { max-width: 320px; }
}

@media (max-width: 900px) {
    .header-search { display: none; }
    .mobile-search { display: block; }
}

@media (max-width: 991px) {
    .mobile-cats { display: block; }
    .layout { grid-template-columns: minmax(0, 1fr); }
    .sidebar { display: none; }
    .site-main { padding-top: 18px; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
    .account-grid { grid-template-columns: minmax(0, 1fr); }
    .account-tabs {
        position: static;
        flex-direction: row;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .account-tabs::-webkit-scrollbar { display: none; }
    .account-tabs > a { white-space: nowrap; }
    .account-logout { margin: 0 0 0 auto; padding: 0; border: 0; }
    .account-logout .btn { white-space: nowrap; }
    .user-name { display: none; }
    .plan-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
    body { font-size: 14.5px; }
    .container { padding: 0 14px; }
    .res-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .res-card-main { padding: 13px 13px 44px; min-height: 136px; gap: 8px; }
    .res-icon { width: 36px; height: 36px; border-radius: 9px; }
    .res-title { font-size: 14px; }
    .res-desc { font-size: 12px; min-height: 36px; }
    .res-cat { display: none; }
    .hero { padding: 28px 20px 24px; border-radius: var(--radius); }
    .hero h1 { font-size: 23px; }
    .hero-sub { font-size: 13.5px; }
    .hero-search { flex-wrap: wrap; padding: 6px; }
    .hero-search input { flex: 1 1 140px; }
    .hero-search .btn { width: 100%; }
    .hero-stats { gap: 20px; margin-top: 18px; }
    .hero-stat strong { font-size: 19px; }
    .section { margin-top: 24px; }
    .section-head h2 { font-size: 18px; }
    .page-head h1 { font-size: 20px; }
    .detail-card { padding: 18px; border-radius: var(--radius); }
    .detail-head { gap: 14px; }
    .detail-icon { width: 52px; height: 52px; border-radius: 13px; }
    .detail-identity h1 { font-size: 20px; }
    .detail-actions { width: 100%; }
    .detail-actions .btn { flex: 1; }
    .favorite-form { flex: 1; }
    .favorite-form .btn { width: 100%; }
    .article-card { flex-direction: column; padding: 14px; }
    .article-cover { width: 100%; height: 168px; }
    .article-title { font-size: 16px; }
    .article-detail, .page-card { padding: 18px; border-radius: var(--radius); }
    .article-header h1 { font-size: 21px; }
    .auth-card { padding: 22px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .plan-grid { grid-template-columns: minmax(0, 1fr); }
    .footer-grid { grid-template-columns: 1fr; padding-top: 26px; }
    .footer-text { max-width: none; }
    .popup-grid { grid-template-columns: minmax(0, 1fr); }
    .popup-panel { padding: 18px; }
    .back-top { right: 14px; bottom: 16px; }
    .order-card { padding: 18px; margin: 10px 0; }
    .category .page-head-main { gap: 10px; }
    .search-page-form { flex-wrap: wrap; }
    .search-page-form .btn { width: 100%; padding: 11px; }
    .auth-links { display: none; }
    .mobile-cats-inner { padding: 9px 14px; }
}

@media (max-width: 420px) {
    .res-grid { gap: 10px; }
    .res-card-main { padding: 11px 11px 42px; }
    .res-icon { width: 32px; height: 32px; }
    .res-title { font-size: 13.5px; }
    .res-visit { right: 9px; bottom: 9px; padding: 4px 9px; }
    .hero h1 { font-size: 20px; }
    .brand-name { font-size: 16px; }
    .account-user h1 { font-size: 19px; }
    .account-hero { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
