/* 手机端适配层（≤1020px）
 *
 * 桌面皮肤（style.css / acg.css / acg-inner.css）是按 1220px 定宽设计的，
 * 手机上没有任何 viewport 与媒体查询，浏览器会按 980px 渲染再整体缩小 —— 字小、列表页还会横向溢出。
 * 这里只在窄屏把布局折成单栏，电脑端一行都不受影响（全部规则包在 @media 里）。
 *
 * 引入位置：template/default/header.htm 末尾（acg-inner.css 之后）。
 */

@media (max-width: 1020px) {
	html, body { overflow-x: hidden; }
	body { font-size: 14px; }
	img { max-width: 100%; height: auto; }

	/* ---------- 通用容器：1220px 定宽 -> 满宽 ---------- */
	.ac-wrap, .m {
		width: auto !important;
		max-width: none !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
		padding-left: 12px !important;
		padding-right: 12px !important;
	}
	.m { overflow: visible !important; }
	/* .m1/.m2 的竖分割线是背景图（960px 处），窄屏必须去掉 */
	.m1, .m2 {
		background: none !important;
		overflow: visible !important;
		display: block !important;
	}
	.m1l, .m2l, .m1r, .m2r {
		float: none !important;
		width: auto !important;
		min-width: 0 !important;
	}
	.m1r, .m2r { margin-top: 14px; }

	/* ---------- 顶部小条 ---------- */
	.ac-top-in { flex-wrap: wrap; gap: 2px 8px; font-size: 12px; }
	.ac-top-r { display: flex; flex-wrap: wrap; gap: 6px; }
	.ac-top-r i { display: none; }

	/* ---------- 页头：logo + 搜索 ---------- */
	.ac-hd-in {
		display: flex !important;
		flex-wrap: wrap;
		grid-template-columns: none !important;
		grid-template-rows: none !important;
		gap: 10px;
		padding: 10px 0 !important;
	}
	.ac-hd-in .ac-logo { grid-column: auto !important; grid-row: auto !important; flex: 0 0 auto; }
	.ac-logo img { height: 34px; width: auto; }
	.ac-hd-in .ac-sch, .ac-sch {
		grid-column: auto !important;
		grid-row: auto !important;
		flex: 1 1 100%;
		order: 3;
		padding: 0 !important;
	}
	.ac-tabs { display: none !important; }
	.ac-sbox input { height: 40px; font-size: 14px; padding: 0 12px; }
	.ac-sbox .ac-sbtn { height: 40px; width: 72px; font-size: 14px; }
	.ac-hot, .ac-hd-r { display: none !important; }

	/* ---------- 主导航：横向滚动，不再换行挤压 ---------- */
	.ac-nav-in {
		height: 44px !important;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
	.ac-all { display: none !important; }
	.ac-menu {
		flex: 1 1 auto;
		margin: 0 !important;
		overflow-x: auto;
		white-space: nowrap;
	}
	.ac-menu a { padding: 0 12px !important; height: 44px !important; line-height: 44px !important; font-size: 14px; }
	.ac-nav-r { display: none !important; }
	.ac-gap { display: none !important; }

	/* ---------- 面包屑 ---------- */
	.nav {
		height: auto !important;
		line-height: 1.9 !important;
		padding: 8px 10px 8px 30px !important;
		word-break: break-all;
	}
	.nav div { float: none !important; margin-bottom: 4px; }

	/* ---------- 列表页筛选条（行业/地区/类别 chips） ---------- */
	.sort-f { padding: 6px 0 !important; }
	.sort { padding: 6px 0 !important; line-height: 1.8 !important; }
	.sort-k { float: none !important; width: auto !important; padding: 0 0 4px !important; font-size: 13px; }
	.sort-v { float: none !important; width: auto !important; overflow: visible !important; }
	.sort-v ul { display: flex; flex-wrap: wrap; gap: 6px 10px; }
	.sort-v li { float: none !important; width: auto !important; padding: 0 !important; margin: 0 !important; }

	/* ---------- 供应/商品卡片：两栏也能挤坏，直接单栏 ---------- */
	.ac-lgrid { grid-template-columns: 1fr !important; gap: 10px !important; }
	.ac-lcard { min-height: 0 !important; }
	.ac-lcard-img { flex: 0 0 104px !important; width: 104px !important; height: 104px !important; margin: 10px !important; }
	.ac-lcard-b { padding: 10px 12px !important; }
	.ac-lprice { font-size: 16px !important; }

	/* ---------- 首页 / 频道页 hero ---------- */
	.ac-hero-in { grid-template-columns: 1fr !important; height: auto !important; }
	/* 左侧「全部分类」：12 项竖排占 440px，窄屏改两列；悬浮子菜单在触摸设备上没用 */
	.ac-cats { padding: 6px 4px !important; }
	.ac-cats ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.ac-cat-a { height: 34px !important; padding: 0 8px !important; font-size: 13.5px; }
	.ac-cat-a em { display: none; }
	.ac-fly { display: none !important; }
	/* 列方向下 align-items:flex-start 会让子项按 max-content 撑宽，
	   长段落被 hero 的 overflow:hidden 直接裁掉 —— 这里必须 stretch */
	.ac-ch-hero-in { flex-direction: column !important; align-items: stretch !important; gap: 14px; }
	.ac-ch-hero-l { width: 100% !important; }
	.ac-ch-stats { display: none !important; }
	.ac-ch-hero p { white-space: normal !important; }
	.ac-ch-search { width: 100% !important; height: 42px !important; }
	/* 搜索按钮原来是深蓝(#163ea8)压在深蓝 hero 上，手机上几乎看不见 -> 反白 */
	.ac-ch-search button { width: 84px !important; background: #fff !important; color: #163ea8 !important; font-weight: 600; }
	.ac-sec { padding: 14px 12px !important; }
	.ac-sec-h { flex-wrap: wrap; gap: 6px; }
	.ac-sec-h h2 { font-size: 18px !important; }
	.ac-sec-h .ac-links { margin-left: 0 !important; flex-wrap: wrap; }

	/* ---------- 详情页正文 / 表格 ---------- */
	.content, .dt-body { overflow-x: auto; }
	.content img, .dt-body img { max-width: 100% !important; height: auto !important; }
	.content table, .dt-body table { max-width: 100%; }

	/* 对比表 / 帮助中心表格：横向滚动，别撑破页面 */
	.cmp, .compare { overflow-x: auto !important; }
	.cmp table, .compare table { min-width: 560px; }
	.tb { display: block; overflow-x: auto; white-space: nowrap; }

	/* ---------- 搜索表单 ---------- */
	.sf { display: block !important; }
	.sf-k { width: auto !important; float: none !important; padding: 0 0 4px !important; }
	.sf-v { width: auto !important; float: none !important; }
	select, input[type="text"], input[type="date"], input[type="search"], textarea { max-width: 100%; }

	/* ---------- 分页 ---------- */
	.pages { text-align: center; line-height: 2.4 !important; }
	.pages a, .pages em, .pages strong { margin: 0 2px !important; }

	/* ---------- 页脚 ---------- */
	.ac-ft-top { flex-wrap: wrap !important; gap: 16px 8px !important; padding: 20px 0 !important; }
	.ac-ft-brand { flex: 1 1 100% !important; }
	.ac-ft-col { flex: 1 1 45% !important; margin: 0 !important; }
	.ac-ft-links { padding: 12px 0 !important; }
	.ac-ft-bot { flex-direction: column !important; gap: 6px; text-align: center; }

	/* ---------- 列表工具条（对比选中 / 批量询价） ---------- */
	.tools table { display: block; }
	.tools td { display: inline-block; padding: 4px !important; }
}

@media (max-width: 480px) {
	.ac-menu a { padding: 0 9px !important; font-size: 13px; }
	.ac-lcard-img { flex: 0 0 92px !important; width: 92px !important; height: 92px !important; }
	.ac-ft-col { flex: 1 1 100% !important; }
}
