:root {
  --bg: #eef1f8;
  --surface: #ffffff;
  --text: #1b2330;
  --text-soft: #6b7686;
  --border: #e7ebf3;
  --primary: #4f6ef7;
  --primary-2: #7d4ff7;
  --primary-soft: #eef1fe;
  --danger: #e0506b;
  --shadow-sm: 0 2px 8px rgba(31, 39, 51, 0.06);
  --shadow: 0 10px 30px rgba(31, 39, 51, 0.10);
  --shadow-lg: 0 18px 44px rgba(79, 110, 247, 0.22);
  --radius: 18px;
  --grad: linear-gradient(135deg, #4f6ef7, #7d4ff7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 400px at 12% -8%, rgba(79, 110, 247, 0.12), transparent 60%),
    radial-gradient(800px 420px at 95% 0%, rgba(125, 79, 247, 0.12), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

/* ===== 顶部 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--grad);
  color: #fff;
  display: grid; place-items: center;
  font-size: 23px; font-weight: 800;
  box-shadow: var(--shadow-lg);
}
.brand-text h1 { font-size: 19px; font-weight: 800; letter-spacing: .2px; }
.brand-text p { font-size: 12.5px; color: var(--text-soft); }
.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.search-box { position: relative; }
.search-box::before {
  content: "🔍"; position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); font-size: 13px; opacity: .6; pointer-events: none;
}
.search-box input {
  width: 250px; max-width: 60vw;
  padding: 10px 14px 10px 34px;
  border: 1px solid var(--border);
  border-radius: 12px; font-size: 14px; outline: none;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }

.ghost-btn {
  padding: 10px 15px;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 12px; text-decoration: none;
  font-size: 14px; font-weight: 700;
  transition: all .15s; white-space: nowrap;
}
.ghost-btn:hover { background: var(--primary); color: #fff; box-shadow: var(--shadow-lg); }

/* ===== 分类导航 ===== */
.cat-nav {
  max-width: 1200px; margin: 0 auto;
  padding: 4px 24px 14px;
  display: flex; gap: 10px; overflow-x: auto; scrollbar-width: thin;
}
.cat-nav::-webkit-scrollbar { height: 6px; }
.cat-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.cat-chip {
  flex: 0 0 auto;
  padding: 8px 15px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px; font-size: 13.5px;
  color: var(--text-soft); cursor: pointer;
  transition: all .15s; user-select: none;
  display: inline-flex; align-items: center; gap: 5px;
}
.cat-chip:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.cat-chip.active {
  background: var(--grad); border-color: transparent; color: #fff;
  font-weight: 700; box-shadow: var(--shadow-lg);
}

/* ===== 主体 ===== */
.hero {
  max-width: 1200px; margin: 0 auto; padding: 30px 24px 4px;
}
.hero-inner {
  background: var(--grad);
  border-radius: 22px;
  padding: 30px 34px;
  color: #fff;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.hero-inner::before {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}
.hero-inner::after {
  content: ""; position: absolute; right: 70px; bottom: -90px;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
}
.hero-title { font-size: 23px; font-weight: 800; position: relative; }
.hero-sub { font-size: 14px; opacity: .92; margin-top: 8px; position: relative; }
.hero-sub b { font-weight: 800; }

.container { flex: 1; max-width: 1200px; width: 100%; margin: 0 auto; padding: 26px 24px 44px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex; flex-direction: column; gap: 13px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
  text-decoration: none; color: inherit;
  animation: rise .35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius);
  background: var(--grad); opacity: 0; transition: opacity .2s; pointer-events: none;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: transparent; }
.card:hover::after { opacity: .04; }

.card-top { display: flex; align-items: center; gap: 13px; }
.card-icon {
  width: 46px; height: 46px; border-radius: 13px;
  background: var(--grad); color: #fff;
  display: grid; place-items: center;
  font-size: 22px; flex: 0 0 auto;
  box-shadow: var(--shadow-lg);
}
.card-title { font-size: 16.5px; font-weight: 800; }
.card-badge {
  align-self: flex-start; font-size: 12px; font-weight: 600;
  color: var(--primary); background: var(--primary-soft);
  padding: 4px 11px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 4px;
}
.card-desc { font-size: 13.5px; color: var(--text-soft); flex: 1; line-height: 1.6; }
.card-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--text-soft);
  border-top: 1px dashed var(--border); padding-top: 13px;
}
.card-open { color: var(--primary); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; transition: gap .15s; }
.card:hover .card-open { gap: 8px; }

.loading, .empty-state { text-align: center; padding: 64px 0; color: var(--text-soft); }
.empty-state p { font-size: 16px; margin-bottom: 6px; }

/* ===== 页脚 ===== */
.site-footer {
  text-align: center; padding: 22px; font-size: 13px; color: var(--text-soft);
  border-top: 1px solid var(--border); background: rgba(255,255,255,.5);
}
.site-footer b { color: var(--primary); }
.site-footer .beian {
  margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 16px;
  justify-content: center; align-items: center; font-size: 12.5px;
}
.site-footer .beian-link {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--text-soft); text-decoration: none; transition: color .15s;
}
.site-footer .beian-link:hover { color: var(--primary); }
.site-footer .beian-icon { height: 16px; width: auto; vertical-align: middle; border-radius: 2px; }
.site-footer .beian-copy { color: var(--text-soft); }

/* ===== 后台 ===== */
.admin-wrap { max-width: 940px; margin: 0 auto; padding: 30px 20px 64px; }
.admin-wrap h1 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.admin-wrap .sub { color: var(--text-soft); font-size: 13.5px; margin-bottom: 22px; }
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin-bottom: 22px; box-shadow: var(--shadow);
}
.panel h2 {
  font-size: 15.5px; font-weight: 800; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.field input, .field textarea, .field select {
  padding: 10px 13px; border: 1px solid var(--border); border-radius: 11px;
  font-size: 14px; outline: none; background: #fff; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft);
}
.field textarea { resize: vertical; min-height: 74px; }

.btn {
  padding: 10px 18px; border-radius: 11px; border: 1px solid var(--primary);
  background: var(--grad); color: #fff; font-size: 14px; cursor: pointer; font-weight: 700;
  box-shadow: var(--shadow-lg); transition: transform .12s, opacity .15s;
}
.btn:hover { transform: translateY(-1px); opacity: .95; }
.btn.ghost { background: #fff; color: var(--primary); box-shadow: none; }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.danger { background: #fff; color: var(--danger); border-color: var(--danger); box-shadow: none; }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }

.row-actions { display: flex; gap: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-soft); font-weight: 700; font-size: 12.5px; }
.table td .badge { font-size: 12px; font-weight: 600; color: var(--primary); background: var(--primary-soft); padding: 3px 10px; border-radius: 999px; }
.tip { font-size: 12px; color: var(--text-soft); margin-top: 7px; }

/* 拖拽上传 */
.dropzone {
  border: 2px dashed #c7cffa; border-radius: 14px; padding: 26px 18px;
  text-align: center; cursor: pointer; background: #fafbff;
  transition: all .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dz-inner { pointer-events: none; }
.dz-icon { font-size: 30px; margin-bottom: 6px; }
.dz-text { font-size: 13.5px; color: var(--text-soft); }
.dz-link { color: var(--primary); font-weight: 700; text-decoration: underline; }
.dz-file { margin-top: 10px; font-size: 13px; font-weight: 600; color: #2e9e5b; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(10px);
  background: #1b2330; color: #fff; padding: 11px 20px; border-radius: 12px;
  font-size: 14px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 600px) {
  .header-inner { padding: 14px 16px; }
  .cat-nav { padding: 4px 16px 12px; }
  .container { padding: 22px 16px 34px; }
  .search-box input { width: 100%; }
  .header-actions { width: 100%; }
  .search-box { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
}
