/* 전역 설정: 1rem = 10px (62.5% 시스템) */
html {
  font-size: 62.5%;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: #f5f7fa;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem; /* 20px */
}

.chat-container {
  width: 100%;
  max-width: 60rem; /* 600px */
  height: 85vh;
  max-height: 80rem; /* 800px */
  background: #ffffff;
  border-radius: 2rem; /* 20px */
  box-shadow: 0 0.2rem 1.6rem rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background: #ffffff;
  color: #191f28;
  padding: 0 2rem 0; /* 패딩 조정 */
  text-align: center;
  border-bottom: 0.1rem solid #f2f4f6;
  position: relative;
}

.lang-bar {
  display: flex;
  justify-content: center; /* 가운데 정렬 */
  padding-top: 1.6rem;
  padding-bottom: 0.8rem;
}

.lang-selector {
  z-index: 100;
}

.custom-select {
  position: relative;
  width: 10rem; /* 너비를 확실하게 고정 */
  min-width: 10rem;
  max-width: 10rem;
}

.select-trigger {
  width: 100%;
  height: 3.2rem; /* 높이도 고정하여 위아래 흔들림 방지 */
  padding: 0 1rem;
  background: #ffffff;
  border: 0.1rem solid #e5e8eb;
  border-radius: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0.2rem 0.4rem rgba(0, 0, 0, 0.04);
}

.select-trigger:hover {
  background: #f9fafb;
  border-color: #d1d6db;
}

#selectedLangText {
  display: inline-block;
  width: 5.5rem; /* English가 충분히 들어갈 만큼 너비 확보 */
  min-width: 5.5rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: #4e5968;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* 혹시나 넘치면 줄임표 처리 */
}

.arrow-icon {
  width: 0.7rem;
  height: 0.7rem;
  border-left: 0.2rem solid #4e5968;
  border-bottom: 0.2rem solid #4e5968;
  transform: rotate(-45deg);
  margin-top: -0.2rem;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.custom-select.active .arrow-icon {
  transform: rotate(135deg);
  margin-bottom: -0.3rem;
}

.select-options {
  position: absolute;
  top: calc(100% + 0.6rem);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 0.1rem solid #e5e8eb;
  border-radius: 1.2rem;
  box-shadow: 0 0.8rem 2.4rem rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: none;
  animation: slideDown 0.2s ease-out;
}

.custom-select.active .select-options {
  display: block;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-0.8rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.option {
  padding: 1rem 1.2rem;
  font-size: 1.2rem;
  font-weight: 500;
  color: #4e5968;
  cursor: pointer;
  transition: background 0.2s ease;
}

.option:hover {
  background: #f2f4f6;
  color: #191f28;
}

.option.selected {
  background: #f2f4f6;
  color: #3182f6;
  font-weight: 700;
}

.header-top {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.8rem;
  padding: 0 1.6rem; /* 제목 좌우 여유 공간 */
}

.chat-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: #191f28;
  letter-spacing: -0.03em;
  line-height: 1.3;
  word-break: keep-all;
  text-align: center;
  width: 100%;
}

.chat-header p {
  font-size: 1.3rem; /* 13px */
  color: #8b95a1;
  font-weight: 400;
  line-height: 1.4;
}

.stats-container {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}

#statsText {
  font-size: 1.2rem;
  color: #8b95a1;
  background: #f2f4f6;
  padding: 0.4rem 1.2rem;
  border-radius: 2rem;
  display: inline-block;
  line-height: 1.4;
  min-height: 2.48rem; /* padding + font-size * line-height 와 일치시켜 흔들림 방지 */
  box-sizing: border-box;
}

#statsText b {
  color: #3182f6;
  font-weight: 700;
}

.chat-tabs {
  display: flex;
  justify-content: center;
  gap: 1.2rem; /* 간격을 좁혀서 텍스트 공간 확보 */
  margin-top: 1.6rem;
  padding: 0 1rem;
}

/* Toast 알림 스타일 */
.toast {
  position: fixed;
  bottom: 10rem;
  left: 50%;
  transform: translateX(-50%) translateY(2rem);
  background: rgba(25, 31, 40, 0.9);
  color: white;
  padding: 1.2rem 2.4rem;
  border-radius: 3rem;
  font-size: 1.4rem;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0.8rem 2.4rem rgba(0, 0, 0, 0.2);
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.tab-button {
  flex: 1; /* 모든 탭의 너비를 동일하게 */
  max-width: 12rem; /* 너무 넓어지지 않게 제한 */
  padding: 0.8rem 0.2rem 1.2rem;
  font-size: 1.4rem; /* 폰트 크기 살짝 축소 (영어 대응) */
  font-weight: 600;
  color: #8b95a1;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
  white-space: nowrap; /* 텍스트 줄바꿈 방지 */
  text-align: center;
}

.tab-button:hover {
  color: #4e5968;
}

.tab-button.active {
  color: #3182f6;
}

.tab-button.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0.3rem;
  background: #3182f6;
  border-radius: 0.3rem 0.3rem 0 0;
}

/* 랭킹 탭 스타일 */
.ranking-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: white;
  overflow-y: auto;
}

.ranking-header {
  padding: 3.2rem 2.4rem 2rem;
  text-align: center;
  border-bottom: 0.1rem solid #f2f4f6;
}

.ranking-title-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.ranking-header h2 {
  font-size: 2rem;
  color: #191f28;
  font-weight: 700;
  margin-bottom: 0; /* 정렬을 위해 margin 제거 */
}

.refresh-button {
  background: none;
  border: none;
  color: #8b95a1;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.refresh-button:hover {
  background-color: #f2f4f6;
  color: #3182f6;
}

.refresh-button:active {
  transform: scale(0.9);
}

.refresh-button.rotating svg {
  animation: rotate 0.6s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.ranking-header p {
  font-size: 1.3rem;
  color: #8b95a1;
}

.ranking-list {
  padding: 2.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  max-width: 50rem;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

/* 랭킹 빈 상태 스타일 */
.empty-ranking {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6rem 2rem;
  text-align: center;
}

.empty-icon {
  font-size: 4.8rem;
  margin-bottom: 2rem;
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
}

.empty-text {
  font-size: 1.6rem;
  color: #4e5968;
  line-height: 1.6;
  margin-bottom: 2.4rem;
  font-weight: 500;
}

.go-to-scenario {
  padding: 1.2rem 2.4rem;
  background: #3182f6;
  color: white;
  border: none;
  border-radius: 1.2rem;
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0.4rem 1.2rem rgba(49, 130, 246, 0.2);
}

.go-to-scenario:hover {
  background: #1b64da;
  transform: translateY(-0.2rem);
  box-shadow: 0 0.6rem 1.6rem rgba(49, 130, 246, 0.3);
}

.ranking-item {
  display: flex;
  align-items: center;
  padding: 1.6rem 2rem;
  background: #f9fafb;
  border-radius: 1.6rem;
  transition: all 0.2s ease;
  border: 0.1rem solid transparent;
}

.ranking-item:hover {
  transform: translateY(-0.2rem);
  background: white;
  border-color: #3182f6;
  box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.08);
}

.rank-number {
  font-size: 1.8rem;
  font-weight: 800;
  width: 4.5rem;
  color: #4e5968;
}

/* 1, 2, 3위 강조 */
.ranking-item:nth-child(1) .rank-number {
  color: #ffd700;
  font-size: 2.4rem;
}
.ranking-item:nth-child(2) .rank-number {
  color: #c0c0c0;
  font-size: 2.2rem;
}
.ranking-item:nth-child(3) .rank-number {
  color: #cd7f32;
  font-size: 2rem;
}

.rank-name {
  flex: 1;
  font-size: 1.6rem;
  font-weight: 600;
  color: #191f28;
}

.rank-count {
  font-size: 1.2rem;
  color: #8b95a1;
  background: #f2f4f6;
  padding: 0.4rem 1.2rem;
  border-radius: 2rem;
  font-weight: 500;
}

.rank-count b {
  color: #3182f6;
  font-weight: 700;
}

/* 공통 유틸리티 */
.hidden {
  display: none !important;
}

/* 탭 콘텐츠 전환 스타일 */
.tab-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  width: 100%;
  overflow-y: auto; /* hidden에서 auto로 변경하여 내용이 길면 스크롤 허용 */
  transition: opacity 0.3s ease;
  -webkit-overflow-scrolling: touch;
}

.tab-content.hidden {
  display: none !important;
  opacity: 0;
}

.tab-content.active {
  display: block;
  opacity: 1;
}

/* 퀴즈 컨테이너 내부 여백 조정 */
.quiz-container {
  max-width: 50rem;
  margin: 0 auto;
  padding: 1.2rem 2.4rem; /* 상단 여백 축소 */
  min-height: auto; /* 고정 높이 제거 */
}

.quiz-view {
  animation: fadeIn 0.4s ease-out;
  display: flex;
  flex-direction: column;
  gap: 1.2rem; /* 간격 축소 */
}

.quiz-card {
  background: white;
  padding: 2rem; /* 패딩 축소 */
  border-radius: 2.4rem;
  box-shadow: 0 0.8rem 2.4rem rgba(0, 0, 0, 0.05);
  border: 0.1rem solid #f2f4f6;
  margin-bottom: 1rem;
}

/* 기존 플레이스홀더 스타일 수정 */
.tab-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: #f5f7fa;
  text-align: center;
  padding: 2.4rem;
}

.placeholder-content {
  animation: fadeIn 0.5s ease-out;
}

.placeholder-icon {
  font-size: 5rem;
  margin-bottom: 2rem;
}

.placeholder-content h2 {
  font-size: 2rem;
  font-weight: 700;
  color: #191f28;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.placeholder-content p {
  font-size: 1.5rem;
  color: #8b95a1;
  line-height: 1.5;
}

.character-container {
  width: 12.8rem; /* 128px */
  height: 12.8rem; /* 128px */
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
}

.character-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0.4rem 1.6rem rgba(0, 0, 0, 0.12));
}

.eye-pupil {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

.chat-messages-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.chat-messages {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  overflow-y: auto;
  padding: 2.4rem; /* 24px */
  background: #f5f7fa;
  display: flex;
  flex-direction: column;
  gap: 1.6rem; /* 16px */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.chat-messages.visible {
  opacity: 1;
  visibility: visible;
}

.chat-messages::-webkit-scrollbar {
  width: 0.6rem; /* 6px */
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #d1d6db;
  border-radius: 1rem; /* 10px */
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #b0b8c1;
}

.message {
  display: flex;
  gap: 1.2rem; /* 12px */
  animation: fadeIn 0.3s ease-in;
}

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

.user-message {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 3.6rem; /* 36px */
  height: 3.6rem; /* 36px */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  flex-shrink: 0;
  background: #ffffff;
  border: 0.1rem solid #f2f4f6;
  overflow: hidden;
  box-shadow: 0 0.1rem 0.3rem rgba(0, 0, 0, 0.06);
}

.message-avatar .avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.user-message .message-avatar {
  background: #3182f6;
  border: 0.1rem solid #3182f6;
}

.message-content {
  max-width: 75%;
  padding: 1.2rem 1.6rem; /* 12px 16px */
  border-radius: 1.4rem; /* 14px */
  line-height: 1.6;
  overflow-wrap: break-word;
  word-break: keep-all; /* 단어 단위 개행 */
  white-space: pre-wrap; /* 줄바꿈(엔터) 반영 */
  font-size: 1.4rem; /* 14px */
  box-shadow: 0 0.1rem 0.2rem rgba(0, 0, 0, 0.04);
  text-align: left; /* 텍스트 정렬 명시 (사용자 메시지 어색함 방지) */
}

.assistant-message .message-content {
  background: #ffffff;
  color: #191f28;
  border-bottom-left-radius: 0.4rem; /* 4px */
  border: 0.1rem solid #f2f4f6;
}

/* 강조 텍스트(b 태그) 스타일 */
.message-content b {
  color: #3182f6;
  font-weight: 700;
  background: rgba(49, 130, 246, 0.05);
  padding: 0 0.4rem;
  border-radius: 0.4rem;
}

/* 사용자 메시지 내부 강조 텍스트 색상 조정 */
.user-message .message-content b {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.2);
}

/* 섹션 타이틀 스타일 */
.assistant-message .message-content b.section-title {
  display: block; /* 한 줄 전체 차지 */
  font-size: 1.6rem;
  color: #191f28;
  background: none;
  padding: 0;
  margin-top: 1.28rem;
  margin-bottom: 0.4rem; /* 타이틀 바로 아래 텍스트와 약간의 간격 */
  border-left: 0.4rem solid #3182f6;
  padding-left: 0.8rem;
  border-radius: 0;
  line-height: 1.2;
}

/* 첫 번째 타이틀은 상단 여백 제거 */
.assistant-message .message-content b.section-title:first-child {
  margin-top: 0;
}

/* 첫 인사 메시지는 줄바꿈(pre-wrap) 미적용 */
.message-content.welcome-message {
  white-space: normal;
}

.user-message .message-content {
  background: #3182f6;
  color: #ffffff;
  border-bottom-right-radius: 0.4rem; /* 4px */
}

.chat-input-container {
  padding: 2rem 2.4rem; /* 20px 24px */
  background: #ffffff;
  border-top: 0.1rem solid #f2f4f6;
}

.chat-input-wrapper {
  display: flex;
  gap: 1.2rem; /* 12px */
  align-items: center;
  opacity: 0;
  transform: translateY(1rem); /* 10px */
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-input-wrapper.visible {
  opacity: 1;
  transform: translateY(0);
}

.chat-input {
  flex: 1;
  padding: 1.4rem 1.8rem; /* 14px 18px */
  border: 0.15rem solid #e5e8eb; /* 1.5px */
  border-radius: 1.4rem; /* 14px */
  font-size: 1.5rem; /* 15px */
  outline: none;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  background: #ffffff;
  color: #191f28;
  font-weight: 400;
}

.chat-input:focus {
  border-color: #3182f6;
  box-shadow: 0 0 0 0.3rem rgba(49, 130, 246, 0.1); /* 3px */
}

.chat-input::placeholder {
  color: #b0b8c1;
}

.send-button {
  padding: 1.4rem 2.2rem; /* 14px 22px */
  background: #3182f6;
  color: #ffffff;
  border: none;
  border-radius: 1.4rem; /* 14px */
  font-size: 1.5rem; /* 15px */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0.2rem 0.8rem rgba(49, 130, 246, 0.2);
  white-space: nowrap;
}

.send-button:hover {
  background: #1b64da;
  box-shadow: 0 0.4rem 1.2rem rgba(49, 130, 246, 0.3);
}

.send-button:active {
  transform: scale(0.98);
}

.send-button:disabled {
  background: #e5e8eb;
  color: #b0b8c1;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 광고 컨테이너 */
.ad-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem 0;
  background: #ffffff;
  border-top: 0.1rem solid #f2f4f6;
  min-height: 100px; /* 광고 높이 확보 (100px로 수정) */
}

/* 스켈레톤 UI 스타일 */
.skeleton {
  background: #f2f4f6;
  background: linear-gradient(90deg, #f2f4f6 25%, #e5e8eb 50%, #f2f4f6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0.8rem;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-item {
  display: flex;
  align-items: center;
  padding: 1.6rem 2rem;
  background: #f9fafb;
  border-radius: 1.6rem;
  border: 0.1rem solid transparent;
}

.skeleton-rank {
  width: 4.5rem; /* .rank-number width 와 일치 */
  height: 2.4rem;
  margin-right: 0; /* .rank-number 에는 margin 이 없음 */
  border-radius: 0.4rem;
}

.skeleton-name {
  flex: 1; /* .rank-name 과 동일하게 flex: 1 */
  height: 2rem;
  margin: 0 1.2rem;
}

.skeleton-count {
  width: 8rem;
  height: 2.48rem; /* .rank-count 의 패딩+폰트사이즈 높이와 일치 */
  border-radius: 2rem;
}

/* 통계 영역 스켈레톤 */
.skeleton-stats {
  width: 16rem;
  height: 1.2rem; /* 폰트 사이즈와 동일하게 맞춤 */
  margin: 0.2rem 0; /* 불필요한 큰 마진 제거, 상하 미세 조정 */
  border-radius: 0.4rem;
  display: inline-block; /* 부모인 #statsText가 inline-block이므로 정렬 유지 */
  vertical-align: middle;
}

/* 퀴즈 컨테이너 */
.quiz-container {
  max-width: 50rem;
  margin: 0 auto;
  padding: 2.4rem;
  min-height: 40rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.quiz-view {
  animation: fadeIn 0.4s ease-out;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.quiz-view h2 {
  font-size: 2.2rem;
  font-weight: 800;
  color: #191f28;
  text-align: center;
}

.quiz-view p {
  font-size: 1.5rem;
  color: #4e5968;
  text-align: center;
  line-height: 1.6;
}

/* 퀴즈 입력창 */
/* 퀴즈 모달/팝업 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(0.4rem);
}

.modal-content.quiz-modal {
  background: white;
  width: 90%;
  max-width: 34rem;
  padding: 3.2rem 2.4rem;
  border-radius: 2.4rem;
  text-align: center;
  animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-icon {
  font-size: 4.8rem;
  margin-bottom: 1.6rem;
}

.quiz-modal h2 {
  font-size: 2rem;
  margin-bottom: 0.8rem;
  color: #191f28;
}

.quiz-modal p {
  font-size: 1.5rem;
  color: #4e5968;
  margin-bottom: 2.4rem;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.revive-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.8rem;
  background: #191f28 !important;
}

.ad-icon {
  font-size: 1.6rem;
}

.secondary-btn {
  background: #f2f4f6;
  color: #4e5968;
  border: none;
  padding: 1.4rem;
  border-radius: 1.2rem;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

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

/* 퀴즈 쿨다운 알림 */
.cooldown-info {
  margin-top: 1.2rem;
  font-size: 1.2rem;
  color: #ff4d4f;
  background: #fff0f0;
  padding: 0.8rem;
  border-radius: 0.8rem;
  display: none;
}

.quiz-input-box {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-top: 1rem;
}

#quizIdolInput,
#quizAnswerInput {
  width: 100%;
  padding: 1.6rem;
  font-size: 1.6rem;
  border: 0.1rem solid #e5e8eb;
  border-radius: 1.6rem;
  background: #f9fafb;
  outline: none;
  transition: all 0.2s ease;
}

#quizIdolInput:focus,
#quizAnswerInput:focus {
  border-color: #3182f6;
  background: white;
  box-shadow: 0 0 0 0.3rem rgba(49, 130, 246, 0.1);
}

.primary-btn {
  padding: 1.6rem;
  font-size: 1.6rem;
  font-weight: 700;
  background: #3182f6;
  color: white;
  border: none;
  border-radius: 1.6rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-btn:hover {
  background: #1b64da;
  transform: translateY(-0.2rem);
}

/* 퀴즈 진행 화면 */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.quiz-status-left {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.quiz-badge {
  padding: 0.6rem 1.2rem;
  border-radius: 1.2rem;
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.level-badge {
  background: #e8f3ff;
  color: #1a73e8;
  border: 1px solid #c2e0ff;
}

.combo-badge {
  background: #fff0f0;
  color: #ff4d4f;
  border: 1px solid #ffccc7;
}

.progress-badge {
  background: #f2f4f6;
  color: #4e5968;
}

.quiz-card {
  background: white;
  padding: 2.4rem;
  border-radius: 2.4rem;
  box-shadow: 0 0.8rem 2.4rem rgba(0, 0, 0, 0.05);
  border: 0.1rem solid #f2f4f6;
}

#quizQuestion {
  font-size: 1.7rem;
  font-weight: 700;
  color: #191f28;
  line-height: 1.4;
  margin-bottom: 1.6rem;
  word-break: keep-all;
}

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

.option-btn {
  padding: 1.2rem 1.6rem;
  font-size: 1.4rem;
  text-align: left;
  background: #f9fafb;
  border: 0.1rem solid #e5e8eb;
  border-radius: 1.2rem;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #333d4b;
}

.option-btn:hover {
  background: #f2f4f6;
  border-color: #3182f6;
}

.option-btn.correct {
  background: #e7f3ff;
  border-color: #3182f6;
  color: #3182f6;
  font-weight: 700;
}

.option-btn.wrong {
  background: #fff0f0;
  border-color: #f04452;
  color: #f04452;
}

/* 퀴즈 주관식 입력 영역 */
.quiz-input-area {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.6rem;
}

.quiz-input-area input {
  flex: 1;
  margin: 0 !important;
}

.short-submit-btn {
  padding: 0 2rem;
  background: #3182f6;
  color: white;
  border: none;
  border-radius: 1.6rem;
  font-weight: 700;
  font-size: 1.4rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.short-submit-btn:hover {
  background: #1b64da;
  transform: translateY(-0.2rem);
}

.quiz-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 0.5rem;
}

.action-btn {
  flex: 1;
  padding: 1rem;
  font-size: 1.3rem;
  font-weight: 600;
  border-radius: 1.2rem;
  border: none;
  cursor: pointer;
  background: #f2f4f6;
  color: #4e5968;
  transition: all 0.2s;
}

.action-btn:hover {
  background: #e5e8eb;
}

.quiz-hint-box {
  padding: 1.2rem 1.6rem;
  background: #fff8e1;
  border-radius: 1.2rem;
  color: #856404;
  font-size: 1.4rem;
  line-height: 1.5;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-icon {
  font-size: 6.4rem;
  text-align: center;
  margin-bottom: 1rem;
}

/* 퀴즈 탭 좁은 너비 대응 */
@media (max-width: 480px) {
  .quiz-actions {
    flex-wrap: wrap;
  }
  .submit-btn {
    width: 100%;
    order: -1;
  }
}

.loading {
  display: inline-flex;
  gap: 0.4rem; /* 4px */
  align-items: center;
}

.loading span {
  width: 0.8rem; /* 8px */
  height: 0.8rem; /* 8px */
  border-radius: 50%;
  background: currentColor;
  animation: bounce 1.4s infinite ease-in-out both;
}

.loading span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

.error-message {
  background: #fff5f5;
  color: #f04452;
  padding: 1.2rem 1.6rem; /* 12px 16px */
  border-radius: 1.2rem; /* 12px */
  border: 0.1rem solid #f04452;
  font-size: 1.4rem; /* 14px */
}

/* 후속 질문 스타일 */
.suggestions-container {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 0.8rem;
  margin-left: 4.8rem; /* 아바타 공간만큼 띄움 */
  animation: fadeIn 0.5s ease-out;
}

.suggestion-button {
  align-self: flex-start;
  padding: 1rem 1.6rem;
  background: #ffffff;
  border: 0.1rem solid #e5e8eb;
  color: #4e5968;
  border-radius: 2rem;
  font-size: 1.4rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0.2rem 0.4rem rgba(0, 0, 0, 0.05);
  text-align: left; /* 왼쪽 정렬 추가 */
  line-height: 1.4;
  word-break: keep-all; /* 단어 단위 개행 추가 */
  overflow-wrap: break-word;
}

.suggestion-button:hover {
  background: #191f28;
  border-color: #191f28;
  color: #ffffff;
  transform: translateY(-0.1rem);
  box-shadow: 0 0.4rem 0.8rem rgba(0, 0, 0, 0.1);
}

.suggestion-button b {
  color: inherit; /* 버튼의 텍스트 색상을 따름 (Hover 시 흰색) */
  font-weight: 700;
}

.suggestion-button:active {
  transform: translateY(0);
}

.suggestion-info-text {
  font-size: 1.3rem;
  color: #8b95a1;
  margin-top: 0.4rem;
  margin-left: 0.8rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* 커버 UI (초기 상태) */
.cover-ui {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #f5f7fa;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overflow: hidden; /* 스크롤 숨김 */
}

.cover-ui.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.cover-content {
  text-align: center;
  padding: 2.4rem; /* 24px */
  max-width: 40rem; /* 400px */
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.cover-content h2 {
  font-size: 1.8rem; /* 18px */
  font-weight: 700;
  color: #191f28;
  margin-bottom: 0.8rem;
  letter-spacing: -0.02em;
}

.cover-content p {
  font-size: 1.3rem; /* 13px */
  color: #8b95a1;
  margin-bottom: 2rem; /* 20px */
  line-height: 1.6;
}

.cover-requirements {
  display: flex;
  flex-direction: column;
  gap: 1.2rem; /* 12px */
  align-items: flex-start;
}

.requirement-item {
  display: flex;
  align-items: center;
  gap: 1.2rem; /* 12px */
  font-size: 1.5rem; /* 15px */
  color: #4e5968;
}

.requirement-check {
  width: 2.4rem; /* 24px */
  height: 2.4rem; /* 24px */
  border-radius: 50%;
  border: 0.2rem solid #d1d6db; /* 2px */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem; /* 12px */
  font-weight: 700;
  color: #d1d6db;
  flex-shrink: 0;
  transition: all 0.2s ease;
  position: relative;
}

.requirement-check::before {
  content: "○";
  font-size: 1.4rem; /* 14px */
  line-height: 1;
}

.requirement-check.completed {
  background: #00d084;
  border-color: #00d084;
  color: #ffffff;
}

.requirement-check.completed::before {
  content: "✓";
  font-size: 1.4rem; /* 14px */
  line-height: 1;
}

/* Toast 메시지 스타일 */
.toast {
  position: fixed;
  bottom: 12rem;
  left: 50%;
  transform: translateX(-50%) translateY(2rem);
  background: rgba(25, 31, 40, 0.9);
  color: white;
  padding: 1.2rem 2.4rem;
  border-radius: 3rem;
  font-size: 1.4rem;
  font-weight: 500;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-shadow: 0 0.8rem 2.4rem rgba(0, 0, 0, 0.2);
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* 퀴즈 결과 액션 */
.result-actions-vertical {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  width: 100%;
  margin-top: 2.4rem;
}

.other-idol-box {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
}

.other-idol-box .secondary-btn {
  width: 100%;
}

.reset-warning {
  font-size: 1.2rem;
  color: #8b95a1;
  margin: 0;
  font-weight: 500;
}

/* 모바일 반응형 */
@media (max-width: 48rem) {
  /* 768px */
  html {
    font-size: 58%; /* 모바일에서 약간 더 작게 (약 9.3px) */
  }

  .chat-container {
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .chat-header {
    padding: 0 1.5rem 0;
  }

  .lang-bar {
    padding-top: 1.2rem;
    padding-bottom: 0.6rem;
    height: auto;
  }

  .chat-header h1 {
    font-size: 1.9rem;
    padding: 0;
    max-width: none;
    margin: 0;
  }

  .chat-messages {
    padding: 2rem; /* 20px */
  }

  .message-content {
    max-width: 85%;
  }

  .chat-input-container {
    padding: 1.5rem 2rem; /* 15px 20px */
  }

  .chat-tabs {
    gap: 0.8rem;
  }

  .tab-button {
    font-size: 1.3rem; /* 모바일에서 더 작게 조정 */
  }
}
