/* 공통 스타일 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2c3e50;
  --secondary-color: #3498db;
  --accent-color: #e74c3c;
  --success-color: #27ae60;
  --warning-color: #f39c12;
  --bg-color: #f5f6fa;
  --card-bg: #ffffff;
  --text-color: #2c3e50;
  --text-light: #7f8c8d;
  --border-color: #dcdde1;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
}

/* 헤더 */
.header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.header h1 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.header p {
  opacity: 0.9;
  font-size: 0.95rem;
}

/* 네비게이션 */
.nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
}

.nav a {
  text-decoration: none;
  color: var(--text-color);
  padding: 0.5rem 1.5rem;
  border-radius: 25px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.nav a:hover,
.nav a.active {
  background: var(--secondary-color);
  color: white;
}

/* 컨테이너 */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* 검색 및 필터 */
.search-section {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.search-box {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.search-box input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--secondary-color);
}

.search-box button {
  padding: 0.75rem 1.5rem;
  background: var(--secondary-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s;
}

.search-box button:hover {
  background: #2980b9;
}

/* 초성 필터 */
.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.category-btn {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border-color);
  background: white;
  border-radius: 20px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s;
  font-weight: 500;
}

.category-btn:hover,
.category-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* 아코디언 리스트 */
.idiom-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.idiom-item {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all 0.3s;
}

.idiom-header {
  padding: 1rem 1.5rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.3s;
}

.idiom-header:hover {
  background: #f8f9fa;
}

.idiom-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
}

.idiom-toggle {
  font-size: 1.5rem;
  color: var(--text-light);
  transition: transform 0.3s;
}

.idiom-item.open .idiom-toggle {
  transform: rotate(180deg);
}

.idiom-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background: #f8f9fa;
}

.idiom-item.open .idiom-content {
  max-height: 500px;
}

.idiom-detail {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.idiom-reading {
  display: inline-block;
  background: var(--secondary-color);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.idiom-meaning {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  line-height: 1.8;
}

.idiom-example {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  color: var(--text-light);
  font-style: italic;
}

/* 퀴즈 스타일 */
.quiz-container {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 2rem;
}

.quiz-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

.quiz-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  margin: 0 1rem;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary-color), var(--success-color));
  border-radius: 4px;
  transition: width 0.5s ease;
}

.quiz-question {
  font-size: 1.3rem;
  line-height: 1.8;
  margin-bottom: 2rem;
  text-align: center;
  color: var(--primary-color);
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: #f8f9fa;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
}

.quiz-option:hover:not(.disabled) {
  background: #eee;
}

.quiz-option.selected {
  background: #e5e5e5;
}

.quiz-option.correct {
  border-color: var(--success-color);
  background: #d4edda;
}

.quiz-option.wrong {
  border-color: var(--accent-color);
  background: #f8d7da;
}

.quiz-option.disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.option-text {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 500;
}

.option-hint-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--secondary-color);
  background: white;
  color: var(--secondary-color);
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1rem;
}

.option-hint-btn:hover {
  background: var(--secondary-color);
  color: white;
}

.option-hint {
  display: none;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: white;
  border-radius: 6px;
}

.option-hint.show {
  display: block;
}

/* 퀴즈 해설 */
.quiz-explanation {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #f5f5f5;
  border-radius: 12px;
  display: none;
}

.quiz-explanation.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 퀴즈 결과 */
.quiz-result {
  text-align: center;
  padding: 2rem;
}

.result-score {
  font-size: 4rem;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.result-message {
  font-size: 1.5rem;
  color: var(--text-light);
  margin-bottom: 2rem;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.btn {
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}

.btn-primary {
  background: var(--secondary-color);
  color: white;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-secondary {
  background: var(--border-color);
  color: var(--text-color);
}

.btn-secondary:hover {
  background: #bdc3c7;
}

/* 오답 리스트 */
.wrong-list {
  text-align: left;
  margin-top: 2rem;
}

.wrong-list h3 {
  margin-bottom: 1rem;
  color: var(--accent-color);
}

.wrong-item {
  background: #fff5f5;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  display: flex;
  gap: 1rem;
}

.wrong-item-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: var(--accent-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.wrong-item-content {
  flex: 1;
  min-width: 0;
}

.wrong-item-name {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.wrong-item-meaning {
  color: var(--text-light);
  font-size: 0.95rem;
}

/* 인쇄 스타일 */
@media print {
  .header,
  .nav,
  .search-section,
  .result-actions,
  .btn,
  .quiz-result {
    display: none !important;
  }

  body {
    background: white;
    font-size: 12pt;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  .quiz-container {
    box-shadow: none;
    padding: 0;
  }

  .wrong-list {
    box-shadow: none;
    border: none;
    margin-top: 0;
  }

  .wrong-item {
    page-break-inside: avoid;
    border: 1px solid #ccc;
  }

  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #333;
  }

  .print-header h1 {
    font-size: 18pt;
  }

  .wrong-list-title {
    display: none !important;
  }

  .print-header p {
    font-size: 10pt;
    color: #666;
  }
}

.print-header {
  display: none;
}

/* 반응형 */
@media (max-width: 768px) {
  .header h1 {
    font-size: 1.5rem;
  }

  .container {
    padding: 1rem;
  }

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

  .quiz-option {
    padding: 0.75rem 1rem;
  }

  .option-text {
    font-size: 1rem;
  }

  .category-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }

  .result-score {
    font-size: 3rem;
  }

  .result-actions {
    flex-direction: column;
  }
}

/* 카운트다운 */
.countdown {
  display: inline-block;
  width: 40px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  background: var(--secondary-color);
  color: white;
  border-radius: 50%;
  font-weight: bold;
  font-size: 1.2rem;
  margin-left: 1rem;
}

/* 시작 화면 */
.quiz-start {
  text-align: center;
  padding: 3rem;
}

.quiz-start h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.quiz-start p {
  color: var(--text-light);
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.quiz-start .btn {
  font-size: 1.2rem;
  padding: 1rem 3rem;
}

/* 결과 통계 */
.result-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
}

.stat-value.correct {
  color: var(--success-color);
}

.stat-value.wrong {
  color: var(--accent-color);
}

.stat-label {
  color: var(--text-light);
  font-size: 0.9rem;
}
