:root {
  --bg: #0d0b16;
  --bg2: #141122;
  --panel: #1a1629;
  --panel2: #221d35;
  --line: #2d2743;
  --text: #ece9f7;
  --mute: #9d97b8;
  --dim: #6d6788;
  --brand: #8b6cff;
  --brand2: #34d3c1;
  --ok: #3ddc97;
  --bad: #ff5d7a;
  --warn: #ffb547;
  --grad: linear-gradient(120deg, #8b6cff 0%, #5b8cff 50%, #34d3c1 100%);
  --r: 14px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
code, pre, .mono { font-family: var(--mono); }
main { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 28px 60px; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 26px;
  padding: 12px 28px;
  background: rgba(13, 11, 22, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.logo b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 7px 14px; border-radius: 9px; color: var(--mute); font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.on { color: var(--text); background: var(--panel2); }
.search {
  flex: 1; max-width: 440px; margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; color: var(--dim);
}
.search:focus-within { border-color: var(--brand); }
.search input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); font: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); font-weight: 600; white-space: nowrap;
  transition: transform .12s, background .12s, border-color .12s;
}
.btn:hover { border-color: #463d68; background: var(--panel2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-grad { background: var(--grad); border: 0; color: #fff; box-shadow: 0 6px 22px -8px rgba(139, 108, 255, .7); }
.btn-grad:hover { background: var(--grad); filter: brightness(1.08); }
.btn-lg { padding: 12px 20px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------- hero */
.hero {
  position: relative; overflow: hidden;
  margin: 24px 0 26px; border-radius: 22px;
  padding: 46px 48px 40px;
  background:
    radial-gradient(900px 380px at 88% -10%, rgba(52, 211, 193, .28), transparent 60%),
    radial-gradient(700px 400px at 10% 120%, rgba(139, 108, 255, .38), transparent 60%),
    linear-gradient(135deg, #1b1533, #120f22);
  border: 1px solid var(--line);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(90deg, transparent, #000 60%);
}
.hero h1 { margin: 0 0 10px; font-size: 38px; line-height: 1.2; letter-spacing: -.5px; }
.hero h1 .g { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { margin: 0 0 26px; color: var(--mute); font-size: 16px; max-width: 720px; }
.pillars { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 1040px; }
.pillar {
  background: rgba(20, 17, 34, .72); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 18px; backdrop-filter: blur(6px);
}
.pillar .k { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.pillar .k i { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-style: normal; font-size: 14px; }
.pillar .v { margin-top: 6px; color: var(--mute); font-size: 13px; }
.pillar .n { margin-top: 10px; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pillar .n small { font-size: 12px; color: var(--dim); font-weight: 500; margin-left: 4px; }

/* ---------------------------------------------------------------- filter bar */
.bar { display: flex; align-items: center; gap: 10px; margin: 6px 0 18px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line);
  color: var(--mute); font-size: 13px; font-weight: 500;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.bar .sp { flex: 1; }
.seg { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; color: var(--mute); font-size: 13px; }
.seg button.on { background: var(--panel2); color: var(--text); }

/* ---------------------------------------------------------------- cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.card {
  position: relative; display: block; border-radius: var(--r); overflow: hidden;
  background: var(--panel); border: 1px solid var(--line);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.card:hover { transform: translateY(-3px); border-color: #4a3f73; box-shadow: 0 16px 40px -18px rgba(139, 108, 255, .55); }
.cover { position: relative; aspect-ratio: 4 / 3; overflow: hidden; }
.cover svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.card:hover .cover svg { transform: scale(1.04); transition: transform .5s; }
.cover .shade { position: absolute; inset: auto 0 0 0; height: 55%; background: linear-gradient(transparent, rgba(8, 6, 16, .92)); }
.cover .ttl { position: absolute; left: 14px; right: 14px; bottom: 12px; }
.cover .ttl h3 { margin: 0; font-size: 18px; letter-spacing: -.2px; }
.cover .ttl div { color: #cfc9e6; font-size: 12.5px; }
.badges { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 6px; justify-content: space-between; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 7px; font-size: 11.5px; font-weight: 600;
  background: rgba(8, 6, 16, .66); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.08);
}
.badge.ok { color: var(--ok); }
.badge.bad { color: var(--bad); }
.badge.wait { color: var(--warn); }
.badge.lic { color: #d6ccff; }
.card .meta { padding: 11px 14px 13px; }
.card .row { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff;
}
.card .who { color: var(--mute); font-size: 12.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .cat { font-size: 11.5px; color: var(--dim); }
.stats { display: flex; gap: 14px; margin-top: 8px; color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.stats span { display: inline-flex; align-items: center; gap: 4px; }
.stats svg { width: 13px; height: 13px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag { font-size: 11px; color: var(--mute); background: var(--bg2); border: 1px solid var(--line); padding: 1px 7px; border-radius: 6px; }
.card.new { display: grid; place-items: center; min-height: 300px; border-style: dashed; color: var(--mute); text-align: center; }
.card.new b { display: block; color: var(--text); font-size: 16px; margin: 10px 0 4px; }

/* ---------------------------------------------------------------- detail */
.crumbs { margin: 20px 0 14px; color: var(--dim); font-size: 13px; }
.crumbs a:hover { color: var(--text); }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.dhead { display: grid; grid-template-columns: 300px 1fr; gap: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.dhead .cover { border-radius: 12px; }
.dhead h1 { margin: 4px 0 2px; font-size: 28px; letter-spacing: -.4px; }
.dhead .sub { color: var(--mute); font-size: 15px; }
.dhead p { color: #cbc5e3; margin: 12px 0; }
.kv { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px; color: var(--mute); font-size: 13px; }
.kv b { color: var(--text); font-weight: 600; }
.tabs { display: flex; gap: 2px; margin: 18px 0 14px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 16px; color: var(--mute); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-color: var(--brand); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.panel + .panel { margin-top: 14px; }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.side { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }
.side .panel { padding: 16px; }
.vbox { border-radius: 14px; padding: 14px; background: var(--bg2); border: 1px solid var(--line); }
.vbox.ok { border-color: rgba(61, 220, 151, .35); background: linear-gradient(180deg, rgba(61, 220, 151, .08), transparent); }
.vbox.bad { border-color: rgba(255, 93, 122, .4); background: linear-gradient(180deg, rgba(255, 93, 122, .08), transparent); }
.vbox .st { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.vbox .st.ok { color: var(--ok); }
.vbox .st.bad { color: var(--bad); }
.hash { font-family: var(--mono); font-size: 12px; color: var(--mute); word-break: break-all; }
.hash b { color: var(--text); font-weight: 600; }
.lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--dim); margin: 12px 0 3px; }
.tools { list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--mute); }
.tools li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.tools li span:last-child { color: var(--text); font-family: var(--mono); font-size: 11.5px; text-align: right; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--dim); font-weight: 600; font-size: 12px; }
.table td code { color: #d6ccff; }
.table tr:last-child td { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; text-align: right !important; }

.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.metric { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.metric .k { font-size: 12px; color: var(--dim); }
.metric .v { font-size: 20px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.metric .v small { font-size: 12px; color: var(--mute); font-weight: 500; }

/* markdown */
.md h1 { font-size: 22px; margin: 0 0 10px; }
.md h2 { font-size: 16px; margin: 22px 0 8px; }
.md p, .md li { color: #d2cce8; }
.md code { background: var(--bg2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; color: #d6ccff; }
.md pre { background: #0a0913; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; }
.md pre code { background: none; border: 0; padding: 0; color: #cfe9ff; }
.md table { border-collapse: collapse; margin: 8px 0; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 10px; }

/* code viewer */
.code-wrap { display: grid; grid-template-columns: 220px 1fr; min-height: 520px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #0a0913; }
.ftree { background: var(--panel); border-right: 1px solid var(--line); padding: 10px 6px; }
.ftree a { display: flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 8px; color: var(--mute); font-family: var(--mono); font-size: 12.5px; }
.ftree a:hover { background: var(--panel2); color: var(--text); }
.ftree a.on { background: var(--panel2); color: var(--text); }
.ftree .grp { font-size: 11px; color: var(--dim); padding: 10px 10px 4px; text-transform: uppercase; letter-spacing: .5px; }
.code { overflow: auto; max-height: 720px; }
.code .fhead { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; background: #110f1d; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--mute); }
.code pre { margin: 0; padding: 12px 0; font-size: 12.5px; line-height: 1.6; counter-reset: ln; }
.code pre .l { display: block; padding: 0 16px 0 0; white-space: pre; }
.code pre .l::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 44px; padding-right: 14px; text-align: right; color: #4a4466; user-select: none; }
.tk-k { color: #c792ea; } .tk-c { color: #6a6490; font-style: italic; } .tk-n { color: #f78c6c; }
.tk-s { color: #c3e88d; } .tk-t { color: #82aaff; } .tk-d { color: #ffcb6b; }

/* verify pipeline */
.pipe { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.pstep { position: relative; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-height: 96px; }
.pstep .h { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13px; }
.pstep .t { color: var(--dim); font-size: 11.5px; margin-top: 2px; }
.pstep .d { margin-top: 8px; font-size: 12px; color: var(--mute); }
.pstep.run { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(139, 108, 255, .15); }
.pstep.pass { border-color: rgba(61, 220, 151, .45); }
.pstep.pass .d { color: var(--ok); }
.pstep.fail { border-color: rgba(255, 93, 122, .55); }
.pstep.fail .d { color: var(--bad); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); flex: none; }
.run .dot { background: var(--brand); animation: pulse 1s infinite; }
.pass .dot { background: var(--ok); }
.fail .dot { background: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }
.term {
  margin-top: 14px; height: 300px; overflow: auto; background: #07060d; border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; font-family: var(--mono); font-size: 12px; line-height: 1.55; color: #b8b2d4;
  white-space: pre-wrap; word-break: break-all;
}
.term .s { color: var(--brand2); }
.term .p { color: var(--ok); }
.term .f { color: var(--bad); }
.term .w { color: var(--warn); }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.cmp .vbox { font-size: 12.5px; }
.match { margin-top: 12px; padding: 12px 14px; border-radius: 12px; font-weight: 600; display: flex; gap: 10px; align-items: center; }
.match.ok { background: rgba(61, 220, 151, .1); color: var(--ok); border: 1px solid rgba(61, 220, 151, .35); }
.match.bad { background: rgba(255, 180, 71, .08); color: var(--warn); border: 1px solid rgba(255, 180, 71, .35); }

/* license */
.perm { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.perm div { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.perm b { display: block; font-size: 22px; }
.perm .y b { color: var(--ok); } .perm .n b { color: var(--dim); } .perm .c b { color: var(--warn); }
.perm span { color: var(--mute); font-size: 12.5px; }

/* royalty */
.bars { display: flex; height: 34px; border-radius: 10px; overflow: hidden; margin: 10px 0 12px; }
.bars div { display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: rgba(0,0,0,.72); min-width: 0; overflow: hidden; white-space: nowrap; transition: flex-grow .3s; }
.legend { display: grid; gap: 6px; }
.legend .li { display: grid; grid-template-columns: 14px 1fr auto auto; gap: 10px; align-items: center; font-size: 13px; }
.legend .sw { width: 12px; height: 12px; border-radius: 4px; }
.legend .li span:nth-child(3) { color: var(--mute); font-variant-numeric: tabular-nums; }
.legend .li span:nth-child(4) { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 88px; text-align: right; }
.inp { display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.inp input, .inp select { background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 15px; font-weight: 600; width: 100%; font-variant-numeric: tabular-nums; }
.inp select option { background: var(--panel); }
.inp span { color: var(--dim); white-space: nowrap; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; counter-reset: fl; }
.flow div { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; position: relative; }
.flow div::before { counter-increment: fl; content: counter(fl); position: absolute; top: 12px; right: 14px; font-size: 26px; font-weight: 800; color: #2c2645; }
.flow b { display: block; margin-bottom: 4px; }
.flow span { color: var(--mute); font-size: 12.5px; }
.muted { color: var(--mute); }
.dim { color: var(--dim); }
.small { font-size: 12.5px; }
h2.sec { font-size: 20px; margin: 28px 0 14px; letter-spacing: -.2px; }

/* upload */
.drop {
  border: 2px dashed #3a3258; border-radius: 18px; padding: 44px; text-align: center; color: var(--mute);
  background: radial-gradient(600px 200px at 50% 0, rgba(139, 108, 255, .09), transparent); transition: border-color .15s, background .15s;
}
.drop.hover { border-color: var(--brand); background: rgba(139, 108, 255, .08); }
.drop b { display: block; color: var(--text); font-size: 17px; margin: 10px 0 4px; }
.tree { font-family: var(--mono); font-size: 12.5px; background: #0a0913; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; color: #cfe9ff; white-space: pre; overflow-x: auto; }
.err { color: var(--bad); margin-top: 12px; font-weight: 600; }

.rank td:first-child { width: 44px; color: var(--dim); font-weight: 700; }
.rank .m { display: flex; align-items: center; gap: 10px; }
.rank .m .mini { width: 52px; height: 39px; border-radius: 7px; overflow: hidden; position: relative; flex: none; }
.rank .m .mini svg { width: 100%; height: 100%; }

.empty { padding: 60px; text-align: center; color: var(--mute); }
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 18px; font-weight: 600;
  transition: all .25s; pointer-events: none; z-index: 50;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.foot { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; padding: 22px; border-top: 1px solid var(--line); color: var(--dim); font-size: 12.5px; }

@media (max-width: 1100px) {
  .detail { grid-template-columns: 1fr; }
  .side { position: static; }
  .pipe { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  main { padding: 0 16px 40px; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .search { order: 4; max-width: none; width: 100%; flex-basis: 100%; }
  .hero { padding: 28px 20px; }
  .hero h1 { font-size: 26px; }
  .pillars, .row3, .flow, .perm, .row2, .cmp { grid-template-columns: 1fr; }
  .dhead { grid-template-columns: 1fr; }
  .pipe { grid-template-columns: 1fr 1fr; }
  .code-wrap { grid-template-columns: 1fr; }
  .ftree { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* grid children must be allowed to shrink below their content width */
.detail > *, .dhead > *, .row2 > *, .row3 > *, .cmp > * { min-width: 0; }
.nav a { white-space: nowrap; }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs a { white-space: nowrap; }
.table { display: block; overflow-x: auto; }
.table tbody { display: table; width: 100%; }
.btn svg { width: 15px; height: 15px; flex: none; }

/* account menu */
.account { position: relative; }
.account .btn .avatar { width: 20px; height: 20px; font-size: 10px; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 18px 40px -12px rgba(0,0,0,.6); z-index: 30; }
.menu .mi { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; border: 0; background: none; font-weight: 600; }
.menu .mi:hover { background: var(--panel); }
.mi-form { display: grid; gap: 6px; padding: 8px 10px; }
.mi-form input { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--text); font: inherit; }
#visits a:hover { color: var(--text); }
