/* 隐藏 type=search 原生清空按钮，避免与自定义按钮重复 */
#yuansuSearch::-webkit-search-cancel-button,
#yuansuSearch::-webkit-search-decoration {
	-webkit-appearance: none;
	appearance: none;
}

/* 覆盖 .yuansu-loading { display:flex }，否则 Tailwind .hidden 不生效 */
#yuansuApp .yuansu-loading.hidden,
#yuansuApp #yuansuMain.hidden {
	display: none !important;
}

.yuansu-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	padding: 3rem 1rem;
	color: #64748b;
	font-size: 0.875rem;
	background: #fff;
	border-radius: 0.375rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	margin-bottom: 2rem;
}

.yuansu-loading-dot {
	width: 0.75rem;
	height: 0.75rem;
	border-radius: 9999px;
	background: #3b82f6;
	animation: yuansu-pulse 1s ease-in-out infinite;
}

@keyframes yuansu-pulse {
	0%, 100% { opacity: 0.35; transform: scale(0.9); }
	50% { opacity: 1; transform: scale(1); }
}

.yuansu-table-wrap {
	padding: 4px;
}

.yuansu-table {
	display: grid;
	grid-template-columns: repeat(18, minmax(44px, 1fr));
	gap: 3px;
	min-width: 860px;
}

.yuansu-cell {
	position: relative;
	min-height: 54px;
	border-radius: 0.35rem;
	border: 1px solid transparent;
	padding: 3px 4px;
	cursor: pointer;
	text-align: left;
	line-height: 1.1;
	transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.15s ease, outline 0.08s ease;
	user-select: none;
}

.yuansu-cell:hover {
	transform: translateY(-1px);
	box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
	z-index: 1;
}

.yuansu-cell.is-dim {
	opacity: 0.18;
	filter: grayscale(0.4);
}

.yuansu-cell.is-active {
	outline: 2px solid #1d4ed8;
	outline-offset: 1px;
	z-index: 2;
}

.yuansu-cell .z {
	display: block;
	font-size: 9px;
	color: rgba(15, 23, 42, 0.65);
	font-weight: 600;
}

.yuansu-cell .sym {
	display: block;
	font-size: 15px;
	font-weight: 800;
	color: #0f172a;
	margin-top: 1px;
}

.yuansu-cell .zh {
	display: block;
	font-size: 10px;
	color: rgba(15, 23, 42, 0.75);
	margin-top: 1px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.yuansu-spacer {
	min-height: 54px;
}

.yuansu-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 0.75rem;
}

.yuansu-legend-item {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 12px;
	color: #475569;
	cursor: pointer;
	padding: 0.15rem 0.35rem;
	border-radius: 0.35rem;
}

.yuansu-legend-item:hover,
.yuansu-legend-item.is-on {
	background: #f1f5f9;
}

.yuansu-legend-swatch {
	width: 12px;
	height: 12px;
	border-radius: 3px;
	border: 1px solid rgba(15, 23, 42, 0.12);
}

/* 大屏：右侧匹配列表高度跟随左侧详情，不由列表内容撑高整行 */
@media (min-width: 1280px) {
	.yuansu-detail-match-grid {
		align-items: stretch;
	}

	.yuansu-match-col {
		height: 0;
		min-height: 100%;
	}
}

.yuansu-match-item {
	display: block;
	width: 100%;
	height: auto;
	flex: none;
	text-align: left;
	border: 1px solid #e2e8f0;
	border-radius: 0.75rem;
	padding: 0.75rem 0.9rem;
	background: #fff;
	transition: border-color 0.12s ease, background 0.12s ease;
}

.yuansu-match-item:hover,
.yuansu-match-item.is-active {
	border-color: #93c5fd;
	background: #eff6ff;
}

.yuansu-detail-hero {
	display: flex;
	gap: 1rem;
	align-items: flex-start;
	margin-bottom: 1rem;
}

.yuansu-detail-badge {
	width: 4.5rem;
	height: 4.5rem;
	border-radius: 0.85rem;
	border: 1px solid rgba(15, 23, 42, 0.08);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.yuansu-detail-badge .sym {
	font-size: 1.6rem;
	font-weight: 800;
	line-height: 1;
}

.yuansu-detail-badge .z {
	font-size: 0.75rem;
	margin-top: 0.2rem;
	opacity: 0.7;
}

.yuansu-detail-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.75rem;
}

.yuansu-detail-card {
	border: 1px solid #e2e8f0;
	border-radius: 0.75rem;
	padding: 0.75rem 0.9rem;
	background: #f8fafc;
}

.yuansu-detail-card.full {
	grid-column: 1 / -1;
}

.yuansu-detail-card .label {
	font-size: 0.75rem;
	color: #64748b;
	margin-bottom: 0.2rem;
}

.yuansu-detail-card .value {
	font-size: 0.95rem;
	font-weight: 700;
	color: #0f172a;
	word-break: break-word;
}

.yuansu-copy-btn {
	margin-left: 0.5rem;
	font-size: 0.75rem;
	color: #2563eb;
	font-weight: 600;
}

.yuansu-copy-btn:hover {
	text-decoration: underline;
}

/* category colors */
.cat-碱金属 { background: #fecaca; }
.cat-碱土金属 { background: #fed7aa; }
.cat-过渡金属 { background: #fde68a; }
.cat-后过渡金属 { background: #bbf7d0; }
.cat-类金属 { background: #a7f3d0; }
.cat-非金属 { background: #99f6e4; }
.cat-双原子非金属 { background: #a5f3fc; }
.cat-卤素 { background: #c7d2fe; }
.cat-稀有气体 { background: #ddd6fe; }
.cat-镧系元素 { background: #fbcfe8; }
.cat-锕系元素 { background: #f9a8d4; }
.cat-待定分类 { background: #e2e8f0; }

@media (max-width: 640px) {
	.yuansu-detail-grid {
		grid-template-columns: 1fr;
	}
}
