:root {
  --brand: #6c66c2;
  --brand-dark: #5751a8;
  --accent: #e0a165;
  --ink: #1b1b22;
  --muted: #7c7c8c;
  --line: #ececf2;
  --bg: #f6f6f9;
  --card: #fff;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* ---------- 顶部 ---------- */
.top {
  background: linear-gradient(135deg, var(--brand) 0%, #8b85d6 100%);
  color: #fff;
  padding: 24px 0 26px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: rgba(255,255,255,.16);
  display: grid; place-items: center;
  font-weight: 700; font-size: 17px; letter-spacing: 1px;
  border: 1px solid rgba(255,255,255,.25);
}
.brand h1 { font-size: 18px; margin: 0; font-weight: 600; letter-spacing: .5px; }
.brand p { margin: 2px 0 0; font-size: 12px; opacity: .8; letter-spacing: .5px; }
.top .lead {
  margin: 18px 0 0; font-size: 13px; line-height: 1.7; opacity: .92;
}

/* ---------- 搜索 ---------- */
.search-wrap { margin: -20px 0 0; position: relative; z-index: 2; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border-radius: 999px;
  padding: 12px 18px;
  box-shadow: 0 6px 22px rgba(60, 55, 130, .12);
}
.search svg { flex: none; opacity: .45; }
.search input {
  border: 0; outline: 0; flex: 1; font-size: 15px; background: transparent;
  color: var(--ink); min-width: 0;
}
.search input::placeholder { color: #b0b0be; }

/* ---------- 分类 ---------- */
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 16px 0 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: #fff;
  color: var(--muted); border-radius: 999px; padding: 7px 15px;
  font-size: 13px; white-space: nowrap; transition: .15s;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .n { opacity: .6; font-size: 11px; margin-left: 3px; }

/* ---------- 网格 ---------- */
.grid {
  display: grid; gap: 14px; padding: 14px 0 28px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 680px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 2px 10px rgba(30, 28, 70, .06);
  transition: transform .16s, box-shadow .16s;
  display: flex; flex-direction: column;
}
.card:active { transform: scale(.985); }
@media (hover: hover) {
  .card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(30, 28, 70, .13); }
}
.card .cover { position: relative; aspect-ratio: 1.46; background: #eeedf4; overflow: hidden; }
.card .cover img { width: 100%; height: 100%; object-fit: cover; }
.card .badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(20, 18, 45, .62); color: #fff;
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  backdrop-filter: blur(4px);
}
.card .body { padding: 10px 12px 13px; flex: 1; display: flex; flex-direction: column; }
.card h3 {
  margin: 0; font-size: 14px; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .meta {
  margin: 7px 0 0; font-size: 11.5px; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.card .meta .dot { width: 2px; height: 2px; border-radius: 50%; background: #c9c9d6; }

.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 14px; }

/* ---------- 详情页 ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255,255,255,.94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
}
.nav .back {
  border: 0; background: transparent; padding: 4px; display: grid; place-items: center;
  color: var(--ink);
}
.nav .title { font-size: 15px; font-weight: 600; flex: 1; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }

.detail-head {
  background: #fff; padding: 16px; border-radius: var(--radius);
  margin-top: 14px; display: flex; gap: 14px; align-items: flex-start;
}
.detail-head img {
  width: 110px; border-radius: 8px; flex: none; background: #f0eff6;
  aspect-ratio: 1.46; object-fit: cover;
}
.detail-head .info { flex: 1; min-width: 0; }
.detail-head h2 { margin: 0; font-size: 17px; line-height: 1.4; }
.detail-head .meta { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.9; }
.detail-head .desc { margin: 8px 0 0; font-size: 13px; color: #55546a; line-height: 1.65; }

.section-title {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 14px; font-weight: 600; margin: 24px 0 12px;
}
.section-title span { font-size: 12px; font-weight: 400; color: var(--muted); }

/* 预览轮播 */
.carousel {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.carousel::-webkit-scrollbar { display: none; }
.slide {
  flex: none; width: 84%; scroll-snap-align: center;
  border-radius: 10px; overflow: hidden; background: #fff;
  box-shadow: 0 2px 12px rgba(30, 28, 70, .09); position: relative;
}
@media (min-width: 680px) { .slide { width: 48%; } }
.slide img { width: 100%; aspect-ratio: 1.464; object-fit: cover; }
.slide .num {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(20, 18, 45, .6); color: #fff; font-size: 11px;
  padding: 2px 8px; border-radius: 999px;
}

/* 下载 */
.cta { margin: 26px 0 14px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: 0; border-radius: 12px; padding: 15px;
  font-size: 16px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #2fb96a, #24a55b);
  box-shadow: 0 6px 18px rgba(35, 165, 91, .28);
}
.btn:active { transform: translateY(1px); }
.btn.ghost {
  background: #fff; color: var(--brand); box-shadow: none;
  border: 1px solid #dcdaf0;
}
.tip {
  margin: 10px 0 0; font-size: 12px; color: var(--muted); line-height: 1.75;
  background: #fff; border-radius: 10px; padding: 12px 14px;
}
.tip b { color: var(--brand); font-weight: 600; }

/* ---------- 页脚 ---------- */
footer {
  margin-top: 18px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff;
  border-top: 1px solid var(--line); text-align: center;
}
footer .co { font-size: 13px; color: #55546a; line-height: 1.6; margin: 0; }
footer .icp { font-size: 12px; line-height: 1.6; margin: 6px 0 0; }
footer .icp a { color: #8a89a0; text-decoration: none; }
footer .icp a:hover { color: #55546a; }

/* ---------- 后台 ---------- */
.admin { max-width: 720px; margin: 0 auto; padding: 20px 16px 60px; }
.admin h1 { font-size: 19px; margin: 6px 0 18px; }
.panel {
  background: #fff; border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(30, 28, 70, .06);
}
.panel h2 { font-size: 14px; margin: 0 0 14px; font-weight: 600; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 6px; }
input[type="text"], input[type="password"], select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; font-size: 15px; outline: none; background: #fbfbfd;
}
input:focus, select:focus { border-color: var(--brand); background: #fff; }
.drop {
  border: 2px dashed #d7d5e8; border-radius: 12px; padding: 28px 16px;
  text-align: center; color: var(--muted); font-size: 13.5px; transition: .15s;
  background: #fbfbfd;
}
.drop.hot { border-color: var(--brand); background: #f4f3fd; color: var(--brand); }
.drop b { color: var(--brand); }
.progress { height: 7px; background: var(--line); border-radius: 999px; margin-top: 14px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.row-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.row-item:last-child { border-bottom: 0; }
.row-item img { width: 68px; aspect-ratio: 1.46; object-fit: cover; border-radius: 6px; flex: none; }
.row-item .t { flex: 1; min-width: 0; }
.row-item .t div:first-child { font-size: 13.5px; font-weight: 500; }
.row-item .t div:last-child { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.mini {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 6px 11px; font-size: 12.5px; color: var(--muted);
}
.mini.danger { color: #d9534f; border-color: #f2d5d4; }
.hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; line-height: 1.7; }
.err { color: #d9534f; font-size: 13px; margin-top: 10px; }

/* ---------- 编辑弹窗 / 分类管理 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(28, 26, 60, .42);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal[hidden] { display: none; }
.modal-box {
  background: #fff; border-radius: var(--radius); padding: 20px;
  width: 100%; max-width: 460px; box-shadow: 0 18px 50px rgba(28, 26, 60, .28);
}
.modal-box h3 { font-size: 15px; margin: 0 0 4px; font-weight: 600; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-actions .btn { padding: 9px 22px; font-size: 14px; }
.modal-actions .mini { padding: 9px 18px; }
.cat-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.cat-row:last-child { border-bottom: 0; }
.cat-row input { flex: 1; min-width: 0; }
.cat-row .mini { flex: none; }

/* ---------- 价格说明 ---------- */
.price-box {
  background: #fff8f1; border: 1px solid #f6dcc4; border-radius: var(--radius);
  padding: 8px 14px; margin: 18px 0 4px; line-height: 1.5;
  display: flex; flex-direction: column; gap: 3px;
}
.price-box h3 { font-size: 15px; margin: 0; color: #c8641e; }
.price-box p { margin: 0; font-size: 14px; color: #3d3c50; }
.price-box .eg {
  margin: 0; font-size: 14px; color: #3d3c50;
}
.price-box mark { background: none; color: #d9381e; font-weight: 600; border: 1.5px solid #d9381e; border-radius: 4px; padding: 0 3px; }
.price-box .eg b { color: #d9381e; font-size: 15px; }
.price-box .nw { white-space: nowrap; }
