:root {
  --bg: #0f1419;
  --panel: #171d25;
  --line: #2a3340;
  --text: #e8eef6;
  --muted: #8b9aab;
  --accent: #3db8ff;
  --ok: #3dd68c;
  --warn: #f0b429;
  --bad: #f07178;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a3a55 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #1e2a22 0%, transparent 50%),
    var(--bg);
}

.method-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.method-label {
  color: var(--muted);
  font-size: 13px;
}

.method-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #10161e;
  cursor: pointer;
  font-size: 14px;
}

.method-opt:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(61, 184, 255, 0.35);
}

.draw-src-block {
  margin-top: 4px;
}

#drawSelect {
  min-width: 200px;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0d1218;
  color: var(--text);
}

.param select {
  margin-left: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0d1218;
  color: var(--text);
}

.param-set {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.score-checks {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.score-checks label {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  cursor: pointer;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.hero h1 {
  margin: 8px 0 12px;
  font-size: 32px;
  letter-spacing: 0.02em;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sub {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  max-width: 720px;
}

.sub code {
  color: #c9e8ff;
  background: #203041;
  padding: 2px 6px;
  border-radius: 4px;
}

.panel {
  margin-top: 20px;
  padding: 18px 20px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.panel-title {
  font-weight: 650;
  margin-bottom: 14px;
}

.draw-row,
.import-row,
.result-head,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.draw-info {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
}

#drawTail {
  color: var(--ok);
  font-size: 20px;
}

button,
input[type="file"]::file-selector-button {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #3db8ff, #2a8fd4);
  color: #041018;
  font-weight: 650;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#btnCopy,
#btnExport {
  background: #2a3544;
  color: var(--text);
  border: 1px solid var(--line);
}

.manual {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  margin-left: auto;
}

.manual input {
  width: 96px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0d1218;
  color: var(--text);
  letter-spacing: 0.2em;
  text-align: center;
}

.status.tip {
  color: var(--accent);
  opacity: 0.9;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.param {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.param input {
  width: 88px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0d1218;
  color: var(--text);
}

.group-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#intersectCard {
  margin-bottom: 16px;
}

.group-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: #10161e;
}

.group-card.hit {
  border-color: rgba(61, 214, 140, 0.45);
  box-shadow: inset 0 0 0 1px rgba(61, 214, 140, 0.12);
}

.group-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.group-head .muted {
  margin-left: 10px;
  color: var(--muted);
  font-size: 13px;
}

.result-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.result-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0d1218;
  padding: 12px;
  min-height: 120px;
}

.result-box-title {
  font-weight: 700;
  color: var(--ok);
  margin-bottom: 8px;
  font-size: 14px;
}

.result-box-body code {
  color: #c9e8ff;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
}

@media (max-width: 900px) {
  .result-boxes { grid-template-columns: 1fr; }
}

.dadi-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.dadi-preview code {
  color: #c9e8ff;
  font-size: 12px;
  word-break: break-all;
  line-height: 1.5;
}

.dadi-full {
  margin-top: 10px;
  padding: 12px;
  border-radius: 8px;
  background: #0d1218;
  color: #c9e8ff;
  font-size: 12px;
  line-height: 1.6;
  word-break: break-all;
  max-height: 240px;
  overflow: auto;
}

.group-actions .btn-act {
  background: #2a3544;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
}

.group-actions .btn-act.primary {
  background: linear-gradient(180deg, #3db8ff, #2a8fd4);
  color: #041018;
  border: 0;
  font-weight: 700;
}

.group-meta .eq012 {
  color: var(--ok);
  font-weight: 650;
}

.tol-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tol-tag {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  border: 1px solid var(--line);
}

.tol-tag.yes {
  color: #041018;
  background: var(--ok);
  border-color: transparent;
}

.tol-tag.no {
  color: var(--muted);
  background: #0d1218;
}

details {
  margin-top: 12px;
}

summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 13px;
}

.table-wrap.compact {
  margin-top: 10px;
  max-height: 280px;
}

@media (max-width: 800px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat {
  padding: 12px;
  border-radius: 10px;
  background: #10161e;
  border: 1px solid var(--line);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.stat b {
  font-size: 24px;
}

.stat.warn b { color: var(--warn); }
.stat.hit b { color: var(--ok); }
.stat.miss b { color: var(--bad); }

.param-label {
  font-size: 14px !important;
  font-weight: 600 !important;
}

.bt-filters {
  margin: 12px 0 8px;
}

.bt-table th,
.bt-table td {
  text-align: center;
  white-space: nowrap;
}

.bt-table tr.row-hit td:last-child { color: var(--ok); }
.bt-table tr.row-miss td:last-child { color: var(--bad); }

.badge {
  display: inline-block;
  min-width: 2em;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
}
.badge.ok {
  background: rgba(61, 214, 140, 0.18);
  color: var(--ok);
}
.badge.bad {
  background: rgba(240, 113, 120, 0.18);
  color: var(--bad);
}

#btTableWrap {
  max-height: 480px;
  overflow: auto;
  margin-top: 8px;
}

.table-wrap {
  overflow: auto;
  max-height: 560px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #141b24;
  z-index: 1;
}

.tag-yes {
  color: var(--ok);
  font-weight: 650;
}

.tag-no {
  color: var(--bad);
}

.score-pill {
  display: inline-block;
  min-width: 28px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #203041;
}

@media (max-width: 800px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .manual { margin-left: 0; width: 100%; }
}
