:root {
  --bg: #0f1420;
  --bg-soft: #161d2e;
  --panel: #1b2436;
  --panel-2: #212c41;
  --line: #2c374f;
  --txt: #e8edf6;
  --muted: #97a3bb;
  --accent: #4f7cff;
  --accent-2: #6ad0a8;
  --gap: #ff6b6b;
  --adv: #6ad0a8;
  --white: #d9b65a;
  --parity: #7c8aa6;
  --high: #ff6b6b;
  --mid: #f3a64b;
  --low: #7c8aa6;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #1d2742 0%, var(--bg) 55%);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(15,20,32,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 30px; line-height: 1; }
.topbar h1 { font-size: 18px; margin: 0; letter-spacing: .2px; }
.tag { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* layout */
.layout {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 22px;
  padding-top: 22px;
  padding-bottom: 22px;
  align-items: start;
}
.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.input-panel { padding: 18px; }
.result-panel { padding: 18px; position: sticky; top: 76px; }

/* names */
.names { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.comp-fields { display: flex; flex-direction: column; gap: 8px; }
.field { display: flex; align-items: center; gap: 10px; }
.field > span { width: 64px; flex-shrink: 0; font-size: 13px; color: var(--muted); }
.field input, .comp-row input {
  flex: 1; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--txt); border-radius: 9px; padding: 9px 11px; font-size: 14px;
  min-width: 0;
}
.field input:focus, .comp-row input:focus { outline: none; border-color: var(--accent); }
.comp-row { display: flex; align-items: center; gap: 8px; }
.comp-row .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.comp-row button { flex-shrink: 0; }

.howto { font-size: 12.5px; color: var(--muted); margin: 6px 0 14px; padding: 9px 11px; background: rgba(79,124,255,.08); border: 1px solid rgba(79,124,255,.2); border-radius: 9px; }
.howto b { color: var(--txt); }

/* matrix */
.matrix { display: flex; flex-direction: column; gap: 14px; }
.dim-group { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.dim-head {
  display: flex; align-items: baseline; gap: 8px; justify-content: space-between;
  padding: 9px 12px; background: var(--panel-2);
}
.dim-head .dname { font-weight: 600; font-size: 14px; }
.dim-head .dhint { font-size: 11.5px; color: var(--muted); }
.dim-head .dmini { font-size: 11.5px; color: var(--muted); }

.cp-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px; align-items: center;
  padding: 8px 12px; border-top: 1px solid var(--line);
}
.cp-label { font-size: 13px; }
.cp-label .imp { font-size: 10.5px; color: var(--muted); margin-left: 6px; padding: 1px 5px; border: 1px solid var(--line); border-radius: 6px; }
.cp-label .imp.i3 { color: #ffd0a0; border-color: #6a4a2a; }
.cp-checks { display: flex; gap: 6px; }
.chk {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2);
  color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s ease; user-select: none; position: relative;
}
.chk:hover { border-color: var(--accent); }
.chk.on { color: #fff; }
.chk.me.on { background: var(--accent); border-color: var(--accent); }
.chk.comp.on { background: var(--parity); border-color: var(--parity); }
.chk .sub { position: absolute; bottom: -15px; font-size: 9px; color: var(--muted); font-weight: 500; }

/* row status accent */
.cp-row.gap { background: rgba(255,107,107,.06); }
.cp-row.advantage { background: rgba(106,208,168,.06); }

/* verdict */
.verdict {
  font-size: 14.5px; font-weight: 600; line-height: 1.5;
  padding: 13px 14px; border-radius: 12px; margin-bottom: 14px;
  background: rgba(79,124,255,.12); border: 1px solid rgba(79,124,255,.3);
}
.verdict.behind { background: rgba(255,107,107,.12); border-color: rgba(255,107,107,.35); }
.verdict.good { background: rgba(106,208,168,.12); border-color: rgba(106,208,168,.35); }

/* scoreboard */
.scoreboard { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }
.score-row { display: grid; grid-template-columns: 92px 1fr 46px; align-items: center; gap: 10px; font-size: 12.5px; }
.score-row .who { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-row.me .who { color: var(--txt); font-weight: 600; }
.bar { height: 9px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; }
.score-row.me .bar > i { background: linear-gradient(90deg, var(--accent), #7aa0ff); }
.score-row .bar > i { background: linear-gradient(90deg, #5b6884, #7c8aa6); }
.score-row .val { text-align: right; font-variant-numeric: tabular-nums; }

/* counts */
.counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.count-card { text-align: center; padding: 10px 6px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel-2); }
.count-card b { display: block; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.count-card span { font-size: 11px; color: var(--muted); }
.count-card.gap b { color: var(--gap); }
.count-card.adv b { color: var(--adv); }
.count-card.white b { color: var(--white); }
.count-card.parity b { color: var(--parity); }

/* result blocks */
.result-block { margin-bottom: 18px; }
.result-block h3 { font-size: 14px; margin: 0 0 10px; display: flex; align-items: baseline; gap: 8px; }
.result-block h3 small { font-size: 11px; color: var(--muted); font-weight: 400; }

/* actions */
.actions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; counter-reset: a; }
.action {
  border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px;
  background: var(--panel-2); position: relative;
}
.action .a-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.action .rk { font-weight: 700; color: var(--muted); font-size: 12px; }
.action .a-label { font-weight: 600; font-size: 13.5px; flex: 1; min-width: 60%; }
.tier { font-size: 10.5px; padding: 2px 7px; border-radius: 999px; font-weight: 600; }
.tier.high { background: rgba(255,107,107,.18); color: #ffb0b0; }
.tier.mid { background: rgba(243,166,75,.18); color: #ffce95; }
.tier.low { background: rgba(124,138,166,.18); color: #b9c3d6; }
.action .meta { font-size: 11px; color: var(--muted); }
.action .fix { font-size: 12.5px; margin: 6px 0 0; }
.action .hyp { font-size: 11.5px; color: var(--muted); margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.action .hyp b { color: var(--accent-2); font-weight: 600; }
.empty { color: var(--muted); font-size: 12.5px; padding: 8px 0; }

/* dimensions */
.dimensions { display: flex; flex-direction: column; gap: 8px; }
.dim-bar { font-size: 12px; }
.dim-bar .dlabel { display: flex; justify-content: space-between; margin-bottom: 3px; }
.dim-bar .dlabel .behind { color: var(--gap); font-size: 11px; }
.dim-bar .dlabel .ahead { color: var(--adv); font-size: 11px; }
.dim-track { position: relative; height: 7px; background: var(--panel-2); border-radius: 5px; }
.dim-track .me { position: absolute; top: 0; left: 0; height: 100%; background: var(--accent); border-radius: 5px; }
.dim-track .cp { position: absolute; top: -2px; height: 11px; width: 2px; background: var(--gap); border-radius: 2px; }

/* taglist */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.taglist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.taglist li { font-size: 12px; padding: 6px 9px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }
.taglist.adv li { border-left: 2px solid var(--adv); }
.taglist.white li { border-left: 2px solid var(--white); }

/* export */
.export { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.copy-hint { font-size: 12px; color: var(--adv); }

/* buttons */
.btn {
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  border-radius: 9px; padding: 9px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: filter .12s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--txt); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); filter: none; }
.btn.small { background: transparent; color: var(--muted); border: 1px dashed var(--line); padding: 7px 11px; font-size: 12px; align-self: flex-start; }
.btn.small:hover { color: var(--accent); border-color: var(--accent); }
.btn.x { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 6px 9px; font-size: 12px; border-radius: 8px; }
.btn.x:hover { color: var(--gap); border-color: var(--gap); }

/* footer */
.site-foot { padding: 20px; color: var(--muted); font-size: 12px; text-align: center; }
.site-foot .muted { font-size: 11px; opacity: .8; margin-top: 4px; }

/* responsive */
@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }
  .result-panel { position: static; }
  .topbar h1 { font-size: 16px; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 12px; }
  .topbar-inner { padding: 10px 12px; }
  .tag { display: none; }
  .two-col { grid-template-columns: 1fr; }
  .counts { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .count-card b { font-size: 18px; }
  .cp-checks .chk { width: 32px; height: 32px; }
  .score-row { grid-template-columns: 78px 1fr 40px; }
}
