
/* V77 — 全环境稳定顶栏字号层级：
   1) “万水千山只等闲”始终是顶栏最大的文字；
   2) 路线名称、显示全部与“生成路线”统一为次一级字号；
   3) 在严格不重叠前提下，按钮字号仍自动取可用最大值；
   4) 保留 V76 的稳定收敛机制，不引入 ResizeObserver 闪烁。 */

#app:not(.is-map-focus) .commandbar.v76-fit,
#app:not(.is-map-focus) .commandbar.v76-stack {
  box-sizing: border-box !important;
  --v76-ui-font: 13px;
}

/* 一行模式：品牌 / 路线 / 操作按钮三块硬隔离 */
#app:not(.is-map-focus) .commandbar.v76-fit {
  grid-template-columns: minmax(0, var(--v76-brand-col, 250px)) minmax(0, 1fr) max-content !important;
  grid-template-rows: minmax(40px, auto) !important;
  column-gap: var(--v76-gap, 5px) !important;
}
#app:not(.is-map-focus) .commandbar.v76-fit .brand-lockup {
  grid-column: 1 !important;
  grid-row: 1 !important;
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  gap: var(--v76-brand-gap, 6px) !important;
}
#app:not(.is-map-focus) .commandbar.v76-fit .brand-lockup > div:last-child {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
}
#app:not(.is-map-focus) .commandbar.v76-fit .brand-lockup h1 {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  font-size: var(--v76-title-font, 22px) !important;
  line-height: 1.08 !important;
  letter-spacing: 0 !important;
}
#app:not(.is-map-focus) .commandbar.v76-fit .brand-star {
  flex: 0 0 auto !important;
  width: var(--v76-star, 34px) !important;
  height: var(--v76-star, 34px) !important;
}
#app:not(.is-map-focus) .commandbar.v76-fit .route-switch {
  grid-column: 2 !important;
  grid-row: 1 !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  padding: 2px !important;
  overflow: hidden !important;
  display: flex !important;
  position: relative !important;
  z-index: 3 !important;
}
#app:not(.is-map-focus) .commandbar.v76-fit .route-tab {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  width: auto !important;
  padding-left: var(--v76-route-pad, 3px) !important;
  padding-right: var(--v76-route-pad, 3px) !important;
  gap: var(--v76-route-gap, 2px) !important;
  justify-content: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  font-size: var(--v76-ui-font) !important;
  line-height: 1 !important;
}
#app:not(.is-map-focus) .commandbar.v76-fit .route-tab span {
  min-width: 0 !important;
  white-space: nowrap !important;
}
#app:not(.is-map-focus) .commandbar.v76-fit .commandbar__actions {
  grid-column: 3 !important;
  grid-row: 1 !important;
  min-width: max-content !important;
  max-width: max-content !important;
  gap: var(--v76-action-gap, 5px) !important;
  position: relative !important;
  z-index: 4 !important;
}

/* 路线名称与“生成路线”严格同步字号 */
#app:not(.is-map-focus) .commandbar.v76-fit #route-toggle,
#app:not(.is-map-focus) .commandbar.v76-stack #route-toggle,
#app:not(.is-map-focus) .commandbar.v76-fit .route-tab,
#app:not(.is-map-focus) .commandbar.v76-stack .route-tab {
  font-size: var(--v76-ui-font) !important;
}
#app:not(.is-map-focus) .commandbar.v76-fit #route-toggle span,
#app:not(.is-map-focus) .commandbar.v76-stack #route-toggle span {
  font-size: inherit !important;
  white-space: nowrap !important;
}

/* 两行模式：第一行仅品牌 + 操作，第二行路线占满整行，物理上不可能重叠。 */
#app:not(.is-map-focus) .commandbar.v76-stack {
  height: auto !important;
  min-height: 86px !important;
  grid-template-columns: minmax(0, 1fr) max-content !important;
  grid-template-rows: 40px 36px !important;
  column-gap: 5px !important;
  row-gap: 3px !important;
  padding-top: 4px !important;
  padding-bottom: 4px !important;
}
#app:not(.is-map-focus) .commandbar.v76-stack .brand-lockup {
  grid-column: 1 !important;
  grid-row: 1 !important;
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  gap: 6px !important;
}
#app:not(.is-map-focus) .commandbar.v76-stack .brand-lockup > div:last-child {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
}
#app:not(.is-map-focus) .commandbar.v76-stack .brand-lockup h1 {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  font-size: var(--v76-stack-title-font, 20px) !important;
  line-height: 1.08 !important;
  letter-spacing: 0 !important;
}
#app:not(.is-map-focus) .commandbar.v76-stack .brand-star {
  flex: 0 0 auto !important;
  width: 32px !important;
  height: 32px !important;
}
#app:not(.is-map-focus) .commandbar.v76-stack .commandbar__actions {
  grid-column: 2 !important;
  grid-row: 1 !important;
  min-width: max-content !important;
  max-width: max-content !important;
  gap: 4px !important;
  position: relative !important;
  z-index: 4 !important;
}
#app:not(.is-map-focus) .commandbar.v76-stack .route-switch {
  grid-column: 1 / -1 !important;
  grid-row: 2 !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 36px !important;
  padding: 1px 2px !important;
  overflow: hidden !important;
  display: flex !important;
  position: relative !important;
  z-index: 3 !important;
}
#app:not(.is-map-focus) .commandbar.v76-stack .route-tab {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  width: auto !important;
  height: 32px !important;
  padding: 0 2px !important;
  gap: 2px !important;
  justify-content: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  line-height: 1 !important;
}
#app:not(.is-map-focus) .commandbar.v76-stack .route-tab span {
  min-width: 0 !important;
  white-space: nowrap !important;
}

/* 防止字体合成/滤镜在部分 Android WebView 非全屏时产生拖影。
   顶栏本身使用不透明度稳定的合成层，文字不做 transform 动画。 */
#app:not(.is-map-focus) .commandbar.v76-fit,
#app:not(.is-map-focus) .commandbar.v76-stack {
  transform: translateZ(0) !important;
  backface-visibility: hidden !important;
  -webkit-backface-visibility: hidden !important;
  will-change: auto !important;
}
#app:not(.is-map-focus) .commandbar.v76-fit .brand-lockup,
#app:not(.is-map-focus) .commandbar.v76-fit .route-switch,
#app:not(.is-map-focus) .commandbar.v76-fit .commandbar__actions,
#app:not(.is-map-focus) .commandbar.v76-stack .brand-lockup,
#app:not(.is-map-focus) .commandbar.v76-stack .route-switch,
#app:not(.is-map-focus) .commandbar.v76-stack .commandbar__actions {
  transform: none !important;
  animation: none !important;
}
