/* === 스터디 그룹 뷰 === */

/* 컨테이너 */
.group-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 60vh;
  background: rgba(10, 14, 30, 0.75);
  border-radius: var(--radius-sm);
}

.group-back {
  margin-bottom: 1rem;
}

/* 로그인 필요 */
.group-login-required {
  text-align: center;
  padding: 3rem 1rem;
}
.group-login-required .group-login-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin-bottom: 1rem;
  border-radius: 50%;
  filter: drop-shadow(0 0 12px rgba(244, 197, 66, 0.25));
}
.group-login-required p {
  color: var(--sand-dark);
  margin-bottom: 1.5rem;
}

/* ═══ 화면 A: 그룹 목록 ═══ */

.group-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.group-list-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
}

/* 초대 배너 */
.invite-banner {
  background: rgba(244, 197, 66, 0.08);
  border: 1px solid var(--gold-muted);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.invite-banner-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.invite-banner-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
}
.invite-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  gap: 0.5rem;
}
.invite-card:last-child {
  border-bottom: none;
}
.invite-card-info {
  flex: 1;
  min-width: 0;
}
.invite-card-group {
  font-weight: 600;
  color: var(--sand);
  font-size: 0.9rem;
}
.invite-card-from {
  font-size: 0.8rem;
  color: var(--sand-dark);
}
.invite-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.invite-accept-btn {
  background: var(--sage);
  color: var(--night);
  border: none;
  border-radius: var(--radius-xs);
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
}
.invite-accept-btn:hover { opacity: 0.85; }
.invite-decline-btn {
  background: transparent;
  color: var(--sand-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: opacity var(--transition);
}
.invite-decline-btn:hover { opacity: 0.7; }

/* 그룹 카드 */
.group-cards {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.group-card {
  background: var(--night-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.group-card:hover, .group-card:focus-visible {
  border-color: var(--gold-muted);
  background: var(--night-card-hover);
}
.group-card-emoji {
  font-size: 1.8rem;
  flex-shrink: 0;
  width: 2.5rem;
  text-align: center;
}
.group-card-body {
  flex: 1;
  min-width: 0;
}
.group-card-name {
  font-weight: 600;
  color: var(--sand);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-card-meta {
  font-size: 0.8rem;
  color: var(--sand-dark);
  margin-top: 0.15rem;
}
.group-card-badge {
  background: var(--rose);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  min-width: 1.3rem;
  height: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.35rem;
  flex-shrink: 0;
}
.group-card-badge[hidden] { display: none; }

/* 그룹 만들기 버튼 */
.group-create-btn {
  width: 100%;
  margin-top: 1rem;
  background: transparent;
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  color: var(--sand-dark);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.group-create-btn:hover, .group-create-btn:focus-visible {
  border-color: var(--gold);
  color: var(--gold);
}

/* 빈 상태 */
.group-empty {
  text-align: center;
  padding: 3rem 1rem;
}
.group-empty-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin-bottom: 0.75rem;
  border-radius: 50%;
  filter: drop-shadow(0 0 12px rgba(244, 197, 66, 0.2));
}
.group-empty-text {
  color: var(--sand-dark);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* 그룹 만들기 모달 */
.group-create-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.group-create-emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.group-create-emoji-picker button {
  width: 2.2rem;
  height: 2.2rem;
  font-size: 1.2rem;
  border: 2px solid transparent;
  border-radius: var(--radius-xs);
  background: var(--night-card);
  cursor: pointer;
  transition: border-color var(--transition);
}
.group-create-emoji-picker button.selected,
.group-create-emoji-picker button:hover {
  border-color: var(--gold);
}
.group-create-input {
  background: var(--night-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.6rem 0.8rem;
  color: var(--sand);
  font-size: 0.9rem;
  width: 100%;
}
.group-create-input:focus {
  outline: none;
  border-color: var(--gold);
}
.group-create-submit {
  background: var(--gold);
  color: var(--night);
  border: none;
  border-radius: var(--radius-xs);
  padding: 0.6rem;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity var(--transition);
}
.group-create-submit:hover { opacity: 0.9; }
.group-create-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ═══ 화면 B: 그룹 상세 ═══ */

.group-detail-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.group-detail-emoji {
  font-size: 1.5rem;
}
.group-detail-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--sand);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 서브탭 */
.group-subtabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  gap: 0.25rem;
}
.group-subtab {
  flex: 1;
  padding: 0.65rem 0.9rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--sand-dark);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  text-align: center;
}
.group-subtab:hover {
  color: var(--sand);
}
.group-subtab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ═══ 채팅 ═══ */

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(60vh);
  min-height: 300px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.chat-messages::-webkit-scrollbar {
  width: 4px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 2px;
}

/* 메시지 버블 */
.chat-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}
.chat-bubble-wrap.mine {
  align-self: flex-end;
  align-items: flex-end;
}
.chat-bubble-wrap.other {
  align-self: flex-start;
  align-items: flex-start;
}
/* 상대방 메시지 헤더 (아바타 + 이름) */
.chat-other-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}
.chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.chat-avatar-default {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--night-card-hover);
  color: var(--sand);
  font-size: 0.75rem;
  font-weight: 700;
}
.chat-sender {
  font-size: 0.7rem;
  color: var(--sand-muted);
}
/* 아바타 있을 때 본문 들여쓰기 */
.chat-bubble-body.with-avatar {
  margin-left: calc(28px + 0.35rem);
}
.chat-bubble {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.5;
  word-break: break-word;
  max-width: 100%;
}
.chat-bubble.mine {
  background: rgba(240, 160, 48, 0.15);
  color: var(--sand);
  border-bottom-right-radius: 4px;
}
.chat-bubble.other {
  background: var(--night-card);
  color: var(--sand);
  border-bottom-left-radius: 4px;
}
.chat-bubble-time {
  font-size: 0.65rem;
  color: var(--sand-muted);
  margin-top: 0.1rem;
  padding: 0 0.3rem;
}

/* 시스템 메시지 */
.chat-system {
  text-align: center;
  padding: 0.3rem 0;
}
.chat-system-text {
  display: inline-block;
  background: rgba(255, 255, 255, 0.05);
  color: var(--sand-muted);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

/* 챌린지 카드 (채팅 내) */
.chat-challenge-card {
  background: rgba(244, 197, 66, 0.08);
  border: 1px solid var(--gold-muted);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  transition: border-color var(--transition);
}
.chat-challenge-card:hover {
  border-color: var(--gold);
}
.chat-challenge-card-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
}
.chat-challenge-card-text {
  font-size: 0.82rem;
  color: var(--sand);
  margin-top: 0.2rem;
}

/* 이전 메시지 로드 */
.chat-load-older {
  text-align: center;
  padding: 0.5rem;
}
.chat-load-older button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--sand-dark);
  font-size: 0.75rem;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.chat-load-older button:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* 채팅 별 상태바 */
.chat-star-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--sand-dark);
}
.chat-star-label {
  font-weight: 600;
  color: var(--gold);
}
.chat-star-counter {
  color: var(--sand-muted);
}
.chat-star-status.insufficient {
  background: rgba(232, 93, 117, 0.08);
  border-color: rgba(232, 93, 117, 0.2);
}
.chat-star-status.insufficient .chat-star-label {
  color: var(--rose);
}
.chat-star-status.insufficient .chat-star-counter {
  color: var(--rose);
}

/* 채팅 입력 */
.chat-input-area {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.chat-input {
  flex: 1;
  background: var(--night-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--sand);
  font-size: 0.88rem;
  font-family: var(--font-main);
  resize: none;
}
.chat-input:focus {
  outline: none;
  border-color: var(--gold);
}
.chat-send-btn {
  background: var(--gold);
  color: var(--night);
  border: none;
  border-radius: var(--radius-sm);
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition);
}
.chat-send-btn:hover { opacity: 0.85; }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* 미디어 버튼 (이미지/마이크) */
.chat-media-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--sand-dark);
  border-radius: var(--radius-sm);
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.chat-media-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* 녹음 중 빨강 펄스 */
.chat-media-btn.recording {
  border-color: var(--rose);
  color: var(--rose);
  background: rgba(232, 93, 117, 0.1);
  animation: recording-pulse 1s ease-in-out infinite;
}
@keyframes recording-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 93, 117, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(232, 93, 117, 0); }
}

/* 음성 플레이어 */
.chat-voice-player {
  max-width: 220px;
  width: 100%;
  height: 36px;
  border-radius: var(--radius-xs);
  filter: sepia(0.3) hue-rotate(15deg);
}

/* 이미지 썸네일 */
.chat-image-thumb {
  max-width: 200px;
  max-height: 200px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  cursor: pointer;
  transition: opacity var(--transition);
}
.chat-image-thumb:hover {
  opacity: 0.85;
}

/* 잠금 미디어 플레이스홀더 */
.chat-media-locked {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.8rem 1.2rem;
  background: rgba(244, 197, 66, 0.06);
  border: 1px dashed var(--gold-muted);
  border-radius: var(--radius-xs);
  color: var(--sand-dark);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  min-width: 140px;
}
.chat-media-locked:hover {
  border-color: var(--gold);
  background: rgba(244, 197, 66, 0.12);
  color: var(--sand);
}
.chat-media-cost {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(244, 197, 66, 0.15);
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
}

/* 이미지 확대 모달 */
.chat-image-full-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 24, 0.92);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  cursor: pointer;
  animation: modalFadeIn 0.2s ease;
}
.chat-image-full {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}
.chat-avatar-full {
  width: min(70vw, 300px);
  height: min(70vw, 300px);
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--gold);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}
img.chat-avatar {
  cursor: pointer;
}

/* ═══ 챌린지 ═══ */

.challenge-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0.75rem;
}
.challenge-tab {
  flex: 1;
  padding: 0.45rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--sand-dark);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: color var(--transition), border-color var(--transition);
}
.challenge-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* 챌린지 카드 */
.challenge-card {
  background: var(--night-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  cursor: pointer;
  transition: border-color var(--transition);
}
.challenge-card:hover {
  border-color: var(--gold-muted);
}
.challenge-card.sealed {
  border-color: var(--gold-muted);
  background: rgba(244, 197, 66, 0.05);
}
.challenge-card.completed {
  opacity: 0.7;
}
.challenge-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}
.challenge-card-from {
  font-size: 0.8rem;
  color: var(--sand-dark);
}
.challenge-card-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.challenge-card-status.sealed {
  background: var(--gold-muted);
  color: var(--gold);
}
.challenge-card-status.in-progress {
  background: rgba(240, 160, 48, 0.2);
  color: var(--amber);
}
.challenge-card-status.correct {
  background: rgba(123, 198, 126, 0.15);
  color: var(--sage);
}
.challenge-card-status.wrong {
  background: rgba(232, 93, 117, 0.15);
  color: var(--rose);
}
.challenge-card-question {
  font-size: 0.88rem;
  color: var(--sand);
  line-height: 1.4;
  margin-top: 0.3rem;
}
.challenge-card-question.hidden-text {
  filter: blur(8px);
  user-select: none;
}
.challenge-card-meta {
  font-size: 0.75rem;
  color: var(--sand-muted);
  margin-top: 0.3rem;
}

/* 챌린지 빈 상태 */
.challenge-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--sand-dark);
  font-size: 0.88rem;
}

/* 챌린지 보내기 버튼 */
.challenge-send-fab {
  background: var(--gold);
  color: var(--night);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  margin-top: 0.75rem;
  width: 100%;
  transition: opacity var(--transition);
}
.challenge-send-fab:hover { opacity: 0.9; }

/* ═══ 화면 C: 챌린지 풀기 ═══ */

.challenge-solve-area {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
}
.challenge-unseal {
  text-align: center;
  padding: 3rem 1rem;
}
.challenge-unseal-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: unseal-pulse 2s ease-in-out infinite;
}
@keyframes unseal-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.challenge-unseal-text {
  color: var(--sand-dark);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.challenge-open-btn {
  background: var(--gold);
  color: var(--night);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.7rem 2rem;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform var(--transition), opacity var(--transition);
}
.challenge-open-btn:hover {
  transform: scale(1.02);
  opacity: 0.95;
}

/* 문제 표시 */
.challenge-question-area {
  margin-top: 1rem;
}
.challenge-question-text {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--sand);
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--night-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.challenge-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.challenge-option {
  background: var(--night-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  color: var(--sand);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition), background var(--transition);
}
.challenge-option:hover {
  border-color: var(--gold-muted);
}
.challenge-option.selected {
  border-color: var(--gold);
  background: var(--gold-muted);
}
.challenge-option.correct {
  border-color: var(--sage);
  background: rgba(123, 198, 126, 0.15);
}
.challenge-option.wrong {
  border-color: var(--rose);
  background: rgba(232, 93, 117, 0.15);
}

.challenge-answer-input {
  background: var(--night-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  color: var(--sand);
  font-size: 0.9rem;
  width: 100%;
  margin-bottom: 0.75rem;
  font-family: var(--font-main);
}
.challenge-answer-input:focus {
  outline: none;
  border-color: var(--gold);
}

.challenge-submit-btn {
  background: var(--gold);
  color: var(--night);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  width: 100%;
  transition: opacity var(--transition);
}
.challenge-submit-btn:hover { opacity: 0.9; }
.challenge-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 결과 */
.challenge-result {
  text-align: center;
  padding: 1.5rem 1rem;
  margin-top: 1rem;
  border-radius: var(--radius-sm);
}
.challenge-result.correct {
  background: rgba(123, 198, 126, 0.1);
  border: 1px solid rgba(123, 198, 126, 0.3);
}
.challenge-result.wrong {
  background: rgba(232, 93, 117, 0.1);
  border: 1px solid rgba(232, 93, 117, 0.3);
}
.challenge-result-img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  margin-bottom: 0.5rem;
  border-radius: 50%;
  filter: drop-shadow(0 0 10px rgba(244, 197, 66, 0.3));
}
.challenge-result-text {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.challenge-result-time {
  font-size: 0.85rem;
  color: var(--sand-dark);
  margin-bottom: 0.5rem;
}
.challenge-result-explanation {
  font-size: 0.85rem;
  color: var(--sand-dark);
  line-height: 1.5;
  background: rgba(11, 16, 38, 0.90);
  padding: 0.6rem;
  border-radius: var(--radius-xs);
  margin-top: 0.5rem;
  text-align: left;
}

/* ═══ 화면 D: 풀이 상세 ═══ */

.attempt-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}
.attempt-card {
  background: var(--night-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}
.attempt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}
.attempt-card-name {
  font-weight: 600;
  color: var(--sand);
  font-size: 0.9rem;
}
.attempt-card-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}
.attempt-card-badge.correct {
  background: rgba(123, 198, 126, 0.15);
  color: var(--sage);
}
.attempt-card-badge.wrong {
  background: rgba(232, 93, 117, 0.15);
  color: var(--rose);
}
.attempt-card-badge.pending {
  background: rgba(244, 197, 66, 0.15);
  color: var(--gold);
}
.attempt-card-detail {
  font-size: 0.8rem;
  color: var(--sand-dark);
  line-height: 1.5;
}

/* ═══ 멤버 ═══ */

.member-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: none; }
.member-row-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.member-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--night-card-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--sand);
  font-weight: 600;
}
.member-avatar-img {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--gold);
}
.member-name {
  font-size: 0.9rem;
  color: var(--sand);
}
.member-role {
  font-size: 0.7rem;
  color: var(--gold);
  margin-left: 0.3rem;
}
.member-kick-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--rose);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.member-kick-btn:hover { background: rgba(232, 93, 117, 0.1); }

.member-invite-btn {
  width: 100%;
  margin-top: 0.75rem;
  background: transparent;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  color: var(--sand-dark);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.member-invite-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* 멤버 검색 모달 */
.member-search-input {
  background: var(--night-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.5rem 0.75rem;
  color: var(--sand);
  font-size: 0.88rem;
  width: 100%;
  margin-bottom: 0.5rem;
}
.member-search-input:focus {
  outline: none;
  border-color: var(--gold);
}
.member-search-results {
  max-height: 200px;
  overflow-y: auto;
}
.member-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.3rem;
  border-bottom: 1px solid var(--border);
}
.member-search-row:last-child { border-bottom: none; }
.member-search-invite-btn {
  background: var(--gold);
  color: var(--night);
  border: none;
  border-radius: var(--radius-xs);
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.member-search-invite-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ═══ 랭킹 ═══ */

.ranking-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.ranking-week-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--sand-dark);
  border-radius: var(--radius-xs);
  width: 2rem;
  height: 2rem;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), color var(--transition);
}
.ranking-week-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.ranking-week-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold);
  min-width: 6rem;
  text-align: center;
  font-family: 'D2Coding', monospace;
}
.ranking-refresh-btn {
  margin-left: 0.3rem;
}

/* 포디움 */
.ranking-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
  padding: 0 0.5rem;
}
.ranking-podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 5.5rem;
  text-align: center;
}
.ranking-podium-slot.empty {
  visibility: hidden;
}
.ranking-podium-medal {
  font-size: 1.5rem;
  margin-bottom: 0.2rem;
}
.ranking-podium-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.ranking-podium-slot.gold .ranking-podium-avatar {
  background: rgba(244, 197, 66, 0.2);
  border: 2px solid var(--gold);
  color: var(--gold);
}
.ranking-podium-slot.silver .ranking-podium-avatar {
  background: rgba(236, 232, 225, 0.15);
  border: 2px solid var(--sand);
  color: var(--sand);
}
.ranking-podium-slot.bronze .ranking-podium-avatar {
  background: rgba(240, 160, 48, 0.15);
  border: 2px solid var(--amber);
  color: var(--amber);
}
.ranking-podium-name {
  font-size: 0.78rem;
  color: var(--sand);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.ranking-podium-score {
  font-size: 0.72rem;
  color: var(--sand-dark);
}
.ranking-podium-slot.is-me .ranking-podium-name {
  color: var(--gold);
}

/* 포디움 바 */
.ranking-podium-bar {
  width: 100%;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  margin-top: 0.3rem;
}
.ranking-bar-gold {
  background: linear-gradient(to top, rgba(244, 197, 66, 0.15), rgba(244, 197, 66, 0.35));
  border: 1px solid var(--gold-muted);
  border-bottom: none;
  transition: height 0.5s ease;
}
.ranking-bar-silver {
  background: linear-gradient(to top, rgba(236, 232, 225, 0.08), rgba(236, 232, 225, 0.2));
  border: 1px solid rgba(236, 232, 225, 0.15);
  border-bottom: none;
  transition: height 0.5s ease;
}
.ranking-bar-bronze {
  background: linear-gradient(to top, rgba(240, 160, 48, 0.08), rgba(240, 160, 48, 0.2));
  border: 1px solid rgba(240, 160, 48, 0.15);
  border-bottom: none;
  transition: height 0.5s ease;
}

/* 테이블 */
.ranking-table {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.ranking-table-header {
  display: flex;
  padding: 0.5rem 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--sand-muted);
  text-transform: uppercase;
}
.ranking-row {
  display: flex;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--sand);
  transition: background var(--transition);
}
.ranking-row:last-child {
  border-bottom: none;
}
.ranking-row:hover {
  background: rgba(255, 255, 255, 0.02);
}
.ranking-row.is-me {
  background: rgba(244, 197, 66, 0.06);
}
.ranking-row.gold .ranking-col-rank {
  color: var(--gold);
  font-weight: 700;
}
.ranking-row.silver .ranking-col-rank {
  color: var(--sand);
  font-weight: 700;
}
.ranking-row.bronze .ranking-col-rank {
  color: var(--amber);
  font-weight: 700;
}
.ranking-col-rank {
  width: 2rem;
  text-align: center;
  flex-shrink: 0;
}
.ranking-col-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ranking-col-stat {
  width: 3rem;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.78rem;
}
.ranking-col-star {
  width: 2.5rem;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--gold);
}
.ranking-col-score {
  width: 3.2rem;
  text-align: right;
  flex-shrink: 0;
  font-weight: 700;
  color: var(--gold);
}

/* 랭킹 빈 상태 */
.ranking-empty {
  text-align: center;
  padding: 2rem 1rem;
}
.ranking-empty-img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  margin-bottom: 0.5rem;
  border-radius: 50%;
  filter: drop-shadow(0 0 10px rgba(244, 197, 66, 0.25));
}
.ranking-empty-text {
  color: var(--sand-dark);
  font-size: 0.9rem;
}

/* 갱신 시각 */
.ranking-updated {
  text-align: center;
  font-size: 0.72rem;
  color: var(--sand-muted);
  margin-top: 0.6rem;
  padding-top: 0.4rem;
}

/* ═══ 그룹 관리 버튼 ═══ */

.group-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.group-leave-btn {
  flex: 1;
  padding: 0.5rem;
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
  cursor: pointer;
  transition: opacity var(--transition);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--sand-dark);
}
.group-leave-btn:hover { opacity: 0.8; }

/* ═══ 네비 배지 ═══ */

.group-nav-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  background: var(--rose);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  border-radius: 50%;
  min-width: 0.9rem;
  height: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* 📤 문제 보내기 버튼 */
.challenge-send-trigger {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--sand-dark);
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
  margin-left: 0.3rem;
}
.challenge-send-trigger:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* ═══ 챌린지 봉인 카드 태그 ═══ */

.challenge-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.4rem;
  gap: 0.5rem;
}
.challenge-card-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.challenge-card-tag {
  font-size: 0.68rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--sand-muted);
  border: 1px solid var(--border);
}
.challenge-card-tag.gold {
  background: rgba(244, 197, 66, 0.08);
  color: var(--gold);
  border-color: var(--gold-muted);
}

/* ═══ 타이머 강화 ═══ */

.challenge-timer-wrap {
  position: sticky;
  top: 3.5rem;
  z-index: 10;
  background: var(--night);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0 0.3rem;
  text-align: center;
}
.challenge-timer {
  position: static;
  background: none;
  border: none;
  padding: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--sage);
  font-family: 'D2Coding', monospace;
  transition: color 0.3s;
}
.challenge-timer.timer-fast { color: var(--sage); }
.challenge-timer.timer-mid { color: var(--gold); }
.challenge-timer.timer-slow { color: var(--rose); }

.challenge-timer-hint {
  font-size: 0.72rem;
  color: var(--sand-muted);
  margin-top: 0.15rem;
  transition: color 0.3s;
}

/* ═══ 객관식 라벨 ═══ */

.option-label {
  color: var(--gold);
  font-weight: 700;
  margin-right: 0.3rem;
  font-size: 0.95rem;
}
.challenge-option.selected {
  border-color: var(--gold);
  background: var(--gold-muted);
  position: relative;
}
.challenge-option.selected::after {
  content: '✓';
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  font-weight: 700;
  font-size: 1rem;
}

/* ═══ 결과 화면 보상 ═══ */

.result-reward-box {
  margin-top: 0.75rem;
  padding: 0.6rem 0.8rem;
  background: rgba(123, 198, 126, 0.08);
  border: 1px solid rgba(123, 198, 126, 0.2);
  border-radius: var(--radius-xs);
}
.result-reward-box.wrong {
  background: rgba(232, 93, 117, 0.06);
  border-color: rgba(232, 93, 117, 0.15);
}
.result-reward-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sage);
  margin-bottom: 0.3rem;
}
.result-reward-box.wrong .result-reward-title {
  color: var(--sand-dark);
}
.result-reward-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.result-reward-item {
  font-size: 0.78rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--sand-muted);
}
.result-reward-item.earned {
  background: rgba(244, 197, 66, 0.12);
  color: var(--gold);
  font-weight: 600;
}
.result-reward-item.missed {
  background: rgba(255, 255, 255, 0.03);
  color: var(--sand-muted);
  text-decoration: line-through;
  opacity: 0.6;
}
.result-reward-item.speed-pending {
  background: rgba(244, 197, 66, 0.06);
  color: var(--sand-muted);
  animation: pulse-fade 1.5s ease-in-out infinite;
}
@keyframes pulse-fade {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.result-correct-answer {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--sand);
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-xs);
}

.challenge-retry-btn {
  width: 100%;
  margin-top: 1rem;
  padding: 0.7rem;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  animation: retry-glow 2s ease-in-out infinite;
}
@keyframes retry-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 197, 66, 0.3); }
  50% { box-shadow: 0 0 12px 2px rgba(244, 197, 66, 0.2); }
}

/* ═══ 랭킹 내 성과 요약 ═══ */

.ranking-my-summary {
  background: rgba(244, 197, 66, 0.06);
  border: 1px solid var(--gold-muted);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 1rem;
}
.ranking-my-summary-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.5rem;
  text-align: center;
}
.ranking-my-stats {
  display: flex;
  justify-content: space-around;
  gap: 0.3rem;
}
.ranking-my-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}
.ranking-my-stat-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--sand);
}
.ranking-my-stat-label {
  font-size: 0.7rem;
  color: var(--sand-muted);
}

/* 랭킹 빈 상태 개선 */
.ranking-empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.3rem;
}
.ranking-empty-tips {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--sand-dark);
}

/* ═══ 출제자 풀이 상세 개선 ═══ */

.attempts-summary {
  display: flex;
  justify-content: space-around;
  gap: 0.3rem;
  padding: 0.6rem;
  background: rgba(244, 197, 66, 0.06);
  border: 1px solid var(--gold-muted);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}
.attempts-summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}
.attempts-summary-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
}
.attempts-summary-label {
  font-size: 0.68rem;
  color: var(--sand-muted);
}

.attempt-card.fastest {
  border-color: var(--gold-muted);
  background: rgba(244, 197, 66, 0.05);
}
.attempt-card-detail {
  font-size: 0.8rem;
  color: var(--sand-dark);
  line-height: 1.5;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ═══ 주간 팀 미션 ═══ */

.team-mission-card {
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--night-card);
  border: 1px solid rgba(244, 197, 66, 0.15);
  border-radius: var(--radius);
  max-height: 280px;
  overflow-y: auto;
}
.team-mission-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.team-mission-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold);
}
.team-mission-week {
  font-size: 0.75rem;
  color: var(--sand-muted);
}
.team-mission-item {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.team-mission-item:last-child { border-bottom: none; }
.team-mission-item.done .team-mission-label { color: var(--sage); }
.team-mission-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.team-mission-icon { font-size: 1.2rem; }
.team-mission-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--sand);
}
.team-mission-progress-text {
  font-size: 0.72rem;
  color: var(--sand-muted);
}
.team-mission-bar {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.team-mission-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.team-mission-item.done .team-mission-fill { background: var(--sage); }
.team-claim-btn { margin-top: 0.75rem; width: 100%; }

/* ═══ 모바일 반응형 ═══ */

@media (max-width: 600px) {
  .group-container {
    padding: 0.75rem;
  }
  .chat-container {
    height: calc(55vh);
    min-height: 250px;
  }
  .chat-bubble-wrap {
    max-width: 88%;
  }
  .group-subtab {
    font-size: 0.78rem;
    padding: 0.5rem 0.3rem;
  }
  .challenge-timer-wrap {
    top: 3rem;
  }
  .ranking-my-stats {
    gap: 0.15rem;
  }
  .ranking-my-stat-val {
    font-size: 0.95rem;
  }
  .attempts-summary {
    gap: 0.15rem;
  }
  .ranking-empty-tips {
    flex-direction: column;
    gap: 0.3rem;
    align-items: center;
  }

  .ranking-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
