/* Global styles */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&display=swap');

:root {
  --primary: #0d9488; /* teal-600 */
  --primary-light: #ccfbf1; /* teal-100 */
  --secondary: #0284c7; /* blue-600 */
  --neutral: #f8fafc; /* slate-50 */
  --neutral-light: #f1f5f9; /* slate-100 */
  --gray-dark: #1f2937; /* gray-800 */
}

body {
  font-family: 'Open Sans', sans-serif;
  color: #1f2937;
  line-height: 1.5;
}

.font-chinese-character {
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 500;
}

/* Animation for character drawing */
@keyframes drawCharacter {
  0% { opacity: 0; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

.animate-draw {
  animation: drawCharacter 1s ease-out forwards;
}

/* Stroke order animation */
.stroke {
  fill: none;
  stroke: #1f2937;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stroke-animated {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawStroke 1.5s linear forwards;
}

@keyframes drawStroke {
  to {
    stroke-dashoffset: 0;
  }
}

/* Canvas for stroke tracing */
.stroke-canvas {
  border: 1px solid #e5e7eb;
  background-color: #f9fafb;
  cursor: pointer;
  touch-action: none;
}

/* Accordion styles */
.accordion-header {
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.accordion-header:hover {
  background-color: #f8fafc;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.accordion-content.open {
  max-height: 1000px;
}

/* Audio player */
.audio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  cursor: pointer;
  transition: background-color 0.2s;
}

.audio-btn:hover {
  background-color: #0f766e; /* darker teal */
}

/* Character grid in archive */
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
}

.character-card {
  aspect-ratio: 1/1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background-color: white;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.character-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

/* Gamification elements */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  background-color: var(--primary-light);
  color: var(--primary);
}

.progress-bar {
  height: 0.5rem;
  width: 100%;
  background-color: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary);
  border-radius: 9999px;
  transition: width 0.5s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .character-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  
  .stroke-canvas {
    max-width: 100%;
    height: auto;
  }
}
