:root {
	--blue: #00aeec;
	--blue-light: #ecf8fd;
	--blue-hover: #00a1d6;
	--bg: #ffffff;
	--bg-gray: #f1f2f3;
	--text: #18191c;
	--text-sub: #9499a0;
	--line: #e3e5e7;
	--wrap: 1300px;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	min-height: 100vh;
	background: var(--bg-gray);
	color: var(--text);
	font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

a {
	color: inherit;
	text-decoration: none;
}

img {
	max-width: 100%;
	vertical-align: top;
	border: 0;
}

ul {
	list-style: none;
}

button,
input {
	font: inherit;
	outline: none;
}

.layout {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

.wrap {
	width: min(var(--wrap), 100%);
	margin: 0 auto;
	padding: 0 20px;
}

/* 顶栏 */
.header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--bg);
	border-bottom: 1px solid var(--line);
}

.header-inner {
	width: min(var(--wrap), 100%);
	margin: 0 auto;
	padding: 0 20px;
	height: 64px;
	display: flex;
	align-items: center;
	gap: 24px;
}

.logo {
	flex-shrink: 0;
	font-size: 20px;
	font-weight: 700;
	color: var(--blue);
	letter-spacing: 0.5px;
}

.logo:hover {
	color: var(--blue-hover);
}

.search-form {
	flex: 1;
	max-width: 520px;
	height: 40px;
	display: flex;
	align-items: center;
	background: var(--bg-gray);
	border: 1px solid transparent;
	border-radius: 8px;
	overflow: hidden;
	transition: border-color 0.2s, background 0.2s;
}

.search-form:focus-within {
	background: var(--bg);
	border-color: var(--blue);
}

.search-form input {
	flex: 1;
	min-width: 0;
	height: 100%;
	padding: 0 12px 0 16px;
	border: 0;
	background: transparent;
	color: var(--text);
}

.search-form input::placeholder {
	color: var(--text-sub);
}

.search-form button {
	flex-shrink: 0;
	width: 48px;
	height: 100%;
	border: 0;
	background: var(--blue);
	color: #fff;
	cursor: pointer;
	font-size: 15px;
}

.search-form button:hover {
	background: var(--blue-hover);
}

/* 主内容 */
.main {
	flex: 1;
	padding: 20px 0 32px;
}

.section-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--line);
}

.section-title {
	font-size: 18px;
	font-weight: 600;
	color: var(--text);
}

.section-count {
	font-size: 13px;
	color: var(--text-sub);
	white-space: nowrap;
}

/* 列表卡片 */
.card-list {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	gap: 20px 16px;
}

.card-item {
	min-width: 0;
}

.card-cover {
	display: block;
	border-radius: 6px;
	overflow: hidden;
	background: var(--bg-gray);
	aspect-ratio: 3 / 4;
}

.card-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.25s;
}

.card-item:hover .card-cover img {
	transform: scale(1.03);
}

.card-body {
	padding-top: 8px;
}

.card-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.45;
	color: var(--text);
}

.card-title:hover {
	color: var(--blue);
}

.card-meta {
	margin-top: 4px;
	font-size: 12px;
	color: var(--text-sub);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.empty {
	padding: 80px 0;
	text-align: center;
	color: var(--text-sub);
	font-size: 14px;
}

/* 播放页 */
.play-page {
	background: var(--bg);
	border-radius: 8px;
	border: 1px solid var(--line);
	overflow: hidden;
}

.play-title {
	padding: 16px 20px 0;
	font-size: 20px;
	font-weight: 600;
	line-height: 1.4;
}

.player-box {
	position: relative;
	margin: 16px 20px 0;
	background: #000;
	border-radius: 6px;
	overflow: hidden;
	aspect-ratio: 16 / 9;
}

.player-box iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.block {
	padding: 20px;
	border-top: 1px solid var(--line);
}

.block-title {
	margin-bottom: 12px;
	padding-left: 10px;
	border-left: 3px solid var(--blue);
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
}

/* 线路 tab */
.tab-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	border-bottom: 1px solid var(--line);
	margin: -4px 0 0;
}

.tab-item {
	position: relative;
	padding: 10px 20px;
	border: 0;
	background: none;
	color: var(--text-sub);
	font-size: 14px;
	cursor: pointer;
}

.tab-item:hover {
	color: var(--blue);
}

.tab-item.active {
	color: var(--blue);
	font-weight: 600;
}

.tab-item.active::after {
	content: "";
	position: absolute;
	left: 20px;
	right: 20px;
	bottom: 0;
	height: 2px;
	background: var(--blue);
	border-radius: 1px;
}

/* 选集 */
.ep-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
	gap: 8px;
	max-height: 240px;
	overflow-y: auto;
}

.ep-item {
	height: 36px;
	padding: 0 6px;
	border: 1px solid var(--line);
	border-radius: 4px;
	background: var(--bg);
	color: var(--text);
	font-size: 13px;
	cursor: pointer;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.ep-item:hover {
	border-color: var(--blue);
	color: var(--blue);
}

.ep-item.active {
	border-color: var(--blue);
	background: var(--blue-light);
	color: var(--blue);
	font-weight: 500;
}

.ep-list::-webkit-scrollbar {
	width: 6px;
}

.ep-list::-webkit-scrollbar-thumb {
	background: #d9d9d9;
	border-radius: 3px;
}

.intro {
	color: var(--text-sub);
	font-size: 14px;
	line-height: 1.8;
}

.footer {
	padding: 24px 0 calc(24px + env(safe-area-inset-bottom));
	background: var(--bg);
	border-top: 1px solid var(--line);
	text-align: center;
	font-size: 12px;
	color: var(--text-sub);
}

.footer p + p {
	margin-top: 4px;
}

.back-top {
	position: fixed;
	right: 20px;
	bottom: calc(24px + env(safe-area-inset-bottom));
	z-index: 90;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--bg);
	border: 1px solid var(--line);
	color: var(--text-sub);
	display: grid;
	place-items: center;
	font-size: 22px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.back-top:hover {
	color: var(--blue);
	border-color: var(--blue);
}

/* 响应式 */
@media (max-width: 1200px) {
	.card-list {
		grid-template-columns: repeat(5, 1fr);
	}
}

@media (max-width: 992px) {
	.card-list {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (max-width: 768px) {
	.wrap {
		padding: 0 12px;
	}

	.header-inner {
		padding: 0 12px;
		height: 56px;
		gap: 12px;
	}

	.logo {
		font-size: 17px;
	}

	.search-form {
		height: 36px;
	}

	.search-form button {
		width: 40px;
	}

	.main {
		padding: 12px 0 24px;
	}

	.section-title {
		font-size: 16px;
	}

	.card-list {
		grid-template-columns: repeat(3, 1fr);
		gap: 12px 10px;
	}

	.play-title {
		padding: 12px 12px 0;
		font-size: 17px;
	}

	.player-box {
		margin: 12px 12px 0;
	}

	.block {
		padding: 16px 12px;
	}

	.ep-list {
		grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
		max-height: 200px;
	}

	.back-top {
		right: 12px;
		bottom: calc(16px + env(safe-area-inset-bottom));
	}
}

@media (max-width: 480px) {
	.card-list {
		grid-template-columns: repeat(2, 1fr);
	}

	.card-title {
		font-size: 13px;
	}
}
