/* Keep the existing navigation and replace only its top-level pictograms. */
#header .el-menu--horizontal > .el-menu-item > i.el-icon-s-home::before,
#header .el-menu--horizontal > .el-menu-item > i.el-icon-s-grid::before,
#header .el-menu--horizontal > .el-menu-item > i.el-icon-s-claim::before,
#header .el-menu--horizontal > .el-menu-item > i.el-icon-trophy::before,
#header .el-menu--horizontal > .el-menu-item > i.el-icon-s-marketing::before,
#header .el-menu--horizontal > .el-menu-item > i.el-icon-s-comment::before,
#header .el-menu--horizontal > .el-menu-item > i.fa-users::before,
#header .el-menu--horizontal > .el-submenu > .el-submenu__title > i.el-icon-s-data::before,
#header .el-menu--horizontal > .el-submenu > .el-submenu__title > i.el-icon-s-tools::before,
#header #hcode-admin-problem-judge > a > i.el-icon-s-marketing::before,
#header #topbar-nav-whiteboard > a > i.el-icon-edit-outline::before {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif !important;
  font-style: normal;
  font-size: 16px;
  line-height: 1;
}
#header .el-menu--horizontal > .el-menu-item > i.el-icon-s-home {
  background: transparent !important;
  -webkit-mask: none !important;
  mask: none !important;
}
#header .el-menu--horizontal > .el-menu-item > i.el-icon-s-home::before { content: "🏠" !important; }
#header > .el-menu.el-menu--horizontal > .el-menu-item.is-active > i.el-icon-s-home[class] {
  background: transparent !important;
  -webkit-mask: none !important;
  mask: none !important;
}
#header > .el-menu.el-menu--horizontal > .el-menu-item.is-active > i.el-icon-s-home[class]::before {
  content: "🏠" !important;
  display: inline-block !important;
}
#header .el-menu--horizontal > .el-menu-item > i.el-icon-s-grid::before { content: "📚"; }
#header .el-menu--horizontal > .el-menu-item > i.el-icon-s-claim::before { content: "🎯"; }
#header .el-menu--horizontal > .el-menu-item > i.el-icon-trophy::before { content: "🏅"; }
#header .el-menu--horizontal > .el-menu-item > i.el-icon-s-marketing::before,
#header #hcode-admin-problem-judge > a > i.el-icon-s-marketing::before { content: "✅"; }
#header .el-menu--horizontal > .el-menu-item > i.el-icon-s-comment::before { content: "💬"; }
#header .el-menu--horizontal > .el-menu-item > i.fa-users::before { content: "👥"; }
#header .el-menu--horizontal > .el-submenu > .el-submenu__title > i.el-icon-s-data::before { content: "📊"; }
#header .el-menu--horizontal > .el-submenu > .el-submenu__title > i.el-icon-s-tools::before { content: "🧰"; }
#header #topbar-nav-whiteboard > a > i.el-icon-edit-outline::before { content: "🎨"; }

/* Unify vertical alignment across native Element UI items and injected nav items */
#header > .el-menu.el-menu--horizontal > .el-menu-item:not([data-hcode-admin-only="true"]):not([index="/lesson"]):not([style*="display: none"]):not([style*="display:none"]),
#header > .el-menu.el-menu--horizontal > .el-submenu:not([style*="display: none"]):not([style*="display:none"]) > .el-submenu__title {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  height: 38px !important;
  line-height: 1.2 !important;
  vertical-align: middle !important;
}
#header #hcode-admin-problem-judge > a,
#header #topbar-nav-whiteboard > a {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  height: 100% !important;
  line-height: 1.2 !important;
  vertical-align: middle !important;
  color: inherit !important;
  text-decoration: none !important;
}
#header #topbar-nav-whiteboard > a {
  padding: 0 5px !important;
}
#header > .el-menu.el-menu--horizontal > .el-menu-item > i[class]:first-child,
#header > .el-menu.el-menu--horizontal > .el-submenu > .el-submenu__title > i[class]:first-child,
#header #hcode-admin-problem-judge > a > i[class]:first-child,
#header #topbar-nav-whiteboard > a > i[class]:first-child,
#header #topbar-nav-wrongbook-summary > span:first-child,
#header #topbar-nav-rating-rank > span:first-child,
#header .gesp-scratch-nav-item > .gesp-scratch-nav-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 16px !important;
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  line-height: 1 !important;
  vertical-align: middle !important;
  transform: translateY(-0.5px);
}
#header #topbar-nav-wrongbook-summary > span:first-child {
  font-size: 16px !important;
}
#header #topbar-nav-wrongbook-summary > span:last-child,
#header #topbar-nav-rating-rank > span:last-child,
#header .gesp-scratch-nav-item > span:not(.gesp-scratch-nav-icon) {
  display: inline-flex !important;
  align-items: center !important;
  line-height: 1.2 !important;
}
#header > .el-menu.el-menu--horizontal > .el-submenu > .el-submenu__title > i.el-submenu__icon-arrow {
  position: static !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 14px !important;
  height: 16px !important;
  margin: 0 0 0 2px !important;
  line-height: 1 !important;
  vertical-align: middle !important;
}

/* Enforce stable flex ordering across Vue NavBar mode switches */
#header > .el-menu.el-menu--horizontal > .logo {
  order: 0 !important;
  flex: 0 0 auto !important;
}
#header > .el-menu.el-menu--horizontal > .el-menu-item,
#header > .el-menu.el-menu--horizontal > .el-submenu {
  order: 10 !important;
}
#header > .el-menu.el-menu--horizontal > #topbar-nav-wrongbook-summary {
  order: 20 !important;
}
#header > .el-menu.el-menu--horizontal > #topbar-nav-rating-rank {
  order: 21 !important;
}
#header > .el-menu.el-menu--horizontal > #topbar-nav-gesp-scratch {
  order: 22 !important;
}
#header > .el-menu.el-menu--horizontal > .el-submenu:has(> .el-submenu__title > i.el-icon-s-tools),
#header > .el-menu.el-menu--horizontal > #topbar-nav-whiteboard {
  order: 30 !important;
}
#header > .el-menu.el-menu--horizontal > #topbar-nav-whiteboard {
  padding: 0 !important;
}
#header > .el-menu.el-menu--horizontal > #hcode-topbar-fn {
  order: 80 !important;
  margin: 0 22px 0 auto !important;
  flex: 0 0 auto !important;
}
#header > .el-menu.el-menu--horizontal > .btn-menu {
  order: 90 !important;
  flex: 0 0 auto !important;
  margin-left: 0 !important;
}
#header > .el-menu.el-menu--horizontal > .drop-menu {
  order: 91 !important;
  flex: 0 0 auto !important;
  margin-left: 0 !important;
}
#header > .el-menu.el-menu--horizontal > .drop-avatar {
  order: 92 !important;
  flex: 0 0 auto !important;
}
#header > .el-menu.el-menu--horizontal > .drop-msg {
  order: 93 !important;
  flex: 0 0 auto !important;
}
#header > .el-menu.el-menu--horizontal > #topbar-p2p-file-btn {
  order: 95 !important;
  flex: 0 0 auto !important;
}
#header > .el-menu.el-menu--horizontal:not(:has(> #hcode-topbar-fn)) > .btn-menu,
#header > .el-menu.el-menu--horizontal:not(:has(> #hcode-topbar-fn)) > .drop-menu {
  margin-left: auto !important;
}

/* Problem-editing mode: keep only 前往首页, 训练主页, 题目列表, 错题&总结 (+ admin 评测) */
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > #topbar-nav-rating-rank,
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > #topbar-nav-gesp-scratch,
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > #hcode-topbar-fn,
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > #topbar-p2p-file-btn,
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > #topbar-wa-report-pill,
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > #cbti-topbar-link,
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > .el-submenu,
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > li.el-menu-item[index^="/group/"]:not([index*="/training/"]),
html.hcode-problem-editing-topbar #header #hcode-topbar-fn,
html.hcode-problem-editing-topbar #header #topbar-p2p-file-btn,
html.hcode-problem-editing-topbar #header #topbar-wa-report-pill,
html.hcode-problem-editing-topbar #header #cbti-topbar-link {
  display: none !important;
}
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > li.el-menu-item[index="/home"] {
  order: 10 !important;
}
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > li.el-menu-item[index*="/training/"]:not([index$="/problems"]) {
  order: 11 !important;
}
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > li.el-menu-item[index$="/problems"] {
  order: 12 !important;
}
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > #topbar-nav-wrongbook-summary {
  order: 20 !important;
}
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > #hcode-admin-problem-judge {
  order: 25 !important;
}
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > #topbar-nav-whiteboard {
  display: inline-flex !important;
  order: 30 !important;
  padding: 0 !important;
}
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > .btn-menu,
html.hcode-problem-editing-topbar #header > .el-menu.el-menu--horizontal > .drop-menu {
  margin-left: auto !important;
}
