/* 非 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: h5detail-rotating 1.5s linear infinite;
}

.empty-icon {
	opacity: 0.6;
}

@keyframes h5detail-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;
}

.wechat-article-preview {
	min-height: 100vh;
	background: #fff;
	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;
}

/* ---- 底部统计：阅读/点赞/分享 ---- */
.article-footer {
	padding: 12px;
}

.stats-row {
	display: flex;
	justify-content: flex-start;
	gap: 32px;
}

.stat-item {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 14px;
	color: #8c8c8c;
	cursor: default;
}

/* 点赞按钮可点击 */
#like-btn {
	cursor: pointer;
}

/* 点赞图标：空心默认，实心点赞后 */
#like-btn .like-icon path {
	fill: transparent;
	stroke: #8c8c8c;
	stroke-width: 64px;
	transition: all 0.2s;
}

/* 已点赞状态 */
#like-btn[data-liked="1"] {
	color: #409eff;
}

#like-btn[data-liked="1"] .like-icon path {
	fill: #409eff;
	stroke: none;
}

/* 分享按钮 */
.share-stat {
	cursor: pointer;
}

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

#like-btn:active {
	opacity: 0.7;
}

/* ---- Toast 提示 ---- */
.h5-toast {
	position: fixed;
	top: 5%;
	right: 5%;
	transform: translate(-50%, -50%);
	background: rgba(0, 0, 0, 0.75);
	color: #fff;
	padding: 10px 16px;
	border-radius: 4px;
	font-size: 14px;
	z-index: 9999;
	max-width: 80%;
	text-align: center;
	box-sizing: border-box;
}

/* ---- 评论区 ---- */
.comment-section {
	padding: 0 12px 20px;
	border-top: 8px solid #f5f5f5;
}

.comment-header h3 {
	margin: 16px 0 12px;
	font-size: 16px;
	font-weight: 600;
	color: #000;
}

.comment-empty,
.comment-loading-tip {
	text-align: center;
	color: #999;
	padding: 24px 0;
	font-size: 14px;
}

.comment-item {
	display: flex;
	gap: 10px;
	padding: 12px 0;
	border-bottom: 1px solid #f0f0f0;
}

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

.comment-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #576b95;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	flex-shrink: 0;
}

.comment-body {
	flex: 1;
	min-width: 0;
}

.comment-user {
	font-size: 14px;
	font-weight: 500;
	color: #576b95;
}

.comment-time {
	font-size: 11px;
	color: #b2b2b2;
	margin-top: 2px;
}

.comment-text {
	font-size: 14px;
	color: #333;
	line-height: 1.6;
	margin-top: 6px;
	word-wrap: break-word;
}

/* 回复列表 */
.reply-list {
	background: #f7f7f7;
	border-radius: 4px;
	padding: 0 8px;
	margin-top: 8px;
}

.reply-item {
	padding: 8px 0;
	border-bottom: 1px solid #eee;
}

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

.reply-header {
	display: flex;
	align-items: center;
	gap: 8px;
}

.reply-user {
	font-size: 12px;
	font-weight: 500;
	color: #576b95;
}

.reply-time {
	font-size: 11px;
	color: #b2b2b2;
}

.reply-text {
	font-size: 13px;
	color: #333;
	line-height: 1.5;
	margin-top: 4px;
	word-wrap: break-word;
}

/* 输入框和发送按钮在同一行 */
.comment-input-row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 16px;
	border-top: 1px solid #f0f0f0;
	padding-top: 12px;
}

.comment-input {
	flex: 1;
	border: 1px solid #e0e0e0;
	border-radius: 20px;
	padding: 8px 14px;
	font-size: 13px;
	outline: none;
	box-sizing: border-box;
	font-family: inherit;
	line-height: 1.4;
}

.comment-input:focus {
	border-color: #576b95;
}

.comment-input::placeholder {
	color: #c0c0c0;
}

.comment-send-btn {
	flex-shrink: 0;
	border: none;
	background: #576b95;
	color: #fff;
	padding: 8px 18px;
	border-radius: 20px;
	font-size: 13px;
	cursor: pointer;
	white-space: nowrap;
}

.comment-send-btn:disabled {
	background: #c0c0c0;
	cursor: not-allowed;
}
