/* ── CSS 변수 ── */
:root {
  --primary:      #1a1a1a;
  --primary-dark: #000000;
  --primary-light:#f0ece7;
  --accent:       #5a5550;
  --bg:           #f7f5f2;
  --surface:      #ffffff;
  --text:         #1a1a1a;
  --text-muted:   #9e9890;
  --border:       #e8e4df;
  --danger:       #e57373;
  --danger-dark:  #c62828;
  --success:      #81c784;
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    20px;
  --shadow-sm:    0 1px 4px rgba(0,0,0,0.05);
  --shadow-md:    0 4px 24px rgba(0,0,0,0.09);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.13);
  --transition:   0.18s ease;
}

/* ── 리셋 & 기본 ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Pretendard', 'Inter', 'Noto Sans KR', '맑은 고딕', sans-serif;
  background: transparent;
  min-height: 100vh;
  margin: 0;
  padding: 24px 20px 40px;
  color: var(--text);
}

#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
}

h1 {
  font-family: 'Pretendard', 'Inter', 'Noto Sans KR', sans-serif;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

h2 {
  font-family: 'Pretendard', 'Inter', 'Noto Sans KR', sans-serif;
  font-weight: 600;
  color: var(--primary);
  margin-top: 0;
  font-size: 1rem;
  letter-spacing: -0.2px;
}

/* ── 로그인 화면 ── */
#auth-section {
  max-width: 380px;
  margin: 0 auto;
  padding-top: 20px;
  animation: fadeUp 0.45s ease both;
}

#auth-section h1 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 24px;
}

.auth-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 36px 32px 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.auth-box h2 {
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 22px;
  color: var(--primary);
}

.auth-box button {
  width: 100%;
  padding: 13px;
  font-size: 15px;
  font-weight: 500;
  margin-top: 4px;
  border-radius: var(--radius-md);
}

.auth-switch {
  text-align: center;
  margin: 16px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-switch a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.auth-switch a:hover { text-decoration: underline; }

.user-count-text {
  text-align: center;
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

/* ── 모달 오버레이 ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  animation: fadeIn 0.2s ease both;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 380px;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease both;
}

.modal-box h2 {
  text-align: center;
  font-size: 1.15rem;
  margin-bottom: 24px;
  color: var(--primary);
}

.modal-box button:not(.modal-close) {
  width: 100%;
  padding: 13px;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius-md);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 16px;
  padding: 0;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  box-shadow: none;
}

.modal-close:hover {
  background: var(--border);
  color: var(--primary);
  box-shadow: none;
}

/* ── 앱 전체 컨테이너 (단일 카드) ── */
#app-section {
  max-width: 700px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: fadeUp 0.45s ease both;
}

/* ── 앱 헤더 ── */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px 14px;
  background: transparent;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  border-radius: 0;
  margin-bottom: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.header-right span {
  color: var(--text-muted);
  font-size: 13px;
}

/* 유저네임 뒤 구분점 */
#welcome-text::after {
  content: ' ·';
  color: var(--text-muted);
}

#mypage-btn,
#logout-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0;
  font-size: 13px;
  font-weight: 400;
  box-shadow: none;
  transition: color var(--transition);
}

#mypage-btn:hover,
#logout-btn:hover {
  background: transparent;
  color: var(--primary);
  box-shadow: none;
}

/* ── 마이페이지 모달 ── */
.mypage-info {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.mypage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.mypage-row:last-child { border-bottom: none; }

.mypage-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.mypage-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.mypage-danger {
  background: #fff5f5;
  border: 1px solid #ffcdd2;
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.danger-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--danger-dark);
  margin: 0 0 6px;
}

.danger-desc {
  font-size: 12px;
  color: #b71c1c;
  margin: 0 0 14px;
  line-height: 1.5;
}

.withdraw-btn {
  width: 100%;
  background: var(--danger);
  color: white;
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
}

.withdraw-btn:hover { background: var(--danger-dark); }

/* ── 섹션 (앱 카드 내부) ── */
section {
  background: transparent;
  border-radius: 0;
  padding: 16px 28px;
  margin-bottom: 0;
  box-shadow: none;
  border: none;
  border-bottom: 1px solid var(--border);
  transition: none;
}

section:hover { box-shadow: none; }

/* ── 입력 요소 ── */
input,
textarea {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: #b0aca8;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(154,152,144,0.1);
}

input::placeholder,
textarea::placeholder {
  color: #c4c0bb;
}

textarea {
  height: 120px;
  resize: vertical;
}

/* ── 버튼 공통 ── */
button {
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
  font-weight: 500;
  cursor: pointer;
  padding: 9px 18px;
  background: var(--primary);
  transition: opacity var(--transition), background var(--transition);
  box-shadow: none;
}

button:hover {
  background: var(--accent);
  box-shadow: none;
  opacity: 0.9;
}

button:active { transform: translateY(1px); }

/* ── 저장 버튼 ── */
#save-btn,
#family-save-post-btn,
#family-save-btn {
  background: var(--primary);
  padding: 10px 22px;
  font-size: 14px;
  border-radius: var(--radius-md);
  box-shadow: none;
}

#save-btn:hover,
#family-save-post-btn:hover,
#family-save-btn:hover {
  background: var(--accent);
  box-shadow: none;
  opacity: 1;
}

/* ── 버튼 종류별 ── */
.edit-btn    { background: #888;         padding: 5px 12px; font-size: 12px; margin-right: 6px; border-radius: 6px; }
.delete-btn  { background: var(--danger); padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.confirm-btn { background: var(--success);padding: 5px 12px; font-size: 12px; margin-right: 6px; border-radius: 6px; }
.cancel-btn  { background: #c4c0bb;      padding: 5px 12px; font-size: 12px; border-radius: 6px; }

.edit-btn:hover    { background: #555; }
.delete-btn:hover  { background: var(--danger-dark); }
.confirm-btn:hover { background: #388e3c; }
.cancel-btn:hover  { background: #999; }

/* ── 일기 목록 ── */
ul { list-style: none; padding: 0; margin: 0; }

li {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 10px;
  background: var(--bg);
  transition: box-shadow var(--transition);
}

li:hover {
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.card-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--primary);
}

li p { margin: 0 0 8px; color: var(--accent); font-size: 14px; line-height: 1.6; }
li small { color: var(--text-muted); font-size: 11px; }

/* ── 사진 슬라이드 ── */
#slideshow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 12px 0 0;
}

#slide-display {
  width: 100%;
  height: 300px;
  background: #1a1a1a;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

#slide-display img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.45s ease;
}

#no-photo-msg {
  color: rgba(255,255,255,0.45);
  font-size: 14px;
  margin: 0;
}

#prev-btn,
#next-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 20px;
  padding: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: background var(--transition), border-color var(--transition);
}

#prev-btn:hover,
#next-btn:hover {
  background: var(--bg);
  border-color: #c8c4c0;
  box-shadow: none;
  opacity: 1;
}

/* #slide-counter는 .family-counter 클래스 스타일을 사용 */
#slide-counter:empty { display: none; }

.photo-exif-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 14px;
  min-height: 18px;
}

.photo-exif-info a { color: var(--accent); text-decoration: none; }
.photo-exif-info a:hover { text-decoration: underline; }

.family-modal-exif {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.family-modal-exif a { color: var(--accent); text-decoration: none; }
.family-modal-exif a:hover { text-decoration: underline; }

/* 업로드 라벨: 가족앨범 헤더 버튼과 동일한 아웃라인 스타일 */
#upload-label {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 13px;
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

#upload-label:hover {
  background: var(--bg);
  border-color: #b0aca8;
}

#photo-btns {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

#delete-photo-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  font-size: 13px;
  padding: 6px 14px;
}

#delete-photo-btn:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
  box-shadow: none;
  opacity: 1;
}

/* ── 게시판 통합 섹션 ── */
.board-section {
  padding: 0;
  overflow: hidden;
  border-bottom: none;
}

/* 게시판 제목 + 검색 한 줄 */
.board-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 28px 11px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  gap: 12px;
}

.board-title-bar h2 {
  margin: 0;
  font-size: 0.95rem;
  flex-shrink: 0;
}

/* 글쓰기 / 수정 패널 */
.board-write {
  display: none;
  padding: 16px 28px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  animation: fadeUp 0.25s ease both;
}

.board-write.open { display: block; }

.board-write h2 { margin-bottom: 16px; }

.write-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* 인라인 검색 그룹 */
.search-group {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  flex-shrink: 0;
}

.search-group select {
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  padding: 6px 10px;
  margin-bottom: 0;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  width: auto;
  outline: none;
}

.search-group input[type="text"] {
  border: none;
  border-radius: 0;
  padding: 6px 12px;
  margin-bottom: 0;
  font-size: 13px;
  width: 180px;
  background: var(--surface);
  outline: none;
  box-shadow: none;
}

.search-group input[type="text"]:focus {
  border-color: transparent;
  box-shadow: none;
  background: var(--surface);
}

/* 검색 버튼 숨김 (Enter / 입력 이벤트로 처리) */
.search-group button {
  display: none;
}

/* 게시판 테이블 */
.board-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.board-table thead {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.board-table th {
  padding: 10px 14px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  text-align: center;
}

.board-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.board-table tbody tr:last-child td { border-bottom: none; }

.board-table tbody tr {
  transition: background var(--transition);
}

.board-table tbody tr:hover { background: var(--bg); }

.col-check  { width: 40px; text-align: center; }
.col-title  { text-align: left; }
.col-author { width: 90px; text-align: center; color: var(--text-muted); font-size: 13px; }
.col-date   { width: 100px; text-align: center; color: var(--text-muted); font-size: 13px; white-space: nowrap; }

.diary-title {
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition);
}

.diary-title:hover {
  color: var(--accent);
  text-decoration: underline;
}

tr.row-active > td {
  background: var(--primary-light);
  border-bottom: none;
}

.detail-row td {
  padding: 0;
  background: var(--primary-light);
  border-bottom: 1px solid var(--border);
}

.detail-content {
  padding: 18px 24px 20px 52px;
  animation: fadeUp 0.22s ease both;
}

.detail-content h3 {
  font-family: 'Pretendard', 'Inter', 'Noto Sans KR', sans-serif;
  color: var(--primary);
  font-size: 1rem;
  margin: 0 0 10px;
}

.detail-content p {
  color: var(--accent);
  font-size: 14px;
  line-height: 1.85;
  margin: 0 0 10px;
  white-space: pre-wrap;
}

.detail-content small { color: var(--text-muted); font-size: 12px; }

.row-actions {
  display: inline-flex;
  gap: 4px;
  margin-left: 8px;
  opacity: 0;
  transition: opacity var(--transition);
}

.board-table tbody tr:hover .row-actions { opacity: 1; }

.board-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0 !important;
  font-size: 14px;
}

/* 하단 버튼 */
.board-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 11px 28px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.board-footer button { padding: 8px 18px; font-size: 13px; }

.board-footer .delete-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  font-size: 13px;
  padding: 7px 16px;
}

.board-footer .delete-btn:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
  opacity: 1;
}

/* ── 수정 폼 ── */
.edit-input,
.edit-textarea {
  border-color: #b0aca8;
  background: #fff;
}

.edit-textarea { height: 80px; }

/* ── 모바일 반응형 ── */
@media (max-width: 540px) {
  body { padding: 12px 8px 40px; }

  #app-section { border-radius: var(--radius-md); }

  .app-header { padding: 14px 16px 12px; }

  .app-header h1 { font-size: 1.2rem; }

  .header-right span { display: none; }

  section { padding: 14px 16px; }

  #slide-display { height: 200px; }

  #prev-btn, #next-btn { width: 30px; height: 30px; font-size: 17px; }

  .board-title-bar { padding: 11px 16px 9px; }

  .search-group input[type="text"] { width: 90px; }

  .col-author { display: none; }

  .col-date { width: 60px; font-size: 11px; }

  .board-table th,
  .board-table td { padding: 9px 8px; }

  .board-write { padding: 14px 16px 12px; }

  .write-footer { flex-direction: row; justify-content: flex-end; }

  .board-footer { padding: 10px 12px; }

  .detail-content { padding: 12px 14px 14px 14px; }

  #photo-btns { justify-content: flex-end; }

  #delete-photo-btn { font-size: 12px; padding: 5px 12px; }
}

/* ── 댓글 ── */
.comment-section {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.comment-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 10px;
}

.comment-empty {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 10px;
}

.comment-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.comment-item:last-child { border-bottom: none; }

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.comment-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.comment-date {
  font-size: 11px;
  color: var(--text-muted);
}

.comment-delete-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  font-family: inherit;
}

.comment-delete-btn:hover { color: var(--danger); }

.comment-content {
  font-size: 13px;
  color: var(--accent);
  margin: 0;
  line-height: 1.6;
  white-space: pre-wrap;
}

.comment-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.comment-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  font-family: inherit;
  transition: border-color var(--transition);
}

.comment-input:focus { border-color: var(--accent); }

.comment-submit-btn {
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background var(--transition);
}

.comment-submit-btn:hover    { background: var(--primary-dark); }
.comment-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── 탭 메뉴 ── */
.tab-menu {
  display: flex;
  gap: 0;
  margin-bottom: 0;
  background: transparent;
  border-radius: 0;
  padding: 0 24px;
  box-shadow: none;
  border: none;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 0;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}

.tab-btn:hover {
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

.tab-btn.active {
  background: transparent;
  color: var(--primary);
  box-shadow: none;
  border-bottom: 2px solid var(--primary);
  font-weight: 600;
}

/* ── 가족앨범 캐러셀 ── */
#family-carousel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 12px 0 0;
  overflow: hidden;
}

#family-prev-btn,
#family-next-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  padding: 0;
  transition: background var(--transition), border-color var(--transition);
}

#family-prev-btn:hover,
#family-next-btn:hover {
  background: var(--bg);
  border-color: #c8c4c0;
  box-shadow: none;
  opacity: 1;
}

#family-carousel-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  overflow: hidden;
}

.carousel-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: transform var(--transition), box-shadow var(--transition);
}

.carousel-center {
  width: 90%;
  max-width: 575px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  z-index: 2;
  position: relative;
  background: #1a1a1a;
}

.carousel-center img,
.carousel-center video { object-fit: contain; }

.carousel-side {
  width: 20%;
  max-width: 120px;
  opacity: 0.4;
  filter: grayscale(20%) blur(1px);
  transform: scale(0.78);
  z-index: 1;
  position: relative;
  margin: 0 -40px;
}

.carousel-center:hover { box-shadow: 0 8px 32px rgba(0,0,0,0.16); }
.carousel-side:hover { opacity: 0.6; }

.carousel-item img,
.carousel-item video { width: 100%; height: 300px; object-fit: cover; display: block; }

.carousel-side img,
.carousel-side video { height: 175px; }

@media (max-width: 480px) {
  .carousel-item img,
  .carousel-item video { height: 160px; }

  .carousel-side img,
  .carousel-side video { height: 110px; }

  #family-prev-btn,
  #family-next-btn { width: 30px; height: 30px; font-size: 17px; }
}

.carousel-desc {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
  color: white;
  font-size: 12px;
  padding: 20px 12px 10px;
  line-height: 1.4;
}

/* 카운터 필 배지 */
.family-counter:empty { display: none; }

.family-counter {
  font-size: 12px;
  color: rgba(255,255,255,0.95);
  background: rgba(20,20,20,0.6);
  padding: 3px 13px;
  border-radius: 20px;
  display: block;
  width: fit-content;
  margin: 8px auto 0;
  letter-spacing: 0.5px;
}

/* ── 가족앨범 모달 ── */
.family-modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease both;
  overflow: hidden;
}

.family-modal-box img,
.family-modal-box video {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #000;
  display: block;
}

.family-modal-info { padding: 16px 20px 20px; }

.family-modal-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* ── 가족앨범 헤더 ── */
.family-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.family-header h2 { margin: 0; }

.family-upload-label {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 13px;
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.family-upload-label:hover {
  background: var(--bg);
  border-color: #b0aca8;
}

.family-add-more-label {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  border: 1.5px dashed #c8c4c0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 12px;
  transition: background var(--transition);
}

.family-add-more-label:hover { background: var(--border); }

#family-queue { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.family-queue-item { position: relative; width: 80px; height: 80px; }

.family-queue-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #eee;
}

.family-queue-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#family-upload-form {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 18px;
  border: 1.5px solid var(--border);
  animation: fadeUp 0.25s ease both;
}

#family-preview-img,
#family-preview-video {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  background: #fff;
}

.family-form-btns { display: flex; justify-content: flex-end; gap: 8px; }

#family-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.family-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg);
  border: 1.5px solid var(--border);
  box-shadow: none;
  transition: box-shadow var(--transition), transform var(--transition);
  animation: fadeUp 0.3s ease both;
}

.family-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.family-card img,
.family-card video { width: 100%; height: 140px; object-fit: cover; display: block; }

.family-card-info { padding: 8px 10px; }

.family-card-desc {
  font-size: 12px;
  color: var(--text);
  margin: 0 0 4px;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.family-card-date { font-size: 11px; color: var(--text-muted); }

.family-card-delete {
  display: block;
  width: 100%;
  background: transparent;
  color: var(--danger);
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding: 6px;
  font-size: 12px;
  box-shadow: none;
  margin-top: 4px;
}

.family-card-delete:hover {
  background: #fff0f0;
  color: var(--danger-dark);
  box-shadow: none;
  opacity: 1;
}

.family-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 40px 0;
}

@media (max-width: 480px) {
  #family-gallery { grid-template-columns: repeat(2, 1fr); }
}

/* ── 캘린더 ── */
#calendar-section { padding: 16px 28px 14px; }

.cal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 14px;
}

.cal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  min-width: 120px;
  text-align: center;
}

.cal-nav-btn {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: none;
  transition: background var(--transition), border-color var(--transition);
}

.cal-nav-btn:hover {
  background: var(--bg);
  border-color: #c8c4c0;
  box-shadow: none;
  opacity: 1;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 2px;
}

.cal-wday {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 0;
}

.cal-wday-sun { color: #e57373; }
.cal-wday-sat { color: #5c9cf5; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  gap: 1px;
  background: var(--border);
}

.cal-cell {
  background: var(--surface);
  min-height: 80px;
  padding: 6px 5px 4px;
  cursor: pointer;
  transition: background var(--transition);
  overflow: hidden;
  position: relative;
}

.cal-cell:hover { background: var(--bg); }

.cal-empty { background: #f9f8f6; cursor: default; }

.cal-selected {
  background: #f5f3f0;
  box-shadow: inset 0 0 0 2px #c8c4c0;
}

.cal-today .cal-day-num {
  background: var(--primary);
  color: white;
  border-radius: 50%;
}

.cal-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  flex-shrink: 0;
}

.cal-num-sun { color: #e57373; }
.cal-num-sat { color: #5c9cf5; }

.cal-event-chip {
  font-size: 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 3px;
  padding: 1px 4px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

.cal-event-chip-more { font-size: 10px; color: var(--text-muted); padding: 0 2px; margin-top: 1px; }

.cal-dots { display: none; gap: 3px; margin-top: 3px; justify-content: center; flex-wrap: wrap; }

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  flex-shrink: 0;
}

.cal-dot-more { font-size: 9px; color: var(--text-muted); line-height: 1; }

#cal-day-panel { padding: 14px 28px; }

.cal-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.cal-day-header h2 { margin: 0; font-size: 1rem; }

.cal-no-event { text-align: center; color: var(--text-muted); font-size: 14px; padding: 30px 0; margin: 0; }

.cal-event-item {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--bg);
  transition: box-shadow var(--transition);
  animation: fadeUp 0.2s ease both;
}

.cal-event-item:hover { box-shadow: var(--shadow-sm); }

.cal-event-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.cal-event-info { flex: 1; min-width: 0; }

.cal-event-title-text { display: block; font-size: 15px; color: var(--text); margin-bottom: 4px; font-weight: 600; }

.cal-event-desc-text { font-size: 13px; color: var(--text-muted); margin: 0 0 8px; white-space: pre-wrap; line-height: 1.6; }

.cal-event-thumb {
  max-width: 160px;
  max-height: 100px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  margin-top: 8px;
  display: block;
  border: 1px solid var(--border);
}

.cal-pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  margin-top: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
}

.cal-pdf-link:hover { text-decoration: underline; }

.cal-event-modal-box { max-width: 420px; }

.cal-recurrence-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.cal-recurrence-label {
  font-size: 13px;
  color: var(--accent);
  white-space: nowrap;
  min-width: 28px;
}

.cal-recurrence-select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

.cal-recurrence-select:focus  { border-color: var(--accent); }
.cal-recurrence-select:disabled { opacity: 0.65; cursor: default; }

.cal-recur-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  background: var(--primary-light);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  vertical-align: middle;
}

.cal-file-section { margin-bottom: 12px; }

.cal-file-label {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1.5px dashed var(--border);
  color: var(--text-muted);
  font-size: 13px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 8px;
  transition: background var(--transition);
  width: 100%;
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
}

.cal-file-label:hover { background: var(--border); }

.cal-file-preview-img {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  display: block;
  margin-bottom: 6px;
  border: 1px solid var(--border);
}

.cal-file-name-text { font-size: 12px; color: var(--text-muted); display: block; margin-top: 4px; }

.cal-remove-file {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
  box-shadow: none;
}

.cal-remove-file:hover {
  background: var(--danger);
  color: white;
  box-shadow: none;
  opacity: 1;
}

@media (max-width: 540px) {
  .cal-cell { min-height: 52px; padding: 4px 3px; }
  .cal-day-num { width: 20px; height: 20px; font-size: 11px; }
  .cal-event-chip, .cal-event-chip-more { display: none; }
  .cal-dots { display: flex; }
  .cal-nav-btn { width: 28px; height: 28px; font-size: 16px; }
}

/* ── 배경음악 플레이어 ── */
.music-player {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 8px 14px;
  z-index: 9000;
  max-width: 280px;
  animation: fadeUp 0.4s ease both;
}

.music-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: none;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}

.music-btn:hover {
  background: var(--bg);
  color: var(--primary);
  box-shadow: none;
  opacity: 1;
}

.music-play-btn { background: var(--bg); font-size: 13px; }

.music-track-name {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
  flex: 1;
}

@media (max-width: 480px) {
  .music-player { bottom: 12px; right: 12px; max-width: 200px; padding: 6px 10px; }
  .music-track-name { max-width: 100px; font-size: 10px; }
}

/* ── 애니메이션 ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes tabEnterRight {
  from { opacity: 0; transform: translateX(22px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes tabEnterLeft {
  from { opacity: 0; transform: translateX(-22px); }
  to   { opacity: 1; transform: translateX(0); }
}

.tab-enter-right { animation: tabEnterRight 0.28s ease both; }
.tab-enter-left  { animation: tabEnterLeft  0.28s ease both; }

@keyframes bgShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes calCellEnter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 스크롤 진입 페이드인 */
.row-fade {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.row-fade.visible {
  opacity: 1;
  transform: translateY(0);
}
