:root {
  --bg: #0e1116;
  --bg-soft: #161b22;
  --bg-card: #1b212b;
  --line: #2a313c;
  --text: #e8edf3;
  --text-dim: #97a3b3;
  --text-faint: #6b7686;
  --brand: #5b8cff;
  --brand-soft: rgba(91, 140, 255, 0.14);
  --ok: #3fb56e;
  --warn: #e7a740;
  --danger: #e5604d;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1100px 600px at 80% -10%, #1a2740 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(1040px, 92vw); margin: 0 auto; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(14, 17, 22, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.brand-mark { font-size: 22px; }
.brand-name { font-size: 17px; letter-spacing: 0.2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.product-name {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 7px 11px;
  font-size: 13px;
  width: 150px;
  outline: none;
}
.product-name:focus { border-color: var(--brand); }

.btn {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 9px;
  padding: 7px 13px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .05s;
}
.btn:hover { border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn-ghost { color: var(--text-dim); }

/* ---------- hero ---------- */
.hero { padding: 38px 0 14px; }
.hero h1 {
  font-size: clamp(22px, 4.4vw, 34px);
  line-height: 1.28;
  margin: 0 0 12px;
  letter-spacing: -0.2px;
}
.hero-sub { color: var(--text-dim); max-width: 720px; margin: 0; font-size: 15px; }
.hero-sub b { color: var(--text); font-weight: 600; }

/* ---------- dashboard ---------- */
.dashboard {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  margin: 22px 0 8px;
}
.score-card, .action-card {
  background: linear-gradient(180deg, var(--bg-card), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.ring {
  --pct: 0;
  --ring-color: var(--text-faint);
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background:
    conic-gradient(var(--ring-color) calc(var(--pct) * 1%), var(--line) 0);
  display: grid;
  place-items: center;
  transition: --pct .5s ease;
}
.ring-inner {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.ring-score { font-size: 40px; font-weight: 800; line-height: 1; }
.ring-unit { font-size: 12px; color: var(--text-faint); }

.score-meta { width: 100%; }
.risk-badge {
  display: inline-block;
  font-weight: 700;
  font-size: 14px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.risk-badge.ok { color: var(--ok); border-color: rgba(63,181,110,.5); background: rgba(63,181,110,.10); }
.risk-badge.warn { color: var(--warn); border-color: rgba(231,167,64,.5); background: rgba(231,167,64,.10); }
.risk-badge.danger { color: var(--danger); border-color: rgba(229,96,77,.5); background: rgba(229,96,77,.10); }

.risk-advice { color: var(--text-dim); font-size: 13.5px; margin: 10px 0; min-height: 38px; }
.counters { font-size: 12.5px; color: var(--text-faint); }
.counter-critical { color: var(--danger); font-weight: 700; }

/* ---------- action list ---------- */
.action-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.action-head h2 { font-size: 16px; margin: 0; }
.action-hint { font-size: 12px; color: var(--text-faint); }
.action-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.action-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13.5px;
}
.action-item .rank {
  flex: 0 0 22px;
  height: 22px;
  width: 22px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
}
.action-item.over .rank { background: rgba(229,96,77,.14); color: var(--danger); }
.action-body { flex: 1; }
.action-body .a-text { color: var(--text); }
.action-body .a-meta { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.wtag { font-size: 10.5px; padding: 1px 6px; border-radius: 5px; margin-right: 6px; border: 1px solid var(--line); }
.wtag.critical { color: var(--danger); border-color: rgba(229,96,77,.4); }
.wtag.important { color: var(--warn); border-color: rgba(231,167,64,.4); }
.wtag.nice { color: var(--text-dim); }
.action-empty { color: var(--text-faint); font-size: 13.5px; padding: 8px 0; }

/* ---------- category bar ---------- */
.catbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.chip .chip-pct { font-weight: 700; color: var(--text); }
.chip .chip-bar { width: 42px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.chip .chip-bar > span { display: block; height: 100%; background: var(--brand); transition: width .4s; }

/* ---------- checklist ---------- */
.checklist { display: grid; gap: 14px; margin-bottom: 30px; }
.cat {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.cat-title { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.cat-title .cat-icon { font-size: 18px; }
.cat-progress { font-size: 12.5px; color: var(--text-faint); }
.cat-items { list-style: none; margin: 0; padding: 6px 8px; }

.item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s;
}
.item:hover { background: var(--bg-soft); }
.item input { display: none; }
.box {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 6px;
  border: 1.5px solid var(--text-faint);
  display: grid;
  place-items: center;
  transition: background .12s, border-color .12s;
}
.box::after {
  content: "✓";
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  opacity: 0;
  transform: scale(.6);
  transition: opacity .12s, transform .12s;
}
.item.checked .box { background: var(--ok); border-color: var(--ok); }
.item.checked .box::after { opacity: 1; transform: scale(1); }
.item.checked .i-text { color: var(--text-faint); text-decoration: line-through; }

.i-main { flex: 1; }
.i-text { font-size: 14.5px; }
.i-why { font-size: 12.5px; color: var(--text-faint); margin-top: 3px; }
.i-weight {
  flex: 0 0 auto;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  margin-top: 2px;
  white-space: nowrap;
}
.i-weight.critical { color: var(--danger); border-color: rgba(229,96,77,.4); background: rgba(229,96,77,.08); }
.i-weight.important { color: var(--warn); border-color: rgba(231,167,64,.4); background: rgba(231,167,64,.08); }
.i-weight.nice { color: var(--text-dim); }

/* ---------- footer + toast ---------- */
.footer { color: var(--text-faint); font-size: 12px; text-align: center; padding: 10px 0 40px; }
.footer p { margin: 4px 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--brand);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  z-index: 50;
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .dashboard { grid-template-columns: 1fr; }
  .topbar-actions { gap: 6px; }
  .product-name { width: 110px; }
  .hero { padding: 26px 0 8px; }
  .i-why { display: none; }
  .item:hover .i-why, .item.show-why .i-why { display: block; }
}
