:root {
  --bg: #0f1115;
  --bg-soft: #161922;
  --panel: #1b1f2a;
  --panel-2: #20242f;
  --line: #2a2f3d;
  --ink: #eef1f7;
  --ink-soft: #aab2c5;
  --muted: #6f7891;
  --brand: #ff6a3d;
  --brand-2: #ffb547;
  --good: #2fbf71;
  --warn: #f5a623;
  --bad: #ef5a5a;
  --accent: #5b8cff;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0,0,0,.35);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(255,106,61,.12), transparent 60%), var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* topbar */
.topbar { border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  background: rgba(15,17,21,.82); backdrop-filter: blur(10px); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 26px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand-sub { font-size: 12.5px; color: var(--ink-soft); }
.ghost-link { color: var(--ink-soft); text-decoration: none; font-size: 14px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; }
.ghost-link:hover { color: var(--ink); border-color: var(--brand); }

/* layout */
.layout { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding-top: 26px; padding-bottom: 26px; align-items: start; }
.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: 78px; }

/* form */
.block { margin-bottom: 22px; }
.block:last-of-type { margin-bottom: 12px; }
.block-title { font-size: 15px; margin: 0 0 14px; display: flex; align-items: baseline; gap: 8px; }
.block-title small { color: var(--muted); font-weight: 400; font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.field span { font-weight: 500; }
input, select { width: 100%; background: #0d0f15; border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255,106,61,.15); }
input::placeholder { color: #4d566e; }

/* self check */
.selfcheck { display: flex; flex-direction: column; gap: 14px; }
.sc-item { background: #0d0f15; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.sc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sc-name { font-size: 14px; font-weight: 600; }
.sc-hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sc-val { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--brand-2); min-width: 22px; text-align: right; }
.sc-range { width: 100%; margin-top: 10px; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--bad), var(--warn), var(--good)); outline: none; }
.sc-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand); cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.sc-range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid var(--brand); cursor: pointer; }

/* actions */
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.btn { border: none; border-radius: 10px; padding: 11px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: transform .08s, filter .15s, background .15s; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #1a1206; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn.ghost:hover { color: var(--ink); border-color: var(--brand); }

/* empty state */
.empty-state { text-align: center; padding: 30px 10px; }
.empty-emoji { font-size: 44px; }
.empty-state h3 { font-size: 18px; margin: 12px 0 8px; }
.empty-state p { color: var(--ink-soft); font-size: 14px; margin: 6px 0; }
.muted { color: var(--muted) !important; font-size: 12.5px; }

/* result */
.score-hero { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.gauge { --p: 0; --c: var(--brand); width: 116px; height: 116px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #2a2f3d 0);
  display: grid; place-items: center; position: relative; }
.gauge::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--panel); }
.gauge-inner { position: relative; text-align: center; }
.gauge-num { font-size: 30px; font-weight: 800; line-height: 1; }
.gauge-label { font-size: 11px; color: var(--muted); }
.hero-meta h3 { margin: 0 0 4px; font-size: 18px; }
.grade-pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.hero-meta .verdict { color: var(--ink-soft); font-size: 13.5px; margin-top: 8px; }

.dims { display: flex; flex-direction: column; gap: 12px; margin: 18px 0; }
.dim { }
.dim-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; margin-bottom: 5px; }
.dim-name { font-weight: 600; }
.dim-score { font-variant-numeric: tabular-nums; font-weight: 700; }
.bar { height: 9px; background: #0d0f15; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; transition: width .5s ease; }
.dim-note { font-size: 12px; color: var(--muted); margin-top: 4px; }

.section-card { background: #0d0f15; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-top: 14px; }
.section-card h4 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.section-card ul { margin: 0; padding-left: 18px; }
.section-card li { font-size: 13.5px; color: var(--ink-soft); margin: 5px 0; }
.section-card li b { color: var(--ink); }
.metric-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip { font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: #12151d; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.chip b { color: var(--ink); }
.chip.good { border-color: rgba(47,191,113,.4); }
.chip.warn { border-color: rgba(245,166,35,.4); }
.chip.bad { border-color: rgba(239,90,90,.4); }

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

/* history */
.history-wrap { padding-bottom: 30px; }
.section-title { font-size: 16px; display: flex; align-items: baseline; gap: 8px; }
.section-title small { color: var(--muted); font-weight: 400; font-size: 12px; }
.history-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.hcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; position: relative; }
.hcard .htitle { font-size: 14px; font-weight: 600; margin-bottom: 4px; padding-right: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hcard .hmeta { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.hcard .hscore { font-size: 22px; font-weight: 800; margin: 6px 0; }
.hcard .hdel { position: absolute; top: 10px; right: 10px; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 15px; }
.hcard .hdel:hover { color: var(--bad); }

/* how */
.how { padding: 24px 20px 10px; }
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; }
.how-grid article { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.how-grid h3 { margin: 0 0 8px; font-size: 15px; }
.how-grid p { margin: 0; font-size: 13.5px; color: var(--ink-soft); }
.how-grid b { color: var(--ink); }
.disclaimer { font-size: 12.5px; color: var(--muted); margin-top: 16px; }

/* footer */
.footer { border-top: 1px solid var(--line); margin-top: 20px; padding: 18px 0; }
.footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--ink-soft); }

.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px); background: #12151d;
  border: 1px solid var(--brand); color: var(--ink); padding: 11px 18px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .result-panel { position: static; }
  .brand-sub { display: none; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .score-hero { flex-direction: column; text-align: center; }
}
