.ha-analyzer,
.ha-insight {
  --ha-text-danger: color-mix(in srgb, var(--ui-color-danger) 72%, white);
}
.ha-notice-anchor {
  position: fixed;
  z-index: 8;
  pointer-events: none;
}
.ha-notice-anchor[hidden] {
  display: none;
}
.ha-analyzer {
  /* Fixed pixel badges need a viewport reference at fractional screen scales. */
  backdrop-filter: none;
  position: fixed;
  top: 69px;
  right: 9px;
  width: 280px;
  padding: 12px;
  z-index: 8;
  max-height: calc(100dvh - 162px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ui-color-border-subtle) transparent;
}
.ha-analyzer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ha-analyzer h1 {
  margin: 0;
  font: 700 12px var(--ui-font-display);
  letter-spacing: 0.035em;
  color: var(--ui-color-accent-strong);
}
.ha-session-time {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--ui-color-text-muted);
  font-size: 11px;
  white-space: nowrap;
}
.ha-session-time strong {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.ha-analyzer svg:not(.ha-chart) {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Two fixed lines per metric: the card's height never follows the numbers. */
.ha-metrics {
  display: grid;
  grid-template-columns: minmax(0, 0.84fr) minmax(0, 1fr);
  gap: 4px;
  margin-top: 8px;
}
.ha-metric {
  min-width: 0;
  padding: 3px 6px;
  border: 1px solid var(--ui-color-border);
  border-radius: 0;
  background: #101a2899;
  color: var(--ui-color-text);
  text-align: left;
}
.ha-metric:hover,
.ha-metric[aria-expanded="true"] {
  border-color: var(--ui-color-accent);
  background: #d4a8480b;
}
.ha-metric-label {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 16px;
  color: var(--ui-color-text-muted);
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
}
.ha-metric-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ha-metric small {
  flex: none;
  margin-left: auto;
  color: var(--ui-color-text-muted);
  font-size: 10px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.ha-metric small.ha-good {
  color: var(--ui-color-success);
}
.ha-metric small.ha-bad {
  color: var(--ha-text-danger);
}
.ha-metric-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.ha-analyzer .ha-metric-label svg {
  width: 12px;
  height: 12px;
}
.ha-metric-value > strong {
  min-width: 0;
  height: 20px;
  overflow: hidden;
  font: 600 16px/20px var(--ui-font-body);
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ha-metric-label .ui-icon {
  display: inline-block;
  font-size: 12px;
}
.ha-count-sprite {
  flex: none;
  width: 14px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ha-analyzer .icon-chevron-right {
  --ui-icon: url("/_assets/b88d45443fa2dbfe501f/icons/chevron-right.svg");
}
.ha-economy strong,
.ha-good {
  color: var(--ui-color-success);
}
.ha-bad,
.ha-economy strong.ha-bad {
  color: var(--ha-text-danger);
}
.ha-section {
  border-top: 1px solid var(--ui-color-border-subtle);
  margin-top: 6px;
  padding-top: 7px;
}
.ha-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}
.ha-section-heading h2 {
  display: flex;
  align-items: center;
  gap: 5px;
  font: 700 10px var(--ui-font-display);
  letter-spacing: 0.045em;
  color: var(--ui-color-accent);
  margin: 0;
}
.ha-section-heading h2 .ui-icon {
  font-size: 13px;
}
.ha-section-heading > button {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--ui-color-text-muted);
  font-size: 9px;
}
.ha-section-heading > button:hover {
  color: var(--ui-color-accent-strong);
}
.ha-helper-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 2px;
}
/* With VIP the capture call to action is hidden; its row must not stay. */
.ha-helper-actions:not(:has(> :not([hidden]))) {
  display: none;
}
.ha-helper-action {
  position: static;
}
.ha-analyzer
  .helper-shiny-control
  #shiny-ball-select
  .custom-select-trigger::before {
  content: none;
}
.ha-auto-catch-action {
  flex: 1;
  min-width: 0;
}
.ha-icon-auto-catch {
  --ui-icon: url("/_assets/b88d45443fa2dbfe501f/icons/settings.svg");
}
.ha-auto-catch-cta.ui-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--ui-space-2);
  width: 100%;
  min-height: 44px;
  padding: var(--ui-space-2) 46px var(--ui-space-2) var(--ui-space-2);
  border-color: var(--ui-color-primary);
  background: color-mix(
    in srgb,
    var(--ui-color-primary) 10%,
    var(--ui-color-surface-control)
  );
  color: var(--ui-color-text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
}
.ha-auto-catch-cta > .ui-icon {
  color: var(--ui-color-primary-hover);
  font-size: 20px;
}
.ha-auto-catch-cta:hover,
.ha-auto-catch-cta:focus-visible {
  border-color: var(--ui-color-primary-hover);
  background: color-mix(
    in srgb,
    var(--ui-color-primary) 18%,
    var(--ui-color-surface-control)
  );
  color: var(--ui-color-text);
}
.ha-auto-catch-vip {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--ui-color-border);
  border-radius: var(--ui-radius);
  background: var(--ui-color-background);
}
.ha-helper-toggle-label {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 80;
  width: max-content;
  max-width: min(240px, 100%);
  padding: 6px 8px;
  border: 1px solid var(--ui-color-border);
  background: var(--ui-color-background);
  box-shadow: 0 4px 13px #000a;
  color: var(--ui-color-text);
  font: 500 11px/1.3 var(--ui-font-body);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}
.ha-helper-action:hover .ha-helper-toggle-label,
.ha-helper-action:focus-within .ha-helper-toggle-label {
  opacity: 1;
  visibility: visible;
}
.manual-capture {
  border-top: 1px solid var(--ui-color-border);
  padding-top: var(--ui-space-2);
  margin-top: var(--ui-space-2);
}
.manual-capture[hidden] {
  display: none;
}
.manual-capture-heading {
  margin-bottom: var(--ui-space-1);
  font-size: 11px;
  color: var(--ui-color-text-muted);
}
.manual-capture-heading h2 {
  color: var(--ui-color-primary);
}
.manual-capture-hint {
  font-size: 11px;
  color: var(--ui-color-text-muted);
  margin: var(--ui-space-1) 0;
}
.manual-capture-list {
  max-height: 144px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}
.manual-capture-list li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--ui-color-border-subtle);
  padding: var(--ui-space-1) 0;
}
.manual-capture-portrait,
.manual-capture-portrait canvas {
  display: block;
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
}
.manual-capture-name {
  font-size: 12px;
  overflow-wrap: anywhere;
}
.manual-capture-list .ui-button {
  min-height: 36px;
  padding: var(--ui-space-1) var(--ui-space-2);
  font-size: 11px;
}
@media (pointer: coarse) {
  .manual-capture-list .ui-button {
    min-height: 44px;
  }
}
.ha-item-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.ha-item-name > span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.ha-item-name .ha-sprite {
  flex: none;
  width: 28px;
  height: 28px;
}
.ha-insight {
  position: fixed;
  z-index: 90;
  width: 360px;
  max-width: calc(100vw - 24px);
  padding: 16px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ui-color-border-subtle) transparent;
  background: var(--ui-color-background);
  box-shadow:
    0 0 0 2px #090a09c9,
    0 8px 30px #0009;
}
.ha-insight[hidden] {
  display: none;
}
.ha-insight[data-pinned="true"] {
  border-color: var(--ui-color-accent);
}
.ha-insight-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  position: absolute;
  top: 8px;
  right: 8px;
}
.ha-insight-tools button {
  color: var(--ui-color-text-muted);
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--ui-radius);
  font-size: 10px;
  padding: 4px 6px;
}
.ha-insight-tools button:hover {
  color: var(--ui-color-text);
  border-color: var(--ui-color-border-subtle);
}
#insight-pin[aria-pressed="true"] {
  color: var(--ui-color-accent-strong);
  border-color: var(--ui-color-border-subtle);
}
.ha-detail-heading {
  color: var(--ui-color-accent-strong);
  font: 700 15px var(--ui-font-display);
  margin: 0 100px 6px 0;
}
.ha-detail-subtitle {
  font-size: 12px;
  color: var(--ui-color-text-muted);
  margin: 0 0 14px;
  line-height: 1.45;
}
h3.ha-detail-subtitle {
  margin: 14px 0 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ui-color-accent);
}
.ha-detail-rows {
  padding: 0;
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
}
.ha-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.ha-detail-row > span {
  color: var(--ui-color-text-muted);
}
.ha-detail-row > strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.ha-detail-total {
  border-top: 1px solid var(--ui-color-border-subtle);
  padding-top: 9px;
}
.ha-detail-total > span,
.ha-detail-total > strong {
  color: var(--ui-color-text);
  font-weight: 700;
}
.ha-detail-total > strong.ha-good {
  color: var(--ui-color-success);
}
.ha-detail-total > strong.ha-bad {
  color: var(--ha-text-danger);
}
.ha-detail-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12px;
}
.ha-detail-table th {
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  color: var(--ui-color-text-muted);
  padding: 4px 0 7px;
}
.ha-detail-table td {
  padding: 5px 0;
  border-top: 1px solid #ffffff0c;
}
.ha-detail-table tbody th {
  padding: 5px 0;
  border-top: 1px solid #ffffff0c;
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ui-color-text);
}
.ha-detail-table td,
.ha-detail-table th {
  vertical-align: middle;
}
.ha-detail-table th:not(:first-child),
.ha-detail-table td:not(:first-child) {
  text-align: right;
  white-space: nowrap;
  padding-left: 10px;
}
.ha-detail-note {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--ui-color-text-muted);
  line-height: 1.5;
}
.ha-progress-row {
  margin: 9px 0;
  font-size: 12px;
}
.ha-progress-row > div:first-child,
.ha-progress-row > label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 3px;
}
.ha-progress-row strong {
  font-size: 11px;
  font-weight: 600;
  color: var(--ui-color-text-muted);
}
.ha-progress-row .ha-item-name .ha-sprite {
  width: 24px;
  height: 24px;
}
.ha-progress-row small {
  display: block;
  margin-top: 4px;
  padding-left: 31px;
  font-size: 10px;
}
.ha-progress {
  height: 4px;
  background: #ffffff0c;
  margin-left: 31px;
  overflow: hidden;
}
.ha-progress > i {
  display: block;
  height: 100%;
  background: var(--ui-color-accent);
}
.ha-progress-row:first-of-type .ha-progress > i {
  background: var(--ui-color-success);
}
.ha-chart {
  width: 100%;
  height: 94px;
  display: block;
  overflow: visible;
  color: var(--ui-color-success);
  margin: 12px 0 3px;
}
.ha-chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--ui-color-text-muted);
}
.ha-muted {
  color: var(--ui-color-text-muted);
}
.ha-sprite {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  object-fit: contain;
}

.ha-analyzer .helper-potion-row {
  grid-template-columns: minmax(0, 1fr) 61px;
}
.ha-analyzer .helper-potion-row .helper-control > div,
.ha-analyzer .helper-potion-row .custom-select,
.ha-analyzer .helper-potion-row .custom-select-trigger {
  height: 100%;
}
.ha-analyzer .helper-potion-row #potion-select .custom-select-menu {
  width: calc(100% + 66px);
}
.ha-analyzer #potion-select .custom-select-trigger .custom-select-primary {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}
.ha-analyzer .custom-select-trigger {
  min-height: 36px;
}
.ha-analyzer .ha-count-sprite img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  image-rendering: pixelated;
}
.ha-analyzer {
  max-height: calc(100dvh - 69px - 126px);
}
@media (max-width: 780px) {
  .ha-analyzer {
    top: 164px;
    max-height: calc(100dvh - 164px - 126px);
  }
}
@media (max-width: 650px) {
  .ha-analyzer .helper-potion-row {
    grid-template-columns: minmax(0, 1fr) 58px;
  }
  .ha-analyzer .helper-potion-row #potion-select .custom-select-menu {
    width: calc(100% + 63px);
  }
  .ha-analyzer #potion-select .custom-select-trigger {
    gap: 3px;
  }
  .ha-analyzer #potion-select .custom-select-trigger .custom-select-icon {
    width: 18px;
    height: 18px;
  }
  .party {
    width: 136px;
  }
  .ha-analyzer {
    top: 155px;
    right: 5px;
    width: 190px;
    padding: 9px;
    max-height: calc(100dvh - 155px - 126px);
  }
  .ha-analyzer h1 {
    font-size: 10px;
  }
  .ha-session-time {
    font-size: 9px;
    gap: 3px;
  }
  .ha-session-time svg {
    display: none;
  }
  .ha-metrics {
    margin-top: 5px;
  }
  .ha-metric {
    padding: 3px 5px;
  }
  /* Names and rates come before the decorative icons on a phone. */
  .ha-metric-label > :is(svg, .ui-icon, .ha-count-sprite) {
    display: none;
  }
  .ha-metric-value > strong {
    font-size: 14px;
  }
  .ha-section-heading h2 {
    font-size: 9px;
  }
  .ha-helper-toggle-label {
    max-width: 100%;
  }
  .ha-insight {
    padding: 14px;
  }
}
@media (max-width: 350px) {
  .party {
    width: calc(100vw - 210px);
  }
  .ha-metric-value > strong {
    font-size: 13px;
  }
  .ha-metric small {
    display: none;
  }
}
