
body {
	font-family: 'Segoe UI', 'Microsoft JhengHei', Arial, sans-serif;
	background: #f5f6fa;
	margin: 0;
	padding: 0;
}

/* 卡片網格排版 */
.grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 20px;
	max-width: 700px;
	width: 100%;
	margin: 0 auto;
	padding: 20px 0;
}

.card {
	border-radius: 16px;
	box-shadow: 0 4px 16px rgba(0,0,0,0.10);
	cursor: pointer;
	position: relative;
	height: 100px;
	min-height: 80px;
	transition: box-shadow 0.2s, opacity 0.3s, border 0.2s;
	display: flex;
	align-items: baseline;
	justify-content: center;
	
	user-select: none;
	border: 2px solid #e1e8ed;
	background: linear-gradient(135deg, #fafdff 60%, #addafb 100%);
}

.card-content {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.5rem;
	border-radius: 16px;
	user-select: none;
	color: #2d3a4a;
	font-weight: 500;
	letter-spacing: 1px;
}

.chem-text {
  display: inline-block;
  vertical-align: baseline;
  
  color: #2d3a4a;
  font-weight: 500;
  letter-spacing: 1px;
}
.chem-text sub {
  font-size: 0.7em;
  vertical-align: sub;
  margin-left: -0.08em;
  line-height: 1;
}

.card-content sub {
	font-size: 0.7em;
	vertical-align: sub;
	line-height: 1;
	margin-left: -0.08em;
	letter-spacing: normal;
}

.card.selected {
	box-shadow: 0 0 0 4px #ffd700, 0 2px 8px rgba(0,0,0,0.08);
	border: 2.5px solid #ffd700;
	z-index: 2;
}

.card.matched {
	opacity: 0.3;
	pointer-events: none;
}

.card.hidden {
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s;
}

@media (max-width: 600px) {
	.grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 12px;
		max-width: 98vw;
		padding: 8px 0;
	}
	.card {
		height: 60px;
		font-size: 1rem;
		border-radius: 10px;
	}
	.card-content {
		border-radius: 10px;
		font-size: 1rem;
	}
}

#gameOver {
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0,0,0,0.4);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	z-index: 100;
}

#gameOver.hidden {
	display: none;
}

.game-over-message {
	background: #fff;
	color: #4a90e2;
	font-size: 2rem;
	padding: 2rem 3rem;
	border-radius: 16px;
	margin-bottom: 1.5rem;
	box-shadow: 0 2px 16px rgba(0,0,0,0.15);
}

button {
	background: #4a90e2;
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 0.7rem 1.5rem;
	font-size: 1.1rem;
	cursor: pointer;
	transition: background 0.2s;
}
button:hover {
	background: #357ab8;
}