.hq-page .chest-odds-shell {
  max-width: none;
  width: 100%;
  margin: 0;
  display: block;
  overflow: auto;
}

.chest-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.chest-odds-page .chest-links button {
  padding: 6px 8px;
  background: var(--surface);
}

.chest-panel {
  margin-block: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.chest-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: start;
  gap: 8px 16px;
  margin-bottom: 8px;
}

.chest-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 235px;
}

.chest-identity img,
.chest-reward-heading img {
  flex: none;
  object-fit: contain;
}

.chest-identity img { width: 40px; height: 40px; }

.chest-count { width: 132px; }

.chest-count label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.chest-count input { width: 100%; }
.chest-count input[aria-invalid="true"] { border-color: var(--error); }
.chest-count .error-text { margin-bottom: 0; }

.chest-rewards { table-layout: fixed; }

.chest-rewards th,
.chest-rewards td {
  padding: 4px 8px;
  font-size: 11px;
}

.chest-rewards thead th {
  white-space: normal;
  padding-block: 6px;
}

.chest-rewards thead th:not(:first-child) { width: 17%; }

.chest-rewards :is(th, td):not(:first-child) { text-align: right; }

.chest-rewards tbody th {
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-transform: none;
  white-space: normal;
  overflow-wrap: anywhere;
}

.chest-reward:nth-child(even) { background: var(--raised); }

.chest-reward-heading {
  display: flex;
  align-items: center;
  gap: 7px;
}

.chest-chance strong { color: var(--accent); }

.chest-reward progress {
  appearance: none;
  display: block;
  width: min(100%, 80px);
  height: 3px;
  margin: 3px 0 0 auto;
  border: 0;
  background: var(--line);
}

.chest-reward progress::-webkit-progress-bar { background: var(--line); }
.chest-reward progress::-webkit-progress-value { background: var(--accent); }
.chest-reward progress::-moz-progress-bar { background: var(--accent); }

.chest-loot-summary #lootCount { color: var(--muted); }
.chest-loot-summary #lootItems {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 12px;
  margin-top: 8px;
}

.chest-loot-summary h3 {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 11px;
}

.chest-loot-summary ul {
  display: grid;
  gap: 4px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.chest-loot-summary li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  background: var(--raised);
  overflow-wrap: anywhere;
}

.chest-loot-summary li strong { color: var(--accent); white-space: nowrap; }

.chest-loot-summary .loot-subtotal { display: block; padding: 0; }

.loot-subtotal summary {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
}

.loot-subtotal summary::-webkit-details-marker { display: none; }
.loot-subtotal summary::before { content: '▸'; color: var(--muted); }
.loot-subtotal details[open] summary::before { content: '▾'; }
.loot-subtotal summary .loot-item-label { flex: 1; }
.loot-subtotal ul { margin: 0 6px 6px 18px; }
.chest-loot-summary .loot-subtotal li { background: var(--surface); }

.loot-hq { color: var(--muted); font-size: 11px; }
.loot-hq input { width: 80px; }
.chest-loot-summary section > .muted { margin-bottom: 6px; }

.loot-item-value {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: center;
  gap: 2px 5px;
  max-width: 50%;
  color: var(--muted);
}

.loot-item-value span { white-space: nowrap; }

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

.loot-item-label img { flex: none; object-fit: contain; }

@media (max-width: 767px) {
  .chest-rewards thead th:not(:first-child) { width: 20%; }
  .chest-rewards th, .chest-rewards td { padding-inline: 4px; font-size: 10px; }
  .chest-reward-heading img { width: 22px; height: 22px; }
}
