/* 非 scoped 样式：全局修复 html/body 溢出，适配手机端 */
html,
body {
	overflow-x: hidden !important;
	max-width: 100vw !important;
	margin: 0 !important;
	padding: 0 !important;
}

/* H5 容器内部所有图片/视频/表格等不溢出屏幕宽度 */
.h5-preview img,
.h5-preview video,
.h5-preview table {
	max-width: 100% !important;
	height: auto !important;
}

.h5-preview pre {
	max-width: 100%;
	overflow-x: auto;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.h5-preview iframe {
	max-width: 100% !important;
}

/* ---- 主容器 ---- */
.h5-preview {
	width: 100%;
	max-width: 640px;
	margin: 0 auto;
	min-height: 100vh;
	background: #fff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	position: relative;
	overflow-x: hidden;
	box-sizing: border-box;
}

/* ---- 加载/错误/空状态 ---- */
.loading-state,
.error-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 60vh;
	color: #999;
	gap: 12px;
}

.loading-icon {
	font-size: 32px;
	animation: h5preview-rotating 1.5s linear infinite;
}

.empty-icon {
	opacity: 0.6;
}

@keyframes h5preview-rotating {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

/* ---- 列表模式 ---- */
.preview-list {
	padding: 12px 10px;
	width: 100%;
	box-sizing: border-box;
}

.multi-article-preview {
	background: #fff;
	border-radius: 5px;
	width: 100%;
	box-sizing: border-box;
}

/* 头部大图文章 */
.main-article {
	position: relative;
	margin-bottom: 10px;
	cursor: pointer;
}

.main-cover {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	max-height: 200px;
	overflow: hidden;
	position: relative;
	border-radius: 4px;
}

.main-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.main-title {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 28px 10px 2px;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.7) 0%,
		rgba(0, 0, 0, 0) 100%
	);
	color: #fff;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.4;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* 子文章列表 */
.sub-article-item {
	display: flex;
	padding: 10px;
	border-bottom: 1px solid #e7e7e7;
	cursor: pointer;
	align-items: center;
}

.sub-article-item:last-child {
	border-bottom: none;
}

.sub-article-item:active {
	background-color: #f5f7fa;
}

.sub-title {
	flex: 1;
	font-size: 14px;
	color: #333;
	line-height: 1.4;
	margin-right: 10px;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
}

.sub-cover {
	width: 60px;
	height: 60px;
	flex-shrink: 0;
	border-radius: 4px;
	overflow: hidden;
}

.sub-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ---- 详情模式 ---- */
.preview-detail {
	min-height: 100vh;
	width: 100%;
	box-sizing: border-box;
	overflow-x: hidden;
}

.detail-back {
	display: flex;
	align-items: center;
	justify-content: space-between;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	padding: 12px 16px;
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	z-index: 100;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.back-btn {
	display: flex;
	align-items: center;
	gap: 4px;
	cursor: pointer;
	color: #576b95;
	font-size: 14px;
	user-select: none;
}

.back-btn:active {
	opacity: 0.7;
}

.share-btn {
	display: flex;
	align-items: center;
	cursor: pointer;
	color: #576b95;
	font-size: 20px;
	padding: 4px;
	user-select: none;
}

.share-btn:active {
	opacity: 0.7;
}

.wechat-article-preview {
	min-height: 100vh;
	background: #fff;
	padding-top: 60px;
	width: 100%;
	box-sizing: border-box;
	overflow-x: hidden;
}

/* 文章头部 */
.article-header {
	padding: 16px 12px 12px;
	border-bottom: 1px solid #e7e7e7;
}

.article-title {
	font-size: 20px;
	font-weight: 600;
	color: #000;
	line-height: 1.4;
	margin: 0 0 10px 0;
	word-wrap: break-word;
	word-break: break-word;
}

.article-meta {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 12px;
	color: #8c8c8c;
}

.article-meta .author {
	color: #576b95;
}

/* 文章正文 */
.article-content {
	padding: 12px;
	min-height: 200px;
	overflow-x: hidden;
}

.content-html {
	font-size: 15px;
	line-height: 1.8;
	color: #333;
	word-wrap: break-word;
	overflow-x: hidden;
}

.content-html img {
	max-width: 100%;
	height: auto;
	display: block;
	margin: 12px 0;
}

.content-html p {
	margin: 12px 0;
	text-align: justify;
}

.content-html h1,
.content-html h2,
.content-html h3,
.content-html h4,
.content-html h5,
.content-html h6 {
	margin: 20px 0 12px 0;
	font-weight: 600;
	color: #000;
}

.content-html ul,
.content-html ol {
	margin: 12px 0;
	padding-left: 24px;
}

.content-html li {
	margin: 6px 0;
}

.content-html blockquote {
	margin: 12px 0;
	padding: 10px 16px;
	border-left: 4px solid #d0d0d0;
	background: #f7f7f7;
	color: #666;
}

.content-html code {
	padding: 2px 6px;
	background: #f5f5f5;
	border-radius: 2px;
	font-family: "Courier New", Consolas, monospace;
	font-size: 14px;
	color: #e96900;
}

.content-html pre {
	margin: 12px 0;
	padding: 12px;
	background: #f5f5f5;
	border-radius: 4px;
	overflow-x: auto;
}

.content-html pre code {
	padding: 0;
	background: none;
	color: #333;
}

.content-html a {
	color: #576b95;
	text-decoration: none;
}

.content-html a:hover {
	text-decoration: underline;
}

.content-html strong {
	font-weight: 600;
}

.content-html em {
	font-style: italic;
}

.content-summary {
	font-size: 15px;
	line-height: 1.8;
	color: #666;
	padding: 12px;
	background: #f7f7f7;
	border-radius: 4px;
}

.content-empty {
	padding: 40px 0;
	text-align: center;
	color: #999;
}

/* 附件 */
.file-name {
	display: inline-block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	word-break: break-word;
	font-size: 13px;
	line-height: 1.6;
	margin-bottom: 4px;
	cursor: pointer;
	color: #576b95;
}
