/* 全局样式 */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	background: linear-gradient(135deg, #dfdfdf 0%, #ffffff 100%);
	min-height: 100vh;
	padding: 20px;
}

.container {
	max-width: 70vw;
	margin: 0 auto;
}

/* 头部区域 */
header {
	background: white;
	padding: 30px;
	border-radius: 15px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.1);
	margin-bottom: 30px;
	width: 100%;
}

h1 {
	color: #000;
	font-size: 2.5em;
	margin-bottom: 10px;
}

header > p {
	color: #666;
	font-size: 1.1em;
}

.header-nav {
	margin-top: 15px;
}

.nav-link {
	color: #007bff;
	text-decoration: none;
	font-size: 16px;
	padding: 8px 16px;
	border-radius: 5px;
	transition: background-color 0.3s;
	display: inline-block;
}

.nav-link:hover {
	background-color: rgba(0, 123, 255, 0.1);
}

/* 按钮 */
button {
	padding: 12px 24px;
	background: linear-gradient(135deg, #000 0%, #333 100%);
	color: white;
	border: none;
	border-radius: 8px;
	font-size: 1em;
	cursor: pointer;
	transition: transform 0.2s;
}

button:hover {
	transform: translateY(-2px);
}

button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

/* 文章网格 - 单列布局 */
.posts-grid {
	display: flex;
	flex-direction: column;
	gap: 20px;
	margin-bottom: 30px;
	width: 100%;
}

.post-card {
	background: white;
	border-radius: 15px;
	overflow: hidden;
	box-shadow: 0 5px 20px rgba(0,0,0,0.1);
	transition: transform 0.3s, box-shadow 0.3s;
	display: flex;
	flex-direction: column;
}

.post-card:hover {
	transform: translateY(-5px);
	box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.post-card.marked {
	background: #ffe5e5;
}

/* 贴文头部 - 第一行：用户、标签、时间、菜单 */
.post-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 15px 20px;
	border-bottom: 1px solid #f0f0f0;
	background: #fafafa;
	flex-wrap: wrap;
}

/* 贴文主体 - 第二行：内容和图片 */
.post-body {
	display: flex;
	flex-direction: row;
	gap: 20px;
	padding: 20px;
	align-items: flex-start;
}

/* 图片容器 - 右侧固定高度，宽度自动 */
.post-images {
	position: relative;
	height: 250px;
	min-height: 250px;
	max-height: 250px;
	width: auto;
	background: #f5f5f5;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border-radius: 8px;
	flex-shrink: 0;
}

/* 图片元素 */
.post-images .post-image {
	position: relative;
	z-index: 2;
}

/* 单图模式 */
.post-images.single .post-image {
	width: auto;
	height: 100%;
	max-width: 400px;
	object-fit: contain;
	display: block;
	cursor: pointer;
	transition: opacity 0.2s;
}

.post-images.single .post-image:hover {
	opacity: 0.9;
}

/* 多图模式 - 按钮切换 */
.post-images.multiple {
	position: relative;
}

.post-images.multiple .post-image {
	position: absolute;
	top: 0;
	left: 0;
	width: auto;
	height: 100%;
	max-width: 400px;
	object-fit: contain;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
	cursor: pointer;
}

.post-images.multiple .post-image:hover {
	opacity: 0.9 !important;
}

.post-images.multiple .post-image.active {
	opacity: 1;
	pointer-events: auto;
	position: relative;
}

/* 图片导航按钮 */
.image-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(0, 0, 0, 0.6);
	color: white;
	border: none;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	font-size: 1.5em;
	cursor: pointer;
	z-index: 10;
	transition: background 0.3s;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.image-nav:hover {
	background: rgba(0, 0, 0, 0.8);
	transform: translateY(-50%) scale(1.1);
}

.image-nav.prev {
	left: 10px;
}

.image-nav.next {
	right: 10px;
}

/* 图片数量标签 */
.image-count {
	position: absolute;
	bottom: 10px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(0, 0, 0, 0.75);
	color: white;
	padding: 6px 12px;
	border-radius: 15px;
	font-size: 0.85em;
	font-weight: 600;
	pointer-events: none;
	z-index: 5;
}

.post-menu-btn {
	margin-left: auto;
	background: none;
	border: none;
	color: #666;
	font-size: 1.2em;
	font-weight: bold;
	cursor: pointer;
	padding: 4px 12px;
	border-radius: 8px;
	transition: background 0.2s;
}

.post-menu-btn:hover {
	background: #e0e0e0;
}

.game-tag {
	color: white;
	padding: 4px 12px;
	border-radius: 12px;
	font-size: 0.8em;
	font-weight: 600;
}

.game-tag.game-ark {
	background: #4b5cf0;
}
.game-tag.game-zmz {
	background: #b2b300;
}

.game-tag.game-lzxc {
	background: #c73f3f;
}

.game-tag.game-pmpm {
	background: #9656a7;
}

.game-tag.game-nstg {
	background: #12ce80;
}

.game-tag.game-default {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.category-tag {
	color: white;
	padding: 4px 12px;
	border-radius: 12px;
	font-size: 0.8em;
	font-weight: 600;
}

.category-tag.category-forum {
	background: #ff511a;
}

.category-tag.category-guide {
	background: #ffc61a;
}

.category-tag.category-event {
	background: #0099cc;
}

.category-tag.category-help {
	background: #3300cc;
}

.category-tag.category-all {
	background: #9900cc;
}

.category-tag.category-default {
	background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.time-tag {
	color: #666;
	padding: 4px 12px;
	border-radius: 12px;
	font-size: 0.8em;
	font-weight: 500;
	background: #e8e8e8;
}

.category-tag.category-default {
	background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.post-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-width: 0; /* 允许文本截断 */
}

.post-caption {
	line-height: 1.6;
	color: #333;
	font-size: 0.95em;
}

.user-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
}

.user-name {
	font-weight: 600;
	color: #000;
	font-size: 0.9em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.post-link {
	display: inline-block;
	color: #000;
	text-decoration: none;
	font-weight: 600;
	font-size: 0.9em;
	margin-top: auto;
	align-self: flex-start;
}

.post-link:hover {
	text-decoration: underline;
}

/* 加载和错误状态 */
.loading {
	text-align: center;
	padding: 40px;
	color: white;
	font-size: 1.2em;
}

.error {
	background: #ff4444;
	color: white;
	padding: 20px;
	border-radius: 10px;
	margin: 20px 0;
	text-align: center;
}

/* 分页 */
.pagination {
	display: none !important; /* 隱藏傳統分頁 */
	justify-content: center;
	gap: 10px;
	margin: 30px 0;
}

.pagination button {
	min-width: 100px;
}

/* 無限滾動樣式 */
.load-more-indicator {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 40px 20px;
	gap: 15px;
}

.load-more-indicator span {
	color: #666;
	font-size: 14px;
}

.spinner {
	width: 40px;
	height: 40px;
	border: 4px solid #f3f3f3;
	border-top: 4px solid #007bff;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

.end-of-list {
	text-align: center;
	padding: 40px 20px;
	color: #999;
	font-size: 14px;
	border-top: 1px solid #eee;
	margin-top: 20px;
}

.end-of-list p {
	margin: 0;
	font-style: italic;
}

/* 查看已標記貼文按鈕 */
.view-records-btn {
	position: fixed;
	bottom: 95px;
	right: 30px;
	width: 50px;
	height: 50px;
	background: #28a745;
	color: white;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	transition: all 0.3s ease;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
}

.view-records-btn svg {
	width: 24px;
	height: 24px;
	display: block;
	flex-shrink: 0;
}

.view-records-btn:hover {
	background: #218838;
	transform: translateY(-5px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.view-records-btn:active {
	transform: translateY(-2px);
}

/* 回到頂部按鈕 */
.back-to-top {
	position: fixed;
	bottom: 30px;
	right: 30px;
	width: 50px;
	height: 50px;
	background: #007bff;
	color: white;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	transition: all 0.3s ease;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.back-to-top svg {
	width: 24px;
	height: 24px;
	display: block;
	flex-shrink: 0;
}

.back-to-top:hover {
	background: #0056b3;
	transform: translateY(-5px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.back-to-top:active {
	transform: translateY(-2px);
}

/* 响应式设计 */
@media (max-width: 768px) {
	.container {
		max-width: 95vw;
	}

	h1 {
		font-size: 1.8em;
	}

	.post-card {
		flex-direction: column;
		max-height: none;
	}

	.post-header {
		flex-wrap: wrap;
	}

	.post-body {
		flex-direction: column;
	}

	.post-images {
		width: 100%;
		height: 200px;
		min-height: 200px;
		max-height: 200px;
	}

	.post-images.multiple .post-image {
		width: auto;
		height: 100%;
		max-width: 100%;
	}

	.post-caption {
		-webkit-line-clamp: 3;
		line-clamp: 3;
	}

	.controls {
		flex-direction: column;
	}

	.search-box {
		width: 100%;
	}

	.stat-card {
		min-width: 100px;
	}
	
	/* 調整浮動按鈕大小 */
	.back-to-top,
	.view-records-btn {
		width: 45px;
		height: 45px;
		right: 20px;
	}
	
	.back-to-top {
		bottom: 20px;
	}
	
	.view-records-btn {
		bottom: 75px;
	}
	
	.view-records-btn svg,
	.back-to-top svg {
		width: 20px;
		height: 20px;
	}
}

/* ===== 懶加載相關樣式 ===== */

/* 貼文卡片淡入動畫 */
.post-card.card-hidden {
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 0.4s ease, transform 0.4s ease;
}

.post-card.card-visible {
	opacity: 1;
	transform: translateY(0);
}

/* 載入狀態優化 */
.loading {
	position: relative;
	min-height: 200px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.loading::after {
	content: '';
	position: absolute;
	width: 50px;
	height: 50px;
	border: 4px solid #f3f3f3;
	border-top: 4px solid #007bff;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

