/* Reset and base styles */
* {
	box-sizing: border-box;
	margin: 0;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
	line-height: 1.6;
}

/* Chart container styles */
#chart-container {
	background: white;
	border-radius: 1rem;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Phonetic card styles */
.word {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 1.25rem 0.5rem;
	border-radius: 0.75rem;
	border: 2px solid transparent;
	transition: all 0.3s ease;
	cursor: pointer;
	min-height: 90px;
	font-weight: 600;
	font-size: 1.75rem;
	text-align: center;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.word:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	border-color: rgba(0, 0, 0, 0.1);
}

.word:active {
	transform: translateY(0);
}

/* Color schemes for different sound types */
.word.bg-cyan-400 {
	background: linear-gradient(135deg, #22d3ee, #06b6d4);
	color: white;
}

.word.bg-orange-400 {
	background: linear-gradient(135deg, #fb923c, #ea580c);
	color: white;
}

.word.bg-red-400 {
	background: linear-gradient(135deg, #f87171, #dc2626);
	color: white;
}

/* Example word styling */
.example {
	position: absolute;
	bottom: -0.8rem;
	left: 50%;
	transform: translateX(-50%);
	background: white;
	color: #374151;
	font-size: 0.875rem;
	font-weight: 500;
	padding: 0.35rem 0.7rem;
	border-radius: 0.5rem;
	border: 1px solid #e5e7eb;
	white-space: nowrap;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	transition: all 0.2s ease;
	cursor: pointer;
}

.example:hover {
	background: #f3f4f6;
	transform: translateX(-50%) scale(1.05);
}

/* Unvoiced consonant indicator */
.unvoiced {
	position: relative;
}

.unvoiced::before {
	content: '🔇';
	position: absolute;
	top: -0.5rem;
	right: -0.5rem;
	font-size: 0.8rem;
	background: white;
	border-radius: 50%;
	padding: 0.1rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
	z-index: 10;
}

/* Responsive grid adjustments */
@media (max-width: 768px) {
	.word {
		min-height: 80px;
		font-size: 1.5rem;
		padding: 1rem 0.25rem;
	}
	
	.example {
		font-size: 0.8rem;
		padding: 0.25rem 0.5rem;
		bottom: -0.7rem;
	}
	
	.unvoiced::before {
		font-size: 0.7rem;
		top: -0.4rem;
		right: -0.4rem;
	}
}

@media (max-width: 480px) {
	.word {
		min-height: 70px;
		font-size: 1.25rem;
		padding: 0.75rem 0.2rem;
	}
	
	.example {
		font-size: 0.75rem;
		padding: 0.2rem 0.4rem;
		bottom: -0.6rem;
	}
}

/* Smooth scrolling for anchor links */
html {
	scroll-behavior: smooth;
}

/* Loading animation for audio */
.word.loading {
	opacity: 0.7;
	pointer-events: none;
}

.word.loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 20px;
	margin: -10px 0 0 -10px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top: 2px solid white;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* Focus styles for accessibility */
.word:focus {
	outline: 2px solid #3b82f6;
	outline-offset: 2px;
}

.example:focus {
	outline: 2px solid #3b82f6;
	outline-offset: 1px;
}

/* Print styles */
@media print {
	.word {
		box-shadow: none;
		border: 1px solid #000;
	}
	
	.example {
		box-shadow: none;
		border: 1px solid #000;
	}
}

/* Back to Top Button */
.back-to-top {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: 50px;
	height: 50px;
	background: linear-gradient(135deg, #3b82f6, #8b5cf6);
	color: white;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
	transition: all 0.3s ease;
	opacity: 0;
	visibility: hidden;
	transform: translateY(20px);
	z-index: 1000;
}

.back-to-top:hover {
	background: linear-gradient(135deg, #2563eb, #7c3aed);
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.back-to-top.show {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.back-to-top:active {
	transform: translateY(0) scale(0.95);
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
	.back-to-top {
		bottom: 15px;
		right: 15px;
		width: 45px;
		height: 45px;
		font-size: 18px;
	}
}
