@import url('https://fonts.googleapis.com/css2?family=Pretendard:wght@400;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600;700&display=swap');
@import url('https://cdn.jsdelivr.net/gh/leetaewook/gmarket-sans-dynamic-subset/GmarketSans.css');
:root { 
    --safe-bottom: env(safe-area-inset-bottom, 0px); 
    --color-primary: #059669; /* 그린: CTA·선택·활성만 사용 */
}
body { 
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif; 
    background-color: #f8fafc; 
    color: #1e293b; 
    overflow-x: hidden; 
    padding-bottom: calc(80px + var(--safe-bottom)); 
}
.mealog-title { 
    font-family: 'Fredoka', sans-serif; 
    font-weight: 600; 
}
/* 헤더 타이틀: text-2xl(1.5rem) 대비 20% 확대 = 1.8rem */
header .mealog-title { 
    font-size: 1.8rem; 
}
/* 서브 타이틀 (INSIGHT, MEAL TALK, 게시글, 글쓰기) – Pretendard, 700, 대문자 */
.sub-title { 
    font-family: 'Pretendard', sans-serif; 
    font-weight: 700; 
    text-transform: uppercase; 
}
.card { 
    background: white; 
    border-radius: 1.5rem; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.02); 
    border: 1px solid #f1f5f9; 
}
.calendar-scroll { 
    display: flex; 
    overflow-x: auto; 
    padding: 4px 0; 
    gap: 10px; 
}
.calendar-scroll::-webkit-scrollbar { 
    display: none; 
}
.calendar-dot { 
    width: 34px; 
    height: 34px; 
    border-radius: 12px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 11px; 
    font-weight: 700; 
    cursor: pointer; 
    transition: all 0.2s; 
    background: #f1f5f9; 
    color: #64748b; 
}
/* 기록 완료(4건 이상): mealog 타이틀(text-emerald-600)=#059669 */
.dot-full { 
    background: #059669; 
    color: white; 
}
/* 미완(1~3건): 연한 그린(#E5F2DB) + primary 텍스트(#059669) + 테두리 #10B981 */
.dot-partial { 
    background: #E5F2DB; 
    color: #059669; 
    border: 1px solid #10B981; 
}
.dot-selected { 
    transform: scale(1.15); 
    border: 2px solid #059669; 
    background: #fff; 
    color: #059669; 
}
/* 전체/일간: 연회색 통 하나, active=흰색 팩+녹색 테두리/글자(mealog #059669), inactive=배경 없이 회색 글자만 */
.view-tab { 
    padding: 4px 10px; 
    border-radius: 6px; 
    font-size: 11px; 
    font-weight: 700; 
    border: 1px solid transparent; 
    transition: all 0.2s; 
}
.view-tab.active { 
    background: #fff; 
    border-color: #059669; 
    color: #059669; 
}
.view-tab.inactive { 
    background: transparent; 
    border-color: transparent; 
    color: #94a3b8; 
}
/* 선택 탭과 연회색 배경 간격 최소화 */
#trackerTabs { 
    padding: 2px; 
    gap: 2px; 
}
.chip { 
    padding: 8px 14px; 
    border-radius: 12px; 
    font-size: 12px; 
    font-weight: 700; 
    background: white;
    border: 1px solid #e2e8f0; 
    color: #475569; 
    cursor: pointer; 
    transition: all 0.2s; 
    margin-right: 4px; 
    margin-bottom: 4px; 
}
.chip.active { 
    background: var(--color-primary); 
    color: white; 
    border-color: var(--color-primary); 
}
.sub-chip { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    padding: 6px 12px; 
    border-radius: 12px; 
    font-size: 10px; 
    font-weight: 600; 
    background: #f1f5f9; 
    color: #94a3b8; 
    border: 1px solid #cbd5e1;
    margin-right: 4px; 
    margin-bottom: 4px; 
    cursor: pointer; 
    transition: all 0.2s; 
}
.sub-chip.active { 
    background: #6366f1; 
    color: white; 
    border-color: #6366f1;
}
/* 나만의 태그가 active일 때 스타일 */
.sub-chip.bg-emerald-100.active {
    background: var(--color-primary) !important;
    color: white !important;
    border-color: var(--color-primary) !important;
}
.sub-chip.bg-emerald-100.active .fa-star {
    color: white !important;
}
.snack-tag { 
    display: inline-flex; 
    align-items: center; 
    padding: 5px 12px; 
    background: white; 
    border: 1px solid #e2e8f0; 
    border-radius: 10px; 
    font-size: 11px; 
    font-weight: 700; 
    color: #475569; 
    white-space: nowrap; 
}
.bottom-nav { 
    position: fixed; 
    bottom: 20px; 
    left: 50%; 
    transform: translateX(-50%); 
    width: 92%; 
    max-width: 26rem; 
    background: rgba(255, 255, 255, 0.9); 
    backdrop-filter: blur(10px); 
    border: 1px solid #f1f5f9; 
    border-radius: 2rem; 
    display: flex; 
    justify-content: space-around; 
    padding: 8px 0; 
    z-index: 50; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.08); 
}
.prop-bar-container { 
    height: 28px; 
    border-radius: 8px; 
    overflow: hidden; 
    display: flex; 
    background: #f1f5f9; 
}
.prop-segment { 
    height: 100%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 10px; 
    font-weight: 800; 
    color: white; 
}
.sticker-badge { 
    background: rgba(255,255,255,0.12); 
    backdrop-filter: blur(8px); 
    border-radius: 1rem; 
    padding: 10px 14px; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    margin-top: 14px; 
    border: 1px solid rgba(255,255,255,0.1); 
}
.date-section-header { 
    position: sticky; 
    top: 148px; 
    z-index: 20; 
    background: rgba(248, 250, 252, 0.95); 
    backdrop-filter: blur(8px); 
    padding: 12px 16px; 
    margin-bottom: 8px; 
    scroll-margin-top: 148px; 
}
#timelineContainer .card {
    border-radius: 0 !important;
}
#galleryContainer {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100% !important;
}
#galleryContainer > div {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}
/* 헤더 돋보기 위치: 1) 접힌 상태=돋보기만(오른쪽 정렬) 2) 펼침=왼쪽부터 하트/댓글/북마크/돋보기 */
.gallery-trace-panel {
    width: 2rem;
    justify-content: flex-end;
}
.gallery-trace-panel.expanded {
    width: 8.5rem !important;
    justify-content: flex-start;
}

/* 타임라인 검색: 돋보기 고정·입력창만 왼쪽으로 확장(프로필 밀지 않음), MEALOG 가리지 않음, 닫을 때 창 닫는 모션(왼쪽→오른쪽) */
.timeline-search-wrapper {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
}
/* 접힌 상태: input이 min-width 등으로 공간을 차지해 돋보기가 오른쪽으로 밀리지 않도록 0으로 */
.timeline-search-wrapper:not(.expanded) #searchInput {
    flex: 0 0 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    width: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow: hidden;
}
.timeline-search-panel {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    justify-content: center;   /* 접힌 상태: 돋보기 중앙 */
    transition: width 0.3s ease-out;
}
.timeline-search-wrapper.expanded .timeline-search-panel {
    justify-content: flex-start;
    /* 상한 170px, MEALOG 안 겹치게 (100vw-300) 이내 */
    width: max(6rem, min(170px, calc(100vw - 300px)));
    padding-left: 0.75rem;
}
.photo-remove-btn { 
    position: absolute; 
    top: 4px; 
    right: 4px; 
    width: 20px; 
    height: 20px; 
    background: rgba(0,0,0,0.6); 
    color: white; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 10px; 
}
.icon-option { 
    width: 44px; 
    height: 44px; 
    border-radius: 50%; 
    border: 2px solid transparent; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 1.2rem; 
    cursor: pointer; 
    background: #e2e8f0; 
    flex-shrink: 0; 
    transition: all 0.2s; 
}
.icon-option.selected {
    border-color: #10b981;
    background: #ecfdf5;
    transform: scale(1.1);
}
.icon-option-setup {
    background: #e2e8f0;
}
.icon-option-setup.selected {
    background: #ecfdf5;
}
.settings-tab {
    transition: all 0.2s;
    background-color: transparent;
}
.settings-tab.active {
    background-color: transparent;
}
.settings-tab-content {
    min-height: 100%;
}
.tag-manage-item { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    padding: 6px 10px; 
    background: #f8fafc; 
    border-radius: 12px; 
    border: 1px solid #f1f5f9; 
    margin-right: 4px; 
    margin-bottom: 4px; 
}
.tag-delete-btn { 
    margin-left: 6px; 
    color: #cbd5e1; 
    cursor: pointer; 
}
@keyframes toastSlideUp { 
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    } 
    to { 
        opacity: 1; 
        transform: translateY(0); 
    } 
}
.animate-toast { 
    animation: toastSlideUp 0.3s ease-out forwards; 
}
#landingPage { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    z-index: 200; 
    background: #059669; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
}
.star-btn { 
    padding: 4px; 
    transition: color 0.2s; 
}
/* 스크롤바 숨기기 (가로 스크롤 시 깔끔하게) */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}
/* Comment 줄바꿈 및 제한 스타일 */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* 기간 표시 높이 통일 */
#periodDisplay {
    min-height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* 직접 설정 모드 캘린더 높이 통일 */
#customDatePicker input {
    min-height: 1.4rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    display: flex;
    align-items: center;
}
/* 분석창 카드 좌우 꽉 차게 */
#dashboardView .card {
    border-radius: 0;
}
/* 베스트/식사/간식 탭과 식사카드 컨테이너 간격 (0.1125rem) */
#dashboardView #bestAnalysisSection,
#dashboardView #mainAnalysisSection,
#dashboardView #snackAnalysisSection {
    margin-top: 0.1125rem;
}
/* 식사/간식 분석 섹션 카드들 같은 박스처럼 보이게 */
#mainAnalysisSection .card,
#snackAnalysisSection .card {
    border-top: 1px solid #f1f5f9;
    margin-top: 0;
    margin-bottom: 0;
}
#mainAnalysisSection .card:first-child,
#snackAnalysisSection .card:first-child {
    border-top: none;
}
/* 베스트 식사/간식 카드 좌우 꽉 차게 */
#bestMealsContainer .best-meal-item {
    border-radius: 0 !important;
    margin-left: -1rem !important;
    margin-right: -1rem !important;
    width: calc(100% + 2rem) !important;
}
/* 인사이트 말풍선 스타일 */
#insightBubble {
    line-height: 1.6;
    font-size: 0.875rem;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    position: relative;
    font-weight: 400;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
    min-height: fit-content; /* 내용에 맞춰 최소 높이 설정 */
}
#insightTextContent {
    line-height: 1.6;
    font-weight: 400;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    word-wrap: break-word;
    word-break: break-word; /* 긴 단어도 박스 안에서 줄바꿈 */
    overflow-wrap: break-word;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    white-space: pre-line; /* 줄바꿈은 유지하되, 긴 줄은 자동 줄바꿈 */
    overflow: visible; /* 텍스트가 잘리지 않도록 */
    display: block;
}
.insight-page-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
}
.insight-page-dot.active {
    background: var(--color-primary);
    width: 8px;
    height: 8px;
}
/* 캐릭터 선택 창 */
#insightCharacterBtn {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
/* 캐릭터 선택 팝업 */
.character-popup-item.active {
    background: #ecfdf5 !important;
    border: 1px solid #10b981;
}
.character-popup-item.active .text-slate-800 {
    color: #10b981;
    font-weight: 800;
}

/* 인스타그램 스타일 포스트 */
.instagram-post {
    transition: transform 0.2s;
}

.instagram-post:active {
    transform: scale(0.98);
}

/* 좋아요, 북마크 버튼 애니메이션 */
.post-like-btn,
.post-bookmark-btn {
    transition: transform 0.15s ease;
}

.post-like-btn:active,
.post-bookmark-btn:active {
    transform: scale(0.9);
}

.post-like-icon.fa-solid {
    animation: heartBeat 0.5s ease;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.2);
    }
    50% {
        transform: scale(1);
    }
    75% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* 댓글 입력 스타일 */
.post-comment-input:focus {
    outline: none;
}

.post-comment-input::placeholder {
    color: #cbd5e1;
}

.post-comment-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 댓글 목록 스타일 */
.post-comments-list {
    max-height: 200px;
    overflow-y: auto;
}

.post-comments-list::-webkit-scrollbar {
    width: 4px;
}

.post-comments-list::-webkit-scrollbar-track {
    background: transparent;
}

.post-comments-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.post-comments-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 댓글 더보기 버튼 */
.post-view-comments-btn {
    cursor: pointer;
    transition: color 0.2s;
}

.post-view-comments-btn:hover {
    color: #64748b;
}

.post-view-comments-btn:active {
    color: #475569;
}

/* 게시판 스타일 */
/* 글쓰기 버튼: 플로팅 FAB – 하단 탭 메뉴 우상단에 정렬, 좌상단으로 약간 이동 */
#boardWriteBtn.board-write-fab {
    position: fixed;
    bottom: 5.75rem;
    right: calc(50% - min(46vw, 13rem) + 1.25rem);
    z-index: 40;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #059669 !important;
    color: white !important;
    box-shadow: 0 2px 12px rgba(5, 150, 105, 0.4);
    border: none;
    transition: box-shadow 0.2s, background-color 0.2s;
}
#boardWriteBtn.board-write-fab:hover {
    box-shadow: 0 4px 16px rgba(5, 150, 105, 0.45);
}
#boardWriteBtn.board-write-fab:active {
    background-color: #047857 !important;
}

/* 카테고리 필터: 보조 (chip) */
.board-category-btn {
    padding: 0.375rem 0.75rem;
    font-weight: 600;
    background-color: #f8fafc !important;
    color: #64748b !important;
    border: 1px solid #e2e8f0;
}
.board-category-btn:hover:not(.active) {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
}
.board-category-btn.active {
    background-color: #ecfdf5 !important;
    color: #059669 !important;
    border-color: #a7f3d0 !important;
}

#board-sort-latest.active,
#board-sort-popular.active {
    background-color: var(--color-primary) !important;
    color: white !important;
    border-color: var(--color-primary) !important;
}

#boardContainer .card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

/* 게시판 리스트 카드: 흰 배경 + 왼쪽 4px 카테고리 포인트 보더 */
.board-list-card {
    background: #fff !important;
    border: none !important;
    border-left: 4px solid #94a3b8;
}
.board-list-card--serious { border-left-color: #475569; }
.board-list-card--chat { border-left-color: #2563eb; }
.board-list-card--food { border-left-color: #059669; }
.board-list-card--admin { border-left-color: #ea580c; }

/* MEAL TALK 게시글 상세 하단 버튼: 참여(추천/비추천) 왼쪽, 관리(수정/삭제) 오른쪽 */
.board-detail-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 1rem;
    margin-top: 0;
    border-top: 1px solid #e2e8f0;
}
.board-detail-actions__left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.board-detail-actions__right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* 참여 액션: 추천/비추천 - 연한 회색/outline, 눌렀을 때만 브랜드 컬러 채움 */
.board-btn-participate {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 1rem;
    border-radius: 0.875rem;
    font-size: 0.875rem;
    font-weight: 700;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    transition: all 0.2s;
}
.board-btn-participate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.board-btn-participate:not(:disabled):active {
    transform: scale(0.98);
}
.board-btn-participate--like {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #64748b;
}
.board-btn-participate--like.is-active {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #059669;
}
.board-btn-participate--dislike {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #64748b;
}
.board-btn-participate--dislike.is-active {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}/* 관리 액션: 수정/삭제 - 텍스트 버튼, 배경 없음 */
.board-btn-manage {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 700;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}
.board-btn-manage--edit {
    color: #475569;
}
.board-btn-manage--edit:hover {
    color: #059669;
}
.board-btn-manage--edit:active {
    opacity: 0.8;
}
/* 삭제: 기본 연한 회색, hover 시에만 붉은색(경고) */
.board-btn-manage--delete {
    color: #94a3b8;
}
.board-btn-manage--delete:hover {
    color: #ef4444;
}
.board-btn-manage--delete:active {
    opacity: 0.8;
}
