:root {
  color-scheme: dark;
  --bg: #101317;
  --panel: #181c21;
  --panel-2: #1d2228;
  --panel-3: #242a31;
  --line: #303740;
  --line-strong: #444d58;
  --text: #eef1f4;
  --text-2: #b7bec7;
  --muted: #7f8995;
  --accent: #c8a96a;
  --accent-2: #e0c58c;
  --red: #bd6767;
  --blue: #6089b8;
  --green: #5f9a78;
  --radius: 6px;
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}

button,
input,
select,
output {
  font: inherit;
  font-variant-numeric: tabular-nums lining-nums;
}

button,
input,
select {
  color: inherit;
}

button {
  border: 0;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

.tool-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 54px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgb(16 19 23 / 96%);
  backdrop-filter: blur(10px);
}

.tool-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.tool-title h1 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: .01em;
}

.tool-title span {
  color: var(--muted);
  font-size: 12px;
}

.tool-header nav {
  display: flex;
  gap: 6px;
}

.tool-header button,
.selected-hero button,
.loadout-block header button,
.close-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text-2);
  cursor: pointer;
}

.tool-header button:hover,
.selected-hero button:hover,
.loadout-block header button:hover,
.close-button:hover {
  border-color: var(--line-strong);
  background: var(--panel-3);
  color: var(--text);
}

.workspace {
  display: grid;
  width: min(1600px, 100%);
  min-height: calc(100vh - 54px);
  grid-template-columns: 278px minmax(600px, 1fr) 340px;
  grid-template-areas: "hero build result";
  gap: 10px;
  padding: 10px;
  margin: 0 auto;
  align-items: stretch;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.hero-panel,
.build-panel,
.result-panel {
  padding: 12px;
  min-height: calc(100vh - 74px);
}

.hero-panel {
  grid-area: hero;
  align-self: start;
}

.hero-panel .selected-hero {
  min-width: 0;
}

.hero-panel .level-row {
  margin-top: 10px;
}

.hero-panel .stats-heading {
  margin-top: 9px;
}

.hero-panel .compact-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 5px;
}

.hero-panel .hero-list-heading {
  margin-top: 8px;
}

.hero-panel .hero-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.hero-panel .yuanliu-panel {
  margin-top: 8px;
}

.selected-hero {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.selected-hero img {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  object-fit: cover;
}

.selected-hero h2 {
  overflow: hidden;
  font-size: 18px;
  font-weight: 650;
  line-height: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-hero p {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-row {
  margin-top: 11px;
  padding: 9px 0 7px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.level-row label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-2);
  font-size: 12px;
}

.level-row output {
  min-width: 2ch;
  color: var(--accent-2);
  font-weight: 700;
  text-align: right;
}

.level-row input[type="range"] {
  display: block;
  width: 100%;
  height: 16px;
  margin: 4px 0 0;
  accent-color: var(--accent);
}

/* 英雄卡内的外部增益：沿用等级条的细线、深底和金色选中态，避免出现独立的表单风格。 */
.hero-boost-row {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}
.hero-boost-row .boost-caption { display: block; min-width: 0; }
.hero-boost-row .boost-caption strong { display: block; }
.hero-boost-row .boost-controls-row { display: flex; width: 100%; align-items: center; justify-content: flex-start; gap: 14px; }
.hero-boost-row .boost-control { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.hero-boost-row .boost-control > span { white-space: nowrap; }
.boost-controls-row { display: flex; align-items: center; gap: 10px; min-width: 0; }

.boost-caption {
  display: grid;
  gap: 1px;
  min-width: 43px;
}

.boost-caption strong {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 650;
}

.boost-caption small {
  color: var(--muted);
  font-size: 8px;
}

.boost-control {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.boost-control > span {
  color: var(--muted);
  font-size: 9px;
}

.boost-select-fit { width: 68px; }
.boost-select-fit .boost-current { width: 100%; min-width: 0; white-space: nowrap; }
.boost-aura-pair .boost-select-fit:first-child { width: 62px; }
.boost-aura-pair .boost-select-fit:last-child { width: 56px; }
.boost-select-fit .boost-menu { min-width: 100%; }
.boost-aura-pair {
  display: flex;
  align-items: center;
  gap: 3px;
}
.boost-aura-pair > div { min-width: 0; }
.boost-aura-pair .boost-current { min-width: 42px; }

.compact-toggle,
.support-tier select {
  height: 27px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--panel-3);
  color: var(--text-2);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.compact-toggle {
  min-width: 76px;
  padding: 0 9px;
  cursor: pointer;
}

.compact-toggle:hover,
.compact-toggle.active {
  border-color: var(--accent);
  background: #30291d;
  color: var(--accent-2);
}

.support-aura-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.boost-control .choice-segments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  min-width: 0;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
}

.boost-control .choice-segments button {
  min-width: 0;
  height: 22px;
  padding: 0 4px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
}

.boost-control .choice-segments button:hover,
.boost-control .choice-segments button.selected {
  background: #30291d;
  color: var(--accent-2);
}

.boost-control .choice-segments button:disabled {
  cursor: not-allowed;
  opacity: .38;
}

.boost-select {
  position: relative;
  min-width: 0;
}

.boost-current {
  display: flex;
  width: 100%;
  height: 26px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 7px 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--panel-3);
  color: var(--text-2);
  font-size: 9px;
  cursor: pointer;
}

.boost-current:hover,
.boost-select.open .boost-current {
  border-color: var(--accent);
  color: var(--accent-2);
}

.boost-current i {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .16s ease;
}

.boost-select.open .boost-current i {
  transform: rotate(225deg) translate(-1px, -1px);
}

.boost-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  display: none;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--panel-2);
  box-shadow: 0 8px 18px rgb(0 0 0 / 28%);
}

.boost-select.open .boost-menu {
  display: grid;
  gap: 2px;
}

.boost-menu button {
  height: 24px;
  padding: 0 6px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--text-2);
  font-size: 9px;
  text-align: left;
  cursor: pointer;
}

.boost-menu button:hover,
.boost-menu button.selected {
  background: #30291d;
  color: var(--accent-2);
}

.boost-menu button:disabled {
  cursor: not-allowed;
  opacity: .38;
}

.support-aura-control > span,
.support-tier > span {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.support-aura-control .choice-segments {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  min-width: 0;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
}

.support-aura-control .choice-segments button {
  min-width: 0;
  height: 22px;
  padding: 0 5px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
}

.support-aura-control .choice-segments button:hover,
.support-aura-control .choice-segments button.selected {
  background: #30291d;
  color: var(--accent-2);
}

.support-aura-control .choice-segments button:disabled {
  cursor: not-allowed;
  opacity: .38;
}

.support-tier {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 4px;
}

.support-tier select {
  width: 46px;
  padding: 0 3px;
  color: var(--text-2);
  outline: 0;
}

.support-tier select:focus,
.compact-toggle:focus-visible,
.support-aura-control button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

.compact-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 5px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--line);
}

.stats-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
}

.stats-heading h3 {
  font-size: 11px;
  font-weight: 650;
}

.stats-heading span {
  color: var(--muted);
  font-size: 9px;
}

.compact-stats > div {
  min-width: 0;
  padding: 6px 8px;
  background: var(--panel-2);
}

.compact-stats > div:last-child:nth-child(odd) {
  grid-column: auto;
}

.compact-stats dt,
.hero-detail-stats dt {
  color: var(--muted);
  font-size: 10px;
  line-height: 15px;
}

.compact-stats dt,
.compact-stats dd {
  text-align: center;
}

.compact-stats dd,
.hero-detail-stats dd {
  overflow: visible;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
  white-space: normal;
  font-variant-numeric: tabular-nums lining-nums;
}

.compact-stats > div:nth-child(10) dd,
.compact-stats > div:nth-child(11) dd {
  font-size: 11px;
  white-space: nowrap;
}

.attack-model {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1px 8px;
  margin-top: 8px;
  padding: 7px 8px;
  border-left: 2px solid var(--accent);
  background: var(--panel-2);
}

.attack-model span,
.attack-model small {
  color: var(--muted);
  font-size: 10px;
}

.attack-model strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums lining-nums;
}

.attack-model small {
  grid-column: 1 / -1;
}

.yuanliu-panel {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #5a4d35;
  border-radius: 4px;
  background: #211e19;
}

.yuanliu-panel[hidden] {
  display: none;
}

.yuanliu-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.yuanliu-title strong {
  font-size: 11px;
}

.yuanliu-title span {
  color: var(--accent-2);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.enhancement-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-top: 7px;
}

.enhancement-options button {
  min-width: 0;
  min-height: 28px;
  padding: 0 3px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.enhancement-options button.selected {
  border-color: var(--accent);
  background: #30291d;
  color: var(--accent-2);
}

#yuanliuEnhancementNote {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.hero-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  margin-top: 8px;
}

.hero-list-heading h3 {
  font-size: 12px;
  font-weight: 600;
}

.hero-list-heading span {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

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

.hero-option {
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 3px;
  padding: 4px 2px 5px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

.hero-option:hover {
  background: var(--panel-2);
  color: var(--text);
}

.hero-option.selected {
  border-color: var(--accent);
  background: #29251d;
  color: var(--accent-2);
}

.hero-option img {
  width: 38px;
  height: 38px;
  border-radius: 3px;
  object-fit: cover;
}

.hero-option span {
  display: block;
  overflow: hidden;
  width: 100%;
  font-size: 10px;
  line-height: 14px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.build-panel {
  grid-area: build;
  display: grid;
  align-content: start;
  gap: 10px;
}

.loadout-block,
.target-block {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-2);
}

.loadout-block > header,
.target-block > header,
.result-header,
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.loadout-block > header > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.loadout-block h2,
.target-block h2,
.result-header h2,
.dialog-header h2 {
  font-size: 14px;
  font-weight: 650;
  line-height: 20px;
}

.loadout-block header span,
.target-block header span,
.result-header span,
.dialog-header span {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums lining-nums;
}

.equipped-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}
.equipment-quantity-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.equipment-quantity-control { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 2px 5px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel-3); font-size: 9px; }
.equipment-quantity-control img { width: 18px; height: 18px; object-fit: contain; }
.equipment-quantity-control span { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.equipment-quantity-control button { width: 20px; height: 20px; padding: 0; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--panel-2); color: var(--text); font-size: 14px; line-height: 18px; }
.equipment-quantity-control output { min-width: 18px; color: var(--accent-2); text-align: center; font-variant-numeric: tabular-nums; }

/* 数量栏属于装备区自身的第二行，不能压进六张装备卡的网格。 */
.equipment-block .equipment-quantity-controls { flex: 0 0 auto; min-height: 32px; }

.equipment-slot {
  position: relative;
  min-width: 0;
  min-height: 112px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-3);
}

.equipment-slot:hover {
  border-color: var(--line-strong);
}

.equipment-slot[draggable="true"] { cursor: grab; }
.equipment-slot.dragging { opacity: .45; }
.equipment-slot.drag-over { border-color: var(--accent); background: #30291d; }

.equipment-total-price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #d8b35f;
  font-variant-numeric: tabular-nums;
}

/* 装备卡沿用游戏内“图标居中、名称在下、价格弱化”的信息层级。 */
.equipment-main b {
  display: grid;
  justify-items: center;
  gap: 1px;
  line-height: 12px;
}
.equipment-main b em { max-width: 100%; }
.equipment-main b small {
  margin: 0;
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
}

.coin-icon {
  display: inline-grid;
  width: 12px;
  height: 12px;
  place-items: center;
  border: 1px solid #a9782e;
  border-radius: 50%;
  background: #d6a842;
  color: #6b4814;
  font-size: 6px;
  font-style: normal;
  line-height: 1;
  vertical-align: -1px;
}

.equipment-main b {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.equipment-main b em,
.equipment-main b small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-main b small {
  flex: 0 0 auto;
  color: #d8b35f;
  font-size: .9em;
  font-weight: 600;
}

/* 被动控制放在卡片底部流式布局，名称和图标不再被遮挡。 */
.equipment-slot {
  display: flex;
  flex-direction: column;
}

.equipment-slot .equipment-main {
  flex: 1 1 auto;
  min-height: 0;
}

.equipment-slot > .item-passive-toggle,
.equipment-slot > .item-passive-auto,
.equipment-slot > .item-proc-control {
  position: static;
  width: auto;
  margin: 0 4px 4px;
}

.equipment-slot > .equipment-remove {
  z-index: 2;
}
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.equipment-main {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 84px;
  align-content: center;
  justify-items: center;
  grid-template-rows: 10px 42px 28px;
  gap: 3px;
  padding: 8px 4px 4px;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
}

.equipment-main:hover {
  background: rgb(255 255 255 / 2%);
}

.equipment-main > span {
  position: absolute;
  top: 3px;
  left: 5px;
  color: var(--muted);
  font-size: 9px;
}

.equipment-main img {
  width: 45px;
  height: 45px;
  object-fit: contain;
  justify-self: center;
  align-self: center;
}

.equipment-main b {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
  width: 100%;
  color: var(--text-2);
  font-size: 9px;
  font-weight: 500;
  line-height: 13px;
  text-align: center;
  white-space: nowrap;
}

.equipment-main b em,
.equipment-main b small {
  display: inline;
  font-style: normal;
  white-space: nowrap;
}

.equipment-main b small {
  flex: 0 0 auto;
  color: #d8b35f;
  font-size: .9em;
}

.equipment-main b small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 8px;
}

.equipment-slot.empty {
  background: transparent;
}

.equipment-slot.empty .equipment-main b {
  color: var(--muted);
  font-size: 22px;
  font-weight: 300;
}

.equipment-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 2;
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgb(16 19 23 / 88%);
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.equipment-remove:hover {
  border-color: #936363;
  color: #e39a9a;
}

.item-passive-toggle,
.item-passive-auto {
  position: absolute;
  right: 4px;
  bottom: 4px;
  left: 4px;
  display: flex;
  height: 21px;
  align-items: center;
  gap: 4px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #1b2025;
  color: var(--muted);
  font-size: 8px;
  cursor: pointer;
}

.item-passive-toggle i,
.item-passive-auto i {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #66717c;
}

.item-passive-toggle span {
  overflow: hidden;
  flex: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-passive-toggle b {
  color: inherit;
  font-weight: 600;
}

.item-passive-toggle.active {
  border-color: #6c5a32;
  background: #29251d;
  color: #ddc47f;
}

.item-passive-toggle.active i,
.item-passive-auto i {
  background: #d2b66f;
}

.item-passive-auto {
  justify-content: center;
  cursor: default;
}

.combat-state-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 9px;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
}

.combat-state-toggle {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 54px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-3);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.combat-state-toggle > span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  color: var(--text-2);
  font-size: 10px;
  white-space: normal;
}

.combat-state-toggle i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border: 1px solid var(--muted);
  border-radius: 50%;
}

.combat-state-toggle > b,
.combat-state-toggle > small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
}

.combat-state-toggle > small {
  grid-column: 1 / -1;
  overflow: hidden;
  line-height: 1.4;
  white-space: normal;
}

.combat-choice {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-3);
}

.combat-choice strong {
  color: var(--text-2);
  font-size: 10px;
}

.combat-choice p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.choice-segments {
  display: flex;
  gap: 3px;
}

.choice-segments button {
  min-width: 32px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text-2);
  cursor: pointer;
}

.choice-segments button.active {
  border-color: var(--accent);
  background: #30291d;
  color: var(--accent-2);
}

.combat-counter,
.skill-state-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-3);
}

.combat-counter {
  grid-column: 1 / -1;
}

.combat-counter.active,
.skill-state-row.active {
  border-color: #6c5a32;
  background: #29251d;
}

.combat-counter > div:first-child,
.skill-copy {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 8px;
}

.combat-counter strong,
.skill-copy strong {
  color: var(--text-2);
  font-size: 10px;
}

.combat-counter > div:first-child > span,
.skill-copy > span {
  overflow: hidden;
  color: var(--accent-2);
  font-size: 9px;
  white-space: normal;
}

.combat-counter .inline-counter {
  align-self: center;
}

.combat-counter p,
.skill-copy p {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-copy p {
  display: -webkit-box;
  overflow: hidden;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.skill-state-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 9px;
}

.skill-state-row:only-child {
  grid-column: 1 / -1;
}

.skill-card-result {
  display: grid;
  min-width: 86px;
  justify-items: end;
  gap: 1px;
}

.skill-card-result > strong {
  color: var(--accent-2);
  font-size: 17px;
  font-weight: 680;
  line-height: 20px;
  font-variant-numeric: tabular-nums lining-nums;
}

.skill-card-result > small {
  color: var(--muted);
  font-size: 8px;
}

.skill-card-result .skill-number-input {
  margin-top: 4px;
}

.inline-counter {
  display: grid;
  grid-template-columns: 24px minmax(18px, auto) auto 24px;
  align-items: center;
  gap: 3px;
}

.inline-counter button {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text-2);
  cursor: pointer;
}

.inline-counter output {
  min-width: 18px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  text-align: right;
}

.inline-counter > span {
  color: var(--muted);
  font-size: 9px;
}

.skill-number-input {
  display: grid;
  grid-template-columns: auto 58px auto;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
}

.skill-number-input input {
  width: 58px;
  height: 28px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
  font-variant-numeric: tabular-nums lining-nums;
  text-align: center;
}

.skill-number-input b {
  color: var(--text-2);
  font-size: 10px;
  font-weight: 600;
}

.combat-state-toggle.active {
  border-color: #6c5a32;
  background: #29251d;
}

.combat-state-toggle.active i {
  border-color: var(--accent-2);
  background: var(--accent-2);
}

.combat-state-toggle.active > b {
  color: var(--accent-2);
}

.empty-combat-state {
  color: var(--muted);
  font-size: 10px;
}

.stat-summary {
  margin-top: 8px;
  color: var(--accent-2);
  font-size: 10px;
  line-height: 17px;
  white-space: normal;
}

.rune-summary {
  margin-top: 7px;
}

.rune-summary .stat-summary {
  margin: 0 0 5px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}

.rune-summary-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 25px;
}

.rune-summary-row > span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.rune-summary-row i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.rune-summary-row.rune-red i {
  color: var(--red);
}

.rune-summary-row.rune-blue i {
  color: var(--blue);
}

.rune-summary-row.rune-green i {
  color: var(--green);
}

.rune-picks {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 4px;
}

.rune-picks > span {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
  padding: 2px 5px 2px 2px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel-3);
}

.rune-picks img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.rune-picks b,
.rune-picks em {
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  font-weight: 500;
  white-space: nowrap;
}

.target-block {
  padding-bottom: 12px;
}

.target-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 9px;
}

.target-grid label {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.target-grid label span {
  color: var(--muted);
  font-size: 10px;
}

.target-grid input,
.target-grid select,
.search-control input {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-variant-numeric: tabular-nums lining-nums;
}

.target-grid select {
  text-align: center;
  text-align-last: center;
}

.target-grid input {
  text-align: center;
}

.result-panel {
  grid-area: result;
  align-self: start;
}

.result-header {
  min-height: 30px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.result-header span {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel-2);
}

.dps-result {
  padding: 16px 4px 14px;
  border-bottom: 1px solid var(--line);
}

.dps-result > span {
  color: var(--muted);
  font-size: 11px;
}

.dps-result strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--text);
  font-size: clamp(36px, 3.3vw, 48px);
  font-weight: 680;
  line-height: 1.12;
  letter-spacing: -.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums lining-nums;
}

.dps-result small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.result-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--line);
}

.result-metrics > div {
  min-width: 0;
  padding: 8px 9px;
  background: var(--panel-2);
}

.result-metrics span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 15px;
  text-align: center;
}

.result-metrics strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  line-height: 21px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums lining-nums;
  text-align: center;
}

.damage-bars {
  display: grid;
  gap: 8px;
  margin-top: 13px;
}

.damage-bars > div {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 62px;
  align-items: center;
  gap: 7px;
}

.damage-bars span,
.damage-bars strong {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.damage-bars strong {
  text-align: right;
}

.damage-bars i {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--panel-3);
}

.damage-bars b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #c28c5a;
}

.damage-bars b.onhit {
  background: #608cb2;
}

.damage-bars b.skill {
  background: #8b78b0;
}

.calculation-details {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 11px;
}

.calculation-details > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.calculation-details h3 {
  font-size: 12px;
  font-weight: 650;
}

.calculation-details header span {
  color: var(--muted);
  font-size: 9px;
}

#calculationBreakdown {
  display: grid;
  gap: 1px;
  margin-top: 7px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--line);
}

#calculationBreakdown article {
  min-width: 0;
  padding: 7px 8px;
  background: var(--panel-2);
}

#calculationBreakdown article > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#calculationBreakdown strong,
#calculationBreakdown b {
  font-size: 10px;
  font-weight: 600;
}

#calculationBreakdown b {
  color: var(--accent-2);
  text-align: right;
}

#calculationBreakdown p,
#calculationBreakdown small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

#calculationBreakdown .skill-detail {
  border-left: 2px solid #8b78b0;
}

.model-warning {
  margin-top: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
}

.model-warning[hidden] {
  display: none;
}

.passive-state-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.passive-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border: 1px solid #554a32;
  border-radius: 3px;
  background: #29251d;
  color: #d3bb82;
  font-size: 9px;
}

.passive-state i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.passive-state.conditional {
  border-color: var(--line-strong);
  background: var(--panel-3);
  color: #aab5c0;
}

.passive-state.active {
  border-color: #6c5a32;
  background: #29251d;
  color: #ddc47f;
}

.passive-state.inactive {
  border-color: var(--line);
  background: var(--panel-3);
  color: var(--muted);
}

.model-warning > strong {
  font-size: 11px;
  font-weight: 650;
}

.model-warning p,
.model-warning li {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.model-warning p {
  margin-top: 5px;
}

.model-warning ul {
  margin: 5px 0 0;
  padding-left: 16px;
}

dialog {
  width: min(1040px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 22px 70px rgb(0 0 0 / 55%);
}

dialog::backdrop {
  background: rgb(5 7 9 / 74%);
  backdrop-filter: blur(4px);
}

.dialog-shell {
  display: flex;
  max-height: calc(100vh - 30px);
  flex-direction: column;
  padding: 14px;
}

.dialog-header {
  flex: 0 0 auto;
  min-height: 38px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}

.dialog-header > div {
  min-width: 0;
}

.dialog-header h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-header span {
  display: block;
  margin-top: 1px;
}

.dialog-toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: end;
  gap: 12px;
  padding: 11px 0;
}

.search-control {
  display: grid;
  width: 220px;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
}

.filter-tabs {
  display: flex;
  min-width: 0;
  flex: 1;
  gap: 4px;
  overflow-x: auto;
}

.filter-tabs button {
  min-width: 52px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text-2);
  cursor: pointer;
}

.filter-tabs button.selected {
  border-color: var(--accent);
  color: var(--accent-2);
}

.item-browser {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 12px;
  overflow: hidden;
}

.item-grid {
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: start;
  gap: 5px;
  padding-right: 3px;
  overflow-y: auto;
}

.item-quantity-panel { min-width: 0; overflow-y: auto; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-2); }

.item-card {
  display: grid;
  min-width: 0;
  min-height: 66px;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
}
.item-card-wrap { display: grid; min-width: 0; grid-template-rows: 66px 31px; gap: 3px; }
.item-card-wrap:not(.selected) { grid-template-rows: 66px 31px; }
.item-card-wrap.selected { display: grid; gap: 3px; }
.item-card-wrap.selected .item-card { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.item-card-status { display: grid; justify-items: center; gap: 0; min-width: 0; overflow: hidden; border: 1px solid var(--accent); border-top: 0; border-radius: 0 0 4px 4px; background: #29251d; }
.item-card-status > b { color: var(--accent-2); font-size: 9px; font-weight: 500; line-height: 10px; }
.item-card-quantity { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 18px; width: 100%; border: 0; border-radius: 0; background: transparent; }
.item-card-wrap:not(.selected)::after { content: ''; display: block; }
.item-card-quantity button { width: 19px; height: 17px; padding: 0; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--panel-2); color: var(--text); font-size: 12px; line-height: 14px; }
.item-card-quantity output { min-width: 18px; color: var(--accent-2); text-align: center; font-size: 10px; font-variant-numeric: tabular-nums; }
.item-card > b { min-width: 42px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }

.item-card:hover,
.item-card.inspected {
  border-color: var(--line-strong);
  background: var(--panel-3);
}

.item-card.selected {
  border-color: var(--accent);
  background: #29251d;
}

.item-card img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.item-card > span {
  min-width: 0;
}

.item-card strong,
.item-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-card strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}

.item-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.item-card > b {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.item-card.selected > b {
  color: var(--accent-2);
}

.item-inspector {
  min-height: 0;
  padding: 12px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-2);
}

.item-detail-dialog {
  width: min(460px, calc(100vw - 28px));
}

.item-detail-shell {
  min-height: 360px;
}

.standalone-item-detail {
  padding-top: 14px;
}

.inspector-identity {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}

.inspector-identity img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.inspector-identity span,
.inspector-identity small,
.item-inspector section > span,
.standalone-item-detail section > span {
  color: var(--muted);
  font-size: 10px;
}

.inspector-identity h3 {
  margin: 2px 0;
  font-size: 16px;
  font-weight: 650;
}

.item-inspector section,
.standalone-item-detail section {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.item-inspector section p,
.standalone-item-detail section p {
  margin-top: 5px;
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.7;
}

.detail-passive-note {
  margin-top: 11px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #20252b;
  color: var(--text-2);
  font-size: 10px;
}

.item-impact strong {
  color: var(--accent-2);
  font-weight: 650;
  font-variant-numeric: tabular-nums lining-nums;
}

.coverage-note {
  margin-top: 11px;
  padding: 8px;
  border-left: 2px solid var(--accent);
  background: var(--panel-3);
  color: var(--text-2);
  font-size: 10px;
}

.empty-state {
  color: var(--muted);
}

.rune-dialog-shell {
  width: 100%;
}

.rune-type-tabs {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 11px 0;
}

.rune-type-tabs button {
  display: flex;
  height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text-2);
  cursor: pointer;
}

.rune-type-tabs button.selected {
  border-color: currentColor;
  background: var(--panel-3);
}

.rune-type-tabs .rune-red.selected {
  color: #d68383;
}

.rune-type-tabs .rune-blue.selected {
  color: #7ca5d1;
}

.rune-type-tabs .rune-green.selected {
  color: #7eb593;
}

.rune-type-tabs b {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.rune-grid {
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 6px;
  overflow-y: auto;
}

.rune-row {
  display: grid;
  min-width: 0;
  min-height: 70px;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
}

.rune-row.active {
  border-color: var(--line-strong);
  background: var(--panel-3);
}

.rune-row img {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

/* 传承、轮回、怜悯的素材留白比例不同，统一缩进到铭文卡片的视觉安全区。 */
.rune-row.compact-rune-icon img {
  width: 50px;
  height: 50px;
  margin: auto;
  transform: scale(.74);
}

.rune-row h3 {
  font-size: 12px;
  font-weight: 650;
}

.rune-row p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.rune-counter {
  display: grid;
  grid-template-columns: 42px 28px 28px 28px 42px;
  align-items: center;
}

.rune-counter button {
  height: 28px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text-2);
  cursor: pointer;
  font-size: 10px;
}

.rune-counter output {
  color: var(--text);
  text-align: center;
}

.hero-details-dialog {
  width: min(820px, calc(100vw - 28px));
}

.hero-detail-poster {
  width: 100%;
  max-height: min(48vh, 400px);
  margin-top: 12px;
  border-radius: 4px;
  object-fit: cover;
  object-position: center;
}

.hero-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--line);
}

.hero-detail-stats > div {
  min-width: 0;
  padding: 7px 9px;
  background: var(--panel-2);
}

.hero-detail-stats > div:last-child:nth-child(odd) {
  grid-column: span 2;
}

.hero-detail-note {
  display: grid;
  gap: 2px;
  margin-top: 10px;
  padding: 9px 10px;
  border-left: 2px solid var(--accent);
  background: var(--panel-2);
}

.hero-detail-note strong {
  font-size: 11px;
}

.hero-detail-note span {
  color: var(--muted);
  font-size: 10px;
}

.sources-dialog {
  width: min(720px, calc(100vw - 28px));
}

.source-shell {
  overflow-y: auto;
}

.source-list {
  display: grid;
  gap: 5px;
  margin-top: 12px;
}

.source-list > * {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

.source-list a:hover {
  border-color: var(--line-strong);
  background: var(--panel-3);
}

.source-list span {
  color: var(--muted);
  font-size: 10px;
}

.source-list strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-caveat {
  margin-top: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
}

.source-caveat h3 {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 650;
}

.source-caveat h3:first-child {
  margin-top: 0;
}

.source-caveat p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

@media (max-width: 1000px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hero"
      "build"
      "result";
  }

  .hero-panel,
  .build-panel,
  .result-panel {
    min-height: auto;
  }

  .hero-panel {
    display: block;
  }

  .hero-panel .level-row {
    margin-top: 11px;
  }

  .hero-panel .stats-heading {
    margin-top: 9px;
  }

  .hero-panel .compact-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 5px;
  }

  .hero-panel .hero-list-heading {
    margin-top: 8px;
  }

  .hero-panel .hero-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .item-browser {
    grid-template-columns: minmax(0, 1fr) 230px;
  }

  .item-quantity-panel { flex: 0 0 auto; max-height: 180px; }

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

@media (max-width: 560px) {
  body {
    font-size: 12px;
  }

  .tool-header {
    height: 50px;
    padding: 0 10px;
  }

  .tool-title h1 {
    font-size: 15px;
  }

  .tool-title span {
    display: none;
  }

  .tool-header button {
    min-height: 28px;
    padding: 0 8px;
    font-size: 11px;
  }

  .workspace {
    min-height: calc(100vh - 50px);
    gap: 8px;
    padding: 8px;
  }

  .hero-panel,
  .build-panel,
  .result-panel {
    padding: 10px;
  }

  .hero-panel .hero-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .hero-option img {
    width: 42px;
    height: 42px;
  }

  .equipped-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .target-grid label:last-child {
    grid-column: 1 / -1;
  }

  .dialog-shell {
    padding: 10px;
  }

  .dialog-toolbar {
    display: grid;
    gap: 8px;
  }

  .search-control {
    width: 100%;
  }

  .item-browser {
    display: flex;
    flex-direction: column-reverse;
    overflow-y: auto;
  }

  .item-inspector {
    flex: 0 0 auto;
    max-height: 230px;
  }

  .item-grid {
    flex: 0 0 auto;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .rune-grid {
    grid-template-columns: 1fr;
  }

  .rune-type-tabs button {
    display: grid;
    height: 48px;
    justify-content: stretch;
    padding: 6px 8px;
    text-align: left;
  }

  .rune-type-tabs b {
    font-size: 10px;
  }

  .rune-row {
    grid-template-columns: 46px minmax(0, 1fr) auto;
  }

  .rune-row img {
    width: 46px;
    height: 46px;
  }

  .rune-row.compact-rune-icon img {
    width: 46px;
    height: 46px;
    transform: scale(.74);
  }

  .rune-counter {
    grid-template-columns: 38px 26px 24px 26px 38px;
  }

  .hero-detail-poster {
    max-height: 250px;
  }

  .hero-detail-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .source-list > * {
    grid-template-columns: 76px minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

/* 方案二主框架 + 左侧英雄轨道 */
:root {
  --bg: #0d1115;
  --panel: #151a20;
  --panel-2: #1a2027;
  --panel-3: #202730;
  --line: #2d3540;
  --line-strong: #46515f;
  --accent: #c6a15f;
  --accent-2: #e2c582;
  --radius: 5px;
}

body {
  background: #0d1115;
  font-variant-numeric: tabular-nums lining-nums;
}

.tool-header {
  height: 50px;
  padding: 0 14px;
  background: rgb(13 17 21 / 97%);
}

.tool-title {
  gap: 9px;
}

.tool-title h1 {
  font-size: 16px;
  font-weight: 660;
}

.tool-title span {
  padding-left: 9px;
  border-left: 1px solid var(--line-strong);
}

.workspace {
  width: min(1720px, 100%);
  min-height: calc(100vh - 50px);
  grid-template-columns: 118px minmax(680px, 1fr) minmax(330px, 370px);
  grid-template-areas: "hero build result";
  gap: 9px;
  padding: 9px;
  align-items: stretch;
}

.hero-panel,
.build-panel,
.result-panel {
  min-height: calc(100vh - 68px);
}

.hero-panel {
  position: sticky;
  top: 59px;
  display: flex;
  max-height: calc(100vh - 68px);
  align-self: start;
  flex-direction: column;
  padding: 8px;
  overflow: hidden;
}

.hero-panel .hero-list-heading {
  min-height: 31px;
  margin: 0;
  padding: 0 3px 7px;
  border-bottom: 1px solid var(--line);
}

.hero-panel .hero-list-heading h3 {
  font-size: 11px;
  letter-spacing: .08em;
}

.hero-panel .hero-grid {
  display: grid;
  min-height: 0;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 3px;
  padding: 7px 2px 4px 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.hero-panel .hero-option {
  grid-template-columns: 36px minmax(0, 1fr);
  justify-items: start;
  gap: 7px;
  min-height: 43px;
  align-items: center;
  padding: 3px 5px;
  border-color: transparent;
}

.hero-panel .hero-option:hover {
  border-color: var(--line);
}

.hero-panel .hero-option.selected {
  border-color: #74603b;
  background: #2a251c;
}

.hero-panel .hero-option img {
  width: 36px;
  height: 36px;
}

.hero-panel .hero-option span {
  font-size: 10px;
  text-align: left;
}

.build-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 9px;
  padding: 0;
  border: 0;
  background: transparent;
}

.hero-context-bar {
  display: grid;
  min-height: 72px;
  grid-template-columns: minmax(250px, .78fr) minmax(320px, 1.22fr);
  align-items: center;
  gap: 22px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.hero-context-bar .selected-hero {
  grid-template-columns: 46px minmax(0, 1fr) auto;
}

.hero-context-bar .selected-hero h2 {
  font-size: 17px;
}

.hero-context-bar .selected-hero p {
  font-size: 10px;
}

.hero-context-bar .level-row {
  margin: 0;
  padding: 0;
  border: 0;
}

.hero-context-bar .level-row label {
  font-size: 10px;
}

.hero-context-bar .level-row output {
  min-width: 28px;
  padding: 1px 6px;
  border: 1px solid #6f5d38;
  border-radius: 3px;
  background: #28231b;
  text-align: center;
}

.hero-context-bar .level-row input[type="range"] {
  height: 18px;
  margin-top: 5px;
}

.build-panel > .yuanliu-panel {
  margin: 0;
}

.build-columns {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  gap: 9px;
  align-items: start;
}

.build-column {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 9px;
}

.build-column-loadout {
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
}

.build-column-loadout .rune-block {
  min-height: 0;
}

.loadout-block,
.target-block {
  padding: 11px;
  border-radius: var(--radius);
  background: var(--panel);
}

.loadout-block > header {
  min-height: 30px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.loadout-block h2,
.target-block h2,
.result-header h2 {
  font-size: 13px;
}

.equipped-row {
  gap: 5px;
  margin-top: 9px;
}

.equipment-slot {
  min-height: 109px;
  background: var(--panel-2);
}

.equipment-main {
  min-height: 81px;
  padding-right: 2px;
  padding-left: 2px;
}

.equipment-main img {
  width: 42px;
  height: 42px;
}

.equipment-main b {
  font-size: 8px;
}

.item-passive-toggle,
.item-passive-auto {
  right: 3px;
  bottom: 3px;
  left: 3px;
  padding: 0 4px;
}

.item-passive-toggle span {
  display: none;
}

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

.skill-state-list {
  grid-template-columns: 1fr;
}

.skill-state-row:only-child {
  grid-column: auto;
}

.rune-summary-row {
  grid-template-columns: 68px minmax(0, 1fr);
  min-height: 31px;
}

.rune-picks > span {
  max-width: 100%;
}

.rune-picks b {
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-panel {
  position: sticky;
  top: 59px;
  display: flex;
  max-height: calc(100vh - 68px);
  align-self: start;
  flex-direction: column;
  padding: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.result-header {
  min-height: 33px;
}

.result-header > div {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.result-header span {
  padding: 0;
  border: 0;
  background: transparent;
}

.result-section {
  padding-top: 10px;
}

.result-panel .stats-heading {
  margin: 0 0 6px;
}

.result-panel .stats-heading h3 {
  font-size: 11px;
}

.result-panel .compact-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
}

.result-panel .compact-stats > div {
  padding: 5px 3px;
}

.result-panel .compact-stats dt {
  overflow: hidden;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-panel .compact-stats dd,
.result-panel .compact-stats > div:nth-child(10) dd,
.result-panel .compact-stats > div:nth-child(11) dd {
  overflow: visible;
  font-size: 10px;
  line-height: 18px;
  white-space: nowrap;
}

.result-panel .target-block {
  margin-top: 10px;
  padding: 9px;
  background: var(--panel-2);
}

.result-panel .target-block > header {
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.result-panel .target-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 7px;
}

.result-panel .target-grid .duration-control {
  grid-column: 1 / -1;
}

.result-panel .target-grid label {
  grid-template-columns: minmax(0, 1fr) 74px;
  align-items: center;
  gap: 6px;
  min-height: 29px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel-3);
}

.result-panel .target-grid label span {
  font-size: 9px;
}

.result-panel .target-grid input,
.result-panel .target-grid select {
  height: 27px;
  padding: 0 4px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 11px;
  text-align: right;
  text-align-last: right;
}

.result-panel .target-grid input:hover,
.result-panel .target-grid input:focus {
  border-color: var(--line-strong);
  background: var(--bg);
  outline: 0;
}

.result-panel .target-grid input {
  padding: 0 10px;
  text-align: right;
  cursor: text;
  overflow: visible;
  position: relative;
  top: 1px;
}

.result-panel .target-grid input::-webkit-inner-spin-button,
.result-panel .target-grid input::-webkit-outer-spin-button {
  margin-left: 8px;
  transform: translateY(1px);
}

.skill-rank-panel {
  padding: 7px 10px 8px;
  border-bottom: 1px solid var(--line);
}
.skill-rank-panel .stats-heading { margin-bottom: 4px; }
.skill-rank-panel .stats-heading h3 { font-size: 11px; }
#skillRankControls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}
.skill-rank-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px 20px 18px;
  align-items: center;
  gap: 2px;
  min-width: 0;
  height: 26px;
  padding: 0 3px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel-3);
}
.skill-rank-row strong { overflow: hidden; color: var(--text-2); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.skill-rank-row button { width: 18px; height: 18px; padding: 0; border: 1px solid var(--line-strong); border-radius: 2px; background: transparent; color: var(--text-2); line-height: 16px; }
.skill-rank-row button:disabled { opacity: .35; }
.skill-rank-row output { color: var(--accent-2); font-size: 10px; font-variant-numeric: tabular-nums; text-align: center; }
.skill-rank-row small { display: none; }

.dps-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2px 10px;
  padding: 12px 4px 10px;
}

.dps-result > span {
  align-self: center;
  color: var(--text-2);
  font-size: 11px;
}

.dps-result strong {
  margin: 0;
  color: var(--accent-2);
  font-size: 29px;
  letter-spacing: -.02em;
  text-align: right;
}

.dps-result small {
  grid-column: 1 / -1;
  margin: 0;
  text-align: right;
}

.result-metrics {
  margin-top: 9px;
}

.result-metrics > div {
  display: flex;
  min-height: 35px;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 6px 8px;
}

.result-metrics span,
.result-metrics strong {
  text-align: left;
}

.result-metrics strong {
  flex: 0 0 auto;
  font-size: 11px;
  text-align: right;
}

.damage-bars {
  margin-top: 11px;
}

.calculation-details {
  margin-top: 11px;
  padding-top: 9px;
}

.build-column .calculation-details {
  margin: 0;
  padding: 11px;
  border-top: 1px solid var(--line);
}

.build-column .calculation-details > header {
  min-height: 30px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.build-column .calculation-details h3 {
  font-size: 13px;
}

#calculationBreakdown {
  max-height: 188px;
  overflow-y: auto;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.build-column #calculationBreakdown {
  max-height: none;
}

.model-warning {
  margin-top: 10px;
  padding: 8px;
}

@media (max-width: 1280px) {
  .workspace {
    grid-template-columns: 104px minmax(620px, 1fr) 330px;
  }

  .hero-context-bar {
    grid-template-columns: minmax(220px, .72fr) minmax(280px, 1.28fr);
  }

  .hero-context-bar .selected-hero {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .hero-context-bar .selected-hero img {
    width: 42px;
    height: 42px;
  }

  .hero-context-bar .selected-hero button {
    padding: 0 8px;
    font-size: 10px;
  }

  .equipment-main img {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 96px minmax(0, 1fr);
    grid-template-areas:
      "hero build"
      "hero result";
  }

  .hero-panel {
    grid-row: 1 / span 2;
  }

  .result-panel {
    position: static;
    max-height: none;
  }

  .result-panel .compact-stats {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .result-panel .target-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .result-panel .target-grid .duration-control {
    grid-column: auto;
  }

  .result-panel .target-grid label {
    display: grid;
    grid-template-columns: 1fr;
    padding: 5px 7px;
  }
}

@media (max-width: 760px) {
  .workspace {
    display: block;
    padding: 8px;
  }

  .hero-panel,
  .build-panel,
  .result-panel {
    min-height: auto;
    margin-bottom: 8px;
  }

  .hero-panel {
    position: static;
    max-height: none;
  }

  .hero-panel .hero-list-heading {
    display: none;
  }

  .hero-panel .hero-grid {
    display: flex;
    padding: 0 0 3px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .hero-panel .hero-option {
    min-width: 64px;
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .hero-panel .hero-option span {
    text-align: center;
  }

  .hero-context-bar,
  .build-columns {
    grid-template-columns: 1fr;
  }

  .hero-context-bar {
    gap: 10px;
  }

  .result-panel .compact-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .result-panel .target-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-panel .target-grid .duration-control {
    grid-column: 1 / -1;
  }
}

/* 审计闭环：桌面端左右两列共用三段工作区，避免单独拉伸出的空盒。 */
@media (min-width: 1001px) {
  .build-columns {
    grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
    gap: 9px;
  }

  .build-column-loadout,
  .build-column-combat {
    grid-template-rows: 220px 280px minmax(0, 1fr);
    align-content: stretch;
  }

  .build-column > .loadout-block {
    min-height: 0;
    overflow: hidden;
  }

  .hero-context-block {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    align-content: center;
    gap: 12px;
  }

  .hero-context-block .selected-hero {
    grid-template-columns: 46px minmax(0, 1fr) auto;
  }

  .hero-context-block .level-row {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .hero-context-block .yuanliu-panel {
    min-height: 0;
    margin: 0;
  }

  .equipment-block,
  .rune-block,
  .calculation-details {
    display: flex;
    flex-direction: column;
  }

  .equipment-block .equipped-row {
    flex: 1 1 auto;
    min-height: 0;
    grid-auto-rows: minmax(0, 1fr);
  }

  .equipment-block .equipped-row { flex: 1 1 auto; min-height: 0; }
  .equipment-block .equipment-quantity-controls { flex: 0 0 34px; overflow-y: auto; }

  .equipment-block .equipment-slot {
    min-height: 0;
  }

  .rune-block .rune-summary {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    grid-template-rows: auto repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 0;
  }

  .rune-block .rune-summary-row {
    min-height: 0;
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .rune-block .rune-picks {
    align-content: center;
  }

  .combat-state-grid,
  .skill-state-list {
    grid-template-columns: 1fr;
  }

  .combat-state-grid {
    grid-auto-rows: minmax(0, 1fr);
  }

  .combat-state-toggle,
  .combat-choice,
  .combat-counter,
  .skill-state-row {
    min-height: 0;
  }

  .skill-state-list {
    grid-auto-rows: minmax(0, 1fr);
  }

  .build-column-combat .calculation-details {
    overflow: hidden;
  }

  .build-column-combat #calculationBreakdown {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-auto-rows: min-content;
    align-content: start;
  }

  .build-column-combat #calculationBreakdown article {
    min-height: 64px;
  }
}

/* “总伤害”的数值是文本，不继承进度条填充色。 */
.damage-bars section > header b {
  flex: initial;
  width: auto;
  height: auto;
  background: transparent;
  border-radius: 0;
}

/* 最终卡片布局覆盖：被动按钮跟随卡片内容流，不覆盖名称。 */
.equipment-slot > .item-passive-toggle,
.equipment-slot > .item-passive-auto,
.equipment-slot > .item-proc-control {
  position: static;
  inset: auto;
  width: auto;
  margin: 0 4px 4px;
}

.equipment-main b {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

/* 结果区与构筑区：保持信息层级，压缩重复内容 */
.hero-context-bar {
  grid-template-columns: minmax(250px, 1.08fr) minmax(210px, .72fr);
  gap: 14px;
}

.hero-context-bar .level-row {
  max-width: 290px;
  justify-self: end;
  width: 100%;
}

.equipment-slot {
  min-height: 98px;
}

.equipment-main {
  min-height: 71px;
}

.equipment-main img {
  width: 36px;
  height: 36px;
}

.item-proc-control {
  position: static;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  min-height: 27px;
  padding: 3px 4px 2px;
  border: 1px solid #3e4c58;
  border-radius: 3px;
  background: #1a222a;
  color: var(--muted);
  font-size: 8px;
  flex-wrap: nowrap;
  min-height: 36px;
  align-items: center;
}

.item-proc-control > span { display: block; grid-column: 1; grid-row: 1; }
.item-proc-control > small { grid-column: 1; grid-row: 2; color: var(--muted); white-space: nowrap; }
.item-proc-control > input { grid-column: 2; grid-row: 1 / span 2; }

.item-proc-control input {
  width: 38px;
  min-width: 38px;
  height: 24px;
  line-height: 20px;
  margin-left: auto;
  padding: 0 2px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--panel-3);
  color: var(--accent-2);
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.item-proc-control input::-webkit-inner-spin-button,
.item-proc-control input::-webkit-outer-spin-button { opacity: 1; }

input[type="number"] { line-height: 1.2; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { min-height: 16px; opacity: 1; }

.item-quantity-panel {
  min-width: 170px;
  padding: 12px;
  border-left: 1px solid var(--line);
}
.item-quantity-panel h3 { margin: 0 0 10px; font-size: 12px; }
.item-quantity-row { display: grid; grid-template-columns: 28px minmax(0,1fr) 42px; align-items: center; gap: 6px; padding: 5px 0; }
.item-quantity-row img { width: 28px; height: 28px; object-fit: contain; }
.item-quantity-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.item-quantity-row input { width: 42px; }
.item-proc-control output {
  min-width: 21px;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.item-choice-select { position: relative; margin: 0 4px 4px; }
.item-choice-current {
  display: flex;
  width: 100%;
  min-height: 22px;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 2px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--panel-3);
  color: var(--text-2);
  font-size: 8px;
  text-align: left;
}
.item-choice-current i,
.boost-current i { width: 6px; height: 6px; flex: 0 0 auto; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg) translateY(-1px); }
.item-choice-menu { position: absolute; right: 0; bottom: calc(100% + 3px); left: 0; z-index: 5; display: none; padding: 2px; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--panel-2); box-shadow: 0 8px 16px rgb(0 0 0 / 30%); }
.item-choice-select.open .item-choice-menu { display: grid; }
.item-choice-menu button { min-height: 20px; border: 0; background: transparent; color: var(--text-2); font-size: 8px; }
.item-choice-menu button.active, .item-choice-menu button:hover { background: #30291d; color: var(--accent-2); }

.damage-bars {
  gap: 10px;
}

.damage-bars section {
  display: grid;
  gap: 5px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.damage-bars section:first-child {
  padding-top: 0;
  border-top: 0;
}

.damage-bars section > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
}

.damage-bars section > header b {
  color: var(--text);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.damage-bars section > div {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 6px;
}

.damage-bars b.magic { background: #7a6eb2; }
.damage-bars b.true { background: #d0d7df; }

.build-column-combat .calculation-details {
  margin-top: 0;
}

/* 固定工作区骨架：切换英雄只更新内容，不移动卡片 */
.hero-context-bar {
  grid-template-columns: minmax(320px, .78fr) minmax(360px, 1.22fr);
}

.hero-context-bar .selected-hero {
  grid-template-columns: 46px minmax(0, 1fr) auto;
}

.hero-context-bar .selected-hero button { justify-self: start; }

.empty-combat-state,
.empty-skill-state {
  display: grid;
  min-height: 42px;
  margin: 0;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.result-panel .dps-result {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 8px 0 0;
  padding: 10px 10px 9px;
  border: 1px solid #574827;
  border-radius: 4px;
  background: #1a1b1b;
}

.result-panel .dps-result strong {
  color: var(--accent-2);
}

.damage-bars section {
  gap: 5px;
}

.damage-bars i { display: flex; }
.damage-bars b { flex: 0 0 auto; border-radius: 0; }
.damage-bars b:first-child { border-radius: 3px 0 0 3px; }
.damage-bars b:last-child { border-radius: 0 3px 3px 0; }
.damage-bars b.physical { background: #c75e5e; }
.damage-bars b.magic { background: #5f94cb; }
.damage-bars b.true { background: #e8edf2; }

@media (min-width: 1001px) {
  .build-panel {
    height: calc(100vh - 74px);
    min-height: calc(100vh - 74px);
  }

  .build-columns {
    min-height: 0;
    height: auto;
    flex: 1 1 auto;
    align-items: stretch;
  }

  .build-column {
    min-height: 0;
    height: 100%;
  }

  .build-column-loadout {
    grid-template-rows: minmax(310px, .85fr) minmax(0, 1.15fr);
  }

  .build-column-combat {
    grid-template-rows: 200px 158px minmax(0, 1fr);
  }

  .build-column-combat > .loadout-block {
    min-height: 0;
    overflow: auto;
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
  }

  .build-column-combat .calculation-details {
    overflow: hidden;
  }

  .build-column-combat #calculationBreakdown {
    max-height: none;
  }
}

@media (max-width: 480px) {
  .equipped-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .result-panel .compact-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 本轮结构修正：三列负载均衡、装备卡恢复完整被动开关 */

.equipped-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.equipment-slot {
  min-height: 118px;
  border-color: #343d48;
  background: #1b2128;
}

.equipment-slot:hover {
  border-color: #75633f;
  background: #1e252d;
}

.equipment-main {
  min-height: 88px;
  gap: 5px;
  padding: 9px 6px 5px;
  /* 清除浏览器按钮默认灰底，沿用装备卡片本身的深色表面。 */
  background: transparent;
}

.equipment-main img {
  width: 48px;
  height: 48px;
}

.equipment-main b {
  font-size: 9px;
  line-height: 14px;
}

.item-passive-toggle,
.item-passive-auto {
  right: 5px;
  bottom: 5px;
  left: 5px;
  height: 24px;
  padding: 0 6px;
  font-size: 8px;
}

.item-passive-toggle span {
  display: block;
}

.rune-summary-row {
  min-height: 36px;
}

.empty-combat-state {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  margin-top: 9px;
  border: 1px dashed var(--line);
  border-radius: 4px;
  background: var(--panel-2);
  text-align: center;
}

.result-panel .target-grid .duration-control {
  grid-template-columns: 68px minmax(0, 1fr);
}

.duration-segments {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
}

.duration-segments button {
  min-width: 0;
  height: 25px;
  padding: 0 3px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #171c22;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
}

.duration-segments button:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.duration-segments button.active {
  border-color: #8a7445;
  background: #2b251b;
  color: var(--accent-2);
}

#duration {
  position: absolute;
  width: 1px;
  height: 1px;
  text-align: center;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 1080px) {
  .build-panel > .calculation-details #calculationBreakdown {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .hero-boost-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .support-aura-control {
    grid-column: auto;
    grid-row: auto;
  }

  .boost-tier { grid-column: 2 / -1; }

  .build-panel > .calculation-details #calculationBreakdown {
    grid-template-columns: 1fr;
  }

  .result-panel .target-grid .duration-control {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}

/* 桌面端终版密度：把可用高度交给铭文与中栏三段内容，而非页面留白。 */
@media (min-width: 1001px) {
  .hero-panel .hero-grid {
    grid-auto-rows: minmax(48px, auto);
  }

  .build-column-loadout .rune-block {
    display: flex;
    flex-direction: column;
  }

  .build-column-loadout .rune-summary {
    display: grid;
    flex: 1 1 auto;
    align-content: start;
    gap: 7px;
  }

  .build-column-loadout .rune-summary-row {
    min-height: 54px;
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .build-column-loadout .rune-picks {
    align-content: center;
  }

  .build-column-loadout .rune-picks > span {
    padding: 3px 7px 3px 3px;
  }

  .build-column-loadout .rune-picks img {
    width: 26px;
    height: 26px;
  }

  .build-column-loadout .rune-picks b,
  .build-column-loadout .rune-picks em {
    font-size: 10px;
  }

  .build-column-combat .calculation-details {
    display: flex;
    flex-direction: column;
  }

  .build-column-combat #calculationBreakdown {
    flex: 1 1 auto;
    align-content: start;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 审计闭环最终覆盖：两列共用三段高度，卡片内部随段高填满。 */
@media (min-width: 1001px) {
  .build-column-loadout,
  .build-column-combat {
    grid-template-rows: 220px 280px minmax(0, 1fr);
  }

  .build-column > .loadout-block { min-height: 0; overflow: visible; }
  .build-column-loadout { position: relative; z-index: 4; }
  .hero-context-block { position: relative; z-index: 8; overflow: visible !important; }
  .equipment-block, .rune-block { position: relative; z-index: 1; }

  .hero-context-block {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    align-content: center;
    gap: 12px;
  }

  .hero-context-block .selected-hero { grid-template-columns: 46px minmax(0, 1fr) auto; }
  .hero-context-block .level-row { margin: 0; padding: 0; border: 0; }
  .hero-context-block .yuanliu-panel { min-height: 0; margin: 0; }

  .equipment-block,
  .rune-block,
  .build-column-combat .calculation-details { display: flex; flex-direction: column; }

  .equipment-block .equipped-row { flex: 1 1 auto; min-height: 0; grid-auto-rows: minmax(0, 1fr); }
  .equipment-block .equipment-slot { min-height: 0; }

  .rune-block .rune-summary {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    grid-template-rows: auto repeat(3, minmax(0, 1fr));
    align-items: stretch;
    align-content: stretch;
    gap: 0;
  }

  .rune-block .rune-summary-row { min-height: 0; grid-template-columns: 62px minmax(0, 1fr); }
  .rune-block .rune-picks { align-content: center; }

  .combat-state-grid,
  .skill-state-list { grid-template-columns: 1fr; }
  .combat-state-grid,
  .skill-state-list { grid-auto-rows: minmax(0, 1fr); }
  .combat-state-toggle,
  .combat-choice,
  .combat-counter,
  .skill-state-row { min-height: 0; }

  .build-column-combat #calculationBreakdown {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-auto-rows: min-content;
    align-content: start;
  }

  .build-column-combat #calculationBreakdown article { min-height: 64px; }
}

.damage-bars section > header b {
  flex: initial;
  width: auto;
  height: auto;
  background: transparent;
  border-radius: 0;
}
