:root {
  --primary-color: #4a6da7;
  --primary-dark: #345491;
  --secondary-color: #f5f5f5;
  --text-color: #333;
  --error-color: #e74c3c;
  --success-color: #2ecc71;
  --border-radius: 8px;
  --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

body {
  font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  background-color: #f0f2f5;
  color: var(--text-color);
  line-height: 1.6;
  /* 다음 속성 제거 또는 수정 */
  display: block;
  /* flex에서 block으로 변경 */
  /* align-items: center; 제거 */
  margin: 0;
  padding: 0;
}

.container {
  margin: 0 auto;
  padding: 10px;
  display: flex;
  justify-content: center;
  /* 상단 여백 추가 (선택사항) */
  padding-top: 20px;
  min-width: 320px
}

.card {
  border-radius: var(--border-radius);
  overflow: hidden;
  width: 100%;
  max-width: 640px;
}

.card-header {
  background-color: var(--primary-color);
}

/* 레벨 선택 스타일 */
.level-item,
.sublevel-item {
  background-color: var(--secondary-color);
  padding: 12px 0;
  border-radius: var(--border-radius);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 18px;
  font-weight: bold;
}

.level-item:hover,
.sublevel-item:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-2px);
}

/* 한자 카드 스타일 */
.card-flip {
  perspective: 1000px;
  height: 150px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.card-inner.flipped {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  background-color: white;
  border: 1px solid #ddd;
}

.card-back {
  transform: rotateY(180deg);
}

.hanja-display {
  font-size: 80px;
  font-weight: bold;
  line-height: 1;
}

.hanja-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.meaning {
  font-size: 18px;
  text-align: center;
}

/* 결과 메시지 */
.result-message {
  margin-top: 10px;
  padding: 8px;
  border-radius: var(--border-radius);
  text-align: center;
  font-weight: bold;
}

.result-message.correct {
  background-color: rgba(46, 204, 113, 0.2);
  color: #27ae60;
}

.result-message.incorrect {
  background-color: rgba(231, 76, 60, 0.2);
  color: #c0392b;
}

/* 결과 화면 */
.stat-item {
  background-color: var(--secondary-color);
  padding: 8px;
  border-radius: var(--border-radius);
}

.stat-label {
  font-size: 12px;
  color: #666;
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  color: var(--primary-color);
}

.wrong-questions li {
  padding: 8px;
  margin-bottom: 4px;
  background-color: #f9f9f9;
  border-radius: var(--border-radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wrong-hanja {
  font-size: 24px;
  font-weight: bold;
  margin-right: 10px;
}

/* 유틸리티 클래스 */
.hidden {
  display: none !important;
}

/* 버튼 스타일 */
.btn {
  font-size: 14px;
  padding: 8px 12px;
}

/* 입력 필드 */
.input-group .form-control {
  font-size: 16px;
}

/* 모바일 최적화 */
@media (max-width: 576px) {
  body {
    font-size: 13px;
  }

  .hanja-display {
    font-size: 70px;
  }

  .card-flip {
    height: 130px;
  }

  .stat-value {
    font-size: 20px;
  }
}