:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --border: #e6ebf4;
  --border-strong: #cbd7ee;
  --text: #141a26;
  --muted: #7b88a2;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --amber: #f59e0b;
  --amber-dark: #d97706;
  --teal: #0d9488;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .08);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, .12), 0 4px 10px rgba(16, 24, 40, .06);
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  --grad-gem: linear-gradient(135deg, #3b82f6, #2563eb 60%, #1d4ed8);
  --grad-gold: linear-gradient(135deg, #fbbf24, #f59e0b 60%, #d97706);
  --grad-hero: linear-gradient(135deg, #0f1f52, #1e40af 55%, #2563eb);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ============ 顶部 Hero ============ */
.site {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 340px at 84% -40%, rgba(96, 165, 250, .55), transparent 62%),
    radial-gradient(760px 300px at 4% 120%, rgba(251, 191, 36, .30), transparent 58%),
    var(--grad-hero);
  padding: 42px 0 40px;
  color: #fff;
}
.site::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: .35; pointer-events: none;
}
.site-head-row { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; }

.brand { display: flex; align-items: center; gap: 18px; }
.logo {
  position: relative; flex: none;
  width: 60px; height: 60px; border-radius: 18px;
  background: var(--grad-gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  box-shadow: 0 10px 24px rgba(217, 119, 6, .38), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.logo::after {
  content: ""; position: absolute; top: 6px; left: 8px; right: 8px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .9), transparent);
}
.brand-text h1 {
  margin: 0; font-size: 28px; font-weight: 800; letter-spacing: .5px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}
.brand-text .sub { margin: 5px 0 0; color: #dbe7ff; font-size: 14px; letter-spacing: .2px; }

.gem-deco {
  position: absolute; pointer-events: none; z-index: 1;
  filter: saturate(.85) drop-shadow(0 6px 18px rgba(0, 0, 0, .18));
}
.gem-1 { right: 6%; top: 14px; font-size: 120px; opacity: .16; transform: rotate(14deg); animation: floaty 7s ease-in-out infinite; }
.gem-2 { left: -34px; bottom: -46px; font-size: 180px; opacity: .12; animation: floaty 9s ease-in-out infinite reverse; }
.gem-3 { right: 34%; bottom: 4px; font-size: 34px; color: #fcd34d; opacity: .35; animation: floaty 5s ease-in-out infinite; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(6deg); }
}

/* ============ 公告 ============ */
.announcement {
  background: linear-gradient(90deg, #fff8e6, #fff3d6);
  border: 1px solid #ffe2a3; color: #8a5a00;
  border-radius: 12px; padding: 12px 18px; margin: 22px 0 0; font-size: 14px;
  box-shadow: var(--shadow);
}
.announcement:empty { display: none; }

/* ============ 搜索 & 分类 ============ */
.controls { display: flex; gap: 14px; align-items: center; margin: 26px 0 20px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 240px; }
.search-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); opacity: .5; z-index: 2; }
.search-box input {
  width: 100%; padding: 12px 16px 12px 42px; border: 1px solid var(--border);
  border-radius: 12px; font-size: 14px; background: var(--panel);
  box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .14), var(--shadow);
}
.cats { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-btn {
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
  padding: 9px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow); transition: all .15s;
}
.cat-btn:hover { border-color: var(--primary); color: var(--primary); }
.cat-btn.active {
  background: var(--grad-gem); border-color: transparent; color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, .35);
}

/* ============ 卡片 ============ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.card {
  position: relative; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 20px 18px; cursor: pointer; overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, #2563eb, #0ea5e9 55%, #f59e0b);
  opacity: .9;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.card .top { display: flex; align-items: center; gap: 14px; }
.card .icon {
  position: relative; width: 54px; height: 54px; border-radius: 14px; flex: none;
  background: var(--grad-gem); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 27px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .30);
}
.card h3 { margin: 0; font-size: 17px; font-weight: 750; }
.card .cat { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card .desc {
  color: var(--muted); font-size: 13.5px; margin: 14px 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .meta {
  display: flex; gap: 18px; margin-top: 16px; font-size: 12.5px; color: var(--muted);
  border-top: 1px dashed var(--border); padding-top: 13px;
}
.card .meta b { color: var(--text); font-weight: 700; }

/* ============ 博客模式布局 ============ */
.blog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 30px;
  align-items: start;
}
.blog-main { min-width: 0; }
.blog-aside { position: sticky; top: 22px; }

.side-panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 18px 14px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.side-panel h4 {
  margin: 0 0 10px; font-size: 14px; font-weight: 750; color: var(--text);
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.side-desc { color: var(--muted); font-size: 13.5px; margin: 0; line-height: 1.7; }

.cat-list { display: flex; flex-direction: column; gap: 4px; }
.cat-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; text-align: left; border: none; background: transparent;
  padding: 9px 12px; border-radius: 9px; font-size: 13.5px; color: var(--text);
  cursor: pointer; transition: background .15s, color .15s;
}
.cat-item:hover { background: var(--primary-soft); color: var(--primary); }
.cat-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.cat-item .ci-count {
  font-size: 11.5px; color: var(--muted); background: var(--bg);
  border-radius: 999px; padding: 1px 8px; min-width: 24px; text-align: center;
}
.cat-item.active .ci-count { background: #dbe6fb; color: var(--primary); }

/* 博客文章条目 */
.post {
  position: relative; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 26px; margin-bottom: 18px; cursor: pointer;
  overflow: hidden; box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.post::before {
  content: ""; position: absolute; top: 0; left: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, #2563eb, #0ea5e9 60%, #f59e0b);
  opacity: .9;
}
.post:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong);
}
.post-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.post-tag {
  display: inline-flex; padding: 2px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 700;
}
.pin-tag {
  display: inline-flex; padding: 2px 8px; border-radius: 999px;
  background: #fff4e0; color: #b45309; font-size: 12px; font-weight: 700;
}
.detail-actions { margin: 16px 0 0; }
.post-date { color: var(--muted); font-size: 12.5px; }
.post-title {
  margin: 0; font-size: 21px; font-weight: 800; line-height: 1.4; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.post-icon { font-size: 22px; }
.post-excerpt { color: var(--muted); font-size: 14px; margin: 12px 0 0; line-height: 1.7; }
.post-meta {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border);
  font-size: 12.5px; color: var(--muted);
}
.post-meta b { color: var(--text); font-weight: 700; }
.post-more { margin-left: auto; color: var(--primary); font-weight: 700; font-size: 13px; }
.post:hover .post-more { text-decoration: underline; }

/* ============ 徽章 ============ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 7px; font-size: 12px; font-weight: 700; line-height: 1.7;
}
.badge.apk { background: #e6f7ee; color: #0b7a43; }
.badge.exe { background: #fff0e2; color: #c2620b; }
.badge.deb { background: #e7f0ff; color: #1d63c9; }
.badge.html { background: #e4f6f6; color: #0d9488; }
.badge.zip { background: #f0f2f6; color: #5b6472; }
.badge.other { background: #f0f2f6; color: #5b6472; }

/* ============ 空状态 ============ */
.empty { text-align: center; color: var(--muted); padding: 76px 0; }
.empty .big { font-size: 46px; opacity: .35; display: block; margin-bottom: 8px; }

/* ============ 详情 ============ */
.detail {
  position: relative; background: var(--panel); border: 1px solid var(--border);
  border-radius: 20px; padding: 30px 32px; margin-top: 22px; overflow: hidden;
  box-shadow: var(--shadow);
}
.detail::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, #2563eb, #0ea5e9 55%, #f59e0b);
}
.detail .head { display: flex; align-items: center; gap: 18px; }
.detail .icon {
  width: 66px; height: 66px; border-radius: 18px; flex: none;
  background: var(--grad-gem); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 34px;
  box-shadow: 0 10px 22px rgba(37, 99, 235, .32);
}
.detail h2 { margin: 0; font-size: 25px; font-weight: 800; }
.detail .cat { margin-top: 2px; }
.detail .desc { color: var(--muted); margin: 16px 0 0; white-space: pre-wrap; }
.detail .home { display: inline-block; margin-top: 10px; font-size: 14px; font-weight: 600; }
.file-list { margin-top: 24px; }
.file-item {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: 12px; padding: 15px 18px; margin-bottom: 10px;
  background: #fafbfd; transition: border-color .15s, background .15s, transform .15s;
}
.file-item:hover { border-color: var(--border-strong); background: #fff; transform: translateY(-1px); box-shadow: var(--shadow); }
.file-item .fname { flex: 1 1 220px; min-width: 0; }
.file-item .fname .nm { font-weight: 700; font-size: 15px; word-break: break-all; }
.file-item .fname .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.file-item .fmeta { display: flex; align-items: center; gap: 10px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--grad-gem); color: #fff; border: none; border-radius: 10px;
  padding: 10px 18px; font-size: 13.5px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .28);
  transition: transform .12s, box-shadow .12s, background .15s;
}
.btn:hover { background: linear-gradient(135deg, #2563eb, #1d4ed8 60%, #1e3a8a); box-shadow: 0 6px 18px rgba(37, 99, 235, .35); transform: translateY(-1px); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid #c4d4f2; box-shadow: none; }
.btn.ghost:hover { background: var(--primary-soft); box-shadow: none; }
.btn.sm { padding: 7px 13px; font-size: 12.5px; border-radius: 8px; }
.btn.green { background: var(--success); box-shadow: 0 4px 12px rgba(22, 163, 74, .28); }
.btn.green:hover { background: #15803d; }
.btn.red { background: var(--danger); box-shadow: 0 4px 12px rgba(220, 38, 38, .26); }
.btn.red:hover { background: #b91c1c; }
.btn.gray { background: #64748b; box-shadow: none; }
.btn.gray:hover { background: #475569; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.back-link { display: inline-block; margin: 18px 0 0; font-size: 14px; font-weight: 600; }

/* ============ 管理后台 ============ */
.admin-body { background: #eef1f7; }
.admin-shell { max-width: 1060px; margin: 0 auto; padding: 24px 20px; }
.admin-top {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--grad-hero); color: #fff;
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px;
  box-shadow: 0 8px 22px rgba(30, 64, 175, .28);
}
.admin-top h1 { margin: 0; font-size: 18px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 18px; font-size: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat {
  background: linear-gradient(135deg, #f4f8ff, #eaf1ff); border: 1px solid #dbe7fb;
  border-radius: 12px; padding: 18px; text-align: center;
}
.stat .num { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat .lbl { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

form .row { margin-bottom: 12px; }
form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px; font-family: var(--font); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea { resize: vertical; min-height: 70px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.list td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list tr:hover td { background: #fafbfd; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.login-box { max-width: 400px; margin: 80px auto; }
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
  padding: 34px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.login-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, #2563eb, #0ea5e9, #f59e0b);
}
.login-card h1 { margin: 0 0 22px; font-size: 20px; text-align: center; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 28px;
  background: #1b2530; color: #fff; padding: 11px 22px; border-radius: 12px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 99;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; }
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }

.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ============ 广告位 ============ */
.ad-slot { margin: 18px auto; }
.ad-slot.ad-top { margin: 24px auto 0; }
.ad-slot.ad-bottom { margin: 30px auto 0; }
.ad-slot .ad { width: 100%; }
.ad-slot .ad.live img, .ad-slot .ad.live video, .ad-slot .ad.live iframe { display: block; max-width: 100%; }
.ad-slot .ad.placeholder {
  border: 2px dashed var(--border-strong); border-radius: 12px;
  background: repeating-linear-gradient(45deg, #fafbfd, #fafbfd 12px, #eef2f9 12px, #eef2f9 24px);
  color: var(--muted); font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.ad-slot.ad-top .ad.placeholder { min-height: 90px; }
.ad-slot.ad-bottom .ad.placeholder { min-height: 80px; }
.ad-slot.ad-detail .ad.placeholder { min-height: 90px; }
.ad-slot .ad-feed { margin-bottom: 0; }
.grid .ad-feed.live { grid-column: 1 / -1; }
.blog-main .ad-feed.live { margin: 0 0 18px; }
.ad-slot .ad-feed.placeholder { min-height: 90px; margin-bottom: 18px; }

/* ============ 页脚 ============ */
.site-footer {
  background: var(--grad-hero); color: #b9c6f4;
  padding: 22px 0; margin-top: 52px; font-size: 13px;
  position: relative; overflow: hidden;
}
.site-footer::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .10) 1px, transparent 1px);
  background-size: 26px 26px; opacity: .4; pointer-events: none;
}
.site-footer .container {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.site-footer a { color: #93c5fd; }
.site-footer a:hover { color: #fff; text-decoration: underline; }

@media (max-width: 900px) {
  .blog-layout { grid-template-columns: 1fr; }
  .blog-aside { position: static; }
}
@media (max-width: 640px) {
  .two-col { grid-template-columns: 1fr; }
  .file-item { flex-direction: column; align-items: flex-start; }
  .brand-text h1 { font-size: 23px; }
  .detail { padding: 22px 20px; }
  .post { padding: 20px; }
}

/* emoji 点选 */
.emoji-picker{display:flex;flex-wrap:wrap;gap:4px;margin-top:8px}
.emoji-picker button{font-size:18px;padding:4px 7px;line-height:1;min-width:34px}
.emoji-picker button:hover{border-color:var(--brand,#C0392B);background:#f5f5f5}
.emoji-picker button{font-size:16px;padding:3px 5px;min-width:28px}
/* 改密做成居中弹窗 */
#pwView{position:fixed;inset:0;background:rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center;margin:0;z-index:200;padding:20px}
#pwView .login-card{margin:0;width:100%;max-width:400px}
/* IP 明细弹窗居中 */
#ipDetailBox{position:fixed;inset:0;background:rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center;margin:0;z-index:200;padding:20px}
#ipDetailBox .login-card{margin:0;width:100%;max-width:600px}

