/* Shared compact segmented navigation. Scope explicitly to opted-in rails;
   content cards, bottom navigation, admin screens and game controls stay out. */
:root {
  --ng-segment-surface: var(--ng-panel-solid, #fff);
  --ng-segment-text: var(--ng-ink, #17243a);
  --ng-segment-muted: var(--ng-muted, #53647d);
  --ng-segment-accent: var(--ng-accent, var(--primary, #2f6bff));
  --ng-segment-accent-end: var(--ng-accent-2, #62b7ff);
  --ng-segment-line: var(--ng-line, #dce4f1);
  --ng-segment-padding: 12px;
  --ng-segment-top: max(8px, env(safe-area-inset-top, 0px));
}
html[data-theme="dark"] {
  --ng-segment-surface: var(--ng-panel-solid, #14213a);
  --ng-segment-text: var(--ng-ink, #edf3ff);
  --ng-segment-muted: var(--ng-muted, #bdcbe1);
}

/* The lottery reference fits four Chinese characters, a 20px icon and a 6px
   gap. Give movie/adult labels the same stable width, including short labels
   such as All. Do not stretch these controls differently on wide screens. */
html[data-ui-theme] body .lottery-category-shell.ng-segmented,
html[data-ui-theme] body .collector-catalog-shell:is([data-collector-type="movies"],[data-collector-type="adult"]) .collector-category-filters.ng-segmented {
  --ng-segment-item-width: calc(78px + var(--ng-segment-padding) + var(--ng-segment-padding));
  --ng-segment-item-flex: 0 0 auto;
}

html[data-ui-theme] body .ng-segmented.ng-segmented {
  position: sticky !important;
  top: var(--ng-segment-top) !important;
  z-index: var(--ng-layer-sticky, 30);
  display: block !important;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0 !important;
  margin: 12px 0 !important;
  padding: 4px !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  backdrop-filter: none !important;
}
html[data-ui-theme] body .ng-segmented.ng-segmented::before,
html[data-ui-theme] body .ng-segmented.ng-segmented::after { content: none !important; display: none !important; }

html[data-ui-theme] body .ng-segmented .ng-segmented-track,
html[data-ui-theme] body .ng-segmented.ng-segmented-track {
  position: relative;
  display: flex !important;
  align-items: center;
  justify-content: flex-start !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  min-width: 0;
  min-height: 40px !important;
  width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none;
  scroll-padding-inline: 4px;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}
html[data-ui-theme] body .ng-segmented > .ng-segmented-track {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.ng-segmented-track::-webkit-scrollbar { display: none; }

html[data-ui-theme] body .ng-segmented .ng-segmented-item.ng-segmented-item {
  position: relative !important;
  isolation: isolate;
  box-sizing: border-box;
  display: inline-flex !important;
  flex: var(--ng-segment-item-flex, 0 0 auto) !important;
  align-items: center !important;
  justify-content: center !important;
  width: var(--ng-segment-item-width, auto) !important;
  min-width: var(--ng-segment-item-width, max-content) !important;
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  margin: 0 !important;
  padding: 0 var(--ng-segment-padding) !important;
  gap: 6px !important;
  overflow: hidden;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;
  color: var(--ng-segment-muted) !important;
  font: 600 13px/1.4 Inter,"PingFang SC","Microsoft YaHei",system-ui,sans-serif !important;
  text-decoration: none;
  text-align: center;
  white-space: nowrap !important;
  text-shadow: none !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
  clip-path: none !important;
  transition: opacity 160ms ease !important;
  cursor: pointer;
}
html[data-ui-theme] body .ng-segmented.is-balanced .ng-segmented-item.ng-segmented-item { flex: var(--ng-segment-item-flex, 1 1 auto) !important; }
html[data-ui-theme] body .ng-segmented .ng-segmented-item.ng-segmented-item::before {
  content: "" !important;
  position: absolute !important;
  inset: 3px 0 !important;
  width: auto !important;
  height: auto !important;
  z-index: -1;
  border: 1px solid var(--ng-segment-line) !important;
  border-radius: 10px !important;
  background: color-mix(in srgb, var(--ng-segment-accent) 7%, var(--ng-segment-surface)) !important;
  box-shadow: none !important;
  transform: none !important;
  opacity: 1 !important;
  animation: none !important;
  pointer-events: none;
}
html[data-ui-theme] body .ng-segmented .ng-segmented-item.ng-segmented-item::after { content: none !important; display: none !important; animation: none !important; }
html[data-ui-theme] body .ng-segmented .ng-segmented-item.ng-segmented-item:is(.active,.is-active,[aria-selected="true"],[aria-current="page"]) { color: var(--ng-on-accent,#fff) !important; }
html[data-ui-theme] body .ng-segmented .ng-segmented-item.ng-segmented-item:is(.active,.is-active,[aria-selected="true"],[aria-current="page"])::before {
  background: var(--ng-button, linear-gradient(125deg,var(--ng-segment-accent),var(--ng-segment-accent-end))) !important;
  border-color: transparent !important;
}
html[data-ui-theme] body .ng-segmented .ng-segmented-item.ng-segmented-item:focus-visible { outline: 2px solid var(--ng-segment-accent) !important; outline-offset: -2px !important; }
html[data-ui-theme] body .ng-segmented .ng-segmented-item.ng-segmented-item:active { opacity: .8; }
html[data-ui-theme] body .ng-segmented-item strong,
html[data-ui-theme] body .ng-segmented-item .collector-category-label { font: inherit !important; }
html[data-ui-theme] body .collector-catalog-shell[data-collector-type] .ng-segmented-item .collector-category-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[data-ui-theme] body .gh-main-categories.ng-segmented small { display: none !important; }
html[data-ui-theme] body .ng-segmented-item :is([data-ng-symbol-slot],.nav-icon) {
  display: inline-flex !important;
  flex: 0 0 20px !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: none !important;
}
html[data-ui-theme] body .ng-segmented-item :is([data-ng-symbol-slot],.nav-icon) img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
  transform: none !important;
  filter: none !important;
}

/* Sticky rails must share the page scroll container, not an overflow-hidden
   ancestor. Keep clipping at the page edge without making another scroller. */
html body.ng-segmented-page { overflow-x: clip; }
html body.ng-segmented-page :is(.ng-music-shell,.collector-catalog-panel) { overflow-x: clip !important; overflow-y: visible !important; }
html body.ng-segmented-page .collector-catalog-shell { overflow: visible !important; }
html body[data-activity-page] .activity-page-filter { display: contents; }
html[data-ui-theme] body[data-activity-page] .activity-hall-backdrop { overflow: visible !important; }
html body[data-activity-page].ng-segmented-page.activity-hall-open:not(.site-share-open):not(.activity-application-open) {
  overflow-x: clip;
  overflow-y: visible;
}
html[data-ui-theme] body .lottery-navigation:has(.ng-segmented) {
  position: sticky !important;
  top: var(--ng-segment-top) !important;
  z-index: var(--ng-layer-sticky, 30);
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
}
html[data-ui-theme] body .lottery-navigation .ng-segmented.ng-segmented { position: relative !important; top: auto !important; margin: 0 !important; }
html[data-ui-theme] body .robot-category-tabs.ng-segmented.ng-segmented { top: calc(var(--ng-segment-top) + 58px) !important; }
@media (max-width:350px) { :root { --ng-segment-padding: 9px; } }
@media (prefers-reduced-motion:reduce) {
  html[data-ui-theme] body .ng-segmented .ng-segmented-item.ng-segmented-item,
  html[data-ui-theme] body .ng-segmented .ng-segmented-item.ng-segmented-item::before { transition: none !important; animation: none !important; }
}
