/* 모바일 최적화 - 커뮤니티 */
:root {
  --touch-min: 44px;
  --mobile-font: 16px;
}

* {
  -webkit-text-size-adjust: 100%;
  word-wrap: break-word;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: var(--mobile-font);
  line-height: 1.5;
  overflow-x: hidden;
}

/* 컨테이너 - 모바일 패딩 */
.container {
  padding-left: 12px !important;
  padding-right: 12px !important;
  max-width: 100%;
}

/* 제목 */
h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

/* 테이블 - 모바일에서 카드형으로 전환 */
@media (max-width: 768px) {
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table {
    font-size: 14px;
  }
  
  .table th, .table td {
    padding: 10px 8px;
    vertical-align: middle !important;
  }
  
  .table th:nth-child(1) { width: 45px; }
  .table th:nth-child(2) { min-width: 0; }
  .table th:nth-child(3) { width: 60px; }
  .table th:nth-child(4) { width: 100px; font-size: 11px; }
  
  .table .post-title {
    word-break: break-word;
    white-space: normal;
  }
}

/* 제목 링크 - 줄바꿈 허용 */
.post-title {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* 페이지 인디케이터 - 터치 영역 확대 */
#pageIndicator .btn {
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  padding: 8px 12px;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 버튼 - 터치 최소 크기 */
.btn {
  min-height: var(--touch-min);
  padding: 10px 16px;
  font-size: 15px;
}

/* 입력 필드 - iOS 줌 방지 */
input, textarea, select {
  font-size: 16px !important;
  padding: 12px !important;
}

textarea {
  min-height: 120px;
}

/* 본문 영역 - 줄바꿈 */
.pre-wrap {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* 버튼 그룹 - 모바일에서 세로 배치 */
@media (max-width: 576px) {
  .btn-group-mobile {
    flex-direction: column;
  }
  
  .btn-group-mobile .btn,
  .btn-group-mobile a.btn {
    width: 100%;
    text-align: center;
  }
}

/* 수정 폼 */
#editForm input, #editForm textarea {
  font-size: 16px !important;
}

/* ── 아바타 시스템 ── */

/* 네비게이션 레벨 표시 */
.avatar-nav-link {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}
.avatar-nav-link:hover {
  text-decoration: underline;
  color: #0d6efd;
}
.avatar-hp-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  background: #fce8e8;
  color: #c0392b;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}

/* 아바타 프로필 카드 */
.avatar-card {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  padding: 20px 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.avatar-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.avatar-username {
  font-size: 1.2rem;
  font-weight: 600;
}
.avatar-level-badge {
  background: #0d6efd;
  color: #fff;
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 0.95rem;
  font-weight: 700;
}

/* EXP 바 */
.exp-bar-bg {
  background: #e9ecef;
  border-radius: 6px;
  height: 14px;
  overflow: hidden;
}
.exp-bar {
  background: linear-gradient(90deg, #0d6efd, #6ea8fe);
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
  min-width: 2px;
}

/* 스탯 그리드 */
.stat-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 80px;
}
.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 2px;
}
.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
}

/* 스탯 분배 버튼 */
.stat-point-btn {
  background: #198754;
  color: #fff;
  border: none;
  border-radius: 4px;
  width: 26px;
  height: 26px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.stat-point-btn:hover:not(:disabled) {
  background: #157347;
}
.stat-point-btn:disabled {
  background: #adb5bd;
  cursor: default;
}

/* 모바일 축약 */
@media (max-width: 576px) {
  .avatar-hp-badge {
    display: none;
  }
  .stat-grid {
    gap: 12px;
  }
  .avatar-card {
    padding: 14px 14px;
  }
}
