/* 顶栏「资源下载」跳转（与 article-header 中按钮配套，样式在下载区块 CSS 中一并加载） */
.nicen-download-section#nicen-resource-download {
	scroll-margin-top: 4.5rem;
}

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

html body .main-container .main-main .main-content .article-info ul li.article-info__item-download {
	display: flex;
	align-items: center;
}

html body .main-container .main-main .main-content .article-info ul li.article-info__item-download .nicen-article-jump-download {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.15rem 0.65rem;
	font-size: var(--theme-text-mini, 0.76rem);
	line-height: 1.4;
	color: #fff !important;
	background: var(--theme-color, #3eaf7c);
	border-radius: 999px;
	border: 1px solid transparent;
	text-decoration: none !important;
	transition: opacity 0.15s ease, filter 0.15s ease;
	white-space: nowrap;
}

html body .main-container .main-main .main-content .article-info ul li.article-info__item-download .nicen-article-jump-download:hover {
	color: #fff !important;
	opacity: 0.9;
	filter: brightness(1.05);
}

/* 文章页：网盘下载区块
 * 说明：主题在 .main-article 内对 a 使用了高优先级选择器 color:var(--theme-color)，
 * 会导致按钮文字与按钮底色同色而不可见；深色模式下 --theme-text-color 变为浅色，
 * 若用于浅色卡片内文字也会不可见。此处对卡片内与按钮使用固定对比色并提高选择器优先级。
 */

.nicen-download-section {
	/* 卡片内文字/图标：不跟随全局 --theme-text-color，保证浅底上始终为深色 */
	--nicen-dl-card-fg: #1a1a1a;
	--nicen-dl-card-fg-muted: rgba(0, 0, 0, 0.55);
	--nicen-dl-card-icon-bg: rgba(0, 0, 0, 0.07);
	margin: 1.75rem 0;
	padding: 0;
	border: none;
}

.nicen-download-section__title {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	margin: 0 0 0.85rem;
	font-size: var(--theme-secondary-level-title, 1.15rem);
	font-weight: 600;
	color: var(--theme-text-color, #262626);
}

.nicen-download-section__title svg {
	flex-shrink: 0;
	color: var(--theme-color, #3eaf7c);
}

.nicen-download-list {
	margin: 0;
	padding: 0;
	list-style: none;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 10px;
	background: var(--theme-white, #f5f7fd);
	overflow: hidden;
	max-width: 100%;
	box-sizing: border-box;
}

.nicen-download-item {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	padding: 0.95rem 1.1rem;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
	min-width: 0;
	box-sizing: border-box;
}

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

.nicen-download-item__icon {
	flex-shrink: 0;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 50%;
	background: var(--nicen-dl-card-icon-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--nicen-dl-card-fg-muted);
}

.nicen-download-item__icon svg {
	display: block;
	width: 1.1rem;
	height: 1.1rem;
}

.nicen-download-item__body {
	flex: 1 1 auto;
	min-width: 0;
}

.nicen-download-item__name {
	margin: 0;
	font-size: var(--theme-text, 0.84rem);
	line-height: 1.45;
	color: var(--nicen-dl-card-fg);
	word-break: break-word;
}

.nicen-download-item__action {
	flex-shrink: 0;
	min-width: 0;
	box-sizing: border-box;
}

.nicen-download-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	padding: 0.38rem 1rem;
	font-size: var(--theme-text-mini, 0.76rem);
	line-height: 1.3;
	border-radius: 999px;
	text-decoration: none;
	font-family: inherit;
	cursor: pointer;
	transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
	white-space: nowrap;
	max-width: 100%;
	box-sizing: border-box;
}

button.nicen-download-btn {
	-webkit-appearance: none;
	appearance: none;
}

.nicen-download-btn:hover {
	opacity: 0.92;
}

/* 覆盖 .main-article a { color: var(--theme-color) }，避免字色与底色相同 */
html body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--free,
html body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--free:visited,
html body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--free:active {
	background-color: var(--theme-color, #3eaf7c);
	color: #fff !important;
	border: 1px solid transparent;
}

html body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--free:hover {
	color: #fff !important;
}

.nicen-download-btn--free {
	background-color: var(--theme-color, #3eaf7c);
	color: #fff;
	border: 1px solid transparent;
}

.nicen-download-btn--free:hover {
	color: #fff;
}

html body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--member,
html body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--member:visited,
html body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--member:active,
html body .main-container .main-main .main-content .main-article .nicen-download-section button.nicen-download-btn--member,
html body .main-container .main-main .main-content .main-article .nicen-download-section button.nicen-download-btn--member:active {
	background-color: #fff;
	color: #1a1a1a !important;
	border: 1px solid rgba(0, 0, 0, 0.18);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

html body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--member:hover,
html body .main-container .main-main .main-content .main-article .nicen-download-section button.nicen-download-btn--member:hover {
	color: #1a1a1a !important;
	border-color: rgba(0, 0, 0, 0.28);
}

.nicen-download-btn--member {
	background: #fff;
	color: #1a1a1a;
	border: 1px solid rgba(0, 0, 0, 0.15);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.nicen-download-btn--member:hover {
	color: #1a1a1a;
	border-color: rgba(0, 0, 0, 0.22);
}

html body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--login,
html body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--login:visited,
html body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--login:active,
html body .main-container .main-main .main-content .main-article .nicen-download-section button.nicen-download-btn--login,
html body .main-container .main-main .main-content .main-article .nicen-download-section button.nicen-download-btn--login:active {
	background: linear-gradient(180deg, #fffbf5 0%, #fff5e8 100%);
	color: #92400e !important;
	border: 1px solid rgba(245, 166, 35, 0.5);
	box-shadow: 0 1px 2px rgba(180, 83, 9, 0.08);
}

html body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--login:hover,
html body .main-container .main-main .main-content .main-article .nicen-download-section button.nicen-download-btn--login:hover {
	color: #78350f !important;
	border-color: rgba(217, 119, 6, 0.55);
}

.nicen-download-btn--login {
	background: linear-gradient(180deg, #fffbf5 0%, #fff5e8 100%);
	color: #92400e;
	border: 1px solid rgba(245, 166, 35, 0.45);
	box-shadow: 0 1px 2px rgba(180, 83, 9, 0.06);
}

.nicen-download-btn--login:hover {
	color: #78350f;
	border-color: rgba(217, 119, 6, 0.5);
}

html.dark body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--login,
html.dark body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--login:visited,
html.dark body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--login:active,
html.dark body .main-container .main-main .main-content .main-article .nicen-download-section button.nicen-download-btn--login,
html.dark body .main-container .main-main .main-content .main-article .nicen-download-section button.nicen-download-btn--login:active {
	background: rgba(245, 166, 35, 0.16) !important;
	color: #fde68a !important;
	border: 1px solid rgba(251, 191, 36, 0.45) !important;
	box-shadow: none;
}

html.dark body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--login:hover,
html.dark body .main-container .main-main .main-content .main-article .nicen-download-section button.nicen-download-btn--login:hover {
	color: #fffbeb !important;
	border-color: rgba(253, 230, 138, 0.55) !important;
}

html.dark .nicen-download-btn--login {
	background: rgba(245, 166, 35, 0.16);
	color: #fde68a;
	border-color: rgba(251, 191, 36, 0.45);
}

html.dark .nicen-download-btn--login:hover {
	color: #fffbeb;
	border-color: rgba(253, 230, 138, 0.55);
}

.nicen-download-btn__lock {
	width: 0.85rem;
	height: 0.85rem;
	flex-shrink: 0;
}

/* 深色模式：卡片与页面暗色背景统一，不再使用浅色底
 * 注意：主题把 .dark 加在 html 上（common/inline/main.js），不能用 .dark html body（要求 .dark 包住 html，永远不成立）。 */
html.dark .nicen-download-section {
	--nicen-dl-card-fg: rgba(255, 255, 255, 0.9);
	--nicen-dl-card-fg-muted: rgba(255, 255, 255, 0.5);
	--nicen-dl-card-icon-bg: rgba(255, 255, 255, 0.1);
}

html.dark .nicen-download-list {
	background: var(--theme-front-main-color, #2a2a2b);
	border-color: rgba(255, 255, 255, 0.1);
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

html.dark .nicen-download-item {
	border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* 会员按钮：深色卡片上用浅色描边样式，需覆盖上文高优先级选择器 */
html.dark body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--member,
html.dark body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--member:visited,
html.dark body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--member:active,
html.dark body .main-container .main-main .main-content .main-article .nicen-download-section button.nicen-download-btn--member,
html.dark body .main-container .main-main .main-content .main-article .nicen-download-section button.nicen-download-btn--member:active {
	background-color: rgba(255, 255, 255, 0.08) !important;
	color: rgba(255, 255, 255, 0.92) !important;
	border: 1px solid rgba(255, 255, 255, 0.22) !important;
	box-shadow: none;
}

html.dark body .main-container .main-main .main-content .main-article .nicen-download-section a.nicen-download-btn--member:hover,
html.dark body .main-container .main-main .main-content .main-article .nicen-download-section button.nicen-download-btn--member:hover {
	color: #fff !important;
	border-color: rgba(255, 255, 255, 0.35) !important;
}

html.dark .nicen-download-btn--member {
	background: rgba(255, 255, 255, 0.08);
	color: rgba(255, 255, 255, 0.92);
	border-color: rgba(255, 255, 255, 0.22);
}

html.dark .nicen-download-btn--member:hover {
	color: #fff;
	border-color: rgba(255, 255, 255, 0.35);
}

html.dark .nicen-download-btn__lock {
	color: inherit;
}

@media (max-width: 600px) {
	.nicen-download-section {
		max-width: 100%;
		overflow-x: hidden;
	}

	.nicen-download-item {
		flex-wrap: wrap;
		align-items: flex-start;
		row-gap: 0.75rem;
	}

	/* 按钮单独占一行；禁止 width:100% + margin-left 并用，否则会撑破父级 */
	.nicen-download-item__action {
		flex: 1 1 100%;
		width: 100%;
		max-width: 100%;
		margin-left: 0;
		display: flex;
		justify-content: stretch;
	}

	.nicen-download-btn {
		width: 100%;
		max-width: 100%;
		white-space: normal;
		text-align: center;
	}
}
