:root{
  --bg:#f5f7fb;
  --card:#fff;
  --ink:#111827;
  --ink-2:#475467;
  --ink-3:#98a2b3;
  --line:#e6eaf0;
  --primary:#2563eb;
  --primary-soft:#eff4ff;
  --amber:#b45309;
  --amber-soft:#fff7e6;
  --green:#067647;
  --green-soft:#ecfdf3;
  --shadow:0 1px 2px rgba(16,24,40,.04),0 8px 24px rgba(16,24,40,.05);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--bg);
  color:var(--ink);
  font:14px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  -webkit-font-smoothing:antialiased;
}
.wrap{max-width:960px;margin:0 auto;padding:32px 20px 40px}
.hero{text-align:center;padding:24px 0 30px}
.hero__mark{
  width:52px;height:52px;margin:0 auto 14px;border-radius:16px;
  display:grid;place-items:center;color:#fff;
  background:linear-gradient(135deg,#3b82f6,#2563eb);
  box-shadow:0 8px 20px rgba(37,99,235,.25);
}
.hero__mark svg{width:26px;height:26px}
.hero h1{font-size:26px;letter-spacing:-.5px;margin:0 0 6px;font-weight:700}
.hero p{color:var(--ink-2);margin:0;font-size:14px}

.tools{display:flex;flex-direction:column;gap:14px;margin-bottom:18px}
.search{position:relative;max-width:520px;width:100%;margin:0 auto}
.search svg{position:absolute;left:14px;top:50%;transform:translateY(-50%);width:18px;height:18px;color:var(--ink-3)}
.search input{
  width:100%;height:44px;padding:0 14px 0 42px;border:1px solid var(--line);
  border-radius:12px;background:#fff;color:var(--ink);font-size:14px;outline:none;
  transition:border-color .2s,box-shadow .2s;
}
.search input:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(37,99,235,.1)}
.cats{display:flex;gap:8px;flex-wrap:wrap;justify-content:center}
.cat{
  border:1px solid var(--line);background:#fff;color:var(--ink-2);
  padding:6px 14px;border-radius:99px;font-size:13px;cursor:pointer;transition:.18s;
}
.cat:hover{border-color:#c7d2fe;color:var(--primary)}
.cat.active{background:var(--primary);border-color:var(--primary);color:#fff}
.meta{
  display:flex;justify-content:space-between;align-items:center;gap:12px;
  color:var(--ink-3);font-size:12.5px;margin:0 2px 12px;
}

.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.item{
  background:var(--card);border:1px solid var(--line);border-radius:16px;
  padding:18px;box-shadow:var(--shadow);display:flex;flex-direction:column;
  transition:transform .18s,box-shadow .18s,border-color .18s;
}
.item:hover{transform:translateY(-2px);box-shadow:0 10px 28px rgba(16,24,40,.09);border-color:#d6e0f5}
.item__top{display:flex;gap:12px;align-items:flex-start}
.item__icon{
  width:42px;height:42px;flex:0 0 42px;border-radius:12px;display:grid;place-items:center;
  background:var(--primary-soft);color:var(--primary);
}
.item__icon img{width:100%;height:100%;object-fit:cover;border-radius:12px}
.item__icon svg{width:22px;height:22px}
.item__head{flex:1;min-width:0}
.item__title{font-weight:650;font-size:15.5px;margin:1px 0 3px;word-break:break-all}
.item__cat{font-size:12px;color:var(--ink-3)}
.item__desc{color:var(--ink-2);font-size:13px;margin:12px 0 14px;min-height:20px;word-break:break-all}
.item__meta{display:flex;gap:14px;color:var(--ink-3);font-size:12px;margin-bottom:14px;flex-wrap:wrap}
.item__foot{margin-top:auto;display:flex;align-items:center;justify-content:space-between;gap:10px}
.badge{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:600;padding:4px 10px;border-radius:99px}
.badge--free{background:var(--green-soft);color:var(--green)}
.badge--paid{background:var(--amber-soft);color:var(--amber)}
.badge--owned{background:var(--primary-soft);color:var(--primary)}
.btn{
  border:0;border-radius:10px;padding:9px 16px;font-size:13.5px;font-weight:600;
  cursor:pointer;transition:.18s;font-family:inherit;
}
.btn:disabled{opacity:.6;cursor:not-allowed}
.btn-primary{background:var(--primary);color:#fff}
.btn-primary:hover:not(:disabled){background:#1d4ed8}
.btn-ghost{background:#f2f4f7;color:var(--ink-2)}
.btn-ghost:hover{background:#e9edf3}
.btn-buy{background:var(--amber);color:#fff}
.btn-buy:hover{background:#92400e}

.empty{
  grid-column:1/-1;text-align:center;padding:56px 20px;color:var(--ink-3);
  background:#fff;border:1px dashed var(--line);border-radius:16px;
}
.empty svg{width:40px;height:40px;margin-bottom:10px}
.empty strong{display:block;color:var(--ink);font-size:15px;margin-bottom:4px}
.empty p{margin:0;font-size:13px}

.foot{text-align:center;color:var(--ink-3);font-size:12px;margin-top:34px}

.modal{position:fixed;inset:0;z-index:50;display:grid;place-items:center;padding:20px;background:rgba(15,23,42,.45)}
.modal[hidden]{display:none}
.modal__box{width:100%;max-width:400px;background:#fff;border-radius:18px;overflow:hidden;box-shadow:0 20px 60px rgba(0,0,0,.2)}
.modal__head{display:flex;align-items:center;justify-content:space-between;padding:18px 20px;border-bottom:1px solid var(--line)}
.modal__head h2{margin:0;font-size:16px}
.modal__close{border:0;background:none;font-size:24px;line-height:1;color:var(--ink-3);cursor:pointer}
.modal__body{padding:18px 20px}
.buy-item{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;background:#f8fafc;border-radius:12px}
.buy-item__name{font-weight:600;word-break:break-all}
.buy-item__price{color:#d92d20;font-size:20px;font-weight:700;white-space:nowrap}
.buy-label{margin:18px 0 10px;font-size:12.5px;color:var(--ink-3)}
.pay-types{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.pay-type{
  border:1px solid var(--line);border-radius:10px;padding:10px 4px;text-align:center;
  font-size:13px;cursor:pointer;color:var(--ink-2);background:#fff;transition:.18s;
}
.pay-type:hover{border-color:#c7d2fe}
.pay-type.active{border-color:var(--primary);background:var(--primary-soft);color:var(--primary);font-weight:600}
.buy-note{margin:14px 0 0;font-size:12px;color:var(--ink-3);line-height:1.7}
.modal__foot{display:flex;gap:10px;padding:14px 20px 20px}
.modal__foot .btn{flex:1}

.toast{
  position:fixed;left:50%;top:24px;transform:translate(-50%,-16px);
  background:#111827;color:#fff;padding:10px 18px;border-radius:10px;font-size:13px;
  opacity:0;pointer-events:none;transition:.25s;z-index:99;max-width:86vw;text-align:center;
}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast.err{background:#b42318}

@media (max-width:680px){
  .wrap{padding:20px 14px 30px}
  .hero{padding:14px 0 22px}
  .hero h1{font-size:22px}
  .grid{grid-template-columns:1fr}
  .meta{flex-direction:column;align-items:flex-start;gap:2px}
}
