/* Directory */
.brawler-directory-title-box {
  width: min(100%, 760px);
  margin-inline: auto;
}

.brawler-directory-list {
  gap: var(--margin-base);
}

.brawler-directory-section {
  padding: 14px;
  border-width: 1px;
}

.brawler-rarity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--margin-sm);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.brawler-rarity-title {
  display: inline-flex;
  align-items: center;
  margin: 0;
  font-size: var(--font-sm);
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.brawler-rarity-count {
  margin: 0;
  padding: 3px 7px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  font-size: var(--font-sm);
  color: var(--color-text-30);
  line-height: 1.2;
  white-space: nowrap;
}

.brawler-directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 7px;
}

.brawler-directory-link {
  display: block;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brawler-directory-card {
  height: 100%;
  min-height: 88px;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px;
  border-width: 1px;
  background: rgba(0, 0, 0, 0.14);
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.brawler-directory-card.card.link:hover,
.brawler-directory-link:focus-visible .brawler-directory-card {
  border-width: 1px;
  border-color: rgba(0, 255, 132, 0.24);
  background: rgba(0, 255, 132, 0.035);
}

.brawler-directory-link:focus-visible {
  border-radius: var(--border-radius);
  outline: 1px solid var(--color-cyan);
  outline-offset: 2px;
}

.brawler-directory-icon {
  width: 50px;
  min-width: 50px;
  max-width: 50px;
  height: 50px;
  margin: 0 auto 2px;
  padding: 2px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  object-fit: contain;
}

.brawler-directory-name {
  margin: 0;
  width: 100%;
  text-align: center;
  font-size: var(--font-sm);
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hero */
.brawler-hero {
  display: flex;
  flex-direction: column;
  gap: var(--margin-sm);
}

.brawler-hero-header {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--margin-base);
}

.brawler-hero .brawler-detail-icon {
  width: 84px;
  min-width: 84px;
  max-width: 84px;
  height: 84px;
  margin: 0;
  border-width: 3px;
}

.brawler-identity {
  min-width: 0;
}

.brawler-hero-name {
  margin: 0;
  font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem);
  line-height: 1.1;
}

.brawler-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.brawler-meta-pill {
  font-size: var(--font-xs);
  color: var(--color-text-80);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 4px 9px;
  background-color: rgba(0, 0, 0, 0.2);
}

.brawler-power-control {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.brawler-power-label {
  font-size: var(--font-xs);
  color: var(--color-cyan);
  font-weight: 750;
  text-transform: uppercase;
}

.brawler-power-select-wrap {
  position: relative;
  display: inline-flex;
  min-width: 116px;
}

.brawler-power-select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 12px;
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--color-cyan);
  border-bottom: 2px solid var(--color-cyan);
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}

.brawler-power-select {
  width: 100%;
  min-height: 36px;
  padding: 7px 34px 7px 11px;
  border: 1px solid rgba(255, 190, 32, 0.18);
  border-radius: 8px;
  appearance: none;
  -webkit-appearance: none;
  background: rgb(8, 8, 8);
  color: var(--color-text-80);
  font-size: var(--font-xs);
  font-weight: 650;
  line-height: 1.3;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: var(--transition);
}

.brawler-power-select:hover {
  border-color: rgba(0, 255, 132, 0.35);
  background: rgb(11, 11, 11);
}

.brawler-power-select:focus-visible {
  border-color: var(--color-cyan);
  outline: 1px solid var(--color-cyan);
  outline-offset: 2px;
}

.brawler-power-select option {
  color: var(--color-text-80);
  background: rgb(8, 8, 8);
}

.brawler-quick-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.brawler-quick-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background-color: rgba(0, 0, 0, 0.2);
  padding: 9px 10px;
}

.brawler-quick-stat span {
  font-size: var(--font-xs);
  color: var(--color-text-30);
}

.brawler-description {
  margin: 7px 0 0;
  max-width: 76ch;
  color: var(--color-text-30);
  font-size: var(--font-xs);
  line-height: 1.45;
}

.brawler-hero-section,
.brawler-traits {
  padding-top: var(--margin-sm);
  border-top: 1px solid var(--color-border);
}

.brawler-hero-section > .kicker-s {
  margin: 0 0 7px;
}

.brawler-combat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.brawler-combat-stat {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: rgba(0, 0, 0, 0.16);
}

.brawler-combat-stat span,
.brawler-combat-stat small {
  display: block;
  overflow: hidden;
  color: var(--color-text-30);
  font-size: 0.7rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brawler-combat-stat strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--color-text-80);
  font-size: var(--font-sm);
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brawler-combat-stat small {
  margin-top: 2px;
  color: var(--color-cyan);
}

.brawler-traits {
  margin: 0;
}

.brawler-traits summary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--margin-sm);
  padding: 9px 11px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: rgba(0, 0, 0, 0.18);
  color: var(--color-text-80);
  font-size: var(--font-sm);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  transition: var(--transition);
}

.brawler-traits summary:hover,
.brawler-traits summary:focus-visible {
  border-color: rgba(0, 255, 132, 0.35);
  background: rgba(0, 255, 132, 0.06);
}

.brawler-traits summary:focus-visible {
  outline: 1px solid var(--color-cyan);
  outline-offset: 2px;
}

.brawler-traits summary > span {
  margin-right: auto;
}

.brawler-traits summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin: 0 2px 3px 1px;
  border-right: 2px solid var(--color-cyan);
  border-bottom: 2px solid var(--color-cyan);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.brawler-traits[open] summary::after {
  margin-bottom: -3px;
  transform: rotate(225deg);
}

.brawler-traits summary::-webkit-details-marker {
  display: none;
}

.brawler-traits summary small {
  color: var(--color-cyan);
  font-size: var(--font-xs);
  font-weight: 500;
}

.brawler-trait-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.brawler-trait {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: rgba(0, 0, 0, 0.15);
  font-size: var(--font-xs);
}

.brawler-trait span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brawler-trait small {
  color: var(--color-text-30);
}

.brawler-trait.is-active {
  border-color: rgba(83, 227, 123, 0.32);
  background: rgba(83, 227, 123, 0.08);
}

.brawler-trait.is-active small {
  color: var(--color-cyan);
}

.brawler-trait.is-inactive {
  color: var(--color-text-30);
}

/* Sections */
.brawler-stats-section {
  gap: var(--margin-base);
}

.brawler-section-head .kicker-m {
  margin: 0;
}

.brawler-section-head p {
  margin-top: 3px;
  color: var(--color-text-30);
}

.brawler-section-intro {
  margin: 0;
  color: var(--color-text-30);
}

.brawler-strongest-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--margin-xs);
}

.brawler-strongest-mode {
  display: flex;
  flex-direction: column;
  gap: var(--margin-xs);
  min-width: 0;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background-color: rgba(0, 0, 0, 0.16);
  padding: var(--margin-sm);
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    transform 0.2s ease;
}

.brawler-strongest-mode:hover,
.brawler-strongest-mode:focus-visible {
  border-color: rgba(0, 255, 213, 0.28);
  background-color: rgba(0, 255, 213, 0.05);
}

.brawler-strongest-mode:active {
  transform: scale(0.99);
}

.brawler-strongest-mode-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brawler-strongest-place {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  border-radius: 8px;
  color: var(--color-cyan);
  background-color: rgba(0, 255, 213, 0.08);
  font-size: var(--font-xs);
  font-weight: 800;
  line-height: 1;
}

.brawler-strongest-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  color: var(--color-text-80);
  font-weight: 700;
}

.brawler-strongest-copy {
  display: grid;
  min-width: 0;
}

.brawler-strongest-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brawler-strongest-copy strong {
  color: var(--color-text-80);
  font-size: var(--font-sm);
  line-height: 1.15;
}

.brawler-strongest-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding-top: var(--margin-xs);
  border-top: 1px solid var(--color-border);
}

.brawler-strongest-stats span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brawler-strongest-stats small {
  color: var(--color-text-30);
  font-size: var(--font-xs);
  line-height: 1.1;
}

.brawler-strongest-stats strong {
  font-size: var(--font-sm);
  line-height: 1.15;
}

.brawler-ranked-mode-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brawler-ranked-mode-group {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.14);
}

.brawler-ranked-mode-group summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  color: var(--color-text-80);
  font-size: var(--font-sm);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  transition: background-color 0.18s ease;
}

.brawler-ranked-mode-group summary:hover,
.brawler-ranked-mode-group summary:focus-visible {
  background: rgba(0, 255, 132, 0.04);
}

.brawler-ranked-mode-group summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin: 0 3px 3px auto;
  border-right: 2px solid var(--color-cyan);
  border-bottom: 2px solid var(--color-cyan);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.brawler-ranked-mode-group[open] summary::after {
  margin-bottom: -3px;
  transform: rotate(225deg);
}

.brawler-ranked-mode-group summary::-webkit-details-marker {
  display: none;
}

.brawler-ranked-mode-content {
  padding: 10px;
  border-top: 1px solid var(--color-border);
}

.brawler-mode-heading-icon {
  width: 22px;
  min-width: 22px;
  height: 22px;
  object-fit: contain;
}

/* Table */
.brawler-stats-section .table-container {
  margin: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.brawler-stats-table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  table-layout: fixed;
  background-color: transparent;
}

.brawler-stats-table .table-header {
  background-color: rgba(255, 190, 32, 0.06);
}

.brawler-stats-table th,
.brawler-stats-table td {
  border-top: 1px solid var(--color-border);
  padding: 11px 10px;
  text-align: center;
  vertical-align: middle;
  line-height: 1.25;
}

.brawler-stats-table th {
  font-size: var(--font-xs);
  color: var(--color-text-30);
  font-weight: 700;
  text-transform: uppercase;
}

.brawler-stats-table thead tr:first-child th {
  border-top: 0;
}

.brawler-stats-table th:not(:first-child),
.brawler-stats-table td:not(:first-child) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.brawler-stats-table th:nth-child(1),
.brawler-stats-table td:nth-child(1) {
  width: 36%;
}

.brawler-stats-table th:nth-child(2),
.brawler-stats-table td:nth-child(2),
.brawler-stats-table th:nth-child(3),
.brawler-stats-table td:nth-child(3),
.brawler-stats-table th:nth-child(4),
.brawler-stats-table td:nth-child(4),
.brawler-stats-table th:nth-child(5),
.brawler-stats-table td:nth-child(5) {
  width: 16%;
}

.brawler-stats-table tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.025);
}

.brawler-stats-table tbody tr:hover {
  background-color: rgba(0, 255, 132, 0.055);
  transition: background-color 0.2s ease-in-out;
}

.brawler-stats-label-cell {
  text-align: left !important;
  white-space: normal !important;
}

.brawler-mode-link {
  color: var(--color-text-80);
  text-decoration: none;
  text-underline-offset: 2px;
  font-weight: 600;
  display: inline-block;
  max-width: 100%;
}

.brawler-mode-link:hover,
.brawler-mode-link:focus-visible {
  color: var(--color-cyan);
  text-decoration: underline;
}

.brawler-mode-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.brawler-mode-label span {
  min-width: 0;
}

.brawler-mode-label-icon {
  width: 20px;
  min-width: 20px;
  height: 20px;
  object-fit: contain;
}

.brawler-stat-value {
  color: var(--color-text-50);
  font-weight: 600;
}

.brawler-stat-good {
  color: #4ad66d;
  font-weight: 700;
}

.brawler-stat-bad {
  color: #ff6b6b;
  font-weight: 700;
}

.brawler-stat-neutral {
  color: var(--color-text-50);
}

/* History rows */
.brawler-stats-table tbody tr.brawler-history-target {
  cursor: pointer;
}

.brawler-stats-table tbody tr.brawler-history-target:focus-visible {
  outline: 2px solid var(--color-yellow);
  outline-offset: -2px;
}

.brawler-stats-table tbody tr.brawler-history-row {
  background-color: transparent !important;
}

.brawler-stats-table tbody tr.brawler-history-row td {
  padding: 0 !important;
}

.brawler-history-wrapper {
  width: 100%;
  height: 260px;
  padding: var(--margin-sm);
}

.brawler-history-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Responsive */
@media (max-width: 960px) {
  .brawler-combat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

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

  .brawler-stats-table {
    min-width: 520px;
  }
}

@media (max-width: 760px) {
  .brawler-hero-header {
    grid-template-columns: 74px minmax(0, 1fr) auto;
    gap: var(--margin-sm);
  }

  .brawler-hero .brawler-detail-icon {
    width: 74px;
    min-width: 74px;
    max-width: 74px;
    height: 74px;
  }

  .brawler-power-control {
    grid-column: auto;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
  }

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

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

  .brawler-ranked-mode-title {
    font-size: var(--font-sm);
  }

  .brawler-mode-heading-icon {
    width: 20px;
    min-width: 20px;
    height: 20px;
  }

}

@media (max-width: 620px) {
  .brawler-directory-section {
    padding: 8px;
  }

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

  .brawler-directory-card {
    min-height: 72px;
    gap: 3px;
    padding: 5px 3px;
  }

  .brawler-directory-icon {
    width: clamp(34px, 11vw, 44px);
    min-width: clamp(34px, 11vw, 44px);
    max-width: clamp(34px, 11vw, 44px);
    height: clamp(34px, 11vw, 44px);
    margin-bottom: 1px;
    padding: 1px;
    border-radius: 6px;
  }

  .brawler-directory-name {
    font-size: 10px;
    line-height: 1.1;
  }

  .brawler-meta-pill {
    padding: 4px 9px;
  }

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

  .brawler-stats-table {
    min-width: 480px;
  }

  .brawler-stats-table th,
  .brawler-stats-table td {
    padding: 8px 9px;
  }

  .brawler-stats-table th {
    font-size: var(--font-xs);
  }

  .brawler-stats-table th:nth-child(1),
  .brawler-stats-table td:nth-child(1) {
    width: 30%;
  }

  .brawler-stats-table th:nth-child(2),
  .brawler-stats-table td:nth-child(2),
  .brawler-stats-table th:nth-child(3),
  .brawler-stats-table td:nth-child(3),
  .brawler-stats-table th:nth-child(4),
  .brawler-stats-table td:nth-child(4),
  .brawler-stats-table th:nth-child(5),
  .brawler-stats-table td:nth-child(5) {
    width: 15%;
  }

  .brawler-mode-label {
    gap: 5px;
  }

  .brawler-mode-label-icon {
    width: 18px;
    min-width: 18px;
    height: 18px;
  }

  .brawler-history-wrapper {
    height: 230px;
    padding: 8px;
  }

  .brawler-strongest-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .brawler-rarity-title {
    font-size: var(--font-sm);
  }

  .brawler-hero-name {
    font-size: clamp(1.2rem, 5.6vw, 1.6rem);
  }

  .brawler-hero-header {
    grid-template-columns: 62px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .brawler-hero .brawler-detail-icon {
    width: 62px;
    min-width: 62px;
    max-width: 62px;
    height: 62px;
  }

  .brawler-power-select-wrap {
    min-width: 92px;
  }

  .brawler-power-select {
    min-height: 34px;
    padding-right: 28px;
    padding-left: 9px;
  }

  .brawler-power-select-wrap::after {
    right: 10px;
  }

  .brawler-description {
    line-height: 1.55;
  }

  .brawler-stats-section .table-container {
    margin-top: 8px;
  }

  .brawler-stats-table {
    min-width: 450px;
  }

  .brawler-stats-table th,
  .brawler-stats-table td {
    padding: 7px 8px;
  }

  .brawler-history-wrapper {
    height: 210px;
    padding: 6px;
  }
}

@media (max-width: 390px) {
  .brawler-quick-stat {
    padding: 8px;
  }

  .brawler-mode-heading-icon {
    width: 18px;
    min-width: 18px;
    height: 18px;
  }

  .brawler-trait-grid {
    grid-template-columns: 1fr;
  }
}
