/**
 * 前端移动页头：md3-mobile-top-nav 与 #topAppBar 搜索条叠层修复
 * 顶栏固定 56px 时，原搜索行被完全遮挡；将 #topAppBar 下移并只保留搜索区。
 */
/* ======== sanxio 移动前端页头搜索 start =========== */

@media (max-width: 767px) {
	/* 无双行头：浮层顶边认单行页头高度，禁止再依赖已停引的 skin 56px 硬编码路径 */
	body:not(.member-md3-page):not(.sx-mobile-nav-v2):not(:has(.md3-mobile-top-nav)):has(#topAppBar) {
		--sanxio-header-mobile-front: 56px;
	}

	body:not(.member-md3-page):not(.sx-mobile-nav-v2):not(:has(.md3-mobile-top-nav)) #searchDropdown.mdc-search-dropdown {
		top: var(--sanxio-header-mobile-front, 56px) !important;
	}

	/* 首屏即终态：safe-area + 双行头，不依赖 sx-mobile-nav-v2 晚挂（F-20261116-mobile-nav-stable） */
	body:not(.member-md3-page):has(.md3-mobile-top-nav) {
		--sx-mobile-top-height: calc(56px + env(safe-area-inset-top, 0px));
		--sx-mobile-nav-title-gap: var(--sanxio-gap-sm, 8px);
	}

	body:not(.member-md3-page):has(.md3-mobile-top-nav):has(#topAppBar) {
		--sanxio-header-mobile-front: calc(var(--sx-mobile-top-height) + 56px);
		padding-top: var(--sanxio-header-mobile-front) !important;
	}

	body:not(.member-md3-page):has(.md3-mobile-top-nav):has(#topAppBar) #searchDropdown.mdc-search-dropdown {
		top: var(--sanxio-header-mobile-front, 112px) !important;
	}

	body:not(.member-md3-page):has(.md3-mobile-top-nav) #topAppBar.mdc-top-app-bar--fixed {
		top: var(--sx-mobile-top-height, 56px) !important;
		z-index: 999;
		left: 0;
		right: 0;
		/* 底色 / 外底线权威在 header-front-surface.css */
		box-shadow: none !important;
	}

	body:not(.member-md3-page) #js-mobile-top-nav {
		height: var(--sx-mobile-top-height, 56px) !important;
		padding: env(safe-area-inset-top, 0px) 4px 0 !important;
		gap: 0;
		box-sizing: border-box;
	}

	body:not(.member-md3-page) #js-mobile-top-nav .md3-mobile-top-nav__leading {
		width: 44px !important;
	}

	body:not(.member-md3-page) #js-mobile-top-nav .md3-mobile-top-nav__actions {
		display: flex;
		flex: 0 0 auto;
		gap: 0 !important;
		margin-left: auto;
	}

	body:not(.member-md3-page) #js-mobile-top-nav .md3-mobile-top-nav__btn {
		width: 44px !important;
		min-width: 44px !important;
		height: 44px !important;
		min-height: 44px !important;
	}

	body:not(.member-md3-page):has(.md3-mobile-top-nav) #topAppBar .mdc-top-app-bar__section--align-start,
	body:not(.member-md3-page):has(.md3-mobile-top-nav) #topAppBar .mdc-top-app-bar__section--align-end {
		display: none !important;
	}

	body:not(.member-md3-page):has(.md3-mobile-top-nav) #topAppBar .mdc-top-app-bar__row {
		height: auto;
		min-height: 56px;
		padding: var(--sanxio-gap-sm, 8px) var(--sanxio-block-px, 12px);
		box-sizing: border-box;
	}

	body:not(.member-md3-page):has(.md3-mobile-top-nav) #topAppBar .mdc-search-section {
		flex: 1 1 auto;
		width: 100%;
		max-width: none;
		margin: 0 !important;
		padding: 0 !important;
	}

	body:not(.member-md3-page):has(.md3-mobile-top-nav) #topAppBar .sanxio-header-search-cluster {
		width: 100%;
	}

	body:not(.member-md3-page):has(.md3-mobile-top-nav) #topAppBar #destoon-search.md3-search-bar {
		width: 100%;
		max-width: none;
		height: 40px !important;
		min-height: 40px;
		padding: 0 var(--sanxio-gap-sm, 8px) 0 var(--sanxio-block-px, 12px) !important;
		border-radius: var(--md3-shape-sm, 8px) !important;
		overflow: hidden !important;
		display: flex !important;
		align-items: center !important;
		gap: var(--sanxio-gap-sm, 8px) !important;
		box-sizing: border-box;
	}

	body:not(.member-md3-page):has(.md3-mobile-top-nav) #topAppBar #destoon-search .md3-search-bar__input-wrapper {
		flex: 1 1 auto;
		min-width: 0;
	}

	/* F-20261116-mobile-header-type：搜索框 body-medium；禁止硬编码 16px 盖 Token */
	body:not(.member-md3-page) #topAppBar #destoon-kw.md3-search-bar__input,
	body:not(.member-md3-page) #topAppBar #destoon-search .md3-search-bar__input,
	body.sx-mobile-nav-v2 #topAppBar #destoon-kw {
		font-size: var(--md3-typescale-body-medium-size, 14px) !important;
		font-weight: var(--md3-typescale-body-medium-weight, 400);
		line-height: var(--md3-typescale-body-medium-line-height, 20px) !important;
		letter-spacing: var(--md3-typescale-body-medium-tracking, 0.25px);
		transform: none !important;
	}

	body:not(.member-md3-page):has(.md3-mobile-top-nav) #topAppBar #destoon-search .md3-search-bar__actions {
		flex-shrink: 0;
		margin: 0 !important;
		padding: 0 !important;
		gap: var(--sanxio-gap-sm, 8px) !important;
		align-items: center;
	}

	body:not(.member-md3-page):has(.md3-mobile-top-nav) #topAppBar #destoon-search .md3-search-bar__module-select {
		margin-right: var(--sanxio-gap-sm, 8px);
		padding-right: var(--sanxio-gap-sm, 8px);
	}

	body:not(.member-md3-page):has(.md3-mobile-top-nav) #topAppBar #destoon-search .custom-md3-select__selected-text {
		max-width: 4.5rem;
		font-size: var(--md3-typescale-label-medium-size, 12px);
		font-weight: var(--md3-typescale-label-medium-weight, 500);
		line-height: var(--md3-typescale-label-medium-line-height, 16px);
		letter-spacing: var(--md3-typescale-label-medium-tracking, 0.5px);
	}

	body:not(.member-md3-page):has(.md3-mobile-top-nav) #topAppBar #destoon-search .md3-search-bar__submit,
	body:not(.member-md3-page):has(.md3-mobile-top-nav) #topAppBar #destoon-search .md3-search-bar__adv {
		width: 32px !important;
		height: 32px !important;
		min-width: 32px !important;
		min-height: 32px !important;
		max-height: 32px !important;
		margin: 0 !important;
		border-radius: var(--md3-shape-sm, 8px) !important;
		box-shadow: none !important;
		align-self: center;
	}

	body:not(.member-md3-page):has(.md3-mobile-top-nav) #topAppBar #destoon-search .md3-search-bar__submit .material-symbols-outlined {
		font-size: 20px !important;
	}

	body:not(.member-md3-page):has(.md3-mobile-top-nav) #topAppBar #destoon-search .md3-search-bar__adv {
		display: none;
	}

	/* sanxio-mobile-search-bar-collapsed 已退役（搜索条常驻）；仅保留 toggle[hidden] */
	.md3-mobile-top-nav__btn.sanxio-mobile-top-nav__search-toggle[hidden] {
		display: none !important;
	}

	/* 抽屉打开时：页头底部分隔线会从卡片左侧露出来 */
	body:has(#settingsDrawer.mdc-drawer--open) .md3-mobile-top-nav,
	body:has(#navDrawer.mdc-drawer--open) .md3-mobile-top-nav {
		border-bottom-color: transparent;
	}
	body:has(#settingsDrawer.mdc-drawer--open) #topAppBar.mdc-top-app-bar--fixed,
	body:has(#navDrawer.mdc-drawer--open) #topAppBar.mdc-top-app-bar--fixed {
		border-bottom-color: transparent !important;
	}

	/* 标题展开卡片打开：顶栏底边线不得压在卡片圆角上 */
	body.sx-mobile-title-card-open .md3-mobile-top-nav,
	.md3-mobile-top-nav.is-title-card-open {
		border-bottom-color: transparent !important;
	}
	body.sx-mobile-title-card-open #topAppBar.mdc-top-app-bar--fixed {
		/* 卡片叠在搜索条之上，避免搜索条顶边线露出来 */
		box-shadow: none !important;
	}
}

/* ======== sanxio 移动前端页头搜索 end =========== */

/* 125: compact public navigation and a single-row inner-page search mode. */
@media(max-width:767px){
body.sx-mobile-nav-v2{--sx-mobile-top-height:calc(56px + env(safe-area-inset-top,0px))}
body.sx-mobile-nav-v2 #js-mobile-top-nav{height:var(--sx-mobile-top-height)!important;padding:env(safe-area-inset-top,0px) 4px 0!important;gap:0}
body.sx-mobile-nav-v2 #js-mobile-top-nav .md3-mobile-top-nav__leading{width:44px!important}
body.sx-mobile-nav-v2 #js-mobile-top-nav .md3-mobile-top-nav__actions{display:flex;flex:0 0 auto;gap:0!important}
body.sx-mobile-nav-v2 #js-mobile-top-nav .md3-mobile-top-nav__btn{width:44px!important;min-width:44px!important;height:44px!important;min-height:44px!important}
/* 标题：左右配平 + flex 槽居中（禁止 absolute 模式切换） */
body.sx-mobile-nav-v2 #js-mobile-top-nav{--sx-mobile-nav-title-gap:var(--sanxio-gap-sm,8px);--sx-nav-bal-left:44px;--sx-nav-bal-right:0px}
body.sx-mobile-nav-v2 #js-mobile-top-nav .md3-mobile-top-nav__title{position:relative!important;left:auto!important;top:auto!important;bottom:auto!important;transform:none!important;flex:1 1 0%!important;width:auto!important;min-width:0!important;max-width:none!important;padding:0 4px!important;margin:0 var(--sx-nav-bal-right,0px) 0 var(--sx-nav-bal-left,44px)!important;z-index:0}
body.sx-mobile-nav-v2 #js-mobile-top-nav .md3-mobile-top-nav__leading,
body.sx-mobile-nav-v2 #js-mobile-top-nav .md3-mobile-top-nav__actions{position:relative;z-index:1}
body.sx-mobile-nav-v2 #js-mobile-top-nav .md3-mobile-top-nav__actions{margin-left:auto}
/* 图标：只认 mobile-top-nav.css mask；禁止 font-size/SVG 双轨（F-20261116-mobile-nav-stable） */
body.sx-mobile-nav-v2 #js-mobile-top-nav .material-symbols-outlined{min-width:0!important;display:inline-flex;align-items:center;justify-content:center;overflow:hidden}
body.sx-mobile-nav-v2 #js-mobile-settings-toggle{position:relative!important;display:flex;align-items:center;justify-content:center}
body.sx-mobile-nav-v2 #js-mobile-top-nav .mdc-top-app-bar__user-avatar-fallback{position:absolute!important;inset:0!important;margin:auto!important;transform:none!important}
body.sx-mobile-nav-v2 #js-translate-btn-mobile{display:none!important}
/* 首页与内页统一：顶栏 + #topAppBar 搜索条常驻（已清叠层搜索壳） */
body.sx-mobile-nav-v2.sx-mobile-nav-inner:not(.member-md3-page):has(#topAppBar),
body.sx-mobile-nav-v2.sx-mobile-nav-home:not(.member-md3-page):has(#topAppBar){--sanxio-header-mobile-front:calc(var(--sx-mobile-top-height) + 56px);padding-top:var(--sanxio-header-mobile-front)!important}
body.sx-mobile-nav-v2.sx-mobile-nav-inner #topAppBar,
body.sx-mobile-nav-v2.sx-mobile-nav-home #topAppBar{top:var(--sx-mobile-top-height)!important}
body.sx-mobile-searching #js-mobile-top-nav{overflow:visible!important;z-index:2102!important}
/* 搜索聚焦：保留左侧返回，勿整栏藏 leading */
body.sx-mobile-nav-v2 #topAppBar #destoon-kw{min-width:0;width:100%;height:42px;box-sizing:border-box;font-size:var(--md3-typescale-body-medium-size,14px)!important;line-height:var(--md3-typescale-body-medium-line-height,20px)!important}
/* 面板顶边贴搜索条底：用整段页头高度，勿只用顶栏 56px */
body.sx-mobile-nav-v2 #topAppBar #searchDropdown{position:fixed!important;top:var(--sanxio-header-mobile-front,calc(var(--sx-mobile-top-height) + 56px))!important;left:0!important;right:0!important;width:100%!important;max-width:none!important;z-index:2103!important}
}

/* 128: 配平后槽内居中；禁止再挂 is-title-screen-center absolute */
@media(max-width:767px){
body.sx-mobile-nav-v2 #js-mobile-top-nav .md3-mobile-top-nav__leading,
body.sx-mobile-nav-v2 #js-mobile-top-nav .md3-mobile-top-nav__actions{display:flex;align-items:center!important;height:44px}
body.sx-mobile-nav-v2 #js-mobile-top-nav .md3-mobile-top-nav__btn{display:inline-flex;align-items:center!important;justify-content:center!important;padding:0!important;line-height:1!important;transform:none!important;box-sizing:border-box}
body.sx-mobile-nav-v2 #js-mobile-top-nav .md3-mobile-top-nav__title{display:flex!important;align-items:center!important;justify-content:center!important;height:44px;line-height:24px!important}
body.sx-mobile-nav-v2 #js-mobile-top-nav .md3-mobile-top-nav__title-text{font-size:var(--md3-typescale-title-medium-size,16px)!important;font-weight:var(--md3-typescale-title-medium-weight,500);line-height:var(--md3-typescale-title-medium-line-height,24px)!important;letter-spacing:var(--md3-typescale-title-medium-tracking,0.15px);width:auto;max-width:100%}
body.sx-mobile-nav-v2 #js-mobile-top-nav .material-symbols-outlined{vertical-align:middle;transform:none!important}
body.sx-mobile-nav-v2 #js-mobile-top-nav .mdc-top-app-bar__user-avatar-img{position:absolute!important;inset:0!important;margin:auto!important;transform:none!important;object-fit:cover}
body.sx-mobile-nav-home #topAppBar{transition:transform .18s ease,opacity .18s ease!important}
body.sx-mobile-nav-home.sx-home-search-hidden #topAppBar{transform:translateY(-100%)!important;opacity:0!important;pointer-events:none!important}
body.sx-mobile-nav-home.sx-home-search-hidden #js-mobile-top-nav{z-index:2102!important}
}
@media(max-width:767px) and (prefers-reduced-motion:reduce){body.sx-mobile-nav-home #topAppBar{transition:none!important}}
/* 129: hide the complete search header when home search is collapsed. */
@media(max-width:767px){
body.sx-mobile-nav-home.sx-home-search-hidden #topAppBar.mdc-top-app-bar{visibility:hidden!important;border-color:transparent!important;box-shadow:none!important}
}
@media(max-width:767px){body.sx-mobile-nav-home.sx-home-search-hidden #categoryDrawer:not(.mdc-category-drawer--open){visibility:hidden!important;border:0!important;box-shadow:none!important}}
