.character-search-history-popover {
  position: fixed;
  z-index: 12000;
  overflow: hidden;
  border: 1px solid #343d4d;
  border-radius: 12px;
  background: #121722;
  color: var(--text, #f4f7fb);
  box-shadow: 0 18px 46px rgba(0, 0, 0, .44), 0 3px 12px rgba(0, 0, 0, .3);
}

.character-search-history-popover[hidden] {
  display: none !important;
}

.character-search-history-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid #2a3240;
  background: #0f141d;
}

.character-search-history-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted, #8f9aab);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.character-search-history-tab::after {
  content: '';
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
}

.character-search-history-tab:hover,
.character-search-history-tab:focus-visible,
.character-search-history-tab.is-active {
  color: var(--text, #f4f7fb);
  background: rgba(245, 185, 66, .045);
}

.character-search-history-tab.is-active {
  color: var(--accent-2, #ffd978);
}

.character-search-history-tab.is-active::after {
  background: var(--accent, #f5b942);
}

.character-search-history-tab svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.character-search-history-tab svg .is-filled,
.character-search-history-star svg .is-filled {
  fill: currentColor;
}

.character-search-history-tab b {
  color: currentColor;
  font-size: 11px;
  font-weight: 700;
  opacity: .74;
}

.character-search-history-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  max-height: min(344px, 48vh);
  padding: 8px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #596273 transparent;
}

.character-search-history-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  min-width: 0;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  transition: background .14s ease, border-color .14s ease;
}

.character-search-history-row:hover,
.character-search-history-row:focus-within {
  border-color: rgba(245, 185, 66, .15);
  background: rgba(245, 185, 66, .07);
}

.character-search-history-star,
.character-search-history-remove,
.character-search-history-name {
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.character-search-history-star,
.character-search-history-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 32px;
  padding: 0;
  color: #6e788a;
  opacity: 0;
  transition: color .14s ease, opacity .14s ease, transform .14s ease;
}

.character-search-history-row:hover .character-search-history-star,
.character-search-history-row:focus-within .character-search-history-star,
.character-search-history-star.is-favorite,
.character-search-history-row:hover .character-search-history-remove,
.character-search-history-row:focus-within .character-search-history-remove {
  opacity: 1;
}

.character-search-history-star:hover,
.character-search-history-star:focus-visible,
.character-search-history-star.is-favorite {
  color: var(--accent, #f5b942);
}

.character-search-history-star:hover,
.character-search-history-star:focus-visible {
  transform: scale(1.08);
}

.character-search-history-star svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}

.character-search-history-name {
  min-width: 0;
  padding: 8px 2px;
  overflow: hidden;
  color: var(--text, #f4f7fb);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
}

.character-search-history-name:hover,
.character-search-history-name:focus-visible {
  color: var(--accent-2, #ffd978);
  outline: none;
}

.character-search-history-remove {
  color: #7e8899;
}

.character-search-history-remove:hover,
.character-search-history-remove:focus-visible {
  color: #dce2eb;
}

.character-search-history-remove svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.character-search-history-empty {
  grid-column: 1 / -1;
  display: flex;
  min-height: 116px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 22px 20px;
  color: var(--muted, #8f9aab);
  text-align: center;
}

.character-search-history-empty strong {
  color: #cdd4df;
  font-size: 14px;
}

.character-search-history-empty span {
  max-width: 360px;
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 560px) {
  .character-search-history-list {
    grid-template-columns: minmax(0, 1fr);
    max-height: min(384px, 55vh);
  }

  .character-search-history-tab {
    min-height: 42px;
    padding-inline: 8px;
  }
}

@media (hover: none) {
  .character-search-history-star,
  .character-search-history-remove {
    opacity: .82;
  }
}
