/* ============================================================
   泊聆市场 · 智能体应用商店（BoundKey Market）
   万界环行官方 · 仿 AppGallery 布局 + 品牌绿
   ============================================================ */

:root {
  --green: #00c853;
  --green-deep: #00a844;
  --green-dark: #059669;
  --teal: #14b8a6;
  --mint: #4ade80;
  --gold: #fbbf24;
  --red: #e5484d;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --border: #e7ebef;
  --border-strong: #d7dde3;

  --text: #1a2230;
  --text-muted: #5c6b80;
  --text-faint: #93a1b3;

  --grad: linear-gradient(120deg, #00c853 0%, #14b8a6 100%);
  --grad-deep: linear-gradient(120deg, #00a844 0%, #0e9f92 100%);

  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 10px rgba(20, 30, 45, .06);
  --shadow: 0 10px 34px rgba(20, 30, 45, .10);
  --shadow-lg: 0 24px 70px -18px rgba(10, 30, 45, .35);

  --topbar-h: 64px;
  --maxw: 1200px;
  --font: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont,
          "Segoe UI", "Helvetica Neue", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* 保证 hidden 属性始终生效：否则 .modal-mask 的 display:flex 会覆盖掉 hidden 的 display:none */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------------- 顶部导航 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  height: 100%; display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--grad);
  box-shadow: 0 4px 12px rgba(0, 200, 83, .35);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 7px;
  background: rgba(255, 255, 255, .92);
  border-radius: 4px;
}
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: var(--text-faint); margin-left: 2px; margin-top: 3px; }
.topnav { display: flex; gap: 4px; margin-left: 8px; }
.topnav a {
  padding: 8px 14px; border-radius: 10px; color: var(--text-muted);
  font-size: 14px; font-weight: 500; transition: .18s;
}
.topnav a:hover { color: var(--text); background: var(--surface-2); }
.topnav a.active { color: var(--green-deep); background: rgba(0, 200, 83, .10); }
.topbar-actions { margin-left: auto; display: flex; gap: 10px; }
.btn-ghost {
  padding: 8px 16px; border-radius: 10px; font-size: 13px; font-weight: 600;
  color: var(--green-deep); border: 1px solid var(--border-strong); transition: .18s;
}
.btn-ghost:hover { border-color: var(--green); background: rgba(0, 200, 83, .06); }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 12px; font-size: 14px; font-weight: 700; color: #fff;
  background: var(--grad); box-shadow: 0 8px 20px rgba(0, 200, 83, .30); transition: .18s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(0, 200, 83, .38); }

/* ---------------- 顶栏下拉（APP下载）---------------- */
.dropdown-wrap { position: relative; }
.drop-toggle { display: inline-flex; align-items: center; gap: 6px; }
.caret { width: 14px; height: 14px; transition: transform .18s; }
.dropdown-wrap.open .caret { transform: rotate(180deg); }
.dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 168px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; list-style: none; margin: 0; z-index: 60;
  opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .18s;
}
.dropdown-wrap.open .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown li { margin: 0; }
.dropdown li a {
  display: block; padding: 9px 14px; border-radius: 8px; font-size: 13px; font-weight: 500;
  color: var(--text); transition: .15s;
}
.dropdown li a:hover { background: rgba(0, 200, 83, .08); color: var(--green-deep); }

/* ---------------- Hero 轮播 ---------------- */
.hero { padding: 26px 0 6px; }
.carousel {
  position: relative; height: 340px; border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow);
}
.carousel-track { display: flex; height: 100%; transition: transform .5s cubic-bezier(.22, .8, .3, 1); }
.carousel-slide {
  flex: 0 0 100%; height: 100%; padding: 46px 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  color: #fff; position: relative; overflow: hidden;
}
.carousel-slide::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(600px 400px at 85% 20%, rgba(255,255,255,.22), transparent 55%);
}
.slide-copy { position: relative; z-index: 2; max-width: 560px; }
.slide-tag {
  display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.22); backdrop-filter: blur(4px);
}
.slide-title { font-size: 34px; font-weight: 800; margin: 12px 0 8px; letter-spacing: .5px; }
.slide-desc { font-size: 15px; opacity: .92; max-width: 460px; }
.slide-meta { margin-top: 20px; display: flex; gap: 18px; font-size: 13px; opacity: .9; }
.slide-meta b { font-weight: 700; }
.slide-cta {
  margin-top: 24px; padding: 12px 26px; border-radius: 12px; font-size: 15px; font-weight: 700;
  color: #06a045; background: #fff; box-shadow: 0 10px 26px rgba(0,0,0,.18); transition: .18s;
}
.slide-cta:hover { transform: translateY(-2px); }
.slide-emoji {
  position: relative; z-index: 2; font-size: 130px; line-height: 1;
  filter: drop-shadow(0 18px 40px rgba(0,0,0,.28));
}
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.2);
  backdrop-filter: blur(4px); color: #fff; font-size: 20px; display: flex; align-items: center; justify-content: center;
  transition: .18s;
}
.carousel-btn:hover { background: rgba(255,255,255,.36); }
.carousel-btn.prev { left: 18px; }
.carousel-btn.next { right: 18px; }
.carousel-dots { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.carousel-dots button {
  width: 8px; height: 8px; border-radius: 999px; background: var(--border-strong); transition: .25s;
}
.carousel-dots button.active { width: 24px; background: var(--green); }

/* ---------------- 搜索 + 分类 ---------------- */
.discover { padding: 22px 0 6px; }
.searchbar {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 18px;
  box-shadow: var(--shadow-sm); transition: .18s;
}
.searchbar:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px rgba(0,200,83,.10); }
.search-ico { width: 20px; height: 20px; color: var(--text-faint); flex: none; }
.searchbar input { flex: 1; border: none; outline: none; font-size: 15px; color: var(--text); background: transparent; }
.searchbar input::placeholder { color: var(--text-faint); }
.search-clear { font-size: 20px; color: var(--text-faint); padding: 2px 6px; border-radius: 50%; }
.search-clear:hover { color: var(--text); background: var(--surface-2); }
.chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
/* 搜索框/分类移入「全部智能体」栏后的间距 */
.catalog .searchbar { margin-bottom: 14px; }
.catalog .chips { margin-bottom: 20px; }
.chip {
  padding: 8px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border); transition: .18s;
}
.chip:hover { color: var(--green-deep); border-color: var(--green); }
.chip.active { color: #fff; background: var(--grad); border-color: transparent; box-shadow: 0 6px 16px rgba(0,200,83,.28); }

/* ---------------- 榜单 ---------------- */
.rank { padding: 30px 0 8px; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; }
.section-title small { font-size: 12px; font-weight: 500; color: var(--text-faint); }
.title-bar { width: 5px; height: 20px; border-radius: 4px; background: var(--grad); }
.rank-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.rank-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 22px; }
.rank-list { list-style: none; margin-top: 14px; display: flex; flex-direction: column; }
.rank-item { display: flex; align-items: center; gap: 14px; padding: 12px 6px; border-radius: 12px; cursor: pointer; transition: .15s; }
.rank-item:hover { background: var(--surface-2); }
.rank-no {
  width: 26px; font-size: 16px; font-weight: 800; text-align: center; color: var(--text-faint); font-style: italic;
}
.rank-no.top { color: var(--gold); }
.rank-emoji { font-size: 30px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 12px; }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-size: 15px; font-weight: 700; }
.rank-dev { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.rank-side { text-align: right; }
.rank-score { font-size: 14px; font-weight: 700; color: var(--green-deep); }
.rank-score small { font-size: 11px; color: var(--text-faint); font-weight: 500; }

/* ---------------- 智能体卡片网格 ---------------- */
.catalog { padding: 26px 0 40px; }
.catalog-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.catalog-count { font-size: 13px; color: var(--text-faint); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; display: flex; flex-direction: column; gap: 14px; transition: .2s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card-top { display: flex; align-items: flex-start; gap: 12px; }
.card-emoji { font-size: 40px; width: 56px; height: 56px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 14px; }
.card-title { font-size: 16px; font-weight: 700; }
.card-dev { font-size: 12px; color: var(--text-faint); margin-top: 3px; }
.card-desc { font-size: 13px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 42px; }
.card-rating { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.stars { color: var(--gold); letter-spacing: 1px; }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.card-price { font-size: 16px; font-weight: 800; color: var(--red); }
.card-price small { font-size: 11px; color: var(--text-faint); font-weight: 500; }
.card-install { padding: 8px 16px; border-radius: 10px; font-size: 13px; font-weight: 700; color: #fff; background: var(--grad); transition: .18s; }
.card-install:hover { box-shadow: 0 6px 16px rgba(0,200,83,.3); }

.empty { text-align: center; padding: 60px 0; color: var(--text-muted); }
.empty-ico { font-size: 56px; margin-bottom: 12px; }
.empty p { margin-bottom: 16px; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(12, 20, 32, .5);
  backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg); position: relative;
  box-shadow: var(--shadow-lg); max-width: 100%; animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 2; width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-muted); font-size: 20px; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal.detail { width: 560px; padding: 28px; }
.detail-head { display: flex; align-items: flex-start; gap: 16px; }
.detail-emoji { font-size: 56px; width: 80px; height: 80px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 18px; }
.detail-title { font-size: 22px; font-weight: 800; }
.detail-dev { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.detail-rating { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--text-muted); }
.detail-desc { margin-top: 18px; font-size: 14px; color: var(--text-muted); line-height: 1.8; }
.detail-features { margin-top: 18px; }
.detail-features h4 { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.detail-features ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.detail-features li { font-size: 12px; padding: 5px 12px; border-radius: 999px; background: rgba(0,200,83,.08); color: var(--green-deep); font-weight: 600; }
.detail-meta { display: flex; gap: 22px; margin-top: 18px; padding: 14px 0; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.detail-meta b { color: var(--text); }
.detail-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.detail-price { font-size: 24px; font-weight: 800; color: var(--red); }
.detail-price small { font-size: 12px; color: var(--text-faint); font-weight: 500; }

/* ---------------- SKILL.md 展示 ---------------- */
.skill-md { margin-top: 14px; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; max-height: 280px; overflow-y: auto; }
.skill-md h4 { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.skill-md .md-h { font-size: 13px; font-weight: 700; color: var(--text); margin: 10px 0 4px; }
.skill-md .md-p { font-size: 13px; color: var(--text-muted); line-height: 1.7; margin: 4px 0; }
.skill-md .md-li { font-size: 13px; color: var(--text-muted); line-height: 1.7; padding-left: 6px; }
.skill-md .md-code { font-size: 12px; background: #0f172a; color: #e2e8f0; padding: 10px; border-radius: 8px; overflow-x: auto; white-space: pre; margin: 6px 0; }
.skill-md .md-quote { border-left: 3px solid var(--green); background: rgba(0, 200, 83, .06); padding: 8px 12px; margin: 8px 0; border-radius: 0 8px 8px 0; color: var(--text-muted); font-size: 13px; line-height: 1.7; }
.skill-md .md-hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.skill-md .md-inline { background: rgba(0, 0, 0, .05); padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: #b45309; }
.skill-md .md-table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 12px; }
.skill-md .md-table th, .skill-md .md-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.skill-md .md-table th { background: rgba(0, 200, 83, .06); font-weight: 600; color: var(--text); }
.skill-md .md-table td { color: var(--text-muted); }

/* ---------------- 评价 ---------------- */
.review-section { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 18px; }
.review-loading, .review-empty { text-align: center; color: var(--text-faint); font-size: 13px; padding: 14px 0; }
.review-summary { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.review-score { font-size: 40px; font-weight: 800; color: var(--green-deep); line-height: 1; }
.review-summary-right { display: flex; flex-direction: column; gap: 4px; }
.review-count { font-size: 12px; color: var(--text-faint); }
.review-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; max-height: 240px; overflow-y: auto; }
.review-item { padding: 10px 12px; background: var(--surface-2); border-radius: 10px; }
.review-head { display: flex; align-items: center; justify-content: space-between; }
.review-user { font-size: 13px; font-weight: 600; color: var(--text); }
.review-stars { color: var(--gold); letter-spacing: 1px; font-size: 13px; }
.review-text { font-size: 13px; color: var(--text-muted); margin-top: 6px; line-height: 1.7; word-break: break-all; }
.review-time { font-size: 11px; color: var(--text-faint); margin-top: 6px; }
.review-form { border-top: 1px dashed var(--border); padding-top: 14px; }
.review-form-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.review-stars-picker { display: flex; gap: 6px; margin-bottom: 10px; }
.pick-star { font-size: 26px; color: var(--border-strong); background: none; border: none; cursor: pointer; transition: .15s; }
.pick-star.active { color: var(--gold); }
.review-form textarea {
  width: 100%; border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px;
  font-size: 13px; font-family: inherit; color: var(--text); resize: vertical; margin-bottom: 10px;
}
.review-form textarea:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px rgba(0, 200, 83, .12); }
.review-login { text-align: center; padding: 14px 0; }
.review-login a { color: var(--green-deep); font-weight: 600; }

.modal.qr { width: 340px; padding: 32px 28px 28px; text-align: center; }
.modal.qr h3 { font-size: 20px; font-weight: 800; }
.qr-sub { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.qr-img { width: 200px; height: 200px; margin: 20px auto; border-radius: 12px; border: 1px solid var(--border); background: #fff; object-fit: contain; }
.qr-hint { font-size: 12px; color: var(--text-faint); }

/* ---------------- 页脚 ---------------- */
.footer { background: #0c1420; color: #c3cdd9; margin-top: 30px; }
.footer-inner { display: grid; grid-template-columns: 1.4fr 2fr; gap: 40px; padding-top: 44px; padding-bottom: 36px; }
.footer .brand-name { color: #fff; }
.footer-desc { font-size: 13px; color: #8190a5; margin-top: 14px; max-width: 360px; line-height: 1.8; }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.footer-col h4 { font-size: 14px; color: #fff; margin-bottom: 14px; }
.footer-col a { display: block; font-size: 13px; color: #8190a5; padding: 5px 0; transition: .15s; }
.footer-col a:hover { color: var(--mint); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); padding: 18px 0; font-size: 12px; color: #64748b; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 200;
  background: rgba(12, 20, 32, .92); color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 14px; box-shadow: var(--shadow); animation: pop .2s;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .brand-sub { display: none; }
  .topnav { display: none; }
  .carousel { height: 300px; }
  .carousel-slide { padding: 30px 28px; flex-direction: column; text-align: center; justify-content: center; }
  .slide-emoji { font-size: 88px; }
  .slide-title { font-size: 26px; }
  .slide-meta { justify-content: center; }
  .rank-cols { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .modal.detail { width: 100%; }
}
