@charset "utf-8";

/* 페이지 이동(달력↔글) 시 화면이 뚝 끊기지 않고 부드럽게 넘어가도록.
   지원하는 브라우저(크롬/엣지 계열)에서만 적용되고, 지원 안 하는 브라우저에서는
   그냥 무시되어 지금처럼 동작합니다. */
@view-transition {
    navigation: auto;
}

/* ==========================================================================
   테마 변수 (3가지 모드)
   - 기본값(클래스 없음) = 갠홈테마 (사이트 메인 컬러 연동)
   - .theme-light = 모던 라이트 테마 (청록/포인트)
   - .theme-dark  = 딥 다크 테마 (네온/퍼플)
   ========================================================================== */

#diary-skin-wrap,
#diary-write-wrap {
    /* 1) 갠홈 테마 (사이트 메인 테마 색상 자동 반영) */
    --diary-surface: var(--card-bg-color, #ffffff);
    --diary-surface-alt: var(--container-bg-color, #f8fafc);
    --diary-chip-bg: color-mix(in srgb, var(--card-bg-color, #fff) 92%, var(--content-font-color, #000) 8%);
    --diary-border: var(--card-border-color, #e2e8f0);
    --diary-border-strong: var(--border-medium, #cbd5e1);
    --diary-text: var(--content-font-color, #1e293b);
    --diary-text-secondary: var(--text-secondary, #475569);
    --diary-text-muted: var(--text-muted, #94a3b8);
    
    /* 버튼 & 태그 전용 컬러 (사이트 메인컬러) */
    --diary-accent: var(--primary-color, #3b82f6);
    --diary-accent-hover: color-mix(in srgb, var(--primary-color, #3b82f6) 85%, #000000 15%);
    --diary-accent-text: #ffffff;
    
    /* 태그 전용 배경 & 글자색 (밝은 배경에 메인컬러 글자) */
    --diary-tag-bg: color-mix(in srgb, var(--primary-color, #3b82f6) 12%, transparent);
    --diary-tag-text: var(--primary-color, #3b82f6);
    --diary-tag-hover-bg: var(--primary-color, #3b82f6);
    --diary-tag-hover-text: #ffffff;

    --diary-sunday: #ef4444;

    /* 하단 페이징(목차) 변수 - 갠홈 테마 */
    --diary-pg-bg: var(--diary-surface);
    --diary-pg-border: var(--diary-border-strong);
    --diary-pg-text: var(--diary-text-secondary);
    --diary-pg-hover-bg: var(--diary-surface-alt);
    --diary-pg-hover-border: var(--diary-accent);
    --diary-pg-hover-text: var(--diary-accent);
    --diary-pg-current-bg: var(--diary-accent);
    --diary-pg-current-border: var(--diary-accent);
    --diary-pg-current-text: var(--diary-accent-text);
}

#diary-skin-wrap.theme-light,
#diary-write-wrap.theme-light {
    /* 2) 라이트 모드 */
    --diary-surface: #ffffff;
    --diary-surface-alt: #f8fafc;
    --diary-chip-bg: #f1f5f9;
    --diary-border: #e2e8f0;
    --diary-border-strong: #cbd5e1;
    --diary-text: #1e293b;
    --diary-text-secondary: #475569;
    --diary-text-muted: #94a3b8;
    
    /* 버튼 & 태그 전용 컬러 */
    --diary-accent: #6366f1;
    --diary-accent-hover: #4f46e5;
    --diary-accent-text: #ffffff;
    
    /* 태그 전용 배경 & 글자색 */
    --diary-tag-bg: #e0e7ff;
    --diary-tag-text: #4338ca;
    --diary-tag-hover-bg: #6366f1;
    --diary-tag-hover-text: #ffffff;

    --diary-sunday: #ef4444;

    /* 하단 페이징(목차) 변수 - 라이트 모드 */
    --diary-pg-bg: #ffffff;
    --diary-pg-border: #cbd5e1;
    --diary-pg-text: #475569;
    --diary-pg-hover-bg: #f8fafc;
    --diary-pg-hover-border: #6366f1;
    --diary-pg-hover-text: #6366f1;
    --diary-pg-current-bg: #6366f1;
    --diary-pg-current-border: #6366f1;
    --diary-pg-current-text: #ffffff;
}

#diary-skin-wrap.theme-dark,
#diary-write-wrap.theme-dark {
    /* 3) 다크 모드 */
    --diary-surface: #1c1f2b;
    --diary-surface-alt: #232735;
    --diary-chip-bg: #262b3a;
    --diary-border: #333852;
    --diary-border-strong: #454b6b;
    --diary-text: #e5e9f0;
    --diary-text-secondary: #a8b0c4;
    --diary-text-muted: #6b7284;
    
    /* 버튼 & 태그 전용 컬러 */
    --diary-accent: #10b981;
    --diary-accent-hover: #059669;
    --diary-accent-text: #ffffff;
    
    /* 태그 전용 배경 & 글자색 */
    --diary-tag-bg: #064e3b;
    --diary-tag-text: #a7f3d0;
    --diary-tag-hover-bg: #10b981;
    --diary-tag-hover-text: #ffffff;

    --diary-sunday: #f87171;

    /* 하단 페이징(목차) 변수 - 다크 모드 */
    --diary-pg-bg: #1c1f2b;
    --diary-pg-border: #454b6b;
    --diary-pg-text: #a8b0c4;
    --diary-pg-hover-bg: #232735;
    --diary-pg-hover-border: #10b981;
    --diary-pg-hover-text: #10b981;
    --diary-pg-current-bg: #10b981;
    --diary-pg-current-border: #10b981;
    --diary-pg-current-text: #ffffff;
}

#bo_cate_custom {margin: 10px auto !important;}

#diary-skin-wrap {
    width: 100%;
    margin: 10px auto 0;
    background-color: var(--diary-surface);
    display: flex;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    border-radius: 12px;
    border: 1px solid var(--diary-border);
    overflow: hidden;
    box-sizing: border-box;
}

#diary-skin-wrap .sidebar {
    width: 220px;
    background-color: var(--diary-surface-alt);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--diary-border);
    box-sizing: border-box;
}

/* 이미지 스타일 좌상단 월 표시 */
#diary-skin-wrap .sidebar-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--diary-text);
    padding-bottom: 10px;
}
#diary-skin-wrap .month-big-num {
    font-size: 38px;
    font-weight: 800;
    color: var(--diary-text);
    line-height: 1;
    letter-spacing: -2px;
    font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}
#diary-skin-wrap .month-eng-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--diary-text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

/* 라이트/다크/갠홈테마 전환 버튼 */
#diary-skin-wrap .theme-switcher {
    display: flex;
    gap: 4px;
}
#diary-skin-wrap .theme-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--diary-border-strong);
    border-radius: 6px;
    background: var(--diary-surface);
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    opacity: 0.5;
    box-sizing: border-box;
}
#diary-skin-wrap .theme-btn:hover { opacity: 0.85; }
#diary-skin-wrap .theme-btn.active {
    opacity: 1;
    border-color: var(--diary-accent);
}

/* 미니 달력 스타일 */
#diary-skin-wrap .mini-calendar-box {
    margin-bottom: 15px;
    background: var(--diary-surface);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--diary-border);
}
#diary-skin-wrap .mini-cal-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--diary-chip-bg);
}
#diary-skin-wrap .mini-cal-nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    color: var(--diary-text);
    font-weight: bold;
    padding: 0 4px;
    text-decoration: none;
}
#diary-skin-wrap .mini-cal-nav-btn:hover {
    color: var(--diary-accent);
}
#diary-skin-wrap .mini-cal-title {
    font-size: 12px;
    font-weight: bold;
    color: var(--diary-text);
    letter-spacing: 1px;
}
#diary-skin-wrap .mini-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    text-align: center;
    font-size: 10px;
}
#diary-skin-wrap .mini-cal-header {
    font-weight: bold;
    color: var(--diary-text-muted);
    padding-bottom: 4px;
}
#diary-skin-wrap .mini-cal-header.sun { color: var(--diary-sunday); }
#diary-skin-wrap .mini-cal-header.sat { color: var(--diary-accent); }

#diary-skin-wrap .mini-cal-cell {
    padding: 0;
    color: var(--diary-text-secondary);
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}
#diary-skin-wrap .mini-cal-cell.sun { color: var(--diary-sunday); }
#diary-skin-wrap .mini-cal-cell.sat { color: var(--diary-accent); }

#diary-skin-wrap a.mini-cal-cell.has-post {
    font-weight: bold;
    background: var(--diary-border);
    text-decoration: none;
    cursor: pointer;
}
#diary-skin-wrap a.mini-cal-cell.has-post:hover {
    background: color-mix(in srgb, var(--diary-border) 85%, #000000 15%);
}

/* 태그 및 TO-DO LIST 박스 공통 간격 및 스타일 */
#diary-skin-wrap .todo-box {
    margin-bottom: 15px;
    background-color: var(--diary-surface);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid var(--diary-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#diary-skin-wrap .todo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    color: var(--diary-text);
    margin-bottom: 8px;
    font-size: 12px;
    border-bottom: 1px solid var(--diary-chip-bg);
    padding-bottom: 6px;
}
#diary-skin-wrap .btn-add-todo {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    padding: 0;
}
#diary-skin-wrap .todo-form {
    display: none;
    margin-bottom: 8px;
}
#diary-skin-wrap .todo-input {
    width: 100%;
    padding: 5px;
    border: 1px solid var(--diary-border-strong);
    border-radius: 4px;
    font-size: 11px;
    box-sizing: border-box;
    outline: none;
    background: var(--diary-surface);
    color: var(--diary-text);
}
#diary-skin-wrap .todo-content {
    font-size: 11px;
    color: var(--diary-text);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
#diary-skin-wrap .todo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px;
    border-radius: 4px;
}
#diary-skin-wrap .todo-item:hover {
    background-color: var(--diary-surface-alt);
}
#diary-skin-wrap .todo-item label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#diary-skin-wrap .todo-item input[type="checkbox"] {
    cursor: pointer;
}
#diary-skin-wrap .todo-item.done span {
    text-decoration: line-through;
    color: var(--diary-text-muted);
}
#diary-skin-wrap .btn-del-todo {
    color: var(--diary-border-strong);
    text-decoration: none;
    font-size: 10px;
    padding-left: 6px;
}
#diary-skin-wrap .btn-del-todo:hover { color: var(--diary-sunday); }

/* 우측 메인 영역 */
#diary-skin-wrap .main-calendar {
    flex: 1;
    margin-top: 8px;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
#diary-skin-wrap .theme-switcher-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 18px;
    flex-shrink: 0;
}
#diary-skin-wrap .top-action-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
}
#diary-skin-wrap .action-btn {
    padding: 5px 12px;
    background-color: var(--diary-accent);
    border: 1px solid var(--diary-accent); 
    border-radius: 20px;
    font-size: 12px;
    color: var(--diary-accent-text); 
    text-decoration: none;
    font-weight: bold; 
    transition: all 0.2s ease; 
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#diary-skin-wrap .action-btn:hover { 
    background-color: var(--diary-accent-hover); 
    border-color: var(--diary-accent-hover);
    color: var(--diary-accent-text);
}

#diary-skin-wrap .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    border-top: 1px solid var(--diary-border); 
    border-left: 1px solid var(--diary-border); 
    background-color: transparent;
}
#diary-skin-wrap .day-header {
    background-color: var(--diary-surface);
    text-align: center;
    font-size: 11px;
    color: var(--diary-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    font-weight: 600;
    box-shadow: inset -1px -1px 0 0 var(--diary-border);
}
#diary-skin-wrap .day-header.sun { color: var(--diary-sunday); }
#diary-skin-wrap .day-header.sat { color: var(--diary-accent); }

/* 날짜 칸 기본 구조 */
#diary-skin-wrap .day-cell {
    background-color: var(--diary-surface);
    padding: 4px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    box-shadow: inset -1px -1px 0 0 var(--diary-border); 
}

/* 상단에 고정되는 날짜 숫자 */
#diary-skin-wrap .date-num {
    font-size: 11px;
    color: var(--diary-text-secondary);
    margin-bottom: 3px;
    font-weight: bold;
    flex-shrink: 0;
}
#diary-skin-wrap .date-num.sun { color: var(--diary-sunday); }
#diary-skin-wrap .date-num.sat { color: var(--diary-accent); }

#diary-skin-wrap .day-posts-wrap {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#diary-skin-wrap .post-link {
    font-size: 10px;
    color: var(--diary-text);
    text-decoration: none;
    background-color: var(--diary-chip-bg);
    padding: 2px 4px;
    border-radius: 3px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    flex-shrink: 0;
}
#diary-skin-wrap .post-link:hover { background-color: var(--diary-border); }

/* ==========================================================================
   공통 확장 스타일
   ========================================================================== */

/* 사이드바 TAGS 박스 */
#diary-skin-wrap .sidebar-tag-link {
    display: inline !important;
    text-decoration: none !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    color: var(--diary-text-secondary) !important;
    font-weight: normal !important;
}
#diary-skin-wrap .sidebar-tag-link.active {
    color: var(--diary-accent-hover) !important;
    font-weight: bold !important;
}

/* 본문 안의 #해시태그 칩 디자인 */
.view-tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 10px;
    background: var(--diary-accent, #3b82f6);
    color: var(--diary-accent-text, #fff);
    border-radius: 4px;
    text-decoration: none;
    margin-right: 4px;
    margin-bottom: 4px;
    transition: background 0.2s;
}
.view-tag-chip:hover, .view-tag-chip.active {
    background: var(--diary-accent-hover, #2563eb);
    color: var(--diary-accent-text, #fff);
}

/* 카테고리 네비게이션 */
#bo_cate_custom {
    width: 100%;
    max-width: 920px;
    margin: 0 auto 15px auto;
    box-sizing: border-box;
}
#bo_cate_custom h2 {
    position: absolute;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
}
#bo_cate_custom ul {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}
#bo_cate_custom ul li a {
    display: block;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--diary-text-secondary, #475569);
    background: var(--diary-surface, #fff);
    border: 1px solid var(--diary-border-strong, #cbd5e1);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s;
}
#bo_cate_custom ul li.active a {
    color: var(--diary-accent-text, #fff);
    background: var(--diary-accent, #3b82f6);
    border-color: var(--diary-accent, #3b82f6);
    font-weight: bold;
}
#bo_cate_custom ul li a:hover {
    background: var(--diary-surface-alt, #f1f5f9);
}

/* 잠긴(회원공개/비밀글) 글 표시용 안내 문구 */
.locked-post-notice {
    text-align: center;
    padding: 60px 20px;
    color: var(--diary-text-secondary, #64748b);
    font-size: 13px;
    background: var(--diary-surface-alt, #f8fafc);
    border-radius: 8px;
    border: 1px dashed var(--diary-border-strong, #cbd5e1);
}
.locked-post-notice a {
    color: var(--diary-accent, #3b82f6);
    font-weight: bold;
    text-decoration: underline;
}

/* 체크 권한이 없는 게스트/일반회원에게 보여지는 비활성 체크박스 표시 */
#diary-skin-wrap .todo-item input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============================================================
   모바일 반응형 레이아웃 (달력/피드 페이지 - list.skin.php)
   ============================================================ */
@media (max-width: 768px) {
    #diary-skin-wrap {
        width: 100%;
        max-width: 100%;
        display: flex;
        flex-direction: column;
        padding: 14px 12px;
        box-sizing: border-box;
    }

    #diary-skin-wrap .sidebar,
    #diary-skin-wrap .main-calendar {
        display: contents;
    }

    #diary-skin-wrap .sidebar-header { order: 1; margin-bottom: 10px; }
    #diary-skin-wrap .mini-calendar-box { order: 2; margin-bottom: 10px; }
    #diary-skin-wrap .theme-switcher-row { order: 3; margin-bottom: 6px; }
    #diary-skin-wrap .top-action-bar { order: 3; margin-bottom: 10px; flex-wrap: wrap; }
    #diary-skin-wrap .tag-filter-banner { order: 4; }
    #diary-skin-wrap .calendar-body,
    #diary-skin-wrap .calendar-grid { order: 5; margin-bottom: 15px !important; }

    #diary-skin-wrap #tagsBox { order: 6; margin-bottom: 15px !important; }
    #diary-skin-wrap #todoBox { order: 7; margin-bottom: 15px !important; }
    #diary-skin-wrap #moodBox { order: 8; margin-bottom: 0 !important; }

    #diary-skin-wrap .mini-cal-grid {
        display: none;
    }
    #diary-skin-wrap .mini-cal-title-bar {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
        justify-content: center;
        gap: 14px;
    }
    #diary-skin-wrap .mini-cal-title {
        font-size: 14px;
    }

    #diary-skin-wrap .sidebar-header {
        border-bottom: 2px solid var(--diary-text);
        padding-bottom: 8px;
    }

    #diary-skin-wrap .calendar-grid {
        width: 100%;
        grid-template-rows: 24px repeat(6, 70px) !important; 
    }
    
    #diary-skin-wrap .day-cell {
        height: 70px !important;
        min-height: 70px !important;
    }
} 

#diary-skin-wrap {
    align-items: stretch !important;
}
#diary-skin-wrap .sidebar {
    padding-top: 20px !important;
}
#diary-skin-wrap .main-calendar {
    padding-top: 20px !important;
    margin-top: 0 !important;
}

#diary-skin-wrap .sidebar-header {
    height: 62px !important;
    box-sizing: border-box !important;
    margin-bottom: 15px !important;
    padding-bottom: 10px !important;
    display: flex !important;
    align-items: baseline !important;
}

#diary-skin-wrap .main-calendar > .theme-switcher-row {
    height: 24px !important;
    margin-bottom: 6px !important;
}
#diary-skin-wrap .main-calendar > .top-action-bar {
    height: 32px !important;
    margin-bottom: 15px !important;
}

#diary-skin-wrap .main-calendar .calendar-grid,
#diary-skin-wrap .main-calendar .calendar-body,
#diary-skin-wrap .main-calendar > div:last-child {
    margin-top: 0 !important;
}

/* ==========================================================================
   페이징 (목차 넘기는 버튼) 테마 스타일
   ========================================================================== */
#diary-skin-wrap .pg_wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
}

#diary-skin-wrap .pg {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

#diary-skin-wrap .pg_wrap a,
#diary-skin-wrap .pg_page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    font-size: 12px;
    text-decoration: none;
    box-sizing: border-box;
    border-radius: 4px;
    background-color: var(--diary-pg-bg);
    border: 1px solid var(--diary-pg-border);
    color: var(--diary-pg-text);
    transition: all 0.2s ease;
}

#diary-skin-wrap .pg_wrap a:hover,
#diary-skin-wrap .pg_page:hover {
    background-color: var(--diary-pg-hover-bg);
    border-color: var(--diary-pg-hover-border);
    color: var(--diary-pg-hover-text);
}

#diary-skin-wrap .pg_current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: bold;
    box-sizing: border-box;
    border-radius: 4px;
    background-color: var(--diary-pg-current-bg);
    border: 1px solid var(--diary-pg-current-border);
    color: var(--diary-pg-current-text);
}

/* ==========================================================================
   상단 검색 영역 슬라이딩 스타일
   ========================================================================== */
#diary-skin-wrap .search-container {
    display: flex;
    align-items: center;
}

#diary-skin-wrap .search-input-wrap {
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
}

#diary-skin-wrap .search-container.active .search-input-wrap {
    width: 170px;
    opacity: 1;
    margin-right: 6px;
}

#diary-skin-wrap .diary-search-input {
    width: 100%;
    height: 28px;
    padding: 0 12px;
    font-size: 11px;
    border: 1px solid var(--diary-border-strong);
    border-radius: 20px;
    background: var(--diary-surface);
    color: var(--diary-text);
    box-sizing: border-box;
}

#diary-skin-wrap .diary-search-input:focus,
#diary-skin-wrap .diary-search-input:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border-color: var(--diary-border-strong) !important;
}


/* ============================================================
   1. 달력의 빈 칸 (1~말일에 해당하지 않는 앞뒤 여백 칸)
   빗금 + 살짝 어두운 배경. 이미지도 JS도 쓰지 않고 CSS만 쓰므로
   추가 요청이 0건이고 렌더링 부담도 없다.
   색은 color-mix 로 잡아서 라이트/다크 테마 양쪽에서 자연스럽게 나온다.
   ============================================================ */
#diary-skin-wrap .day-cell.empty {
    position: relative;
    background-color: color-mix(in srgb, var(--diary-surface) 91%, var(--diary-text) 9%);
    background-image: repeating-linear-gradient(
        45deg,
        transparent 0px,
        transparent 6px,
        color-mix(in srgb, transparent 88%, var(--diary-text) 12%) 6px,
        color-mix(in srgb, transparent 88%, var(--diary-text) 12%) 8px
    );
}

/* color-mix 를 모르는 옛 브라우저용 대비값 */
@supports not (background-color: color-mix(in srgb, red 50%, blue)) {
    #diary-skin-wrap .day-cell.empty {
        background-color: rgba(128, 128, 128, 0.08);
        background-image: repeating-linear-gradient(
            45deg,
            transparent 0px, transparent 6px,
            rgba(128, 128, 128, 0.15) 6px, rgba(128, 128, 128, 0.15) 8px
        );
    }
}


/* ============================================================
   2. 댓글 이미지
   높이만 맞춰 한 줄로 늘어놓고, 댓글 폭을 넘으면 다음 줄로 넘긴다.
   가로는 원본 비율대로 두므로 잘리는 부분이 없다.
   높이를 바꾸고 싶으면 --diary-cimg-h 한 곳만 고치면 된다.
   ============================================================ */
.diary-cimg-grid {
    --diary-cimg-h: 130px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 4px;
    margin: 8px 0 2px 0;
}
.diary-cimg-cell {
    display: block;
    line-height: 0;
    text-decoration: none;
    border-radius: 8px;
    overflow: hidden;
    background: var(--diary-surface-alt);
}
.diary-cimg-cell img {
    display: block;
    height: var(--diary-cimg-h);
    width: auto;
    /* 아주 가로로 긴 이미지 한 장이 줄을 다 잡아먹지 않도록 */
    max-width: 100%;
    object-fit: contain;
}

.diary-cmt-text { margin-bottom: 2px; }

.diary-cmt-locked-notice {
    margin-top: 15px;
    padding: 10px 12px;
    background: var(--diary-surface-alt);
    border: 1px dashed var(--diary-border-strong);
    border-radius: 6px;
    font-size: 11px;
    color: var(--diary-text-muted);
    text-align: center;
}

@media (max-width: 768px) {
    .diary-cimg-grid { --diary-cimg-h: 100px; }
}


/* ============================================================
   3. 본문 스티커
   위치/크기는 전부 % 라서 화면 폭이 달라져도 같은 자리에 붙어 있다.
   보기 상태에서는 pointer-events 를 꺼서 본문 링크를 가리지 않는다.
   움직임은 transform 만 쓰므로 브라우저가 GPU로 처리한다.
   ============================================================ */
#diaryStickerStage { position: relative; }

#diaryStickerLayer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
    z-index: 3;
    /* 글자 스티커 크기를 이 영역 너비 기준(cqw)으로 잡기 위한 설정.
       화면 폭이 달라져도 글자와 이미지가 같은 비율로 따라온다. */
    container-type: inline-size;
}

#diaryStickerLayer .ds-item {
    position: absolute;
    transform-origin: 50% 50%;
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
}
#diaryStickerLayer .ds-item img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* --- 편집 모드 --- */
#diaryStickerLayer.ds-edit { pointer-events: auto; }
#diaryStickerLayer.ds-edit .ds-item {
    cursor: move;
    outline: 1px dashed color-mix(in srgb, var(--diary-accent) 70%, transparent);
    outline-offset: 2px;
}
#diaryStickerLayer.ds-edit .ds-item.ds-selected {
    outline: 2px solid var(--diary-accent);
}
#diaryStickerLayer.ds-dragging { cursor: grabbing; }

#diaryStickerLayer .ds-handles { position: absolute; inset: 0; }
#diaryStickerLayer .ds-handle {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--diary-accent);
    color: var(--diary-accent-text);
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    touch-action: none;
}
#diaryStickerLayer .ds-h-del  { top: -9px; left: -9px; background: var(--diary-sunday); }
#diaryStickerLayer .ds-h-rot  { top: -9px; right: -9px; cursor: alias; }
#diaryStickerLayer .ds-h-size { bottom: -9px; right: -9px; cursor: nwse-resize; }

/* --- 편집 툴바 --- */
#diaryStickerBar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 12px;
    padding: 8px 10px;
    background: var(--diary-surface-alt);
    border: 1px solid var(--diary-border);
    border-radius: 6px;
}
#diaryStickerBar .ds-bar-btn,
#calStampBar .ds-bar-btn {
    height: 26px;
    padding: 0 10px;
    font-size: 11px;
    background: var(--diary-surface);
    color: var(--diary-text);
    border: 1px solid var(--diary-border-strong);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}
#diaryStickerBar .ds-bar-btn.ds-primary,
#calStampBar .ds-bar-btn.ds-primary {
    background: var(--diary-accent);
    color: var(--diary-accent-text);
    border-color: var(--diary-accent);
    font-weight: bold;
}
#diaryStickerBar .ds-bar-btn.ds-danger,
#calStampBar .ds-bar-btn.ds-danger {
    color: var(--diary-sunday);
    border-color: var(--diary-sunday);
}
#diaryStickerBar .ds-bar-input,
#calStampBar .ds-bar-input {
    height: 26px;
    width: 220px;
    max-width: 100%;
    padding: 0 6px;
    font-size: 11px;
    background: var(--diary-surface);
    color: var(--diary-text);
    border: 1px solid var(--diary-border-strong);
    border-radius: 4px;
    box-sizing: border-box;
}
#diaryStickerBar .ds-bar-label,
#calStampBar .ds-bar-label { font-size: 11px; color: var(--diary-text); white-space: nowrap; }
#diaryStickerBar .ds-bar-sep,
#calStampBar .ds-bar-sep { width: 1px; height: 16px; background: var(--diary-border-strong); }
#diaryStickerBar .ds-bar-hint,
#calStampBar .ds-bar-hint { font-size: 10px; color: var(--diary-text-muted); }

/* 모바일에서는 스티커를 아예 보여주지 않는다.
   좁은 화면에선 스티커가 글자를 가려서 오히려 지저분해지기 때문에,
   모바일은 본문만 깔끔하게 보여준다.
   이미지 요청 자체도 안 나가도록 view.skin.php 에서 data-src 로 처리한다. */
@media (max-width: 768px) {
    #diaryStickerBar { display: none !important; }
    #diaryStickerLayer { display: none !important; }
}


/* ============================================================
   달력 빈 칸에 찍는 도장(스티커)
   칸이 overflow:hidden 이라 가장자리는 자연스럽게 잘린다.
   ============================================================ */
#diary-skin-wrap .day-cell.empty .ds-stamp {
    position: absolute;
    left: 50%;
    top: 50%;
    height: auto;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* 꾸미기 모드일 때만 빈 칸이 클릭 대상처럼 보이게 */
#diary-skin-wrap .calendar-grid.cs-edit .day-cell.empty {
    cursor: copy;
}
#diary-skin-wrap .calendar-grid.cs-edit .day-cell.empty:hover {
    outline: 2px solid var(--diary-accent);
    outline-offset: -2px;
}

/* --- 빈칸 꾸미기 툴바 --- */
#calStampBar {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: var(--diary-surface-alt);
    border: 1px solid var(--diary-border);
    border-radius: 6px;
}
#calStampBar .cs-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    width: 100%;
}

/* 자주 쓰는 스티커 팔레트 (달력 / 글보기 공용) */
.cs-palette {
    display: flex;
    align-items: flex-start;
    align-content: flex-start;
    gap: 4px;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 0;
    /* 스티커가 많아지면 세로로 끝없이 늘어나는 대신 이 안에서 스크롤한다 */
    max-height: 108px;
    overflow-y: auto;
    overflow-x: hidden;
}
/* 스크롤바를 얇게 (지원하는 브라우저에서만 적용된다) */
.cs-palette { scrollbar-width: thin; }
.cs-palette::-webkit-scrollbar { width: 6px; }
.cs-palette::-webkit-scrollbar-thumb {
    background: var(--diary-border-strong);
    border-radius: 3px;
}
.cs-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 2px;
    background: var(--diary-surface);
    border: 1px solid var(--diary-border-strong);
    border-radius: 5px;
    cursor: pointer;
    box-sizing: border-box;
}
.cs-chip img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    pointer-events: none;
}
.cs-chip.cs-chip-on {
    border-color: var(--diary-accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--diary-accent) 35%, transparent);
}
.cs-chip.cs-chip-bad { border-style: dashed; opacity: 0.45; }
.cs-chip b {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 15px;
    height: 15px;
    line-height: 15px;
    text-align: center;
    font-size: 9px;
    font-weight: normal;
    border-radius: 50%;
    background: var(--diary-sunday);
    color: #fff;
    opacity: 0;
    transition: opacity 0.12s;
}
.cs-chip:hover b { opacity: 1; }

@media (max-width: 768px) {
    #calStampBar { display: none !important; }
}


/* ============================================================
   기분 통계 (사이드바)
   달력에 이미 쓰고 있는 이번 달 조회 결과를 그대로 세는 것이라
   쿼리가 새로 늘지 않는다.
   ============================================================ */
.mood-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.mood-face {
    flex: 0 0 auto;
    width: 18px;
    text-align: center;
    font-size: 13px;
    line-height: 1;
}
.mood-bar {
    flex: 1 1 auto;
    height: 8px;
    min-width: 0;
    border-radius: 4px;
    background: color-mix(in srgb, var(--diary-border) 60%, transparent);
    overflow: hidden;
}
.mood-bar i {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--diary-accent);
}
.mood-num {
    flex: 0 0 auto;
    min-width: 14px;
    text-align: right;
    font-size: 10px;
    color: var(--diary-text-muted);
}
.mood-total {
    margin-top: 6px;
    padding-top: 5px;
    border-top: 1px dashed var(--diary-border);
    font-size: 9.5px;
    color: var(--diary-text-muted);
    text-align: right;
}

/* ============================================================
   스티커 이름표 / 주소 미리보기
   ============================================================ */
.cs-chip.cs-chip-named {
    width: auto;
    min-width: 34px;
    max-width: 62px;
    height: auto;
    flex-direction: column;
    gap: 1px;
    padding: 3px;
}
.cs-chip.cs-chip-named img { width: 28px; height: 28px; }
.cs-chip i {
    display: block;
    max-width: 56px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 9px;
    font-style: normal;
    line-height: 1.2;
    color: var(--diary-text-muted);
}
.cs-chip.cs-chip-on i { color: var(--diary-text); }

.ds-bar-input-sm { width: 110px !important; }

/* 주소를 넣는 순간 옆에 뜨는 작은 미리보기. 오타를 바로 알아챌 수 있다. */
.diary-url-preview {
    display: none;
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--diary-border-strong);
    border-radius: 4px;
    background: var(--diary-surface);
    overflow: hidden;
}
.diary-url-preview.on { display: inline-flex; }
.diary-url-preview.bad { border-style: dashed; border-color: var(--diary-sunday); }
.diary-url-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ============================================================
   반복되던 인라인 스타일을 클래스로 옮긴 것.
   선언 내용은 원래 있던 그대로이고 위치만 여기로 왔다.
   색이나 여백을 바꿀 때 HTML 을 뒤지지 않아도 된다.
   ============================================================ */
.dm-01 {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.dm-03 {
    margin-bottom: 15px;
}
.dm-04 {
    font-size: 10px;
    color: var(--diary-text-muted);
}
.dm-05 {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dm-06 {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.dm-10 {
    color:var(--diary-text-muted);
    display: inline;
}
.dm-12 {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dm-13 {
    background: var(--diary-surface-alt);
    border: 1px solid var(--diary-border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-sizing: border-box;
}
.dm-14 {
    width: 180px;
}


/* 글보기 스티커 툴바: 한 줄씩 쌓아서 팔레트가 가로로 펴지게 한다 */
#diaryStickerBar .ds-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    width: 100%;
}
#diaryStickerBar .ds-palette-row {
    align-items: flex-start;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--diary-border);
}
#diaryStickerBar .ds-palette-row .ds-bar-label {
    padding-top: 8px;
    flex: 0 0 auto;
}
#dsEditTools {
    display: none;           /* 편집을 켜면 JS 가 flex 로 바꾼다 */
    flex-direction: column;
    gap: 6px;
    width: 100%;
}
#diaryStickerBar .ds-bar-input { flex: 1 1 200px; min-width: 140px; }


/* ============================================================
   글자 스티커
   이미지 스티커와 같은 방식으로 옮기고 돌리고 크기를 바꾼다.
   다른 점은 "폭"이 아니라 "글자 크기"가 바뀐다는 것뿐이다.
   ============================================================ */
#diaryStickerLayer .ds-item.ds-text {
    width: auto;
    max-width: 92%;
    /* 긴 문장은 스티커 영역 안에서 알아서 줄이 바뀐다 */
    white-space: pre-wrap;
    word-break: keep-all;
    line-height: 1.25;
    text-align: center;
}

/* 편집 중에는 글자도 잡기 편하도록 여백을 조금 준다 */
#diaryStickerLayer.ds-edit .ds-item.ds-text {
    padding: 2px 4px;
}

/* --- 툴바에 새로 생긴 색/폰트 조절칸 --- */
#diaryStickerBar .ds-bar-color {
    width: 26px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--diary-border-strong);
    border-radius: 4px;
    background: var(--diary-surface);
    cursor: pointer;
    vertical-align: middle;
}
#diaryStickerBar .ds-bar-select {
    height: 24px;
    padding: 0 4px;
    font-size: 11px;
    background: var(--diary-surface);
    color: var(--diary-text);
    border: 1px solid var(--diary-border-strong);
    border-radius: 4px;
    vertical-align: middle;
    cursor: pointer;
}
#diaryStickerBar #dsTextInput { flex: 1 1 180px; min-width: 130px; }


/* 글자 스티커 테두리.
   글자 크기(em) 기준이라 크게 키워도 굵기가 자연스럽게 따라온다.
   text-shadow 를 여덟 방향으로 깔아 만든다 (-webkit-text-stroke 는
   글자 안쪽을 파먹어서 얇은 서체가 가늘어 보인다). */
#diaryStickerLayer .ds-item.ds-out-w {
    text-shadow:
        -0.05em -0.05em 0 #fff,  0     -0.05em 0 #fff,  0.05em -0.05em 0 #fff,
        -0.05em  0     0 #fff,                          0.05em  0     0 #fff,
        -0.05em  0.05em 0 #fff,  0      0.05em 0 #fff,  0.05em  0.05em 0 #fff;
}
#diaryStickerLayer .ds-item.ds-out-b {
    text-shadow:
        -0.05em -0.05em 0 #000,  0     -0.05em 0 #000,  0.05em -0.05em 0 #000,
        -0.05em  0     0 #000,                          0.05em  0     0 #000,
        -0.05em  0.05em 0 #000,  0      0.05em 0 #000,  0.05em  0.05em 0 #000;
}
