.drop-rates-app {
  display: flex;
  flex-direction: column;
  gap: var(--margin-base);
  min-width: 0;
  width: 100%;
}

.drop-rates-app > * {
  min-width: 0;
}

.drop-rates-app > .ad-placeholder {
  max-width: 100%;
  contain: inline-size;
}

.drop-rates-app [hidden] {
  display: none !important;
}

.drop-rates-title {
  width: 100%;
}

.drop-selector-card {
  gap: var(--margin-base);
}

.selector-top {
  align-items: flex-start;
}

.selector-top p,
.table-head p {
  margin-top: 2px;
}

.quick-filter {
  flex: 0 0 280px;
}

.quick-filter .lookup-input-wrap {
  width: 100%;
}

.quick-filter input {
  padding: 10px;
  text-transform: none;
}

.gacha-menu {
  display: flex;
  flex-direction: column;
  gap: var(--margin-base);
  overflow-anchor: none;
  width: 100%;
}

.gacha-category {
  display: grid;
  gap: var(--margin-xs);
  width: 100%;
}

.gacha-category-grid {
  display: grid;
  gap: var(--margin-sm);
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.gacha-button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: var(--margin-sm);
  min-height: 64px;
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-surface);
  color: var(--color-text-50);
  padding: var(--margin-sm);
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.gacha-button span:last-child {
  min-width: 0;
  color: var(--color-text-80);
  font-size: var(--font-sm);
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gacha-button:hover,
.gacha-button:focus-visible {
  border-color: rgba(255, 190, 32, 0.28);
}

.gacha-button[aria-selected="true"] {
  border-color: rgba(0, 255, 132, 0.55);
  background: rgba(0, 255, 132, 0.08);
}

.asset-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--color-yellow);
  font-size: var(--font-xs);
  font-weight: 800;
  overflow: hidden;
}

.asset-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.asset-box.rarity-rare {
  border-color: rgba(0, 255, 132, 0.4);
}

.asset-box.rarity-superrare {
  border-color: rgba(74, 173, 255, 0.45);
}

.asset-box.rarity-epic {
  border-color: rgba(190, 105, 255, 0.45);
}

.asset-box.rarity-mythic {
  border-color: rgba(255, 105, 80, 0.45);
}

.asset-box.rarity-legendary {
  border-color: rgba(255, 190, 32, 0.55);
}

.asset-box.rarity-hypercharge {
  border-color: rgba(0, 255, 255, 0.55);
}

.rate-strip,
.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--margin-xs);
  width: 100%;
}

.rate-pill,
.tab-button {
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-surface);
  color: var(--color-text-50);
  font-size: var(--font-sm);
  line-height: 1;
  transition: var(--transition);
}

.rate-pill {
  padding: 9px 12px;
  border-left-color: var(--pill-color, var(--color-border));
}

.rate-pill small {
  color: var(--color-yellow);
  font-weight: 700;
  margin-left: 6px;
}

.tab-button {
  cursor: pointer;
  padding: 9px 12px;
}

.tab-button:hover,
.tab-button:focus-visible {
  border-color: rgba(255, 190, 32, 0.28);
}

.tab-button[aria-selected="true"] {
  border-color: rgba(0, 255, 132, 0.55);
  background: var(--color-cyan);
  color: black;
  font-weight: 700;
}

.tab-button small {
  margin-left: 6px;
  font-weight: 700;
}

.summary-grid {
  display: grid;
  gap: var(--margin-base);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  width: 100%;
}

.summary-card {
  min-height: 86px;
  justify-content: center;
}

.summary-label {
  color: var(--color-text-30);
  display: block;
  font-size: var(--font-xs);
  margin-bottom: var(--margin-xs);
}

.summary-card strong {
  color: #fff;
  font-size: var(--font-lg);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.drop-table-card {
  gap: var(--margin-base);
  min-width: 0;
  scroll-margin-top: 90px;
}

.table-head {
  align-items: flex-start;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.drop-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.drop-table th,
.drop-table td {
  border-top: 1px solid var(--color-border);
  padding: 10px 8px;
  vertical-align: middle;
}

.drop-table th {
  color: var(--color-text-30);
  font-size: var(--font-xs);
  font-weight: 600;
  text-align: left;
}

.drop-table td {
  color: var(--color-text-50);
  font-size: var(--font-sm);
}

.drop-table:not(.upgrade-table) td:nth-child(3),
.drop-table:not(.upgrade-table) th:nth-child(3),
.upgrade-table td:nth-child(4),
.upgrade-table th:nth-child(4) {
  text-align: right;
  white-space: nowrap;
  width: 130px;
}

.upgrade-table td:nth-child(2),
.upgrade-table th:nth-child(2) {
  width: 150px;
}

.reward-cell,
.fallback-cell,
.cost-cell {
  display: flex;
  align-items: center;
  gap: var(--margin-sm);
  min-width: 0;
}

.reward-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.reward-cell > span:last-child,
.fallback-cell > span:last-child,
.cost-cell > span:last-child {
  min-width: 0;
}

.chance,
.cost-cell {
  color: var(--color-yellow);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.drop-badge {
  appearance: none;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-cyan);
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 7px;
}

button.drop-badge {
  cursor: pointer;
}

button.drop-badge:hover,
button.drop-badge:focus-visible {
  border-color: var(--color-cyan);
  background: rgba(0, 255, 132, 0.08);
}

.muted {
  color: var(--color-text-30);
}

.pool-panel {
  gap: var(--margin-base);
  scroll-margin-top: 90px;
}

.pool-head {
  align-items: center;
}

.pool-content {
  display: grid;
  gap: var(--margin-base);
  width: 100%;
}

.pool-content-columns {
  align-items: start;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pool-group {
  display: grid;
  gap: var(--margin-sm);
  min-width: 0;
  scroll-margin-top: 90px;
}

.pool-group h3 {
  font-size: var(--font-md);
}

.pool-grid {
  display: grid;
  gap: var(--margin-sm);
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.pool-content-columns .pool-grid {
  grid-template-columns: 1fr;
}

.pool-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: var(--margin-sm);
  min-height: 64px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: rgba(0, 0, 0, 0.22);
  padding: var(--margin-sm);
}

.pool-item strong {
  color: var(--color-text-80);
  display: block;
  font-size: var(--font-sm);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pool-item small {
  color: var(--color-yellow);
  font-size: var(--font-xs);
  font-weight: 700;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .selector-top,
  .table-head {
    flex-direction: column;
  }

  .quick-filter {
    flex: 1 1 auto;
    width: 100%;
  }

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

@media (max-width: 620px) {
  .summary-grid {
    gap: 4px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .summary-card {
    min-height: 58px;
    padding: 6px 3px;
  }

  .summary-label {
    font-size: 7px;
    line-height: 1.1;
    margin-bottom: 3px;
    overflow-wrap: anywhere;
  }

  .summary-card strong {
    font-size: 10px;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .gacha-category-grid {
    grid-template-columns: 1fr;
  }

  .rate-pill,
  .tab-button {
    flex: 1 1 140px;
    text-align: center;
  }

  .pool-content-columns,
  .pool-grid {
    grid-template-columns: 1fr;
  }

  .table-scroll {
    overflow-x: visible;
  }

  .drop-table {
    min-width: 0;
    table-layout: fixed;
    width: 100%;
  }

  .drop-table th,
  .drop-table td {
    padding: 6px 4px;
  }

  .drop-table th {
    font-size: 9px;
    line-height: 1.1;
  }

  .drop-table td {
    font-size: 10px;
    line-height: 1.15;
  }

  .drop-table:not(.upgrade-table) th:nth-child(1),
  .drop-table:not(.upgrade-table) td:nth-child(1) {
    width: 43%;
  }

  .drop-table:not(.upgrade-table) th:nth-child(2),
  .drop-table:not(.upgrade-table) td:nth-child(2) {
    width: 35%;
  }

  .drop-table:not(.upgrade-table) th:nth-child(3),
  .drop-table:not(.upgrade-table) td:nth-child(3) {
    width: 22%;
  }

  .upgrade-table th:nth-child(1),
  .upgrade-table td:nth-child(1) {
    width: 31%;
  }

  .upgrade-table th:nth-child(2),
  .upgrade-table td:nth-child(2) {
    width: 20%;
  }

  .upgrade-table th:nth-child(3),
  .upgrade-table td:nth-child(3) {
    width: 31%;
  }

  .upgrade-table th:nth-child(4),
  .upgrade-table td:nth-child(4) {
    width: 18%;
  }

  .reward-cell,
  .fallback-cell,
  .cost-cell {
    gap: 4px;
  }

  .drop-table .asset-box {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 6px;
    font-size: 7px;
  }

  .reward-cell > span:last-child,
  .fallback-cell > span:last-child,
  .cost-cell > span:last-child,
  .reward-label {
    overflow-wrap: anywhere;
  }

  .drop-badge {
    display: none;
  }

  .chance,
  .cost-cell {
    font-size: 10px;
  }
}

@media (max-width: 420px) {
  .summary-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .asset-box,
  .pool-item,
  .gacha-button {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .asset-box {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  .drop-table th,
  .drop-table td {
    padding: 5px 3px;
  }

  .drop-table .asset-box {
    width: 22px;
    height: 22px;
    min-width: 22px;
  }
}

@media (max-width: 360px) {
  .drop-table th {
    font-size: 8px;
  }

  .drop-table td,
  .chance,
  .cost-cell {
    font-size: 9px;
  }

  .reward-cell,
  .fallback-cell,
  .cost-cell {
    gap: 3px;
  }

  .drop-table .asset-box {
    width: 20px;
    height: 20px;
    min-width: 20px;
  }
}
