.biliindex-wrap {
  display: inline-flex !important;
  align-items: center;
  vertical-align: middle;
  position: relative;
  z-index: 12;
  pointer-events: auto;
  flex-shrink: 0;
}

.comment-header + .biliindex-wrap,
bili-comment-renderer .comment-header + .biliindex-wrap,
.user-info + .biliindex-wrap,
.sub-reply-info + .biliindex-wrap {
  margin-left: 6px;
  vertical-align: middle;
  flex-shrink: 0;
  align-self: center;
}

#user-name + .biliindex-wrap,
.user-name + .biliindex-wrap,
bili-comment-user-renderer + .biliindex-wrap,
.comment-header .biliindex-wrap,
bili-comment-renderer .biliindex-wrap {
  margin-left: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

bili-comment-renderer .comment-header:has(.user-info + .biliindex-wrap),
bili-comment-renderer .comment-header:has(+ .biliindex-wrap) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.upname .biliindex-wrap,
.up-name .biliindex-wrap,
.up-detail-top + .biliindex-wrap,
.up-info--wrapper > .biliindex-wrap {
  margin-left: 6px;
  vertical-align: middle;
}

bili-comment-user-renderer,
bili-comment-renderer .comment-header,
bili-comment-renderer .user-info {
  overflow: visible !important;
}

.video-page-card-small .upinfo .upname,
.video-page-card-small .r-upinfo .upname,
.rec-list-item .upinfo .upname {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  max-width: 100%;
}

.up-detail-top,
.up-detail-top .up-info,
.up-info--wrapper .up-detail-top {
  display: inline-flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 4px;
}

a.up-name + .biliindex-wrap,
.upname a[href*="space.bilibili.com"] + .biliindex-wrap,
.up-info--author a + .biliindex-wrap {
  display: inline-flex !important;
  margin-left: 4px !important;
  vertical-align: middle !important;
  flex-shrink: 0;
}

#v_upinfo .biliindex-wrap,
.up-panel-container .biliindex-wrap,
.up-info-container .biliindex-wrap {
  display: inline-flex !important;
  flex-wrap: nowrap !important;
  max-width: 100%;
}

#v_upinfo .biliindex-bar,
.up-panel-container .biliindex-bar {
  flex-wrap: nowrap !important;
}

.video-page-card-small .upname,
.rec-list-item .upname,
.rcmd-item .upname {
  display: inline-flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  max-width: 100%;
}

.video-page-card-small .upname a + .biliindex-wrap,
.rec-list-item .upname a + .biliindex-wrap {
  margin-left: 4px;
  vertical-align: middle;
}

.video-page-card-small .bili-video-card__stats,
.rec-list-item .info-detail,
.rcmd-item .reco-stats {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
}

.video-page-card-small .biliindex-wrap,
.rec-list-item .biliindex-wrap {
  position: relative !important;
  z-index: 8 !important;
}

.up-panel-container .up-name,
.up-panel-container .upname,
.up-info-container .up-name,
#v_upinfo .up-name,
.up-info--wrapper .up-name {
  display: inline-flex !important;
  align-items: center;
  flex-wrap: nowrap;
}

.video-page-card-small a.up-name,
.video-page-card-small .up-name a,
.video-page-card-small .upinfo a {
  display: inline !important;
  vertical-align: middle;
}

.video-page-card-small .biliindex-wrap,
.rec-list-item .biliindex-wrap,
.rcmd-item .biliindex-wrap,
.bili-video-card .biliindex-wrap {
  margin-left: 4px;
  vertical-align: middle;
  position: relative !important;
  z-index: 8 !important;
}

#reco_list .biliindex-wrap,
.rcmd-list .biliindex-wrap,
.recommend-list-v1 .biliindex-wrap {
  contain: layout style;
}

.biliindex-bar {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  vertical-align: middle;
  flex-shrink: 0;
  position: relative;
  z-index: 50;
  pointer-events: auto;
  font-size: inherit;
  line-height: inherit;
  visibility: visible !important;
  opacity: 1 !important;
}

#user-name,
.user-name,
bili-comment-user-renderer,
.upname,
.up-name,
.up-info--wrapper {
  overflow: visible !important;
}

button.biliindex-slot {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  font: inherit;
  outline: none;
}

.biliindex-slot {
  display: inline-grid !important;
  grid-auto-flow: column;
  place-items: center;
  align-content: center;
  justify-content: center;
  column-gap: 3px;
  box-sizing: border-box;
  min-width: 28px;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #c9ccd0;
  background: #f6f7f8;
  color: #61666d;
  font-size: 12px;
  font-family: inherit;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  max-width: 11em;
  overflow: visible;
  cursor: pointer;
  vertical-align: middle;
  opacity: 1 !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.biliindex-slot.biliindex-slot-filled {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-wrap: nowrap;
  gap: 3px;
  background: #e3f6fc;
  border-color: #00aeec;
  color: #00aeec;
  font-weight: 500;
}

.biliindex-slot-label {
  display: block;
  margin: 0;
  padding: 0;
  line-height: 1;
  text-align: center;
  align-self: center;
  justify-self: center;
}

.biliindex-slot-empty-mark {
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: inherit;
}

.biliindex-slot[data-slot="emoji"] .biliindex-slot-label,
.biliindex-slot.biliindex-slot-locked-emoji .biliindex-slot-label {
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 15px;
  line-height: 1;
  min-width: 1em;
}

.biliindex-slot.biliindex-slot-locked-emoji {
  display: inline-grid !important;
  place-items: center;
  padding: 4px 7px;
  min-width: 26px;
  gap: 0;
}

.biliindex-slot[data-slot="emoji"]:not(.biliindex-slot-filled) .biliindex-slot-label {
  font-size: 14px;
  opacity: 0.88;
}

.biliindex-slot-count {
  display: block;
  margin: 0;
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  color: #00aeec;
  line-height: 1;
  min-width: 1ch;
  align-self: center;
}

.biliindex-tag-menu .menu-emoji {
  margin-right: 8px;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.15em;
  line-height: 1;
}

.biliindex-tag-menu .menu-count {
  margin-left: auto;
  font-size: 0.9em;
  color: #00aeec;
  font-weight: 700;
}

.biliindex-tag-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.biliindex-slot:hover {
  background: #e3f6fc;
  border-color: #00aeec;
}

/* 评论区：白底实心，避免透出输入框占位文案 */
.biliindex-bar[data-placement="comment"] .biliindex-slot {
  background: #ffffff !important;
  border-color: #e3e5e7 !important;
  color: #61666d !important;
  font-size: 12px !important;
  line-height: 1 !important;
  padding: 4px 8px !important;
  min-height: 24px !important;
  place-items: center !important;
}

.biliindex-bar[data-placement="comment"] .biliindex-slot.biliindex-slot-filled {
  background: #e3f6fc !important;
  border-color: #00aeec !important;
  color: #00aeec !important;
}

.biliindex-bar[data-placement="comment"] .biliindex-slot-label,
.biliindex-bar[data-placement="comment"] .biliindex-slot-count {
  color: #00aeec !important;
}

.biliindex-tag-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 99999;
  min-width: 96px;
  padding: 4px;
  background: #fff;
  border: 1px solid #e3e5e7;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 一级分类：路人置顶 + 横向选项卡，第二行常用标签 */
.biliindex-tag-menu.is-category-tabs {
  min-width: 0;
  padding: 6px 8px 4px;
  gap: 6px;
}

.biliindex-tag-tab-row-main {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 4px;
  width: min(360px, calc(100vw - 24px));
  max-width: 360px;
}

.biliindex-tag-tab-viewport {
  display: flex;
  flex: 1 1 0;
  flex-direction: row;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}

.biliindex-tag-menu.is-category-tabs button.is-passerby {
  flex: 0 0 auto;
  min-width: 44px;
  max-width: 52px;
  background: #fff3e8;
  border-color: #ffb86c;
  color: #e58900;
  font-weight: 600;
}

.biliindex-tag-menu.is-category-tabs button.is-passerby:hover {
  background: #ffe8cc;
  border-color: #ff9f1a;
  color: #c96f00;
}

.biliindex-tag-menu.is-category-tabs button.is-super-hate {
  flex: 0 0 auto;
  min-width: 56px;
  max-width: 72px;
  background: #f3f3f3;
  border-color: #9499a0;
  color: #18191c;
  font-weight: 700;
  font-size: 11px;
  line-height: 1.2;
  white-space: normal;
  padding: 4px 6px;
}

.biliindex-tag-menu.is-category-tabs button.is-super-hate:hover {
  background: #e3e5e7;
  border-color: #61666d;
}

.biliindex-tag-tab-row-frequent {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(360px, calc(100vw - 24px));
  max-width: 360px;
}

.biliindex-tag-tab-row-label {
  font-size: 11px;
  color: #61666d;
  line-height: 1.2;
  padding: 0 2px;
}

.biliindex-tag-tab-frequent {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 4px;
}

.biliindex-tag-menu.is-category-tabs .biliindex-tag-tab-frequent button {
  flex: 1 1 0;
  max-width: none;
}

.biliindex-tag-tab-frequent .freq-empty {
  flex: 1 1 0;
  padding: 6px 4px;
  text-align: center;
  font-size: 12px;
  color: #c9ccd0;
  border: 1px dashed #e3e5e7;
  border-radius: 6px;
  line-height: 1.25;
}

.biliindex-tag-menu.is-category-tabs button {
  flex: 1 1 0;
  min-width: 0;
  max-width: 68px;
  padding: 6px 4px;
  text-align: center;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid #e3e5e7;
  background: #f6f7f8;
  border-radius: 6px;
}

.biliindex-tag-menu.is-category-tabs button:hover {
  background: #e8f7fc;
  border-color: #00aeec;
  color: #00aeec;
}

.biliindex-tag-tab-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px 2px;
  font-size: 11px;
  color: #9499a0;
  user-select: none;
}

.biliindex-tag-tab-foot .tab-page {
  font-variant-numeric: tabular-nums;
}

/* 表情槽：上方网格 + 底部分类（类似 B 站表情面板） */
.biliindex-tag-menu.is-emoji-categories {
  position: fixed;
  z-index: 2147483647;
  display: flex;
  flex-direction: column;
  width: min(296px, calc(100vw - 24px));
  min-width: 0;
  padding: 8px 8px 6px;
  gap: 0;
  background: #fff;
  border: 1px solid #e3e5e7;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.biliindex-emoji-panel {
  min-height: 0;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f1f2f3;
  overflow-x: hidden;
}

.biliindex-emoji-cat-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  overflow: visible;
  padding-top: 2px;
}

.biliindex-emoji-cat-row button {
  flex: 0 0 auto;
  min-width: 52px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f6f7f8;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  color: #18191c;
}

.biliindex-emoji-cat-row button.is-active {
  background: #e8f7fd;
  border-color: #00aeec;
  color: #00aeec;
  font-weight: 600;
}

.biliindex-emoji-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  max-height: calc(3 * 36px + 2 * 2px);
  overflow-y: auto;
  overflow-x: hidden;
}

.biliindex-tag-menu.is-emoji-categories .biliindex-emoji-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  text-align: center;
  color: #18191c;
}

.biliindex-tag-menu.is-emoji-categories .biliindex-emoji-cell:hover {
  background: #f1f2f3;
}

.biliindex-emoji-grid-empty {
  grid-column: 1 / -1;
  padding: 12px 8px;
  font-size: 12px;
  color: #9499a0;
  text-align: center;
}

.biliindex-tag-menu:not(.is-emoji-categories) button {
  padding: 6px 8px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #18191c;
  text-align: left;
}

.biliindex-tag-menu:not(.is-emoji-categories) button:hover {
  background: #f1f2f3;
}

.biliindex-tag-empty {
  padding: 6px 8px;
  font-size: 12px;
  color: #9499a0;
}

/* 标签栏应在昵称链接外；若旧版误挂在 a 内，仍抬高层级便于点击 */
a .biliindex-wrap,
a .biliindex-bar,
a .biliindex-slot {
  position: relative;
  z-index: 60;
}

/* 空间个人主页头图：昵称后 3+1 槽，浅色描边便于压在头图上 */
.s-space .h-name,
.s-space .h-user .h-name,
.s-space #h-name,
.s-space .space-info .n-name,
.h-header .h-name,
.h-header .nickname,
.h-user .h-name,
.h-user .nickname,
#h-name,
.space-info .n-name,
.header-info .nickname {
  display: inline-flex !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  overflow: visible !important;
}

.h-header .biliindex-wrap,
.h-gradient .biliindex-wrap,
.h-user .biliindex-wrap,
.nickname + .biliindex-wrap,
.h-name .biliindex-wrap {
  margin-left: 4px;
  vertical-align: middle;
}

/* 空间头图：粉红底 + 白字（与大会员徽章类似，头图上易读） */
.biliindex-bar-space .biliindex-slot,
.biliindex-bar[data-placement="space"] .biliindex-slot {
  background: #fb7299 !important;
  border-color: rgba(255, 255, 255, 0.9) !important;
  color: #fff !important;
}

.biliindex-bar-space .biliindex-slot-label,
.biliindex-bar-space .biliindex-slot-count,
.biliindex-bar[data-placement="space"] .biliindex-slot-label,
.biliindex-bar[data-placement="space"] .biliindex-slot-count {
  color: #fff !important;
}

.biliindex-bar-space .biliindex-slot.biliindex-slot-filled,
.biliindex-bar[data-placement="space"] .biliindex-slot.biliindex-slot-filled {
  background: #fb7299 !important;
  border-color: rgba(255, 255, 255, 0.95) !important;
}

.biliindex-bar-space .biliindex-slot:hover,
.biliindex-bar[data-placement="space"] .biliindex-slot:hover {
  background: #ff85a8 !important;
  filter: brightness(1.05);
}
