:root {
  --bg: #0a0f1c;
  --bg-soft: #0f1729;
  --panel: #131c30;
  --panel-2: #182238;
  --line: #243349;
  --line-soft: #1c283d;
  --text: #eef3fb;
  --muted: #93a3bd;
  --muted-2: #6c7c97;
  --accent: #5b8cff;
  --accent-2: #7c5bff;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 48px -22px rgba(0, 0, 0, 0.8);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 600px at 12% -8%, rgba(91, 140, 255, 0.16), transparent 60%),
    radial-gradient(800px 600px at 100% 0%, rgba(124, 91, 255, 0.14), transparent 55%),
    var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(140%) blur(12px);
  background: rgba(10, 15, 28, 0.82);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  font-size: 26px;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px -8px rgba(91, 140, 255, 0.7);
}
.brand h1 { font-size: 1.18rem; margin: 0; letter-spacing: -0.01em; }
.tagline { margin: 2px 0 0; font-size: 0.82rem; color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; }

/* Buttons */
.ghost-btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, transform .1s, background .15s;
  font-family: inherit;
}
.ghost-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.ghost-btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.link-btn { text-decoration: none; display: inline-flex; align-items: center; }
.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 13px 22px;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s, filter .15s;
  box-shadow: 0 12px 26px -12px rgba(91, 140, 255, 0.8);
  font-family: inherit;
}
.primary-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.primary-btn:active { transform: translateY(0); }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 22px;
  align-items: start;
  margin: 26px auto 12px;
}
.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.result-panel { position: sticky; top: 86px; min-height: 380px; }
.panel-head { margin-bottom: 16px; }
.panel-head h2 { margin: 0 0 4px; font-size: 1.05rem; display: flex; align-items: center; gap: 9px; }
.step-no {
  display: grid; place-items: center;
  width: 24px; height: 24px;
  border-radius: 7px;
  background: rgba(91, 140, 255, 0.18);
  color: var(--accent);
  font-size: 0.82rem; font-weight: 800;
}
.hint { margin: 0; font-size: 0.83rem; color: var(--muted); }

/* Fields */
.field { margin-bottom: 13px; }
.field-row { display: grid; gap: 13px; }
label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.req { color: var(--accent); font-weight: 700; font-size: 0.72rem; margin-left: 2px; }
.opt { color: var(--muted-2); font-weight: 500; font-size: 0.72rem; margin-left: 2px; }
.field-note { margin: 7px 0 0; font-size: 0.76rem; color: var(--muted); min-height: 1em; }
input, select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.18);
}
input::placeholder { color: var(--muted-2); }
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 14px 0 4px;
}

/* Checklist */
.checklist-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.block-label { font-size: 0.82rem; font-weight: 600; margin: 0 0 10px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 14px; }
.checks label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.84rem; font-weight: 500; margin: 0; cursor: pointer;
  color: var(--muted);
}
.checks input { width: auto; accent-color: var(--accent); cursor: pointer; }
.checks label:has(input:checked) { color: var(--text); }

.actions { display: flex; gap: 10px; margin-top: 18px; }
.actions .primary-btn { flex: 1; }
.privacy { margin: 13px 0 0; font-size: 0.76rem; color: var(--muted-2); }

/* Empty state */
.empty-state { text-align: center; padding: 26px 8px; }
.empty-emoji { font-size: 46px; opacity: 0.5; margin-bottom: 6px; }
.empty-state h2 { font-size: 1.08rem; margin: 0 0 8px; }
.empty-state > p { color: var(--muted); font-size: 0.9rem; margin: 0 0 14px; }
.empty-points { text-align: left; margin: 0 auto; max-width: 460px; padding-left: 20px; color: var(--muted); font-size: 0.86rem; }
.empty-points li { margin-bottom: 8px; }
.empty-points b { color: var(--text); }

/* Scorecard */
.hidden { display: none !important; }
.score-hero {
  display: flex; align-items: center; gap: 20px;
  padding-bottom: 18px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}
.score-ring {
  --pct: 0;
  position: relative;
  width: 116px; height: 116px; flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), var(--line-soft) 0);
  display: grid; place-items: center;
}
.score-ring::before {
  content: "";
  position: absolute; inset: 9px;
  border-radius: 50%;
  background: var(--bg-soft);
}
.score-ring-inner { position: relative; text-align: center; }
.score-num { font-size: 2.1rem; font-weight: 800; line-height: 1; }
.score-max { font-size: 0.78rem; color: var(--muted-2); }
.score-meta h3 { margin: 0 0 4px; font-size: 1.25rem; }
.grade-pill {
  display: inline-block;
  padding: 3px 12px; border-radius: 999px;
  font-size: 0.82rem; font-weight: 700;
  margin-bottom: 8px;
}
.score-meta .one-liner { margin: 0; color: var(--muted); font-size: 0.9rem; }
.score-meta .ctx { margin: 6px 0 0; font-size: 0.78rem; color: var(--muted-2); }

/* Dimensions */
.dims { display: grid; gap: 12px; }
.dim {
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
}
.dim-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.dim-name { font-weight: 700; font-size: 0.92rem; display: flex; align-items: center; gap: 8px; }
.dim-tag { font-size: 0.7rem; padding: 1px 8px; border-radius: 999px; font-weight: 600; }
.dim-score { font-size: 0.82rem; font-weight: 700; color: var(--muted); }
.bar { height: 7px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; transition: width .5s ease; }
.dim-detail { margin: 9px 0 0; font-size: 0.82rem; color: var(--muted); }
.dim-detail b { color: var(--text); font-weight: 600; }
.dim-fix { margin: 6px 0 0; font-size: 0.82rem; color: var(--text); }
.dim-fix::before { content: "→ "; color: var(--accent); font-weight: 700; }

.good { color: var(--good); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.tag-good { background: rgba(52, 211, 153, 0.16); color: var(--good); }
.tag-warn { background: rgba(251, 191, 36, 0.16); color: var(--warn); }
.tag-bad { background: rgba(248, 113, 113, 0.16); color: var(--bad); }
.fill-good { background: linear-gradient(90deg, #10b981, var(--good)); }
.fill-warn { background: linear-gradient(90deg, #f59e0b, var(--warn)); }
.fill-bad { background: linear-gradient(90deg, #ef4444, var(--bad)); }

/* Next steps */
.next-block {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.next-block h4 { margin: 0 0 10px; font-size: 0.98rem; }
.next-list { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 8px; }
.next-list li {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 0.87rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.next-list .chk { color: var(--accent); font-weight: 800; flex: none; }

.result-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }

/* Archive */
.archive-section { margin: 30px auto 50px; }
.archive-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.archive-head h2 { font-size: 1.1rem; margin: 0; }
.archive-actions { display: flex; gap: 8px; }
.archive-hint { color: var(--muted); font-size: 0.84rem; margin: 6px 0 16px; }
.archive-empty { color: var(--muted-2); font-size: 0.88rem; padding: 22px; text-align: center; background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }
.archive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 13px; }
.arch-card {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  position: relative;
}
.arch-card .arch-del {
  position: absolute; top: 10px; right: 10px;
  background: transparent; border: 0; color: var(--muted-2);
  cursor: pointer; font-size: 1rem; line-height: 1; padding: 2px 5px; border-radius: 6px;
}
.arch-card .arch-del:hover { color: var(--bad); background: rgba(248,113,113,.12); }
.arch-top { display: flex; align-items: baseline; gap: 9px; margin-bottom: 6px; }
.arch-score { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.arch-grade { font-size: 0.74rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.arch-title { font-size: 0.88rem; font-weight: 600; margin: 0 0 4px; word-break: break-word; padding-right: 18px; }
.arch-meta { font-size: 0.74rem; color: var(--muted-2); margin: 0; }
.arch-delta { font-size: 0.76rem; font-weight: 700; margin-left: auto; }

/* Footer */
.site-footer { border-top: 1px solid var(--line-soft); padding: 22px 0 40px; margin-top: 10px; }
.site-footer p { margin: 0; font-size: 0.82rem; color: var(--muted); }
.site-footer .muted { margin-top: 6px; font-size: 0.76rem; color: var(--muted-2); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #fff; color: #0a0f1c;
  padding: 11px 20px; border-radius: 999px;
  font-size: 0.88rem; font-weight: 600;
  box-shadow: 0 14px 34px -10px rgba(0, 0, 0, 0.6);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .result-panel { position: static; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .brand h1 { font-size: 1.02rem; }
  .tagline { display: none; }
  .checks { grid-template-columns: 1fr; }
  .score-hero { flex-direction: column; text-align: center; gap: 14px; }
}
