/* Generation history image layouts. Keep a single result fully visible. */
.history-images {
  grid-template-columns: 1fr !important;
  grid-template-rows: minmax(0, 1fr);
  grid-auto-rows: minmax(0, 1fr);
  overflow: hidden;
}

.history-images:has(.history-image-btn:nth-of-type(2)) {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.history-images:has(.history-image-btn:nth-of-type(3)) {
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.history-images > .history-image-btn {
  align-self: stretch;
  min-height: 0;
}

.history-images img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
}

.history-images .history-image-btn:only-child img {
  object-fit: contain;
}

.history-image-btn em {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: #edf1f8;
  color: #71809a;
  font-size: 12px;
  font-style: normal;
  line-height: 1.6;
  text-align: center;
}

.history-image-btn.is-broken img,
.history-image-btn.is-broken span {
  display: none;
}

.history-image-btn.is-broken em {
  display: flex;
}

.history-reference-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.history-reference-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 4px 10px 4px 4px;
  border: 1px solid #dbe4f1;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.history-reference-btn:hover {
  border-color: #c5d4ef;
  background: #f7f9fd;
  transform: translateY(-1px);
}

.history-reference-btn img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 7px;
  flex: 0 0 28px;
}

.history-reference-btn span {
  color: #5a6984;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}
