:root {
	--bg-base: #09090b;
	--bg-surface: #18181b;
	--bg-surface-hover: #27272a;
	--border-subtle: #27272a;
	--border-strong: #3f3f46;
	--text-primary: #ffffff;
	--text-secondary: #e4e4e7;
	--text-muted: #a1a1aa;
	--accent-gold: #f59e0b;
	--accent-gold-hover: #d97706;
	--accent-gold-text: #fbbf24;
	--accent-red: #ef4444;
	--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		"Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
		"Microsoft YaHei", sans-serif;
	--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	--radius-sm: 6px;
	--radius-md: 10px;
	--radius-lg: 16px;
}

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

[hidden] {
	display: none !important;
}

html {
	color-scheme: dark;
}

body {
	min-height: 100vh;
	font-family: var(--font-sans);
	font-size: 15px;
	line-height: 1.6;
	color: var(--text-primary);
	background:
		radial-gradient(1100px 520px at 50% -12%, rgba(245, 158, 11, 0.1), transparent 65%),
		var(--bg-base);
	-webkit-font-smoothing: antialiased;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
	outline: 2px solid var(--accent-gold);
	outline-offset: 2px;
}

::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

::-webkit-scrollbar-track {
	background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
	background: var(--border-strong);
	border-radius: 4px;
}

.page {
	width: 100%;
	max-width: 960px;
	margin: 0 auto;
	padding: 40px 20px 64px;
}

/* ---------- 页头 ---------- */

.header {
	margin-bottom: 28px;
}

.brand__title {
	font-size: 28px;
	font-weight: 700;
	letter-spacing: -0.02em;
}

.brand__subtitle {
	margin-top: 6px;
	color: var(--text-muted);
	font-size: 13px;
}

/* ---------- 状态与提示 ---------- */

.alert {
	margin-bottom: 16px;
	padding: 10px 14px;
	border: 1px solid rgba(245, 158, 11, 0.35);
	border-radius: var(--radius-md);
	background: rgba(245, 158, 11, 0.08);
	color: var(--accent-gold-text);
	font-size: 13px;
}

.board__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	min-height: 24px;
	color: var(--text-muted);
	font-size: 12px;
}

.badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 9px;
	border: 1px solid rgba(245, 158, 11, 0.35);
	border-radius: 999px;
	background: rgba(245, 158, 11, 0.1);
	color: var(--accent-gold-text);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
}

.badge[data-source="cache"] {
	border-color: rgba(161, 161, 170, 0.4);
	background: rgba(161, 161, 170, 0.12);
	color: var(--text-secondary);
}

.badge[data-source="stale"] {
	border-color: rgba(239, 68, 68, 0.45);
	background: rgba(239, 68, 68, 0.12);
	color: #fca5a5;
}

.board__summary {
	font-weight: 500;
	color: var(--text-secondary);
}

.board__updated::before {
	content: "·";
	margin-right: 10px;
	color: var(--border-strong);
}

/* ---------- 加载与错误面板 ---------- */

.panel {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 10px;
	margin-top: 18px;
	padding: 24px;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-lg);
	background: var(--bg-surface);
}

.panel--error {
	border-color: rgba(239, 68, 68, 0.4);
}

.panel__title {
	font-size: 16px;
	font-weight: 600;
}

.panel__text {
	color: var(--text-muted);
	font-size: 13px;
	word-break: break-word;
}

.progress {
	width: 100%;
	max-width: 420px;
	height: 6px;
	margin-top: 4px;
	overflow: hidden;
	border-radius: 999px;
	background: var(--border-subtle);
}

.progress__bar {
	width: 0;
	height: 100%;
	border-radius: inherit;
	background: linear-gradient(90deg, var(--accent-gold-hover), var(--accent-gold));
	transition: width 0.2s ease;
}

.progress__bar--indeterminate {
	width: 40% !important;
	animation: progress-slide 1.2s ease-in-out infinite;
}

@keyframes progress-slide {
	0% {
		transform: translateX(-100%);
	}

	100% {
		transform: translateX(260%);
	}
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 16px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--text-secondary);
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
}

.btn:hover {
	background: var(--bg-surface-hover);
}

.btn--primary {
	border-color: transparent;
	background: var(--accent-gold);
	color: #1c1917;
	font-weight: 600;
}

.btn--primary:hover {
	background: var(--accent-gold-hover);
}

/* ---------- 工具栏 ---------- */

.board__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 22px;
}

.sort-tabs {
	display: inline-flex;
	gap: 2px;
	padding: 3px;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	background: var(--bg-surface);
}

.sort-tab {
	padding: 7px 14px;
	border: 0;
	border-radius: 7px;
	background: transparent;
	color: var(--text-muted);
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.sort-tab:hover {
	color: var(--text-secondary);
}

.sort-tab--active {
	background: var(--accent-gold);
	color: #1c1917;
	font-weight: 600;
}

.board__count {
	color: var(--text-muted);
	font-size: 12px;
}

/* ---------- 榜单列表 ---------- */

.rank-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 12px;
	margin-top: 16px;
	list-style: none;
}

.rank-item {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	background: var(--bg-surface);
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.rank-item:hover {
	border-color: var(--border-strong);
	background: var(--bg-surface-hover);
	transform: translateY(-2px);
}

.rank-item__pos {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 2;
	min-width: 26px;
	padding: 1px 7px;
	border-radius: var(--radius-sm);
	background: rgba(0, 0, 0, 0.72);
	color: var(--text-secondary);
	font-family: var(--font-mono);
	font-size: 12px;
	font-weight: 600;
	text-align: center;
}

.rank-item:nth-child(-n + 3) .rank-item__pos {
	background: var(--accent-gold);
	color: #1c1917;
}

.rank-item__cover {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: #0b0b0d;
}

.rank-item__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.rank-item__fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 8px;
	background: linear-gradient(160deg, #27272a, #18181b);
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 12px;
	line-height: 1.3;
	text-align: center;
	word-break: break-all;
}

.rank-item__body {
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 10px 12px 12px;
	min-width: 0;
}

.rank-item__top {
	display: flex;
	align-items: baseline;
	gap: 10px;
}

.rank-item__code {
	overflow: hidden;
	color: var(--accent-gold-text);
	font-family: var(--font-mono);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.01em;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.rank-item__score {
	margin-left: auto;
	color: var(--accent-gold-text);
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}

.rank-item__title {
	display: -webkit-box;
	overflow: hidden;
	min-height: 2.7em;
	color: var(--text-secondary);
	font-size: 13px;
	line-height: 1.35;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.rank-item__meta {
	overflow: hidden;
	color: var(--text-muted);
	font-size: 12px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.rank-empty {
	padding: 36px 0;
	color: var(--text-muted);
	font-size: 13px;
	text-align: center;
	list-style: none;
}

/* ---------- 分页 ---------- */

.pager {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 22px;
}

.pager__btn,
.pager__page {
	min-width: 34px;
	padding: 6px 10px;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-sm);
	background: var(--bg-surface);
	color: var(--text-secondary);
	font-family: inherit;
	font-size: 13px;
	cursor: pointer;
}

.pager__btn:hover:not(:disabled),
.pager__page:hover:not(.pager__page--active) {
	border-color: var(--border-strong);
	background: var(--bg-surface-hover);
}

.pager__btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.pager__page--active {
	border-color: transparent;
	background: var(--accent-gold);
	color: #1c1917;
	font-weight: 600;
}

.pager__gap {
	padding: 0 2px;
	color: var(--text-muted);
	font-size: 13px;
}

.pager__info {
	width: 100%;
	margin-top: 4px;
	color: var(--text-muted);
	font-size: 12px;
	text-align: center;
}

/* ---------- 页脚 ---------- */

.footer {
	margin-top: 56px;
	padding-top: 20px;
	border-top: 1px solid var(--border-subtle);
	color: var(--text-muted);
	font-size: 12px;
	text-align: center;
}

/* ---------- 免责声明 ---------- */

.consent-modal {
	position: fixed;
	inset: 0;
	z-index: 110;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(0, 0, 0, 0.74);
}

.consent {
	width: 100%;
	max-width: 560px;
	max-height: 88vh;
	overflow-y: auto;
	padding: 24px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-lg);
	background: var(--bg-surface);
}

.consent__title {
	margin-bottom: 12px;
	font-size: 18px;
	font-weight: 700;
}

.consent__list {
	padding-left: 18px;
	color: var(--text-secondary);
	font-size: 13px;
	line-height: 1.65;
}

.consent__list li + li {
	margin-top: 8px;
}

.consent__actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	margin-top: 22px;
}

/* ---------- 内嵌详情弹层 ---------- */

.frame-modal {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(0, 0, 0, 0.74);
}

.frame-modal__panel {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 1200px;
	height: 100%;
	max-height: 92vh;
	background: var(--bg-surface);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-lg);
	overflow: hidden;
}

.frame-modal__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 14px;
	border-bottom: 1px solid var(--border-subtle);
}

.frame-modal__title {
	font-size: 14px;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.frame-modal__actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

.frame-modal__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	color: var(--text-secondary);
	background: transparent;
	border: 1px solid var(--border-subtle);
	border-radius: 8px;
	font-size: 15px;
	cursor: pointer;
}

.frame-modal__btn:hover {
	background: var(--bg-surface-hover);
}

.frame-modal--max {
	padding: 0;
}

.frame-modal--max .frame-modal__panel {
	max-width: none;
	height: 100vh;
	max-height: 100vh;
	border: 0;
	border-radius: 0;
}

.frame-modal__body {
	flex: 1;
	min-height: 0;
	background: #0b0b0d;
}

.frame-modal__iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ---------- 响应式 ---------- */

@media (max-width: 640px) {
	.page {
		padding: 24px 14px 48px;
	}

	.brand__title {
		font-size: 22px;
	}

	.rank-list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}

	.rank-item__body {
		padding: 9px 10px 10px;
	}

	.rank-item__title {
		font-size: 12px;
	}

	.sort-tab {
		padding: 7px 10px;
		font-size: 12px;
	}

	.frame-modal {
		padding: 0;
	}

	.frame-modal__panel {
		max-width: none;
		height: 100vh;
		max-height: 100vh;
		border: 0;
		border-radius: 0;
	}
}
