:root {
	--red: #d93025;
	--red-bg: #fff5f5;
	--border: #eee;
	--text: #222;
	--muted: #666;
	--primary: #0b57d0;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
	color: var(--text);
	background: #fff;
	touch-action: manipulation;
	-webkit-touch-callout: none;
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	opacity: 1;
	/* 浏览器刷新时的平滑过渡 */
	transition: opacity 0.3s ease;
}

.notice-bar {
	background: var(--red-bg);
	border-bottom: 1px solid #ffe0e0;
	color: var(--red);
	height: 36px;
	overflow: hidden;
	position: relative;
	min-height: 36px;
	max-height: 36px;
	transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.notice-track {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
}
.notice-track ul {
	margin: 0;
	padding: 0;
	list-style: none;
	animation: scrollUpLoop linear infinite;
	will-change: transform;
}
.notice-track li {
	height: 36px;
	line-height: 36px;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.notice-track a, .notice-track span {
	color: var(--red);
	text-decoration: none;
	font-weight: 600;
}

@keyframes scrollUpLoop {
	0% { transform: translateY(0); }
	100% { transform: translateY(-50%); }
}

.container {
	max-width: 860px;
	margin: 0 auto;
	padding: 16px;
	transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 页面刷新时的淡出效果 */
body.page-refreshing .container {
	opacity: 0;
	transform: translateY(-8px);
}

body.page-refreshing .notice-bar {
	opacity: 0;
}

body.page-refreshing .site-footer {
	opacity: 0;
}

.copy-card {
	border: 1px solid #e6a23c;
	border-radius: 10px;
	padding: 16px;
	background: #fff;
	transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 版本选择器 */
.version-selector {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
	margin-bottom: 16px;
}

.version-btn {
	position: relative;
	background: #f5f5f5;
	border: 2px solid #e0e0e0;
	border-radius: 8px;
	padding: 10px 12px;
	font-size: 14px;
	font-weight: 600;
	color: #666;
	cursor: pointer;
	transition: all 0.2s ease;
	text-align: left;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
	outline: none;
	touch-action: manipulation;
}

.version-btn:hover {
	background: #ebebeb;
	border-color: #d0d0d0;
}

.version-btn.active {
	background: #e8f5e9;
	border-color: #4caf50;
	color: #2e7d32;
}

.version-btn:active {
	transform: scale(0.98);
}

.version-dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	background: #4caf50;
	border-radius: 50%;
	margin-right: 6px;
	vertical-align: middle;
	animation: pulse 2s ease-in-out infinite;
	pointer-events: none;
}

@keyframes pulse {
	0%, 100% {
		opacity: 1;
		transform: scale(1);
	}
	50% {
		opacity: 0.6;
		transform: scale(1.2);
	}
}

/* 版本状态标识 */
.version-badge {
	display: inline-block;
	font-size: 12px;
	margin-left: 4px;
	opacity: 0.8;
	vertical-align: middle;
}

.version-badge.locked {
	color: #ff9800;
}

.version-badge.pinned {
	color: #2196f3;
}

.version-badge.temp {
	color: #f44336;
}

.version-btn.locked {
	border-color: #ff9800;
	background: #fff3e0;
}

.version-btn.locked:hover {
	background: #ffe0b2;
}

.version-btn.locked.active {
	background: #fff3e0;
	border-color: #ff9800;
	color: #e65100;
}

.version-btn.pinned {
	border-color: #2196f3;
	background: #e3f2fd;
}

.version-btn.pinned:hover {
	background: #bbdefb;
}

.version-btn.pinned.active {
	background: #e3f2fd;
	border-color: #2196f3;
	color: #0d47a1;
}

/* 刷新时卡片也淡出 */
body.page-refreshing .copy-card {
	opacity: 0;
	transform: translateY(-8px);
}
.title {
	font-size: 20px;
	margin: 0 0 12px;
}
.copy-text {
	white-space: pre-wrap;
	line-height: 1.6;
	border: 1px dashed var(--border);
	border-radius: 8px;
	padding: 12px;
	background: #fafafa;
	margin-bottom: 12px;
	transition: opacity 0.15s ease, transform 0.15s ease;
}
.btn-row {
	display: flex;
	gap: 10px;
	margin-bottom: 8px;
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
}
.btn-row.sticky {
	position: fixed;
	top: 36px;
	left: 16px;
	right: 16px;
	z-index: 999;
	background: rgba(255, 255, 255, 0.98);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	padding: 10px 16px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
	border-radius: 12px;
	max-width: 828px;
	margin: 0 auto;
	transform: translateZ(0);
	will-change: transform;
	transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 刷新时吸顶按钮也淡出 */
body.page-refreshing .btn-row.sticky {
	opacity: 0;
}

/* 响应式适配 */
@media (min-width: 892px) {
	.btn-row.sticky {
		left: 50%;
		right: auto;
		transform: translateX(-50%);
		width: 860px;
	}
}

@keyframes fadeIn {
	to {
		opacity: 1;
	}
}
.btn-row-placeholder {
	height: 0;
	overflow: hidden;
}
.btn {
	-webkit-tap-highlight-color: transparent;
	background: var(--primary);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 12px 14px;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	flex: 1;
	position: relative;
	overflow: hidden;
	user-select: none !important;
	-webkit-user-select: none !important;
	-moz-user-select: none !important;
	-ms-user-select: none !important;
	-webkit-touch-callout: none !important;
}
.btn * {
	user-select: none !important;
	-webkit-user-select: none !important;
	-moz-user-select: none !important;
	-ms-user-select: none !important;
	-webkit-touch-callout: none !important;
	pointer-events: none;
}
.btn-secondary {
	background: #5f6368;
}
.btn-progress {
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	width: 0;
	background: #ff4444;
	opacity: 0;
	transition: opacity 0.1s ease;
	pointer-events: none;
	z-index: 0;
}
.btn-progress.active {
	opacity: 0.5;
	animation: progressBar linear forwards;
}
.btn span {
	position: relative;
	z-index: 1;
}
@keyframes progressBar {
	0% { width: 0; }
	100% { width: 100%; }
}
.hint {
	color: var(--muted);
	font-size: 12px;
	margin: 0;
}

.image-list {
	border: 1px solid #e6a23c;
	border-radius: 10px;
	padding: 16px;
	background: #fff;
	margin-top: 16px;
	transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 刷新时图片列表也淡出 */
body.page-refreshing .image-list {
	opacity: 0;
	transform: translateY(-8px);
}
.image-list h2 {
	font-size: 16px;
	margin: 0 0 10px;
}
.grid {
	list-style: none;
	padding: 0;
	margin: 0;
	visibility: hidden;
}
.grid.initialized {
	visibility: visible;
}
/* 顶部对齐行 */
.grid-top-row {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
	margin-bottom: 0;
}
.grid-top-row li {
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	line-height: 0;
}
/* Grid 网格布局 - 横向排列，紧密贴合 */
.grid-waterfall {
	display: grid !important;
	grid-template-columns: repeat(2, 1fr) !important;
	grid-auto-flow: row dense !important;
	grid-auto-rows: min-content !important;
	gap: 10px;
	align-items: start !important;
	visibility: hidden;
	transform: translateZ(0);
	will-change: contents;
	contain: layout style paint;
}
.grid-waterfall.loaded {
	visibility: visible;
}
/* 固定模式 - 随机排列后使用绝对定位瀑布流 */
.grid-waterfall.fixed-mode {
	display: block !important;
	position: relative;
	width: 100%;
}
.grid-waterfall li {
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	line-height: 0;
	width: 100%;
	height: auto;
	align-self: start;
	transform: translateZ(0);
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	contain: layout style paint;
	position: relative;
}
/* 固定模式下的li样式 - 使用绝对定位 */
.grid-waterfall.fixed-mode li {
	display: block;
	background: transparent;
	overflow: visible;
	position: absolute !important;
	left: 0;
	top: 0;
}
.grid-waterfall.fixed-mode li a {
	background: transparent;
}
/* 兼容原grid样式 */
.grid li {
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	line-height: 0;
}
.grid li a,
.grid-top-row li a,
.grid-waterfall li a {
	display: block;
	line-height: 0;
	font-size: 0;
	-webkit-user-drag: none;
	-webkit-touch-callout: none;
	width: 100%;
	position: relative;
	background: #f5f5f5;
	min-height: 200px;
	/* 方形布局：宽高比1:1 */
	aspect-ratio: 1 / 1;
}

/* 固定模式下也保持方形比例 */
.grid-waterfall.fixed-mode li a {
	aspect-ratio: 1 / 1;
}
.grid li a::before,
.grid-top-row li a::before,
.grid-waterfall li a::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 60px;
	height: 60px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	opacity: 0.3;
	pointer-events: none;
	z-index: 0;
}
.grid img,
.grid-top-row img,
.grid-waterfall img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	transition: opacity .3s ease, transform .2s ease;
	vertical-align: top;
	border-radius: 7px;
	border: 2px solid #999;
	box-sizing: border-box;
	-webkit-user-drag: none;
	-webkit-touch-callout: none;
	pointer-events: auto;
	position: relative;
	z-index: 1;
	will-change: transform;
	transform-origin: center center;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}
.grid img.loaded,
.grid-top-row img.loaded,
.grid-waterfall img.loaded {
	opacity: 1;
}
/* 图片加载完成后隐藏占位符并移除背景 */
.grid li a:has(img.loaded)::before,
.grid-top-row li a:has(img.loaded)::before,
.grid-waterfall li a:has(img.loaded)::before {
	opacity: 0;
}
.grid li a:has(img.loaded),
.grid-top-row li a:has(img.loaded),
.grid-waterfall li a:has(img.loaded) {
	background: transparent;
}

/* 长按反馈 - 完全禁用视觉反馈，避免瀑布流布局重排 */
/* .grid li.pressing::after,
.grid-top-row li.pressing::after,
.grid-waterfall li.pressing::after {
	已禁用，防止布局抖动
} */

.grid .empty {
	text-align: center;
	color: var(--muted);
	padding: 24px 0;
}

/* 响应式：大屏幕保持2列 */
@media (min-width: 768px) {
	.grid-top-row {
		grid-template-columns: repeat(2, 1fr);
	}
	.grid-waterfall {
		grid-template-columns: repeat(2, 1fr) !important;
	}
}

/* 移动端优化：确保悬浮按钮固定显示 */
@media (max-width: 767px) {
	.float-buttons {
		position: fixed !important;
		right: 12px !important;
		bottom: 12px !important;
		z-index: 1000 !important;
	}
	
	.float-btn {
		width: 48px !important;
		height: 48px !important;
		position: relative !important;
		min-width: 48px !important;
		min-height: 48px !important;
		max-width: 48px !important;
		max-height: 48px !important;
	}
	
	#refreshBtn {
		position: relative !important;
		transform: translateY(0) translateZ(0) !important;
	}
	
	#sortBtn {
		position: relative !important;
	}
	
	#editBtn, #phoneBtn, #backToTop {
		position: relative !important;
	}
}

#toast {
	position: fixed;
	top: 10px;
	left: 50%;
	transform: translateX(-50%);
	background: #07c160;
	color: #fff;
	padding: 8px 12px;
	border-radius: 4px;
	font-size: 14px;
	z-index: 9999;
	pointer-events: none;
	opacity: 0;
	transition: opacity .18s ease;
	box-shadow: 0 2px 8px rgba(7, 193, 96, 0.3);
}
#toast.show { opacity: 1; }

/* 右下角悬浮按钮组 */
.float-buttons {
	position: fixed !important;
	right: 16px !important;
	bottom: 16px !important;
	z-index: 1000 !important;
	display: flex !important;
	flex-direction: column !important;
	gap: 12px !important;
	transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	width: auto !important;
	height: auto !important;
	transform: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

/* 刷新时悬浮按钮组也淡出（除了刷新按钮本身保持可见） */
body.page-refreshing .float-buttons {
	pointer-events: none;
}

body.page-refreshing .float-btn:not(#refreshBtn) {
	opacity: 0.3 !important;
	transform: scale(0.95) !important;
}

.float-btn {
	width: 48px;
	height: 48px;
	border: none;
	border-radius: 50%;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px) translateZ(0);
	transition: opacity .25s ease, visibility .25s ease, transform .25s ease;
	will-change: opacity, transform;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	-webkit-tap-highlight-color: transparent;
	color: #fff;
	text-decoration: none;
	position: relative !important;
}

/* 禁用按钮过渡动画（用于刷新后立即显示按钮，避免重复播放动画） */
.no-btn-transition .float-btn {
	transition: none !important;
}

.float-btn.show {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) translateZ(0);
}

.float-btn:active {
	transform: scale(0.95);
}

#sortBtn {
	background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
	/* 始终显示排序按钮 */
	opacity: 1 !important;
	visibility: visible !important;
	/* 初始位置在刷新按钮下方（下移60px：1个按钮+间隙） */
	transform: translateY(60px) translateZ(0) !important;
	transition: transform 0.3s ease !important;
}

/* 禁用排序按钮过渡动画（用于刷新后立即显示） */
.no-btn-transition #sortBtn {
	transition: none !important;
}

#sortBtn.raised {
	/* 滚动后回到原始位置 */
	transform: translateY(0) translateZ(0) !important;
}

#refreshBtn {
	background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
	/* 始终显示刷新按钮，固定在第2个位置，不移动 */
	opacity: 1 !important;
	visibility: visible !important;
	transform: translateY(0) translateZ(0) !important;
	transition: transform 0.3s ease !important;
	position: relative !important;
}

#refreshBtn::before {
	content: '↻';
	font-size: 28px;
	font-weight: bold;
	display: block;
	transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* 刷新按钮点击时的旋转动画 */
#refreshBtn.refreshing::before {
	animation: spin 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

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

#editBtn::before {
	content: '⚙';
	font-size: 22px;
	display: block;
}

#phoneBtn {
	background: #07c160;
}

#phoneBtn::before {
	content: '☎';
	font-size: 22px;
	display: block;
}

#backToTop {
	background: var(--primary);
}

#backToTop::before {
	content: '↑';
	font-weight: bold;
}

/* 排序按钮的图标样式 */
#sortBtn .sort-icon {
	font-size: 28px;
	font-weight: bold;
	display: block;
	line-height: 1;
}

/* 排序状态切换（只改变背景色，图标始终显示双向箭头） */
#sortBtn.asc {
	background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
}

#sortBtn.desc {
	background: linear-gradient(135deg, #fa709a 0%, #fee140 100%) !important;
}

/* 添加小标记指示当前排序方向 */
#sortBtn.asc::after {
	content: '↑';
	position: absolute;
	top: 4px;
	right: 4px;
	font-size: 14px;
	font-weight: bold;
	background: rgba(255, 255, 255, 0.9);
	color: #4facfe;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

#sortBtn.desc::after {
	content: '↓';
	position: absolute;
	top: 4px;
	right: 4px;
	font-size: 14px;
	font-weight: bold;
	background: rgba(255, 255, 255, 0.9);
	color: #fa709a;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

/* 确保排序状态切换时位置逻辑不受影响 */
#sortBtn.asc:not(.raised) {
	transform: translateY(60px) translateZ(0) !important;
}

#sortBtn.desc:not(.raised) {
	transform: translateY(60px) translateZ(0) !important;
}

#sortBtn.asc.raised,
#sortBtn.desc.raised {
	transform: translateY(0) translateZ(0) !important;
}

/* 底部信息 */
.site-footer {
	background: #f8f8f8;
	border-top: 1px solid #eee;
	padding: 24px 16px;
	margin-top: 40px;
	text-align: center;
	font-size: 13px;
	color: #666;
	transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.footer-content {
	max-width: 860px;
	margin: 0 auto;
}

.footer-content a {
	color: #666;
	text-decoration: none;
	transition: color 0.2s ease;
}

.footer-content a:hover {
	color: var(--primary);
}

.footer-divider {
	margin: 0 10px;
	color: #ddd;
}

.author-link {
	cursor: pointer;
}

/* 弹窗样式 */
.modal {
	display: none;
	position: fixed;
	z-index: 10000;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	overflow: auto;
	background-color: rgba(0, 0, 0, 0.5);
	animation: fadeIn 0.2s ease;
}

.modal.show {
	display: flex;
	align-items: center;
	justify-content: center;
}

.modal-content {
	background-color: #fff;
	margin: auto;
	padding: 24px 28px;
	border-radius: 12px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
	max-width: 400px;
	width: 90%;
	position: relative;
	animation: slideIn 0.3s ease;
}

@keyframes slideIn {
	from {
		transform: translateY(-20px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

.modal-close {
	color: #aaa;
	position: absolute;
	right: 16px;
	top: 16px;
	font-size: 28px;
	font-weight: bold;
	cursor: pointer;
	line-height: 1;
	transition: color 0.2s ease;
}

.modal-close:hover,
.modal-close:focus {
	color: #333;
}

.contact-info {
	line-height: 1.8;
}

.contact-info p {
	margin: 12px 0;
	color: #444;
}

.contact-info strong {
	color: #222;
}

.contact-info a {
	color: var(--primary);
	text-decoration: none;
}

.contact-info a:hover {
	text-decoration: underline;
}

.wechat-copy {
	color: var(--primary);
	cursor: pointer;
	padding: 2px 6px;
	border-radius: 4px;
	transition: background-color 0.2s ease;
	user-select: none;
}

.wechat-copy:hover {
	background-color: #e8f0fe;
}

.wechat-copy:active {
	background-color: #d2e3fc;
}

.copy-tip {
	display: inline-block;
	margin-left: 8px;
	padding: 2px 8px;
	background: #07c160;
	color: #fff;
	font-size: 12px;
	border-radius: 3px;
	opacity: 0;
	transform: translateY(-2px);
	transition: opacity 0.3s ease, transform 0.3s ease;
	pointer-events: none;
}

.copy-tip.show {
	opacity: 1;
	transform: translateY(0);
}

/* 🌊 波纹扩散刷新效果 */
.ripple-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 9998;
	overflow: hidden;
}

.ripple-circle {
	position: absolute;
	background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
	border-radius: 50%;
	transform: scale(0);
	opacity: 0;
}

/* 扩散动画 */
.ripple-circle.expanding {
	animation: rippleExpand 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes rippleExpand {
	0% {
		transform: scale(0);
		opacity: 0.9;
	}
	100% {
		transform: scale(1);
		opacity: 1;
	}
}

/* 收缩动画 */
.ripple-circle.shrinking {
	animation: rippleShrink 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes rippleShrink {
	0% {
		transform: scale(1);
		opacity: 1;
	}
	100% {
		transform: scale(0);
		opacity: 0;
	}
}

