:root {
  --gym-statistics-width: 296px;
}
.gym-statistics-toggle {
  white-space: nowrap;
}
.gym-statistics {
  position: fixed;
  z-index: 46;
  top: calc(var(--navbar-height, 76px) + 54px);
  left: var(--ui-space-3);
  bottom: auto;
  display: flex;
  flex-direction: column;
  width: min(var(--gym-statistics-width), calc(100vw - 24px));
  max-height: min(480px, calc(100dvh - var(--navbar-height, 76px) - 210px));
  min-height: 180px;
  color: var(--ui-color-text);
  background: var(--ui-color-surface);
  border: 1px solid var(--ui-color-border);
  border-radius: var(--ui-radius);
  font: 13px/1.3 var(--ui-font-body);
  box-shadow: 0 4px 12px #0005;
  pointer-events: auto;
}
.gym-statistics[hidden],
.gym-statistics [hidden] {
  display: none;
}
.gym-statistics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ui-space-2);
  padding: var(--ui-space-2);
  border-bottom: 1px solid var(--ui-color-border);
}
.gym-statistics h2 {
  margin: 0;
  font: 20px/1 var(--ui-font-display);
}
.gym-statistics-header > div > span {
  color: var(--ui-color-text-muted);
  font-size: 11px;
}
.gym-statistics-header .ui-button {
  min-height: 30px;
  padding: 4px 8px;
}
.gym-statistics-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  padding: var(--ui-space-2);
}
.gym-statistics-teams {
  display: flex;
  grid-column: 1 / -1;
  gap: var(--ui-space-1);
}
.gym-statistics-teams .ui-button {
  flex: 1;
  min-width: 0;
  min-height: 30px;
  padding: 4px 8px;
  font-size: 13px;
}
.gym-statistics-teams [aria-pressed="true"] {
  border-color: var(--ui-color-primary);
  color: var(--ui-color-on-primary);
  background: var(--ui-color-action);
}
.gym-statistics-controls label {
  display: grid;
  gap: 2px;
  color: var(--ui-color-text-muted);
  font-size: 12px;
}
.gym-statistics select {
  min-width: 0;
  width: 100%;
  min-height: 30px;
  padding: 4px 6px;
  border: 1px solid var(--ui-color-border);
  border-radius: var(--ui-radius);
  background: var(--ui-color-surface-control);
  color: var(--ui-color-text);
  font: 13px var(--ui-font-body);
}
.gym-statistics :is(button, select):focus-visible {
  outline: var(--ui-focus-width) solid var(--ui-color-focus);
  outline-offset: var(--ui-focus-offset);
}
.gym-statistics-note,
.gym-statistics-partial {
  flex-shrink: 0;
  margin: 0 var(--ui-space-2) var(--ui-space-2);
  color: var(--ui-color-text-muted);
  font-size: 12px;
}
.gym-statistics-note {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.gym-statistics-partial {
  padding-left: var(--ui-space-2);
  border-left: 2px solid var(--ui-color-accent);
}
.gym-statistics-summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px var(--ui-space-2);
  padding: 6px var(--ui-space-2);
  border-top: 1px solid var(--ui-color-border);
  border-bottom: 1px solid var(--ui-color-border);
}
.gym-statistics-summary > span {
  flex-shrink: 0;
  color: var(--ui-color-text-muted);
  font-size: 11px;
}
.gym-statistics-rows {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 0 var(--ui-space-2);
}
.gym-statistics-row {
  border-bottom: 1px solid var(--ui-color-border-subtle);
}
.gym-statistics-pokemon {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 48px;
  padding: 4px var(--ui-space-1) 10px;
  border: 0;
  background: transparent;
  color: var(--ui-color-text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.gym-statistics-pokemon:hover,
.gym-statistics-pokemon[aria-expanded="true"] {
  background: var(--ui-color-surface-control);
}
.gym-statistics-sprite {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
}
.gym-statistics-sprite img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  object-fit: contain;
}
.gym-statistics-identity,
.gym-statistics-amount {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.gym-statistics-identity > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gym-statistics-identity > small,
.gym-statistics-amount > small {
  font-size: 11px;
  color: var(--ui-color-text-muted);
}
.gym-statistics-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.gym-statistics-bar {
  position: absolute;
  bottom: 4px;
  left: 42px;
  right: 4px;
  height: 4px;
  background: var(--ui-color-surface-control);
}
.gym-statistics-bar > span {
  display: block;
  height: 100%;
  background: var(--ui-color-accent-strong);
}
.gym-statistics-detail {
  padding: var(--ui-space-2);
  background: var(--ui-color-surface-raised);
}
.gym-statistics-breakdown {
  display: grid;
  gap: var(--ui-space-1);
  margin: 0;
  font-size: 12px;
}
.gym-statistics-breakdown > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--ui-space-2);
}
.gym-statistics-breakdown dt {
  color: var(--ui-color-text-muted);
}
.gym-statistics-breakdown dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.gym-statistics-detail h3 {
  margin: var(--ui-space-3) 0 var(--ui-space-1);
  font-size: 13px;
}
.gym-statistics-moves {
  display: grid;
  gap: var(--ui-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.gym-statistics-moves li {
  display: flex;
  flex-direction: column;
  overflow-wrap: anywhere;
  font-size: 12px;
}
.gym-statistics-moves li > span {
  color: var(--ui-color-text-muted);
}
.gym-statistics-empty {
  padding: var(--ui-space-3) var(--ui-space-1);
}
@media (max-width: 959px) {
  .gym-statistics {
    top: var(--gym-statistics-mobile-top, 80px);
    left: var(--ui-space-2);
    right: auto;
    bottom: auto;
    width: min(var(--gym-statistics-width), calc(100vw - 16px));
    max-height: 52dvh;
    min-height: 0;
  }
  .gym-statistics-header {
    padding: 6px var(--ui-space-2);
  }
  .gym-statistics-header .ui-button,
  .gym-statistics select,
  .gym-statistics-teams .ui-button {
    min-height: 44px;
  }
  .gym-statistics-controls {
    padding-top: var(--ui-space-2);
  }
  .gym-statistics-rows {
    min-height: 64px;
  }
}
@media (min-width: 521px) and (max-width: 959px) and (max-height: 500px) {
  #gym-world-hud .gym-details-toggle {
    grid-column: 1 / -1;
  }
  #gym-world-hud .gym-exit {
    grid-column: 1 / -1;
    grid-row: 3;
  }
  .gym-statistics {
    top: calc(var(--navbar-height, 56px) + 4px);
    bottom: 8px;
    right: auto;
    width: var(--gym-statistics-width);
    max-height: none;
  }
  .gym-statistics-controls {
    gap: 4px;
  }
}
