/* 기본 스타일 */
:root {
  --primary-color: #5062AA;
  --secondary-color: #8C9EFF;
  --accent-color: #FF9A8B;
  --correct-color: #81C784;
  --incorrect-color: #E57373;
  --background-color: #F8F9FA;
  --card-background: #FFFFFF;
  --text-color: #37474F;
  --light-text: #78909C;
  --border-color: #ECEFF1;
  --hover-color: #F5F7FA;
}

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

body {
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
  line-height: 1.8;
  color: var(--text-color);
  background-color: var(--background-color);
  padding: 2rem;
  text-align: center;
  letter-spacing: -0.01em;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

h1, h2, h3 {
  margin-bottom: 1.5rem;
  color: var(--text-color);
  text-align: center;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

/* 캐릭터 표시 */
.character-display {
  text-align: center;
  margin-bottom: 2.5rem;
  padding: 2rem;
  background-color: var(--background-color);
  border-radius: 12px;
}

.korean-char {
  font-size: 5rem;
  font-weight: bold;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.english-sound {
  font-size: 1.5rem;
  color: var(--secondary-color);
  margin-bottom: 0.75rem;
}

.reference-word {
  font-size: 1rem;
  color: var(--light-text);
  margin-bottom: 1.5rem;
}

/* 캐릭터 그리드 */
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
  text-align: center;
}

.character-card {
  padding: 1.5rem 1rem;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  text-align: center;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
}

.character-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.05);
}

/* 퀴즈 스타일 */
.quiz-container {
  text-align: center;
  padding: 1rem;
}

.quiz-question {
  font-size: 3.5rem;
  margin: 2rem 0;
  font-weight: bold;
  color: var(--primary-color);
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
  text-align: center;
}

.quiz-option {
  padding: 1.25rem 1rem;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1.1rem;
}

.quiz-option:hover {
  background-color: var(--hover-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  transform: translateY(-3px);
}

.quiz-option.correct {
  background-color: var(--correct-color);
  color: white;
  border-color: var(--correct-color);
}

.quiz-option.incorrect {
  background-color: var(--incorrect-color);
  color: white;
  border-color: var(--incorrect-color);
}

/* 연습 컨테이너 */
.practice-container {
  text-align: center;
  padding: 1rem;
}

.timer-container {
  margin: 2rem 0;
  text-align: center;
}

.timer-buttons {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.timer-button {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  background-color: var(--background-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.timer-display {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.25rem 0;
  text-align: center;
  color: var(--primary-color);
}

.syllable-grid, .practice-grid, .random-characters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
  text-align: center;
}

.syllable-card, .practice-card, .random-character {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 110px;
  font-size: 2.5rem;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  text-align: center;
}

.syllable-card:hover, .practice-card:hover, .random-character:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.05);
}

/* 음절 빌더 */
.builder-container {
  text-align: center;
  padding: 1.5rem;
}

.builder-result {
  font-size: 5rem;
  height: 120px;
  margin: 2rem 0;
  font-weight: bold;
  text-align: center;
  color: var(--primary-color);
}

.builder-components {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  margin: 2rem 0;
  text-align: center;
}

.component-section {
  flex: 1 1 45%;
  min-width: 300px;
  text-align: center;
  background-color: var(--background-color);
  padding: 1.5rem;
  border-radius: 12px;
}

.component-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  text-align: center;
  color: var(--text-color);
}

.component-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 0.75rem;
  text-align: center;
}

.component-item {
  padding: 0.75rem;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.component-item:hover {
  background-color: var(--hover-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.component-item.selected {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* 받침 관련 스타일 */
.batchim-group {
  margin-bottom: 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  background-color: white;
  text-align: center;
}

.batchim-display {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: center;
  text-align: center;
}

.batchim-card {
  padding: 1.25rem;
  background-color: var(--background-color);
  border-radius: 12px;
  text-align: center;
  min-width: 120px;
  transition: transform 0.3s, box-shadow 0.3s;
}

.batchim-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.05);
}

.batchim-char {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  text-align: center;
  color: var(--primary-color);
}

.batchim-sound {
  font-size: 1rem;
  color: var(--secondary-color);
  margin-bottom: 0.5rem;
  text-align: center;
}

.batchim-example {
  font-size: 0.9rem;
  color: var(--light-text);
  text-align: center;
}

.components {
  font-size: 0.875rem;
  background-color: var(--hover-color);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.5rem;
  text-align: center;
}

/* 푸터 */
footer {
  text-align: center;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  color: var(--light-text);
  font-size: 0.875rem;
}

/* 문단 관련 스타일 */
.paragraph-title {
  color: var(--primary-color);
  margin-bottom: 1.25rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
}

.paragraph-content {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
  text-align: left;
  color: var(--text-color);
}

/* 문단 컨트롤 */
.paragraph-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
  text-align: center;
}

.paragraph-controls button {
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.paragraph-controls button:hover {
  background-color: var(--secondary-color);
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

/* 타이머 스타일 */
.paragraph-timer {
  margin: 2rem 0;
  padding: 1.5rem;
  background-color: var(--background-color);
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  text-align: center;
}

.timer-controls {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  text-align: center;
}

.timer-controls button {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.875rem;
}

#paragraph-timer-start {
  background-color: var(--correct-color);
  color: white;
}

#paragraph-timer-stop {
  background-color: var(--incorrect-color);
  color: white;
}

#paragraph-timer-reset {
  background-color: var(--border-color);
  color: var(--text-color);
}

.timer-controls button:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.timer-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 단어 연습 관련 스타일 */
.word-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin: 1.5rem 0 2.5rem 0;
}

.practice-word {
  background-color: var(--card-background);
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  padding: 1.25rem 1.5rem;
  font-size: 1.5rem;
  min-width: 80px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.practice-word:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.05);
  background-color: var(--primary-color);
  color: white;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
  body {
    padding: 1rem;
  }

  .builder-components {
    flex-direction: column;
    gap: 1.5rem;
  }

  .quiz-options, .character-grid, .syllable-grid, .practice-grid, .random-characters {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 1rem;
  }

  .korean-char {
    font-size: 3.5rem;
  }

  .builder-result {
    font-size: 3.5rem;
    height: 90px;
  }

  .quiz-question {
    font-size: 2.5rem;
  }

  .paragraph-content {
    font-size: 1rem;
  }

  .paragraph-controls {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }

  .paragraph-controls button {
    width: 100%;
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0.75rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .quiz-options, .character-grid, .syllable-grid, .practice-grid, .random-characters {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
  }

  .korean-char {
    font-size: 3rem;
  }

  .builder-result {
    font-size: 3rem;
    height: 80px;
  }

  .quiz-question {
    font-size: 2.25rem;
  }

  .component-grid {
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.5rem;
  }

  .section-nav {
    gap: 0.5rem;
  }

  .section-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .content-section, .content-area {
    padding: 1.25rem;
    border-radius: 10px;
  }
}

/* 알림 바 스타일 */
.notification-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: var(--accent-color);
  color: white;
  text-align: center;
  padding: 0.75rem;
  z-index: 1000;
  display: none;
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
}

button {
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: all 0.2s ease;
}

button:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

button:disabled {
  background-color: var(--light-text);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 헤더 스타일 */
header {
  text-align: center;
  margin-bottom: 3rem;
}

/* 내비게이션 */
.main-nav ul {
  display: flex;
  justify-content: center;
  list-style: none;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 3rem;
}

.main-nav a {
  display: block;
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  color: var(--text-color);
  background-color: var(--card-background);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.3s;
  font-size: 0.9rem;
}

.main-nav a:hover,
.main-nav a.active {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 12px rgba(80, 98, 170, 0.15);
}

/* 섹션 내비게이션 */
.section-nav {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.section-btn {
  padding: 0.6rem 1.25rem;
  background-color: var(--card-background);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
}

.section-btn.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(80, 98, 170, 0.15);
}

/* 콘텐츠 섹션 */
.content-section {
  display: none;
  background-color: var(--card-background);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  margin-bottom: 2rem;
  text-align: center;
}

.content-section.active {
  display: block;
}

.content-area {
  background-color: var(--card-background);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  margin-bottom: 2rem;
}

/* 사운드 제어 컨트롤 */
.sound-toggle-container {
  display: flex;
  align-items: center;
  margin: 0 10px;
}

/* 소리 토글 버튼 */
.sound-toggle-btn {
  background-color: #5062AA;
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  padding: 6px 12px;
  transition: all 0.2s ease;
}

.sound-toggle-btn:hover {
  background-color: #3d4d8a;
}

.sound-toggle-btn:active {
  background-color: #2c3a69;
}

/* 소리 끄기 상태일 때 */
.sound-toggle-btn.off {
  background-color: #888;
}

.sound-toggle-btn.off:hover {
  background-color: #777;
}

/* 재생 버튼 스타일 */
.sound-button {
  background-color: #5062AA;
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  padding: 3px 8px;
  margin-left: 5px;
  transition: all 0.2s ease;
}

.sound-button:hover {
  background-color: #3d4d8a;
}

.sound-button:active {
  background-color: #2c3a69;
}

/* 비활성화된 사운드 버튼 스타일 */
.sound-button.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background-color: #999;
}

.sound-button.disabled:hover {
  background-color: #999;
}

/* 문자 표시 영역에서의 버튼 조정 */
.character-display {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
}

.korean-char {
  font-size: 48px;
  margin-right: 15px;
}

.english-sound {
  font-size: 20px;
  color: #666;
  margin-right: 10px;
}

/* 받침 학습 버튼 조정 */
.batchim-group h3 .sound-button {
  vertical-align: middle;
  margin-left: 10px;
}

/* 음절 결과 영역 버튼 조정 */
.builder-result {
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
}

.builder-result .sound-button {
  font-size: 14px;
  margin-left: 10px;
}

/* 모바일에서의 스타일 최적화 */
@media (max-width: 768px) {
  .sound-toggle-btn {
    font-size: 12px;
    padding: 4px 8px;
  }

  .sound-button {
    font-size: 10px;
    padding: 2px 6px;
  }

  .korean-char {
    font-size: 36px;
  }

  .english-sound {
    font-size: 16px;
  }

  .builder-result {
    font-size: 24px;
  }

  .builder-result .sound-button {
    font-size: 12px;
  }
}

