.wb-body,
.wb-chart-dialog,
.wb-attr-compare-body {
  --wb-series-lightness: 62%;
  --wb-slot-1: #3987e5;
  --wb-slot-2: #d95926;
  --wb-slot-3: #199e70;
  --wb-slot-4: #c98500;
  --wb-slot-5: #d55181;
  --wb-slot-6: #008300;
  --wb-slot-7: #9085e9;
  --wb-slot-8: #e66767;
  --wb-slot-9: #22b8cf;
}

:root[data-theme="light"] .wb-body,
:root[data-theme="light"] .wb-chart-dialog,
:root[data-theme="light"] .wb-attr-compare-body {
  --wb-series-lightness: 40%;
  --wb-slot-1: #2a78d6;
  --wb-slot-2: #eb6834;
  --wb-slot-3: #1baf7a;
  --wb-slot-4: #eda100;
  --wb-slot-5: #e87ba4;
  --wb-slot-6: #008300;
  --wb-slot-7: #6250d6;
  --wb-slot-8: #e34948;
  --wb-slot-9: #0c8599;
}

.wb-body,
.wb-attr-compare-body {
  padding: var(--aw-space-4);
}

.wb-sync-banner {
  display: grid;
  gap: 0.7rem;
  padding: 0.9rem 1.05rem;
  margin-bottom: 1rem;
  border: 1px solid color-mix(in srgb, var(--aw-accent) 34%, var(--aw-border));
  border-left: 3px solid var(--aw-accent);
  border-radius: var(--aw-radius-md);
  background:
    radial-gradient(70% 120% at 0% 0%, color-mix(in srgb, var(--aw-accent) 12%, transparent), transparent 62%),
    radial-gradient(60% 110% at 100% 0%, color-mix(in srgb, var(--teal, #18c8ff) 10%, transparent), transparent 65%),
    var(--aw-surface-2);
}

.wb-sync-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.wb-sync-head strong {
  color: var(--aw-text);
  font-size: 0.92rem;
  font-weight: 780;
}

.wb-sync-meta {
  color: var(--aw-muted);
  font-family: var(--aw-font-mono);
  font-size: 0.76rem;
}

.wb-preset-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.wb-preset-btn {
  min-height: 34px !important;
  padding: 0.35rem 0.72rem !important;
  font-size: 0.8rem !important;
}

.wb-preset-btn.is-active {
  border-color: color-mix(in srgb, var(--aw-accent) 68%, var(--aw-border)) !important;
  background: linear-gradient(135deg, color-mix(in srgb, var(--aw-accent) 26%, var(--aw-surface-2)), color-mix(in srgb, var(--teal, #18c8ff) 12%, var(--aw-surface-2))) !important;
  box-shadow: 0 0 16px color-mix(in srgb, var(--aw-accent) 22%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.14) !important;
}

.wb-metric-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 1rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--aw-border);
  border-radius: var(--aw-radius-md);
  background: var(--aw-surface-2);
}

.wb-metric-label {
  color: var(--aw-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.wb-metric-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.wb-metric-btn {
  min-height: 34px !important;
  padding: 0.35rem 0.8rem !important;
  font-size: 0.81rem !important;
}

.wb-metric-btn.is-active {
  border-color: color-mix(in srgb, var(--teal, #18c8ff) 62%, var(--aw-border)) !important;
  background: linear-gradient(135deg, color-mix(in srgb, var(--teal, #18c8ff) 20%, var(--aw-surface)), color-mix(in srgb, var(--aw-accent) 14%, var(--aw-surface))) !important;
  color: var(--aw-text) !important;
  box-shadow: 0 0 14px color-mix(in srgb, var(--teal, #18c8ff) 20%, transparent) !important;
}

.wb-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}

.wb-controls label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  color: var(--aw-muted);
  font-size: 0.84rem;
  font-weight: 640;
}

.wb-controls select,
.wb-controls input {
  display: block;
  width: 100%;
  min-width: 0;
  font: inherit;
}

.wb-controls label:has(input[type="range"]) {
  grid-column: span 2;
}

.wb-controls input[type="range"] {
  accent-color: var(--aw-accent);
  cursor: pointer;
}

.wb-controls output {
  margin-left: auto;
  color: var(--aw-text);
  font-family: var(--aw-font-mono);
  font-variant-numeric: tabular-nums;
}

.wb-active-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--aw-border);
  border-radius: var(--aw-radius-sm);
  background: var(--aw-control);
}

.wb-active-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 28px;
  padding: 0.18rem 0.52rem;
  border: 1px solid var(--aw-border);
  border-radius: var(--aw-radius-xs);
  background: var(--aw-surface-2);
  color: var(--aw-text);
  font-size: 0.78rem;
}

.wb-active-chip.is-primary {
  border-color: color-mix(in srgb, var(--teal, #18c8ff) 42%, var(--aw-border));
  background: color-mix(in srgb, var(--teal, #18c8ff) 10%, var(--aw-surface-2));
}

.wb-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--aw-border);
  border-radius: 3px;
  background: var(--aw-control);
  color: var(--aw-muted);
  font: 700 13px/1 var(--aw-font-mono);
  cursor: pointer;
}

.wb-chip-remove:hover {
  border-color: var(--aw-danger);
  color: var(--aw-danger);
}

.wb-picker-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.65rem;
}

.wb-plots {
  display: grid;
  grid-template-columns: minmax(0, 2.05fr) minmax(0, 0.95fr);
  gap: 1.15rem;
  margin-top: 1.15rem;
}

.wb-figure {
  min-width: 0;
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--aw-border);
  border-radius: var(--aw-radius-md);
  background: var(--aw-surface-2);
}

.wb-figure figcaption {
  color: var(--aw-text);
  font-weight: 780;
  font-size: 0.96rem;
}

.wb-figure svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.wb-figure svg text {
  fill: var(--aw-muted);
  font: 12px var(--aw-font-mono);
  font-variant-numeric: tabular-nums;
}

.wb-chart-scroll {
  position: relative;
  overflow-x: auto;
}

.wb-chart-scroll .wb-chart {
  min-width: 460px;
}

.wb-chart {
  touch-action: pan-y;
  user-select: none;
  cursor: crosshair;
}

.wb-hover-tooltip {
  position: absolute;
  top: 10px;
  left: var(--wb-tt-left, 72px);
  z-index: 12;
  min-width: 248px;
  max-width: min(360px, calc(100% - 16px));
  padding: 0.6rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--teal, #18c8ff) 36%, var(--aw-border));
  border-radius: var(--aw-radius-sm);
  background: color-mix(in srgb, var(--aw-surface) 95%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--aw-shadow-raise);
  pointer-events: none;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.wb-hover-tooltip[hidden] {
  display: none !important;
}

.wb-tt-head {
  padding-bottom: 0.35rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid var(--aw-border);
  color: var(--aw-muted);
  font-family: var(--aw-font-mono);
  font-size: 0.73rem;
  font-weight: 700;
}

.wb-tt-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.16rem 0;
}

.wb-tt-name {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  color: var(--aw-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wb-tt-swatch {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border: 2px solid var(--wb-series-color);
  border-radius: 50%;
}

.wb-tt-swatch[data-status="draft"] {
  border-radius: 0;
  background: var(--wb-series-color);
}

.wb-tt-swatch[data-status="custom"] {
  border: 0;
  border-radius: 0;
  width: 10px;
  height: 10px;
  background: var(--wb-series-color);
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
}

.wb-tt-val {
  flex: 0 0 auto;
  color: var(--aw-text);
  font-family: var(--aw-font-mono);
  white-space: nowrap;
}

.wb-tt-val small {
  color: var(--aw-muted);
  font-size: 0.7rem;
}

.wb-chart-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.8rem 0;
}

.wb-chart-tools .aw-button,
.wb-chart-range .aw-button {
  min-height: 36px;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem !important;
}

.wb-chart-range {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 0.5rem;
  align-items: end;
}

.wb-chart-range label {
  display: grid;
  gap: 0.3rem;
  color: var(--aw-muted);
  font-size: 0.76rem;
  min-width: 0;
}

.wb-chart-range input {
  min-width: 0;
  width: 100%;
  font: inherit;
}

.wb-chart-dialog {
  width: 96vw;
  max-width: 1800px;
  height: 94vh;
  max-height: 94vh;
  padding: 1rem;
  border: 1px solid var(--aw-border);
  border-radius: var(--aw-radius-md);
  background: var(--aw-bg);
  color: var(--aw-text);
  overflow: auto;
}

.wb-chart-dialog::backdrop {
  background: rgb(0 0 0 / 0.75);
}

.wb-chart-dialog .wb-figure {
  border: 0;
}

.wb-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  margin: 0.7rem 0;
  font-size: 0.78rem;
  color: var(--aw-muted);
}

.wb-series-label::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 0.4rem;
  vertical-align: middle;
  border: 2px solid var(--wb-series-color);
  border-radius: 50%;
}

.wb-series-label[data-status="draft"]::before {
  border-radius: 0;
  background: var(--wb-series-color);
}

.wb-series-label[data-status="custom"]::before {
  border: 0;
  border-radius: 0;
  width: 12px;
  height: 12px;
  background: var(--wb-series-color);
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
}

.wb-version-badge {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--wb-series-color);
  border-radius: 3px;
  color: var(--aw-text);
  font-size: 0.7rem;
  font-weight: 750;
  white-space: nowrap;
}

.wb-compare-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.wb-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem 0.75rem;
}

.wb-choices label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  color: var(--aw-text);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.wb-choices input {
  flex: 0 0 auto;
  accent-color: var(--aw-accent);
}

.wb-choices label[hidden] {
  display: none;
}

.wb-mode-filter {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  color: var(--aw-muted);
  font-size: 0.84rem;
}

.wb-mode-filter select {
  width: auto;
  max-width: 100%;
}

.wb-grid {
  stroke: var(--aw-border);
  stroke-width: 1;
}

.wb-threshold-line {
  stroke: color-mix(in srgb, var(--aw-accent-2) 60%, var(--aw-border));
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
}

.wb-figure svg .wb-threshold-text {
  fill: color-mix(in srgb, var(--aw-accent-2) 86%, var(--aw-text));
  stroke: var(--aw-surface-2);
  stroke-width: 3.5px;
  stroke-linejoin: round;
  paint-order: stroke;
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}

.wb-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.wb-ideal {
  stroke-dasharray: 7 5;
  opacity: 0.62;
  stroke-width: 1.75;
}

.wb-dot {
  fill: var(--aw-surface);
  stroke-width: 3;
}

.wb-hover-line {
  stroke: var(--teal, #18c8ff);
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.wb-hover-dot {
  pointer-events: none;
}

.wb-crossing {
  cursor: pointer;
  outline: none;
}

.wb-crossing path {
  fill: var(--aw-surface);
  stroke: var(--aw-text);
  stroke-width: 1.7;
}

.wb-crossing.is-active path,
.wb-crossing:focus path {
  fill: var(--aw-accent);
  stroke-width: 2.5;
}

.wb-crossing-hit {
  fill: transparent;
  stroke: none;
}

.wb-crossing-callout {
  pointer-events: none;
}

.wb-crossing-callout rect {
  fill: var(--aw-surface);
  stroke: var(--aw-border);
}

.wb-figure .wb-crossing-callout text {
  fill: var(--aw-text);
  font-size: 11px;
}

.wb-intersection-info {
  min-height: 2.4em;
  overflow-wrap: anywhere;
}

.wb-intersections-table {
  min-width: 600px;
  font-size: 0.8rem;
}

.wb-intersections-table td:last-child {
  min-width: 320px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.wb-cursor {
  stroke: var(--aw-muted);
  stroke-dasharray: 3 4;
}

.wb-target {
  fill: color-mix(in srgb, var(--aw-accent) 8%, transparent);
  stroke: var(--aw-accent);
  stroke-width: 1.5;
}

.wb-envelope {
  fill: none;
  stroke: var(--aw-muted);
  stroke-dasharray: 4 4;
}

.wb-hit {
  fill: var(--aw-accent);
}

.wb-miss {
  fill: var(--aw-muted);
  opacity: 0.55;
}

.wb-axis {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--aw-muted);
}

.wb-axis select {
  width: auto;
  min-height: 36px;
  padding: 0.3rem 0.5rem;
  font: inherit;
}

.wb-note,
.wb-method {
  font-size: 0.82rem;
  color: var(--aw-muted);
  line-height: 1.65;
}

.wb-results {
  margin-top: 1rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.wb-results caption {
  text-align: left;
  margin-bottom: 0.4rem;
}

.wb-results th:first-child {
  white-space: normal;
  min-width: 165px;
}

.wb-results td.is-best,
.wb-ac-val-cell.is-best {
  background: color-mix(in srgb, var(--aw-success) 13%, transparent);
  color: color-mix(in srgb, var(--aw-success) 88%, var(--aw-text));
  font-weight: 760;
}

.wb-method {
  border-top: 1px solid var(--aw-border);
  padding-top: 0.8rem;
}

.wb-method summary {
  color: var(--aw-text);
  cursor: pointer;
}

.wb-custom {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--aw-border);
  border-radius: var(--aw-radius-sm);
  background: color-mix(in srgb, var(--aw-surface-2) 55%, transparent);
}

.wb-custom summary {
  cursor: pointer;
  color: var(--aw-text);
  font-weight: 750;
}

.wb-custom fieldset {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--aw-border);
  min-width: 0;
}

.wb-custom fieldset:disabled {
  opacity: 0.5;
}

.wb-custom legend,
.wb-enable {
  color: var(--aw-muted);
  font-size: 0.86rem;
}

.wb-enable input {
  accent-color: var(--aw-accent);
}

/* ── 武器参数横向对比矩阵 (#compare) ───────────────────── */

.wb-ac-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--aw-border);
  background: color-mix(in srgb, var(--aw-surface-2) 65%, var(--aw-surface));
}

.wb-ac-add-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.wb-ac-add-group select {
  width: auto;
  min-height: 36px;
  padding: 0.35rem 0.65rem;
  font-size: 0.84rem;
}

.wb-ac-add-group .aw-button {
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem !important;
}

.wb-ac-diff-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--aw-text);
  font-size: 0.84rem;
  font-weight: 660;
  cursor: pointer;
}

.wb-ac-diff-toggle input {
  accent-color: var(--aw-accent);
}

.wb-attr-diff-table {
  min-width: 720px;
  font-variant-numeric: tabular-nums;
}

.wb-attr-diff-table th:first-child {
  min-width: 210px;
}

.wb-ac-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  min-width: 150px;
}

.wb-ac-group-row th {
  padding: 0.5rem 0.85rem !important;
  background: color-mix(in srgb, var(--teal, #18c8ff) 9%, var(--aw-control)) !important;
  color: var(--teal, #18c8ff) !important;
  font-size: 0.76rem !important;
  font-weight: 780 !important;
  letter-spacing: 0.03em;
}

.wb-ac-attr-name {
  font-weight: 680;
  color: var(--aw-text) !important;
  background: transparent !important;
}

.wb-ac-attr-name code {
  font-size: 0.73rem;
}

.wb-attr-diff-table tr.is-diff > th.wb-ac-attr-name {
  border-left: 3px solid var(--aw-accent);
}

.wb-ac-val-cell {
  font-family: var(--aw-font-mono);
  font-size: 0.86rem !important;
  white-space: nowrap;
}

.wb-ac-val-cell.is-muted {
  color: var(--aw-muted) !important;
}

.wb-ac-src {
  display: inline-block;
  padding: 0.05rem 0.32rem;
  border: 1px solid color-mix(in srgb, var(--aw-accent-2) 42%, var(--aw-border));
  border-radius: 3px;
  background: color-mix(in srgb, var(--aw-accent-2) 12%, transparent);
  color: color-mix(in srgb, var(--aw-accent-2) 88%, var(--aw-text));
  font-size: 0.68rem;
  font-weight: 720;
}

.wb-ac-delta {
  display: inline-block;
  padding: 0.06rem 0.34rem;
  border-radius: 3px;
  background: var(--aw-surface-2);
  color: var(--aw-muted);
  font-size: 0.72rem;
  font-weight: 740;
}

.wb-ac-delta.is-up {
  background: color-mix(in srgb, var(--aw-success) 15%, transparent);
  color: var(--aw-success);
}

.wb-ac-delta.is-down {
  background: color-mix(in srgb, var(--aw-danger) 14%, transparent);
  color: var(--aw-danger);
}

.wb-ac-empty {
  padding: 1.5rem !important;
  text-align: center !important;
  color: var(--aw-muted) !important;
}

@media (max-width: 920px) {
  .wb-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wb-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wb-plots {
    grid-template-columns: 1fr;
  }

  .wb-spread {
    max-width: 360px;
    margin: auto;
  }

  .wb-chart-range {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .wb-chart-dialog {
    padding: 0.4rem;
    width: 100vw;
    max-width: 100vw;
    height: 96vh;
    max-height: 96vh;
  }

  .wb-body,
  .wb-figure {
    padding: 0.75rem;
  }

  .wb-controls,
  .wb-choices {
    grid-template-columns: 1fr;
  }

  .wb-controls label:has(input[type="range"]) {
    grid-column: auto;
  }
}
