/* ==========================================================================
 * UC工具箱：Discuz 原生「我的收藏 / 个人中心」窄视口布局修复（插件侧覆盖样式）
 *
 * 加载条件（见 source/plugin/uctools/uctools.class.php 的 global_meta）：
 *   home.php?mod=space&do=favorite        （我的收藏，含 favtype=tools）
 *   home.php?mod=spacecp                  （个人中心设置系列页面）
 * 论坛 / 门户 / 帖子页不加载本文件。
 *
 * 只在 max-width:1199px 生效：≥1200px（含 1280/1440 桌面）与改动前完全一致。
 *
 * 为什么用 !important：
 *   global_meta 钩子在 template/wind/common/header_common.php L7 输出，
 *   早于 L9 的 <!--{csstemplate}-->（style_4_common.css）加载。
 *   同优先级的声明会被后加载的主题样式覆盖，必须 !important 才能生效。
 *
 * 病理（实测证据）：
 *   1) 内核默认模板 template/default/common/common.css L91  body{min-width:1200px}
 *   2) 主题 template/wind/common/extend_common.css L122      .dz_wide .wp{width:1200px}
 *   3) 同文件 L127  .dz_wide .ct2_a .mn{width:945px}（+ .ct2 L123/L125、L422 .dz_btm_layer）
 *   4) 页面无 <meta name="viewport">，移动端布局视口落到 980px，媒体查询全部失效
 * ========================================================================== */

@media (max-width: 1199px) {

	/* 0) 兜底：主题页头在 375 下 flex 内容比容器宽 12.7px（左右内边距各 12px 已吸收 12px），
	 *    残留 0.7px 落在 #gzuc_mobile_menu_btn 右缘（right=375.7），会把 html scrollWidth
	 *    顶到 376。clip 只裁剪越界像素、不产生滚动容器，吸顶页头与离屏抽屉动画不受影响。
	 * 1) 内核默认 body 最小宽 1200px：窄屏归零，否则任何内容都撑出横向滚动 */
	body {
		overflow-x: clip;
		min-width: 0 !important;
	}

	/* 2) 外层容器固定宽 1200px（.wp / .dz_wide .wp）：窄屏改为随视口 */
	.wp,
	.dz_wide .wp,
	#wp {
		width: auto !important;
		max-width: 100%;
	}

	/* 3) 主栏 / 边栏固定宽：945 / 885 / 720 / 300 / 250，一律回到自适应并取消浮动 */
	.dz_wide .ct2_a .mn,
	.dz_wide .ct2_a_r .mn,
	.dz_wide .ct2 .mn,
	.dz_wide .ct3_a .mn,
	.dz_wide .ct2 .sd,
	.dz_wide .ct3_a .sd {
		width: auto !important;
		max-width: 100%;
		float: none !important;
	}

	/* 4) 两栏容器（#ct.ct2_a）改为纵向流：DOM 里 .appl 在 .mn 之后，
	 *    用 order 把「页签/用户菜单」提到内容上方，避免被压到页面底部。
	 *    桌面（≥1200）不生效。 */
	#ct.ct2_a {
		display: flex !important;
		flex-direction: column;
	}

	#ct.ct2_a > .appl {
		order: 1;
		width: auto !important;
		max-width: 100%;
		float: none !important;
		margin: 0 0 10px 0;
	}

	#ct.ct2_a > .mn {
		order: 2;
		width: auto !important;
		max-width: 100%;
		float: none !important;
		margin: 0 0 15px 0;
	}

	/* 5) 页签/用户菜单：每行 44px，满足 ≤991 触控目标 ≥44px */
	.appl li {
		height: 44px !important;
		line-height: 44px !important;
	}

	.appl li a {
		display: block;
		min-height: 44px;
		white-space: normal;
	}

	/* 6) 底部层固定最小宽（extend_common.css L422）；没有该元素的页面无副作用 */
	.dz_btm_layer {
		min-width: 0 !important;
	}

	/* 7) 用户卡固定 210px / max-width:286px，窄屏收紧到视口内 */
	.header-user .user-card {
		width: auto !important;
		max-width: calc(100vw - 24px);
	}
}
