/* ===== 资源分享站 全站样式（渐变主题，前台+后台） ===== */
:root {
    --theme-start: #6478e8;
    --theme-end: #7d4eb3;
    --primary: #665fd8;
    --primary-dark: #554bbb;
    --page-bg: #f4f4f5;
    --card-bg: #ffffff;
    --text: #202128;
    --muted: #73747d;
    --line: #e8e8ec;
    --shadow: 0 10px 25px rgba(28, 31, 55, .07);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { min-height: 100%; background: var(--page-bg); }
body {
    min-height: 100vh; margin: 0; color: var(--text); background: var(--page-bg);
    font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    display: flex; flex-direction: column;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; }
main { flex: 1; }
code { background: #f0f0f4; padding: 2px 8px; border-radius: 6px; font-size: 13px; }
.muted { color: var(--muted); }
.center { text-align: center; }
hr { border: none; border-top: 1px solid var(--line); margin: 22px 0; }

/* ----- 顶部渐变横幅 ----- */
.site-hero {
    min-height: 98px; display: flex; align-items: center; justify-content: center;
    padding: 15px 20px; color: #fff;
    background: linear-gradient(110deg, var(--theme-start), var(--theme-end));
}
.hero-content { text-align: center; }
.site-title { display: flex; align-items: center; justify-content: center; gap: 10px; }
.site-title h1 { margin: 0; font-size: 27px; line-height: 1.2; letter-spacing: .4px; }
.site-game-icon { font-size: 28px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.18)); }
.hero-content p { margin: 8px 0 0; font-size: 14px; opacity: .9; }

/* ----- 搜索条 ----- */
.search-section {
    min-height: 61px; display: flex; align-items: center;
    padding: 9px 15px; background: #fff; border-bottom: 1px solid #ececf0;
}
.search-form { width: min(1128px, 100%); display: flex; gap: 10px; margin: 0 auto; }
.search-form input {
    flex: 1; min-width: 0; height: 38px; padding: 0 16px;
    border: 1px solid #dedee3; border-radius: 999px;
    color: var(--text); background: #fff; outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.search-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(102,95,216,.11); }
.search-form button {
    width: 67px; height: 38px; border: 0; border-radius: 999px; color: #fff;
    background: linear-gradient(110deg, var(--primary), var(--primary-dark));
    font-weight: 700; cursor: pointer;
}

/* ----- 分类胶囊导航 ----- */
.category-nav { min-height: 60px; display: flex; align-items: center; background: #fff; box-shadow: 0 5px 17px rgba(30,31,48,.04); }
.category-list { width: min(1128px, 100%); margin: 0 auto; display: flex; gap: 10px; padding: 10px; overflow-x: auto; scrollbar-width: none; }
.category-list::-webkit-scrollbar { display: none; }
.category-button {
    flex: 0 0 auto; min-width: 89px; padding: 10px 18px; border-radius: 999px;
    color: #303139; background: #f1f1f3; text-align: center; font-size: 14px;
    transition: transform .2s, background .2s, color .2s;
}
.category-button:hover { transform: translateY(-1px); background: #e8e8ed; }
.category-button.active { color: #fff; background: linear-gradient(110deg, var(--primary), var(--primary-dark)); }

/* ----- 资源卡片网格 ----- */
.resource-section { width: min(1128px, calc(100% - 30px)); margin: 14px auto 50px; }
.resource-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.resource-card {
    min-width: 0; overflow: hidden; border-radius: 13px; background: #fff;
    box-shadow: var(--shadow); transition: transform .22s, box-shadow .22s;
}
.resource-card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px rgba(28,31,55,.12); }
.resource-cover-link { display: block; overflow: hidden; background: #e8e9ee; }
.resource-cover { width: 100%; aspect-ratio: 16/10; object-fit: cover; transition: transform .32s; }
.resource-card:hover .resource-cover { transform: scale(1.035); }
.cover-placeholder {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--theme-start), var(--theme-end));
    color: rgba(255,255,255,.9); font-size: 46px; font-weight: 800;
}
.resource-card-body { min-height: 98px; padding: 15px 14px 14px; }
.resource-card-body h2 {
    margin: 0; overflow: hidden; color: #24252b; font-size: 16px;
    line-height: 1.45; text-overflow: ellipsis; white-space: nowrap;
}
.resource-card-body h2 a:hover { color: var(--primary); }
.resource-summary {
    margin: 7px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.55;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.resource-tags, .detail-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.resource-tags span, .detail-tags span {
    display: inline-flex; align-items: center; min-height: 23px; padding: 3px 7px;
    border-radius: 5px; color: #70717a; background: #f3f3f5; font-size: 11px;
}
.detail-tags .category-tag { color: var(--primary-dark); background: #eeeefe; }

/* ----- 分页 ----- */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
.pagination a {
    min-width: 37px; height: 37px; display: inline-flex; align-items: center; justify-content: center;
    padding: 0 12px; border-radius: 9px; color: #555762; background: #fff;
    box-shadow: var(--shadow); font-size: 13px;
}
.pagination a.active { color: #fff; background: linear-gradient(110deg, var(--primary), var(--primary-dark)); }

/* ----- 空状态 ----- */
.empty-card { padding: 85px 20px; border-radius: 16px; text-align: center; background: #fff; box-shadow: var(--shadow); }
.empty-card > div { font-size: 50px; }
.empty-card h2 { margin: 17px 0 8px; }
.empty-card p { margin: 0; color: var(--muted); }

/* ----- 前台页脚 ----- */
.site-footer {
    min-height: 70px; display: flex; align-items: center; justify-content: center; gap: 18px;
    padding: 20px; color: #90919a; background: #fff; border-top: 1px solid var(--line); font-size: 13px;
}
.site-footer a:hover { color: var(--primary); }

/* ----- 详情页 ----- */
.detail-page { background: #f3f4f7; }
.detail-nav {
    color: #fff; background: linear-gradient(110deg, var(--theme-start), var(--theme-end));
    position: sticky; top: 0; z-index: 50;
}
.detail-nav-inner {
    width: min(1128px, calc(100% - 30px)); min-height: 52px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
}
.detail-nav-title { font-weight: 700; font-size: 15px; opacity: .95; }
.detail-back { display: inline-flex; align-items: center; gap: 2px; font-size: 14px; padding: 6px 10px; border-radius: 999px; }
.detail-back span { font-size: 20px; line-height: 1; }
.detail-back:hover { background: rgba(255,255,255,.15); }
.detail-main { width: min(1000px, calc(100% - 30px)); margin: 0 auto 55px; }
.cover-hero { border-radius: 0; }
.cover-wrap { overflow: hidden; background: #e8e9ee; }
.cover-img { width: 100%; max-height: 480px; object-fit: cover; }
.detail-overlap { max-width: 800px; margin: -50px auto 0; padding: 0 15px; position: relative; z-index: 10; }
.product-card {
    overflow: hidden; border-radius: 18px; background: #fff; box-shadow: var(--shadow);
}
.product-info { display: flex; align-items: center; gap: 16px; padding: 22px; }
.app-icon {
    width: 72px; height: 72px; border-radius: 16px; object-fit: cover; flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(28,31,55,.15);
}
.icon-placeholder {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--theme-start), var(--theme-end));
    color: #fff; font-size: 30px; font-weight: 800;
}
.product-text { flex: 1; min-width: 0; }
.product-text h1 { margin: 0; font-size: 20px; line-height: 1.35; }
.update-time { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.download-button {
    flex-shrink: 0; border: 0; border-radius: 10px; padding: 12px 26px; color: #fff;
    background: linear-gradient(110deg, var(--primary), var(--primary-dark));
    font-weight: 700; font-size: 15px; cursor: pointer;
    transition: transform .2s, box-shadow .2s;
}
.download-button:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(82,72,188,.23); }
.group-card {
    margin-top: 14px; border-radius: 18px; padding: 22px; color: #fff;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    box-shadow: var(--shadow); text-align: center;
}
.group-icon {
    width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.25);
    display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.group-content h2 { margin: 0; font-size: 17px; }
.group-content p { margin: 4px 0 0; font-size: 13px; opacity: .92; }
.group-number {
    margin-top: 6px; border: 0; border-radius: 999px; padding: 9px 26px;
    background: rgba(255,255,255,.92); color: #d6336c; font-weight: 800; font-size: 16px;
    letter-spacing: 1px; cursor: pointer; transition: transform .15s;
}
.group-number:hover { transform: scale(1.04); }
.detail-overlap .detail-tags { margin: 14px 2px 0; }
.detail-tags span { font-size: 12px; padding: 5px 10px; }
.description-card {
    margin-top: 14px; border-radius: 18px; background: #fff; box-shadow: var(--shadow); padding: 24px;
}
.description-card h2 { margin: 0 0 14px; font-size: 18px; }
.description-content { color: #4d4e57; line-height: 1.9; word-break: break-word; font-size: 14px; }
.not-found { margin-top: 40px; padding: 80px 25px; border-radius: 18px; text-align: center; background: #fff; box-shadow: var(--shadow); }
.not-found > div { font-size: 55px; }
.not-found h1 { margin: 18px 0 25px; }
.detail-footer { padding: 22px; text-align: center; color: #90919a; font-size: 13px; }

/* ----- 下载弹窗 ----- */
.download-modal { position: fixed; inset: 0; z-index: 100; display: none; }
.download-modal.show { display: block; }
.download-modal-mask { position: absolute; inset: 0; background: rgba(20,20,30,.5); }
.download-dialog {
    position: relative; width: min(400px, calc(100% - 40px)); margin: 12vh auto 0;
    background: #fff; border-radius: 18px; padding: 28px 24px 22px; text-align: center;
    box-shadow: 0 30px 80px rgba(20,22,40,.3);
    animation: pop .18s ease-out;
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.download-dialog-close {
    position: absolute; top: 10px; right: 12px; border: 0; background: none;
    font-size: 24px; color: var(--muted); cursor: pointer; line-height: 1;
}
.modal-icon {
    width: 60px; height: 60px; margin: 0 auto 15px; border-radius: 50%;
    background: linear-gradient(135deg, var(--theme-start), var(--theme-end));
    display: flex; align-items: center; justify-content: center;
}
.download-dialog h2 { margin: 0 0 14px; font-size: 19px; }
.modal-body {
    font-size: 14px; color: #555; line-height: 1.8; margin-bottom: 16px;
    text-align: left; background: #f9f9f9; padding: 15px; border-radius: 10px;
}
.modal-code {
    display: block; width: 100%; margin-bottom: 16px; padding: 10px;
    border: 1px dashed #d8d8e0; border-radius: 10px; background: #fbfbff;
    color: #3d3e47; font-size: 14px; cursor: pointer;
}
.modal-code b { color: var(--primary-dark); font-size: 16px; }
.download-dialog-actions { display: flex; gap: 12px; }
.download-cancel-button, .download-confirm-button {
    flex: 1; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px; font-weight: 700; cursor: pointer; border: 0; font-size: 15px;
}
.download-cancel-button { background: #f1f1f4; color: #3d3e47; }
.download-confirm-button { color: #fff; background: linear-gradient(110deg, var(--primary), var(--primary-dark)); }
body.modal-open { overflow: hidden; }
.copy-toast {
    position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%) translateY(16px);
    background: rgba(32,33,40,.92); color: #fff; padding: 11px 26px; border-radius: 999px;
    font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 200;
}
.copy-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ----- 按钮（后台通用） ----- */
.btn { display: inline-block; border: 0; cursor: pointer; padding: 10px 20px; border-radius: 10px; font-size: 14px; font-weight: 600; transition: .15s; text-align: center; }
.btn.primary { color: #fff; background: linear-gradient(110deg, var(--primary), var(--primary-dark)); }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(82,72,188,.23); }
.btn.ghost { background: #f1f1f4; color: #3d3e47; }
.btn.ghost:hover { background: #e6e6ec; }
.btn.danger { background: #fff0f0; color: #c22e2e; }
.btn.danger:hover { background: #ffdede; }
.btn.sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }

/* ----- 登录页 ----- */
.login-layout {
    min-height: 100vh; display: grid; place-items: center; padding: 20px;
    background:
        radial-gradient(circle at 15% 8%, color-mix(in srgb, var(--theme-start) 35%, transparent), transparent 32%),
        radial-gradient(circle at 88% 82%, color-mix(in srgb, var(--theme-end) 27%, transparent), transparent 36%),
        #f2f3f7;
}
.login-card { width: min(420px, 100%); padding: 34px; border-radius: 21px; background: #fff; box-shadow: 0 24px 68px rgba(37,40,75,.16); }
.login-icon { font-size: 43px; }
.login-card h1 { margin: 13px 0 6px; font-size: 22px; }
.login-card > p { margin: 0 0 23px; color: var(--muted); }
.login-back { display: block; margin-top: 17px; color: var(--muted); text-align: center; font-size: 13px; }

/* ----- 表单 ----- */
.form-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.form-field > span { font-size: 14px; font-weight: 700; }
.form-field > span i { color: #c22e2e; font-style: normal; }
.form-field input, .form-field textarea, .form-field select {
    width: 100%; border: 1px solid #dfe0e6; border-radius: 10px; color: var(--text);
    background: #fff; outline: none; transition: border-color .2s, box-shadow .2s;
    font-weight: 400;
}
.form-field input { height: 43px; padding: 0 13px; }
.form-field input[type="color"] { padding: 4px; height: 46px; }
.form-field input[type="file"] { padding: 9px 13px; height: auto; }
.form-field input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }
.form-field textarea { min-height: 120px; padding: 13px; resize: vertical; line-height: 1.7; }
.form-field input:focus, .form-field textarea:focus, .form-field select:focus {
    border-color: var(--primary); box-shadow: 0 0 0 4px rgba(102,95,216,.1);
}
.form-field small { color: var(--muted); font-size: 12px; font-weight: 400; }
.check-field { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700; margin-bottom: 16px; }
.form-ops { display: flex; gap: 12px; margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 17px; }
.full-field { grid-column: 1 / -1; }
.img-preview { display: flex; align-items: center; gap: 12px; }
.img-preview img, .img-preview .ph {
    width: 84px; height: 56px; object-fit: cover; border-radius: 10px;
    background: #e8e9ee; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px;
}
.img-preview .icon-prev { width: 56px; border-radius: 14px; }

/* ----- 闪存消息 ----- */
.alert { margin-bottom: 18px; padding: 13px 15px; border-radius: 10px; font-size: 13px; }
.alert.error { color: #a42626; background: #fff0f0; border: 1px solid #ffd2d2; }
.alert.success { color: #176a43; background: #edf9f3; border: 1px solid #c9eddc; }
.alert.warn { color: #8a6d1a; background: #fff8e6; border: 1px solid #f5e3b3; }
.alert a { color: inherit; text-decoration: underline; }

/* ----- 后台框架 ----- */
.admin-header { color: #fff; background: linear-gradient(110deg, var(--theme-start), var(--theme-end)); }
.admin-header-inner {
    width: min(1128px, calc(100% - 30px)); min-height: 76px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
    padding: 10px 0;
}
.admin-header h1 { margin: 0; font-size: 22px; }
.admin-header p { margin: 4px 0 0; opacity: .82; font-size: 13px; }
.admin-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-header-actions a {
    padding: 8px 14px; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; font-size: 13px;
    transition: background .15s;
}
.admin-header-actions a:hover { background: rgba(255,255,255,.15); }
.admin-header-actions a.on { background: rgba(255,255,255,.92); color: var(--primary-dark); font-weight: 700; border-color: transparent; }
.admin-main { width: min(1128px, calc(100% - 30px)); margin: 24px auto 55px; }
.admin-panel { margin-bottom: 21px; padding: 23px; border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.panel-heading h2 { margin: 0; font-size: 19px; }
.panel-heading > div { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ----- 统计卡 ----- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 21px; }
.stat { padding: 22px; border-radius: 16px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.stat .num { font-size: 32px; font-weight: 800; background: linear-gradient(110deg, var(--theme-start), var(--theme-end)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ----- 表格 ----- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { color: var(--muted); font-size: 13px; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .thumb { width: 64px; height: 40px; object-fit: cover; border-radius: 8px; background: #e8e9ee; }
.tbl .thumb-ph { width: 64px; height: 40px; border-radius: 8px; background: #e8e9ee; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }
.tag { font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.tag.ok { background: #edf9f3; color: #1d9e56; }
.tag.off { background: #f0f1f5; color: var(--muted); }
.ops { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
form.inline { display: inline; }
.inline-flex { display: flex; gap: 6px; align-items: center; }
.inline-flex input { height: 36px; width: 130px; padding: 0 10px; border: 1px solid #dfe0e6; border-radius: 8px; }
.inline-search { display: flex; gap: 8px; }
.inline-search input { height: 40px; width: 200px; padding: 0 14px; border: 1px solid #dfe0e6; border-radius: 999px; outline: none; }
.toplist { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.toplist li { display: flex; justify-content: space-between; font-size: 14px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.toplist b { color: var(--primary); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

@media (max-width: 900px) {
    .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .two-col, .form-grid { grid-template-columns: 1fr; }
    .product-info { flex-wrap: wrap; }
    .download-button { width: 100%; }
}
