:root {
  --bg: #0f1115;
  --bg-soft: #161a21;
  --panel: #1b2029;
  --panel-2: #20262f;
  --line: #2a313c;
  --line-soft: #232a34;
  --text: #e8edf4;
  --text-dim: #9aa6b6;
  --text-faint: #6b7686;
  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, 0.14);
  --go: #34d399;
  --watch: #f5b942;
  --drop: #f87171;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--accent);
  color: #fff; padding: 8px 14px; border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(15, 17, 21, 0.82);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: baseline; gap: 9px; }
.brand-mark { color: var(--accent); font-size: 20px; transform: translateY(2px); }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; }
.brand-en { color: var(--text-faint); font-size: 12px; letter-spacing: 0.4px; }
.topnav { display: flex; gap: 22px; font-size: 14px; }
.topnav a { color: var(--text-dim); }
.topnav a:hover { color: var(--text); text-decoration: none; }

/* ---------- Lab ---------- */
.lab { padding: 38px 0 20px; }
.lab-head { max-width: 760px; }
.lab-head h1 { font-size: clamp(24px, 4vw, 34px); line-height: 1.25; margin: 0 0 12px; letter-spacing: -0.3px; }
.lab-sub { color: var(--text-dim); font-size: 15px; margin: 0; }
.lab-sub b { color: var(--text); font-weight: 600; }

.lab-grid {
  margin-top: 26px;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.panel-head h2 { font-size: 16px; margin: 0; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.results-panel { position: sticky; top: 76px; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); cursor: pointer; transition: all 0.15s ease;
}
.btn:hover { border-color: #3a4453; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #639bff; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--drop); }
.btn-danger:hover { border-color: var(--drop); }

/* ---------- Cards ---------- */
.cards { display: flex; flex-direction: column; gap: 14px; }
.empty-hint { color: var(--text-faint); text-align: center; padding: 30px 0; font-size: 14px; }

.card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 14px 6px;
  position: relative;
}
.card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-name {
  flex: 1; font: inherit; font-size: 15px; font-weight: 600;
  background: transparent; border: none; border-bottom: 1px dashed transparent;
  color: var(--text); padding: 4px 2px;
}
.card-name:focus { outline: none; border-bottom-color: var(--accent); }
.card-name::placeholder { color: var(--text-faint); }
.card-score {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 20px;
  min-width: 46px; text-align: right;
}
.card-band {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
  white-space: nowrap;
}
.card-del {
  border: none; background: transparent; color: var(--text-faint);
  cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 4px;
}
.card-del:hover { color: var(--drop); }

.band-go { background: rgba(52, 211, 153, 0.16); color: var(--go); }
.band-watch { background: rgba(245, 185, 66, 0.16); color: var(--watch); }
.band-drop { background: rgba(248, 113, 113, 0.16); color: var(--drop); }

.dims { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
@media (max-width: 560px) { .dims { grid-template-columns: 1fr; } }

.dim { padding: 5px 0; }
.dim-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--text-dim); margin-bottom: 3px;
}
.dim-label .dim-val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.dim-label .info {
  cursor: help; color: var(--text-faint); border: 1px solid var(--line);
  border-radius: 50%; width: 15px; height: 15px; line-height: 13px;
  text-align: center; font-size: 10px; margin-left: 5px;
}
.dim input[type="range"] {
  width: 100%; -webkit-appearance: none; appearance: none; height: 5px;
  border-radius: 4px; background: var(--line); outline: none; cursor: pointer; margin: 2px 0;
}
.dim input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--accent); border: 2px solid #fff2; cursor: pointer;
}
.dim input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent);
  border: 2px solid #fff2; cursor: pointer;
}

.card-weak {
  margin: 8px 0 4px; font-size: 12px; color: var(--watch);
  background: rgba(245, 185, 66, 0.08); border-radius: 7px; padding: 6px 9px;
}
.card-weak b { color: var(--text); }

/* ---------- Leaderboard ---------- */
.leaderboard { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.lb-empty { color: var(--text-faint); font-size: 13px; padding: 12px 0; }
.lb-row {
  display: flex; align-items: center; gap: 11px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 12px;
}
.lb-rank { font-weight: 700; color: var(--text-faint); font-size: 13px; width: 18px; }
.lb-name { flex: 1; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-bar { width: 70px; height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; }
.lb-bar i { display: block; height: 100%; border-radius: 4px; }
.lb-score { font-variant-numeric: tabular-nums; font-weight: 700; width: 34px; text-align: right; font-size: 14px; }
.lb-row.top { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }

/* ---------- Weights ---------- */
.weights { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.weights summary {
  cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-dim);
  display: flex; align-items: center; gap: 8px; list-style: none;
}
.weights summary::-webkit-details-marker { display: none; }
.weights summary::before { content: "⚙"; color: var(--text-faint); }
.weight-profile {
  margin-left: auto; font-size: 11px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); padding: 2px 8px; border-radius: 20px;
}
.profile-row { display: flex; gap: 7px; flex-wrap: wrap; margin: 12px 0; }
.chip {
  font: inherit; font-size: 12px; padding: 5px 11px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text-dim); cursor: pointer;
}
.chip:hover { color: var(--text); border-color: #3a4453; }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.weight-sliders { display: flex; flex-direction: column; gap: 9px; }
.wslider { display: grid; grid-template-columns: 96px 1fr 28px; align-items: center; gap: 10px; font-size: 12.5px; }
.wslider label { color: var(--text-dim); }
.wslider span { text-align: right; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.wslider input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 5px; border-radius: 4px;
  background: var(--line); outline: none; cursor: pointer;
}
.wslider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: var(--text-dim); cursor: pointer;
}
.weights-note { color: var(--text-faint); font-size: 12px; margin: 12px 0 2px; }

/* ---------- Method ---------- */
.method { padding: 48px 0 10px; border-top: 1px solid var(--line-soft); margin-top: 30px; }
.method h2 { font-size: 22px; margin: 0 0 8px; }
.method-sub { color: var(--text-dim); margin: 0 0 24px; font-size: 14.5px; }
.method-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.mcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.mcard h3 { margin: 0 0 4px; font-size: 15px; }
.mcard .m-tag { font-size: 11px; color: var(--text-faint); }
.mcard .m-anchor { margin-top: 10px; font-size: 13px; color: var(--text-dim); }
.mcard .m-anchor b { color: var(--text); }
.mcard .m-line { display: flex; gap: 8px; margin-top: 5px; }
.mcard .m-line .lv { font-weight: 700; min-width: 30px; }
.lv0 { color: var(--drop); }
.lv5 { color: var(--go); }

.verdict-legend { margin-top: 30px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.verdict-legend h3 { margin: 0 0 12px; font-size: 16px; }
.verdict-legend ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.verdict-legend li { color: var(--text-dim); font-size: 14px; }
.band { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 20px; margin-right: 8px; }

/* ---------- Why ---------- */
.why { padding: 40px 0; }
.why h2 { font-size: 20px; margin: 0 0 10px; }
.why p { color: var(--text-dim); max-width: 760px; font-size: 15px; }
.why b { color: var(--text); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line-soft); padding: 26px 0; margin-top: 20px; }
.footer-inner { color: var(--text-faint); font-size: 13px; }
.footer-sub { margin: 6px 0 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 24px; font-size: 13.5px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: all 0.25s ease; z-index: 80;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .lab-grid { grid-template-columns: 1fr; }
  .results-panel { position: static; }
  .topnav { gap: 16px; }
  .brand-en { display: none; }
}
@media (max-width: 480px) {
  .topnav a:first-child { display: none; }
  .panel { padding: 14px; }
}
