/* ================================================================
   웅녀범이 자유게시판 - board.css  v1.0.0
   ================================================================ */

/* ── 웹폰트 (Google Fonts 무료) ──────────────────────────────
   나눔명조: 본문용 (바탕체 계열)
   나눔고딕: 제목용 (굴림체 계열)
   ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Nanum+Gothic:wght@400;700;800&family=Nanum+Myeongjo:wght@400;700;800&display=swap');

/* ── 변수 ──────────────────────────────────────────────────── */
:root {
    --ung-primary:   #2d6a4f;
    --ung-primary-d: #1b4332;
    --ung-accent:    #95d5b2;
    --ung-bg:        #f8fdf9;
    --ung-border:    #d8e8df;
    --ung-text:      #333;
    --ung-sub:       #777;
    --ung-notice-bg: #edf7f2;
    --ung-radius:    6px;
    /* 본문: 나눔명조 / 제목: 나눔고딕 */
    --ung-font:        'Nanum Myeongjo', 'Batang', '바탕', serif;
    --ung-font-title:  'Nanum Gothic', 'Malgun Gothic', '맑은 고딕', sans-serif;
}

/* ── 래퍼 ──────────────────────────────────────────────────── */
.ung-board-wrap {
    max-width: 800px !important;
    width: 100%;
    margin: 0 auto !important;
    padding: 10px 16px 40px;
    box-sizing: border-box;
    font-family: var(--ung-font);
    font-size: 14px;
    color: var(--ung-text);
    line-height: 1.6;
}

/* ── 제목 ──────────────────────────────────────────────────── */
.ung-board-title {
    font-family: var(--ung-font-title);
    font-size: 22px;
    font-weight: 800;
    color: var(--ung-primary);
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--ung-primary);
}

/* ── 카테고리 탭 ──────────────────────────────────────────── */
.ung-board-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
    align-items: center;
}

/* 연재 탭 앞 구분선 */
.ung-series-tab:first-of-type {
    margin-left: 6px;
    padding-left: 10px;
    border-left: 1px solid var(--ung-border) !important;
}

/* ── 연재 탭 (목록 화면) ────────────────────── */
/* 기본 카테고리 탭과 같은 모양이지만 📚 아이콘 포함 */
.ung-series-tab {
    background: #e8f5e9 !important;
    color: #2d6a4f !important;
}
.ung-series-tab.active,
.ung-series-tab:hover {
    background: var(--ung-primary) !important;
    color: #fff !important;
}

/* ── 회차 목록 패널 (글 보기 화면) ─────────── */
.ung-series-panel {
    border: 1px solid #d4edda;
    border-radius: 10px;
    margin: 24px 0;
    overflow: hidden;
}

/* 패널 헤더 버튼 */
.ung-series-panel-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f0faf3;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    color: #2d6a4f;
    font-family: var(--ung-font);
    transition: background .15s;
}
.ung-series-panel-toggle:hover { background: #d4edda; }
.ung-series-panel-icon { font-size: 12px; transition: transform .2s; }
.ung-series-panel-toggle[aria-expanded="true"] .ung-series-panel-icon {
    transform: rotate(180deg); /* 펼쳐졌을 때 화살표 반전 */
}

/* 패널 본문 — 회차 목록 */
.ung-series-panel-body {
    padding: 8px 0;
    max-height: 300px;
    overflow-y: auto;
}
.ung-series-episode-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.ung-series-episode-item {
    padding: 0;
}
.ung-series-episode-item a,
.ung-series-episode-item > span.ung-ep-num {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    text-decoration: none;
    color: var(--ung-text);
    font-size: 14px;
    transition: background .12s;
}
.ung-series-episode-item a:hover { background: #f0faf3; }

/* 현재 회차 강조 */
.ung-series-episode-item.current {
    background: #e8f5e9;
}
.ung-series-episode-item.current > * {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    font-weight: 700;
    color: #2d6a4f;
}
.ung-ep-num {
    background: var(--ung-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}
.ung-ep-title { flex: 1; }
.ung-ep-current-mark {
    font-size: 11px;
    color: var(--ung-primary);
    flex-shrink: 0;
}

/* 글쓰기 연재명 입력 */
.ung-series-name-input {
    width: 200px !important;
}

.ung-series-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.ung-series-check-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
    color: var(--ung-text);
}
.ung-series-check-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--ung-primary);
}
.ung-series-fields {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.ung-series-num-input {
    width: 90px !important;
}
.ung-series-title-input {
    width: 220px !important;
}
.ung-series-unit {
    font-size: 13px;
    color: var(--ung-sub);
    white-space: nowrap;
}

/* 목록 회차 배지 */
.ung-series-badge {
    display: inline-block;
    background: var(--ung-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    margin-right: 5px;
    vertical-align: middle;
    white-space: nowrap;
}

/* 글 보기 회차 헤더 */
.ung-series-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.ung-series-badge-lg {
    font-size: 13px;
    padding: 3px 10px;
    border-radius: 6px;
}
.ung-series-header-title {
    font-size: 15px;
    color: var(--ung-sub);
    font-weight: 500;
}

.ung-cat-btn {
    display: inline-block;
    padding: 3px 11px;
    border: 1px solid var(--ung-border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--ung-sub);
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}

.ung-cat-btn:hover,
.ung-cat-btn.active {
    background: var(--ung-primary);
    border-color: var(--ung-primary);
    color: #fff;
}

/* ── 검색 폼 ────────────────────────────────────────────────── */
.ung-board-search {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    align-items: center;
}

.ung-board-search input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--ung-border);
    border-radius: var(--ung-radius);
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}

.ung-board-search input[type="text"]:focus {
    border-color: var(--ung-primary);
}

.ung-board-search button {
    padding: 8px 20px !important;
    background: var(--ung-primary) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--ung-radius) !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: background .15s !important;
    white-space: nowrap !important;
}
.ung-board-search button:hover {
    background: var(--ung-primary-d) !important;
}

.ung-search-reset {
    font-size: 12px;
    color: var(--ung-sub);
    text-decoration: none;
    white-space: nowrap;
}

.ung-search-reset:hover {
    color: #c00;
}

/* ── 상단 액션 영역 ─────────────────────────────────────────── */
.ung-board-top-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 10px;
}

.ung-login-notice {
    font-size: 13px;
    color: var(--ung-sub);
}

.ung-login-notice a {
    color: var(--ung-primary);
    font-weight: 600;
}

/* ── 버튼 공통 ──────────────────────────────────────────────── */
/* ── Astra 테마 버튼 색상 오버라이드
   Astra 가 전역 button { background: 테마색 } 을 적용하므로
   .ung-board-wrap 범위 안의 버튼에만 타깃 리셋을 적용 ── */
.ung-board-wrap button:not([class*="ck-"]) {
    background: transparent;
    color: inherit;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    cursor: pointer;
}

.ung-btn {
    display: inline-block;
    padding: 8px 22px;
    border-radius: var(--ung-radius);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background .15s;
}

/* 각 버튼별 색상을 !important 로 명시 — 테마 간섭 방지 */
.ung-btn-write {
    background: var(--ung-primary) !important;
    color: #fff !important;
}
.ung-btn-write:hover { background: var(--ung-primary-d) !important; }

/* ── 표 너비 100% 강제 ───────────────────────────────────────── */
.ck-content .table {
    width: 100% !important;
    margin: 1em 0 !important;
}
.ck-content .table table {
    width: 100% !important;
    border-collapse: collapse;
}
.ck-content .table table td,
.ck-content .table table th {
    border: 1px solid #ccc;
    padding: 6px 10px;
    min-width: 60px;
    vertical-align: top;
}
.ck-content .table table th {
    background: #f4f4f4;
    font-weight: 700;
}

/* 글 보기에서도 표 너비 100% */
.ung-view-content .table {
    width: 100% !important;
    overflow-x: auto;
}
.ung-view-content .table table {
    width: 100% !important;
}

/* ── 게시글 테이블 ───────────────────────────────────────────── */
.ung-board-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.ung-board-table thead th {
    background: var(--ung-bg);
    border-top: 2px solid var(--ung-primary);
    border-bottom: 1px solid var(--ung-border);
    padding: 10px 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #444;
    white-space: nowrap;
}

.ung-board-table tbody td {
    border-bottom: 1px solid #eee;
    padding: 10px 8px;
    vertical-align: middle;
    font-size: 14px;
}

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

/* 열 너비 */
.ung-board-table .col-num    { width: 60px;  text-align: center; }
.ung-board-table .col-cat    { width: 72px;  text-align: center; }
.ung-board-table .col-title  { /* 나머지 */                       }
.ung-board-table .col-author { width: 90px;  text-align: center; }
.ung-board-table .col-date   { width: 90px;  text-align: center; }
.ung-board-table .col-view   { width: 56px;  text-align: center; }

/* 제목 링크 */
.ung-board-table .col-title a {
    font-family: var(--ung-font-title);
    color: var(--ung-text);
    text-decoration: none;
    font-weight: 700;
}

.ung-board-table .col-title a:hover {
    color: var(--ung-primary);
    text-decoration: underline;
}

/* 공지 행 */
.ung-notice-row td {
    background: var(--ung-notice-bg) !important;
}

/* 공지 뱃지 */
.ung-notice-badge {
    display: inline-block;
    background: var(--ung-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
    letter-spacing: 0.03em;
}

/* 카테고리 태그 */
.ung-cat-tag {
    display: inline-block;
    background: #edf7f2;
    color: var(--ung-primary);
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 3px;
    border: 1px solid var(--ung-accent);
}

/* 글 없음 */
.ung-no-posts {
    text-align: center !important;
    padding: 50px 0 !important;
    color: #aaa;
    font-size: 14px;
}

/* ── 하단 푸터 (전체 수 + 페이지네이션) ────────────────────── */
.ung-board-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
    gap: 10px;
}

.ung-total-count {
    font-size: 12px;
    color: #aaa;
}

/* ── 페이지네이션 ────────────────────────────────────────────── */
.ung-pagination {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.ung-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border: 1px solid var(--ung-border);
    border-radius: var(--ung-radius);
    color: var(--ung-sub);
    text-decoration: none;
    font-size: 13px;
    transition: all .15s;
}

.ung-page-btn:hover,
.ung-page-btn.current {
    background: var(--ung-primary);
    border-color: var(--ung-primary);
    color: #fff;
    font-weight: 700;
}

.ung-page-prev,
.ung-page-next {
    font-size: 16px;
    font-weight: 700;
}

/* ── 모바일 최적화 ───────────────────────────────────────────── */
@media (max-width: 640px) {

    .ung-board-table .col-cat,
    .ung-board-table .col-author {
        display: none;
    }

    .ung-board-search {
        flex-wrap: wrap;
    }

    .ung-board-search input[type="text"] {
        width: 100%;
    }

    .ung-board-footer {
        flex-direction: column;
        align-items: center;
    }

    .ung-total-count {
        order: 2;
    }
}


/* ================================================================
   2단계 추가: 글쓰기 폼 스타일
   ================================================================ */

/* 알림 박스 */
.ung-notice {
    padding: 12px 16px;
    border-radius: var(--ung-radius);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 600;
}

.ung-notice-success {
    background: #d4edda;
    border: 1px solid #b2dfca;
    color: #1b5e37;
}

.ung-notice-error {
    background: #fdecea;
    border: 1px solid #f5c6cb;
    color: #7f1d1d;
}

/* 글쓰기 폼 전체 */
.ung-write-form {
    background: #fff;
    border: 1px solid var(--ung-border);
    border-radius: var(--ung-radius);
    padding: 28px 32px;
}

/* 폼 행 */
.ung-form-row {
    margin-bottom: 20px;
}

.ung-form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #444;
    margin-bottom: 7px;
}

.ung-required {
    color: #c0392b;
    margin-left: 2px;
}

/* 입력 필드 공통 */
.ung-form-input,
.ung-form-select,
.ung-form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--ung-border);
    border-radius: var(--ung-radius);
    font-size: 14px;
    font-family: var(--ung-font);
    color: var(--ung-text);
    box-sizing: border-box;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    background: #fff;
}

.ung-form-input:focus,
.ung-form-select:focus,
.ung-form-textarea:focus {
    border-color: var(--ung-primary);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.12);
}

/* select 박스 */
.ung-form-select {
    width: auto;
    min-width: 160px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    appearance: none;
    padding-right: 36px;
}

/* 본문 textarea */
.ung-form-textarea {
    min-height: 380px;
    resize: vertical;
    line-height: 1.8;
    padding: 14px;
}

/* 작성자 표시 */
.ung-write-meta {
    font-size: 13px;
    color: var(--ung-sub);
    margin-bottom: 20px;
    padding: 10px 14px;
    background: var(--ung-bg);
    border-radius: var(--ung-radius);
    border: 1px solid var(--ung-border);
}

.ung-write-meta strong {
    color: var(--ung-primary);
}

/* 버튼 영역 */
.ung-form-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 6px;
    border-top: 1px solid #eee;
    margin-top: 24px;
}

/* 취소 버튼 */
.ung-btn-cancel {
    background: #fff !important;
    color: #666 !important;
    border: 1px solid #ccc !important;
    padding: 9px 24px !important;
}
.ung-btn-cancel:hover {
    background: #f4f4f4 !important;
    border-color: #aaa !important;
}

/* 등록 버튼 */
.ung-btn-submit {
    background: var(--ung-primary) !important;
    color: #fff !important;
    border: none !important;
    padding: 9px 28px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    border-radius: var(--ung-radius) !important;
    cursor: pointer !important;
}
.ung-btn-submit:hover {
    background: var(--ung-primary-d) !important;
}

/* 모바일 글쓰기 */
@media (max-width: 640px) {
    .ung-write-form {
        padding: 20px 16px;
    }

    .ung-form-buttons {
        flex-direction: column-reverse;
    }

    .ung-btn-cancel,
    .ung-btn-submit {
        width: 100%;
        text-align: center;
    }
}


/* ================================================================
   3단계 추가: 글 보기 / 수정 스타일
   ================================================================ */

/* 삭제 알림 (파란색) */
.ung-notice-info {
    background: #e8f4fd;
    border: 1px solid #bee3f8;
    color: #1a4a6b;
}

/* ── 글 보기 헤더 ────────────────────────────────────────────── */
.ung-view-header {
    border-bottom: 2px solid var(--ung-border);
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.ung-view-title {
    font-family: var(--ung-font-title);
    font-size: 22px;
    font-weight: 800;
    color: #222;
    margin: 0 0 12px;
    line-height: 1.5;
    word-break: keep-all;
}

.ung-view-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    font-size: 16px;
    color: var(--ung-sub);
}

.ung-view-author { font-weight: 600; color: #444; }
.ung-view-updated { color: #aaa; font-size: 14px; }

/* 메타 줄 안의 목록 버튼 */
.ung-meta-list-btn {
    display: inline-block;
    background: var(--ung-primary);
    border: 1px solid var(--ung-primary);
    border-radius: 999px;
    padding: 5px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #fff !important;
    text-decoration: none;
    transition: background .15s;
    line-height: 1.4;
}
.ung-meta-list-btn:hover {
    background: var(--ung-primary-d);
    border-color: var(--ung-primary-d);
    color: #fff !important;
}

/* ── 글 본문 ─────────────────────────────────────────────────── */
.ung-view-content {
    font-family: var(--ung-font);
    min-height: 200px;
    padding: 24px 0;
    font-size: 16px;
    line-height: 1.9;
    color: #333;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.ung-view-content p  { margin: 0 0 1em; }
.ung-view-content img { max-width: 100%; height: auto; border-radius: 4px; }
.ung-view-content a  { color: var(--ung-primary); }
.ung-view-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}
.ung-view-content table td,
.ung-view-content table th {
    border: 1px solid #ddd;
    padding: 8px 12px;
}
.ung-view-content table th {
    background: var(--ung-bg);
    font-weight: 700;
}

/* ── 글 보기 하단 버튼 ───────────────────────────────────────── */
/* 좋아요 + 댓글 한 줄 바 */
.ung-engage-bar {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 12px;
    margin: 30px 0 0;
    flex-wrap: wrap;
}

.ung-like-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 9px !important;
    background: #fff !important;
    border: 1.5px solid #f3c6cf !important;
    border-radius: 999px !important;
    padding: 12px 28px !important;
    font-size: 15px !important;
    font-family: var(--ung-font) !important;
    color: #d36b7d !important;
    cursor: pointer !important;
    transition: background .2s, border-color .2s, color .2s, transform .1s !important;
    line-height: 1 !important;
}
.ung-like-btn:hover {
    border-color: #ff9aa8 !important;
    background: #fff6f8 !important;
}
.ung-like-btn:active { transform: scale(0.96); }
.ung-like-btn.liked {
    background: linear-gradient(135deg, #ff8fa3, #ff6b81) !important;
    border-color: #ff6b81 !important;
    color: #fff !important;
    font-weight: 700 !important;
    box-shadow: 0 3px 10px rgba(255, 107, 129, 0.35) !important;
}
.ung-like-btn:disabled { opacity: .7; cursor: default; }
.ung-like-heart {
    font-size: 18px;
    line-height: 1;
    color: #f0a9b5;
    transition: color .2s, transform .2s;
}
.ung-like-btn.liked .ung-like-heart { color: #fff; }
.ung-like-count { min-width: 14px; text-align: left; font-weight: 700; }
.ung-like-btn.pop .ung-like-heart { animation: ung-heart-pop 0.45s ease; }
@keyframes ung-heart-pop {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.5); }
    50%  { transform: scale(0.85); }
    70%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* 하단 버튼 영역 */
.ung-view-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.ung-view-actions-right { justify-content: flex-end; }
.ung-view-edit-btns { display: flex; gap: 8px; }

/* 목록 버튼 */
.ung-btn-list {
    background: var(--ung-primary) !important;
    color: #fff !important;
    border: 1.5px solid var(--ung-primary) !important;
    padding: 9px 28px !important;
    border-radius: 999px !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    text-decoration: none !important;
}
.ung-btn-list:hover {
    background: var(--ung-primary-d) !important;
    border-color: var(--ung-primary-d) !important;
}

/* 수정 버튼 */
.ung-btn-edit {
    background: #4a90a4 !important;
    color: #fff !important;
    padding: 8px 20px !important;
    border: none !important;
    border-radius: var(--ung-radius) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}
.ung-btn-edit:hover { background: #366f80 !important; }

/* 삭제 버튼 */
.ung-btn-delete {
    background: #e53e3e !important;
    color: #fff !important;
    padding: 8px 20px !important;
    border: none !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: var(--ung-radius) !important;
    cursor: pointer !important;
}
.ung-btn-delete:hover { background: #c53030 !important; }

/* 공지 지정/해제 버튼 */
.ung-btn-notice {
    background: #6b46c1 !important;
    color: #fff !important;
    padding: 8px 20px !important;
    border: none !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: var(--ung-radius) !important;
    cursor: pointer !important;
    text-decoration: none !important;
    display: inline-block !important;
    line-height: 1.4 !important;
}
.ung-btn-notice:hover { background: #553c9a !important; }

/* ── 버튼 색상 최강 오버라이드 ────────────────────────────────
   html body 접두어 + hex 직접값으로 Astra 완전 제압 */
html body .ung-board-wrap .ung-like-btn       { background: #fff !important; color: #d36b7d !important; border: 1.5px solid #f3c6cf !important; }
html body .ung-board-wrap .ung-like-btn.liked { background: linear-gradient(135deg, #ff8fa3, #ff6b81) !important; color: #fff !important; border-color: #ff6b81 !important; }
html body .ung-board-wrap .ung-comments-title { background: #f3effc !important; color: #7a5cc4 !important; border: 1.5px solid #d9ccf3 !important; }
html body .ung-board-wrap .ung-btn-notice     { background: #6b46c1 !important; color: #fff !important; }
html body .ung-board-wrap .ung-btn-edit       { background: #4a90a4 !important; color: #fff !important; }
html body .ung-board-wrap .ung-btn-delete     { background: #e53e3e !important; color: #fff !important; }
html body .ung-board-wrap .ung-btn-list       { background: #2d6a4f !important; color: #fff !important; }
html body .ung-board-wrap .ung-btn-submit     { background: #2d6a4f !important; color: #fff !important; }
html body .ung-board-wrap .ung-btn-cancel     { background: #eee !important; color: #444 !important; }

/* 모바일 글 보기 */
@media (max-width: 640px) {
    .ung-view-title { font-size: 18px; }
    .ung-view-meta  { gap: 8px; font-size: 14px; }
    .ung-view-content { font-size: 14px; }
    .ung-view-actions { flex-direction: column; align-items: flex-start; }
}


/* ================================================================
   4단계 추가: 댓글 스타일
   ================================================================ */

/* 목록의 댓글 수 표시 */
.ung-comment-count {
    color: var(--ung-primary);
    font-size: 12px;
    font-weight: 700;
    margin-left: 4px;
}

/* ── 댓글 영역 전체 ─────────────────────────────────────────── */
/* 다른 글 보기 (최신글 목록) */
.ung-recent-wrap {
    margin-top: 32px;
    padding-top: 24px;
}
.ung-recent-title {
    font-size: 15px;
    font-weight: 700;
    color: #555;
    margin: 0 0 14px;
}
.ung-recent-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--ung-border);
    border-radius: var(--ung-radius);
    overflow: hidden;
}
.ung-recent-item + .ung-recent-item {
    border-top: 1px solid #eee;
}
.ung-recent-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 16px;
    text-decoration: none;
    color: #333;
    transition: background .15s;
}
.ung-recent-item a:hover {
    background: var(--ung-bg);
}
.ung-recent-cat {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--ung-primary);
    background: var(--ung-bg);
    border: 1px solid #d7e8dd;
    border-radius: 4px;
    padding: 2px 8px;
}
.ung-recent-post-title {
    flex: 1;
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ung-recent-date {
    flex-shrink: 0;
    font-size: 12px;
    color: #aaa;
}
.ung-recent-more {
    margin: 0 0 16px;
    text-align: center;
}

/* ── 댓글 영역 ──────────────────────────────── */
.ung-comments-wrap {
    margin-top: 18px;
}

/* 댓글 토글 버튼 (좋아요 옆, 연한 보라 알약) */
.ung-comments-title {
    display: inline-flex !important;
    align-items: center !important;
    gap: 9px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #7a5cc4 !important;
    margin: 0 !important;
    background: #f3effc !important;
    border: 1.5px solid #d9ccf3 !important;
    border-radius: 999px !important;
    padding: 12px 28px !important;
    cursor: pointer !important;
    text-align: left !important;
    font-family: var(--ung-font) !important;
    transition: background .15s, border-color .15s !important;
}
.ung-comments-title:hover {
    background: #ece4fa !important;
    border-color: #c3aeed !important;
}
.ung-comments-title-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ung-comments-toggle-icon {
    font-size: 12px;
    color: #7a5cc4;
    transition: transform .2s;
}
.ung-comments-title.open .ung-comments-toggle-icon {
    transform: rotate(180deg);
}

.ung-comment-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #7a5cc4;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    padding: 0 6px;
}

/* 댓글 펼침 영역 */
.ung-comments-body {
    margin-top: 20px;
    padding-top: 22px;
}

.ung-no-comments {
    color: #aaa;
    font-size: 14px;
    text-align: center;
    padding: 24px 0;
}

/* ── 댓글 목록 ──────────────────────────────────────────────── */
.ung-comment-list {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
}

.ung-comment-item {
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

/* 댓글 헤더: 아바타+작성자 + 삭제 버튼 */
.ung-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.ung-comment-author-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ung-comment-avatar {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    flex-shrink: 0;
}

/* [디자인변경] 댓글 닉네임 — 연노란 테두리 + 진한 금색 글씨 (연크림 배경으로 가독성 보강) */
.ung-comment-author {
    display: inline-block;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    background: #FFFBE6;
    border: 1.5px solid #FFD966;
    padding: 2px 12px;
    border-radius: 14px;
}

.ung-comment-date {
    display: block;
    font-size: 12px;
    color: #aaa;
    margin-top: 2px;
}

/* 댓글 삭제 버튼 */
.ung-comment-del-btn {
    background: none;
    border: 1px solid #ddd;
    color: #aaa;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.ung-comment-del-btn:hover {
    border-color: #e53e3e;
    color: #e53e3e;
    background: #fff5f5;
}

/* 댓글 본문 */
.ung-comment-body {
    font-size: 14px;
    line-height: 1.8;
    color: #444;
    padding-left: 50px;
    word-break: keep-all;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

/* ── 답글(대댓글) ─────────────────────────────────────────── */
/* 헤더 우측 버튼 묶음 (답글 + 삭제) */
.ung-comment-header-btns {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.ung-reply-btn {
    background: none;
    border: 1px solid #ddd;
    color: #888;
    font-size: 12px;
    font-family: var(--ung-font);
    cursor: pointer;
    padding: 3px 10px;
    border-radius: 3px;
    transition: all .15s;
    white-space: nowrap;
}
.ung-reply-btn:hover {
    border-color: var(--ung-primary);
    color: var(--ung-primary);
    background: var(--ung-bg);
}

/* 답글 폼 푸터 (취소·등록 모두 오른쪽) */
.ung-reply-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    gap: 8px;
}
.ung-reply-footer-btns {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 글쓰기 이모티콘 바 */
.ung-write-emo-bar {
    margin-bottom: 8px;
}
.ung-write-emo-bar .ung-emoticon-toggle {
    width: auto;
    height: auto;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* 답글 아이템 헤더 버튼 영역 */
.ung-reply-item .ung-comment-header-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}
/* contenteditable 댓글 에디터 */
.ung-comment-editor {
    min-height: 70px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--ung-border);
    border-radius: var(--ung-radius);
    padding: 10px 14px;
    font-size: 15px;
    font-family: var(--ung-font);
    line-height: 1.7;
    outline: none;
    word-break: break-word;
    background: #fff;
    transition: border-color .15s;
    cursor: text;
    margin-bottom: 8px;
}
.ung-comment-editor:focus {
    border-color: var(--ung-primary);
    box-shadow: 0 0 0 3px rgba(45,106,79,.08);
}
.ung-comment-editor.is-empty::before {
    content: attr(data-placeholder);
    color: #bbb;
    pointer-events: none;
    display: block;
}
.ung-comment-editor .ung-emoticon-img {
    width: 56px;
    height: 56px;
    vertical-align: middle;
    margin: 0 3px;
    display: inline-block;
}
.ung-reply-editor {
    min-height: 55px;
}

.ung-reply-form-wrap {
    padding-left: 50px;
    margin-top: 12px;
}
.ung-reply-textarea {
    min-height: 60px;
}
.ung-reply-cancel {
    background: none;
    border: 1px solid #ddd;
    color: #888;
    font-size: 13px;
    font-family: var(--ung-font);
    padding: 8px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: all .15s;
}
.ung-reply-cancel:hover {
    border-color: #aaa;
    color: #555;
}

/* 답글 목록 (들여쓰기) */
/* 무한 대댓글 - 중첩 리스트 */
.ung-nested-list {
    list-style: none;
    margin: 4px 0 0;
    padding: 0 0 0 24px;
}
.ung-nested-list.ung-no-indent {
    padding-left: 0;
}

/* depth별 아바타 크기 */
.ung-depth-0 .ung-comment-avatar { width: 40px !important; height: 40px !important; }
.ung-depth-1 .ung-comment-avatar,
.ung-depth-2 .ung-comment-avatar,
.ung-depth-3 .ung-comment-avatar,
.ung-depth-4 .ung-comment-avatar { width: 34px !important; height: 34px !important; }

/* 삭제된 댓글 */
.ung-comment-deleted {
    color: #bbb;
    font-style: italic;
    font-size: 13px;
}

/* 모바일 */
@media (max-width: 640px) {
    .ung-nested-list { padding-left: 12px; }
}

.ung-reply-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0 0 0 40px;
}
.ung-reply-item {
    padding: 14px 0;
    border-bottom: none !important;
    border-top: 1px solid #f4f4f4;
}
.ung-reply-item .ung-comment-avatar {
    width: 34px !important;
    height: 34px !important;
}
.ung-reply-item .ung-comment-body {
    padding-left: 44px;
}
.ung-reply-arrow {
    color: #bbb;
    font-size: 16px;
    margin-right: 2px;
    flex-shrink: 0;
}

/* ── 댓글 작성 폼 ───────────────────────────────────────────── */
.ung-comment-form-wrap {
    background: transparent;
    border: none;
    padding: 0;
    margin-top: 16px;
}

.ung-comment-form-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 700;
    color: #444;
}

.ung-comment-form-author .ung-comment-avatar {
    border-radius: 50%;
}

.ung-comment-textarea {
    width: 100%;
    min-height: 76px;   /* 약 3줄 */
    max-height: 300px;
    padding: 16px 18px;
    border: 1.5px solid #e3ece6;
    border-radius: 14px;
    font-size: 15px;
    font-family: var(--ung-font);
    line-height: 1.7;
    resize: none;
    overflow-y: hidden;
    box-sizing: border-box;
    outline: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
    background: #fafdfb;
    color: #333;
}

.ung-comment-textarea::placeholder {
    color: #b3bfb8;
}

.ung-comment-textarea:focus {
    border-color: var(--ung-primary);
    background: #fff;
    box-shadow: 0 4px 16px rgba(45, 106, 79, 0.10);
}

.ung-comment-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.ung-comment-limit {
    font-size: 12px;
    color: #bbb;
}

.ung-btn-comment-submit {
    background: var(--ung-primary) !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 28px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    border-radius: 999px !important;
    cursor: pointer !important;
    transition: background .15s, transform .1s, box-shadow .15s !important;
    box-shadow: 0 2px 8px rgba(45, 106, 79, 0.20) !important;
}
.ung-btn-comment-submit:hover {
    background: var(--ung-primary-d) !important;
    box-shadow: 0 4px 12px rgba(45, 106, 79, 0.28) !important;
}
.ung-btn-comment-submit:active { transform: scale(0.97); }

/* 비로그인 안내 */
.ung-comment-login-msg {
    text-align: center;
    padding: 20px;
    background: var(--ung-bg);
    border: 1px solid var(--ung-border);
    border-radius: var(--ung-radius);
    font-size: 14px;
    color: var(--ung-sub);
    margin-top: 8px;
}

.ung-comment-login-msg a {
    color: var(--ung-primary);
    font-weight: 700;
}

/* 모바일 */
@media (max-width: 640px) {
    .ung-comment-body {
        padding-left: 0;
        margin-top: 8px;
    }

    .ung-comment-form-footer {
        flex-direction: column;
        gap: 8px;
        align-items: flex-end;
    }
}


/* ================================================================
   5단계 추가: CKEditor 5 스타일 조정
   ================================================================ */

/* ── CKEditor 5 에디터 영역 커스터마이징 ────────────────────── */

/* 에디터 래퍼 전체 border */
.ck.ck-editor {
    border-radius: var(--ung-radius) !important;
}

/* 툴바 */
.ck.ck-toolbar {
    border-radius: var(--ung-radius) var(--ung-radius) 0 0 !important;
    border-color: var(--ung-border) !important;
    background: #f8f8f8 !important;
    padding: 4px !important;
}

/* 에디터 본문 영역 */
.ck.ck-editor__main > .ck-editor__editable {
    min-height: 380px;
    border-color: var(--ung-border) !important;
    border-radius: 0 0 var(--ung-radius) var(--ung-radius) !important;
    font-family: var(--ung-font) !important;
    font-size: 16px !important;
    line-height: 1.9 !important;
    padding: 16px 20px !important;
}

.ck.ck-editor__main > .ck-editor__editable:focus {
    border-color: var(--ung-primary) !important;
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.12) !important;
}

/* 툴바 버튼 hover */
.ck.ck-button:hover:not(.ck-disabled),
.ck.ck-button.ck-on {
    background: #e8f4ef !important;
    color: var(--ung-primary) !important;
}

/* 드롭다운 패널 */
.ck.ck-dropdown__panel {
    border-color: var(--ung-border) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
}

/* 표 내부 선 */
.ck-content .table table {
    border-collapse: collapse;
}
.ck-content .table table td,
.ck-content .table table th {
    border: 1px solid #ccc;
    padding: 6px 10px;
    min-width: 60px;
}
.ck-content .table table th {
    background: #f4f4f4;
    font-weight: 700;
}

/* 이미지 스타일 */
.ck-content img {
    max-width: 100%;
    height: auto;
}
.ck-content .image {
    margin: 1em auto;
}
.ck-content .image-style-side {
    float: right;
    margin-left: 1.5em;
    max-width: 50%;
}

/* 업로드 중 프로그레스바 색상 */
.ck.ck-upload-bar {
    background: var(--ung-primary) !important;
}

/* 글보기 화면: CKEditor 생성 HTML 스타일 */
.ung-view-content .table {
    margin: 1em 0;
    overflow-x: auto;
}
.ung-view-content .table table {
    border-collapse: collapse;
    width: 100%;
}
.ung-view-content .table table td,
.ung-view-content .table table th {
    border: 1px solid #ddd;
    padding: 8px 12px;
    vertical-align: top;
}
.ung-view-content .table table th {
    background: var(--ung-bg);
    font-weight: 700;
}
.ung-view-content .image {
    text-align: center;
    margin: 1em 0;
}
.ung-view-content .image img {
    max-width: 100%;
}
.ung-view-content .image-style-side {
    float: right;
    margin-left: 1.5em;
    max-width: 50%;
}
.ung-view-content blockquote {
    border-left: 4px solid var(--ung-accent);
    margin: 1em 0;
    padding: 0.5em 1em;
    color: #666;
    background: var(--ung-bg);
}
.ung-view-content h2 { font-size: 1.5em; margin: 1.2em 0 0.6em; }
.ung-view-content h3 { font-size: 1.3em; margin: 1em 0 0.5em; }
.ung-view-content h4 { font-size: 1.1em; margin: 0.8em 0 0.4em; }
.ung-view-content ul,
.ung-view-content ol {
    padding-left: 1.8em;
    margin: 0.5em 0;
}
.ung-view-content hr {
    border: none;
    border-top: 2px solid var(--ung-border);
    margin: 1.5em 0;
}

/* 모바일에서 CKEditor 툴바 스크롤 */
@media (max-width: 640px) {
    .ck.ck-toolbar {
        overflow-x: auto;
    }
}


/* ── CKEditor balloon 툴바 z-index 수정 ──────────────────── */
.ck-body-wrapper {
    position: relative;
    z-index: 999999 !important;
}
.ck.ck-balloon-panel {
    z-index: 999999 !important;
}
/* balloon이 뷰포트 위쪽으로 잘리지 않도록 */
.ck.ck-balloon-panel[class*="arrow_n"] {
    margin-top: 8px;
}

/* 에디터 영역 overflow 허용 */
.ck.ck-editor__main,
.ck.ck-editor__editable_inline,
.ck-editor__editable.ck-focused {
    overflow: visible !important;
}

/* 이미지 좌/우 배치 스타일 */
.ck-content .image.image-style-side,
.ck-content .image.image-style-align-right {
    float: right;
    margin-left: 1.5em;
    max-width: 50%;
}
.ck-content .image.image-style-align-left {
    float: left;
    margin-right: 1.5em;
    max-width: 50%;
}
.ck-content .image.image-style-align-center {
    margin-left: auto;
    margin-right: auto;
}
/* inline 이미지 박스 이탈 방지 */
.ck-content .image-inline,
.ck-content .image-inline img {
    max-width: 100% !important;
    height: auto;
}

/* 글 보기에도 동일하게 */
.ung-view-content .image.image-style-side,
.ung-view-content .image.image-style-align-right {
    float: right;
    margin-left: 1.5em;
    max-width: 50%;
}
.ung-view-content .image.image-style-align-left {
    float: left;
    margin-right: 1.5em;
    max-width: 50%;
}
/* float 해제 */
.ck-content p,
.ung-view-content p {
    clear: none;
}
.ck-content::after,
.ung-view-content::after {
    content: '';
    display: table;
    clear: both;
}


/* ── 표 칸 넓이 조절 핸들 영역 확장 ─────────────────────── */
.ck-editor__editable .ck-table-column-resizer {
    width: 16px !important;
    margin-left: -8px !important;
    cursor: col-resize !important;
    opacity: 0;
}
.ck-editor__editable .ck-table-column-resizer:hover,
.ck-editor__editable .ck-table-column-resizer.ck-table-column-resizer_active {
    opacity: 1;
    background: var(--ung-primary) !important;
}


/* ── 표 셀 안 이미지 툴바 표시 허용 ─────────────────────── */
.ck-editor__editable .table,
.ck-editor__editable .table td,
.ck-editor__editable .table th {
    overflow: visible !important;
}

/* 표 셀 안 이미지 넘침 방지 (기본값) */
.ck-content .table td img,
.ck-content .table th img,
.ck-editor__editable .table td img,
.ck-editor__editable .table th img {
    max-width: 100% !important;
    height: auto !important;
}

/* ── 표 셀 안 이미지는 셀 너비에 자동 맞춤 ──────────────── */
/* (저장 시 ung-table-image-fit 클래스가 부여된 이미지) */
.ck-content td figure.image.ung-table-image-fit,
.ck-content th figure.image.ung-table-image-fit,
.ung-view-content td figure.image.ung-table-image-fit,
.ung-view-content th figure.image.ung-table-image-fit {
    display: block !important;
    float: none !important;
    clear: both !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    text-align: left !important;
}
.ck-content td figure.image.ung-table-image-fit img,
.ck-content th figure.image.ung-table-image-fit img,
.ung-view-content td figure.image.ung-table-image-fit img,
.ung-view-content th figure.image.ung-table-image-fit img {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
}


/* ================================================================
   표 셀 안 이미지·텍스트 시작 위치 정렬 (워드처럼)
   ================================================================ */

/* 표 셀 기본 정렬 - 위쪽 정렬 + 동일 패딩 */
.ck-content td,
.ck-content th,
.ung-view-content td,
.ung-view-content th {
    vertical-align: top !important;
    padding: 8px !important;
}

/* 이미지 figure 기본 여백 제거 */
.ck-content td figure.image,
.ck-content th figure.image,
.ung-view-content td figure.image,
.ung-view-content th figure.image {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* 셀 안 문단 여백 제거 */
.ck-content td p,
.ck-content th p,
.ung-view-content td p,
.ung-view-content th p {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* 셀 안 첫 요소 여백 제거 */
.ck-content td > *:first-child,
.ck-content th > *:first-child,
.ung-view-content td > *:first-child,
.ung-view-content th > *:first-child {
    margin-top: 0 !important;
}

/* 셀 안 마지막 요소 여백 제거 */
.ck-content td > *:last-child,
.ck-content th > *:last-child,
.ung-view-content td > *:last-child,
.ung-view-content th > *:last-child {
    margin-bottom: 0 !important;
}


/* ── 편집 화면: 표 셀 안 이미지도 셀 너비 기준으로 보이게 ── */
/* (저장 전이라 ung-table-image-fit 클래스가 아직 없을 때) */
.ck-editor__editable td figure.image,
.ck-editor__editable th figure.image {
    margin: 0 !important;
}
.ck-editor__editable td figure.image img,
.ck-editor__editable th figure.image img {
    margin: 0 !important;
}


/* ================================================================
   이미지 + 설명 카드 블록 (표 대체)
   ================================================================ */

/* 카드 블록 전체 */
.ung-card-block {
    display: flex;
    gap: 20px;
    align-items: flex-start;      /* 상단 정렬 */
    margin: 1.2em 0;
    width: 100%;
}

/* 이미지·텍스트 영역 첫 요소 위 여백 완전 제거 (일직선 시작) */
.ung-card-image > *:first-child,
.ung-card-text > *:first-child,
.ung-card-image figure.image,
.ung-card-image p:first-child,
.ung-card-text p:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}
.ung-card-image img {
    display: block;
    margin-top: 0 !important;
    vertical-align: top;
}

/* 이미지 영역 - 이미지 크기에 맞춰 자동 너비 */
.ung-card-image {
    flex: 0 0 auto;               /* 내용(이미지) 크기만큼만 차지 */
    max-width: 70%;
}
.ung-card-image img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}
/* 이미지 영역 안 figure도 이미지 크기만큼만 (칸 벌어짐 방지) */
.ung-card-image figure.image,
.ung-card-image figure.image.ung-card-fig {
    margin: 0 !important;
    display: block !important;
    max-width: 100% !important;
}
.ung-card-image figure.image img {
    width: 100%;
    height: auto;
}
/* 글 보기에서 카드 이미지칸은 figure(이미지) 폭에 딱 맞춤 */
.ung-view-content .ung-card-image {
    width: auto;
}

/* 설명 영역 - 남은 공간 전부 (이미지 옆에 바로 붙음) */
.ung-card-text {
    flex: 1 1 auto;
    min-width: 0;                 /* 텍스트 줄바꿈 깨짐 방지 */
    line-height: 1.9;
    word-break: keep-all;
}
.ung-card-text p:first-child { margin-top: 0; }
.ung-card-text p:last-child  { margin-bottom: 0; }

/* 편집 화면에서 카드 영역 시각적 구분 (옅은 안내선) */
.ck-editor__editable .ung-card-block {
    border: 1px dashed #cdddd4;
    border-radius: 6px;
    padding: 12px;
}
.ck-editor__editable .ung-card-image {
    background: #f4f9f6;
    border-radius: 6px;
    min-width: 120px;
    min-height: 40px;
}
.ck-editor__editable .ung-card-text {
    background: #fbfdfc;
    border-radius: 6px;
    padding: 4px 8px;
}

/* 글 보기 화면에서는 안내선 없음 */
.ung-view-content .ung-card-block {
    border: none;
    padding: 0;
}

/* ── 모바일: 세로 배치 ─────────────────────────────────────── */
@media (max-width: 640px) {
    .ung-card-block {
        flex-direction: column;
        gap: 12px;
    }
    .ung-card-image {
        flex: none;
        max-width: 100%;
        width: 100%;
    }
    .ung-card-text {
        width: 100%;
    }
}


/* ── 이미지+설명 블록 삽입 버튼 ──────────────────────────── */
.ung-card-insert-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    padding: 8px 16px;
    background: var(--ung-primary);
    color: #fff;
    border: none;
    border-radius: var(--ung-radius);
    font-size: 13px;
    font-weight: 700;
    font-family: var(--ung-font-title);
    cursor: pointer;
    transition: background .15s;
}
.ung-card-insert-btn:hover {
    background: var(--ung-primary-d);
}


/* ── 글 보기 카드 블록 정렬 보강 ──────────────────────────── */
.ung-view-content .ung-card-block {
    align-items: flex-start;
}
.ung-view-content .ung-card-image figure.image {
    margin: 0 !important;
    padding: 0 !important;
}
.ung-view-content .ung-card-image img {
    display: block;
    margin: 0 !important;
    vertical-align: top;
}
.ung-view-content .ung-card-text > *:first-child {
    margin-top: 0 !important;
}
.ung-view-content .ung-card-text > *:last-child {
    margin-bottom: 0 !important;
}


/* ================================================================
   말풍선 대화 (카톡 스타일, 웅녀·범이)
   ================================================================ */

/* 말풍선 한 줄 */
.ung-talk {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 10px auto;
    max-width: 640px;
    width: 100%;
}

/* 캐릭터 아이콘 — <img> 대신 ::before 배경이미지로 표시
   (CKEditor가 <img>를 이미지 위젯으로 바꿔 말풍선 틀을 깨뜨리는 문제 방지) */
.ung-talk::before {
    content: '';
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-color: #fff;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid #eee;
}
.ung-talk-ungnyeo::before { background-image: url(../icons/ungnyeo.png); }
.ung-talk-beomi::before   { background-image: url(../icons/beomi.png); }

/* 말풍선 본체 */
.ung-talk-bubble {
    position: relative;
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 14px;
    line-height: 1.6;
    word-break: keep-all;
}
.ung-talk-bubble p:first-child { margin-top: 0; }
.ung-talk-bubble p:last-child  { margin-bottom: 0; }

/* 웅녀 = 분홍 */
.ung-talk-ungnyeo .ung-talk-bubble {
    background: #ffe3ec;
    color: #5a2a3a;
}
/* 범이 = 주황 */
.ung-talk-beomi .ung-talk-bubble {
    background: #ffe8cc;
    color: #5a3a1a;
}

/* ── 왼쪽 배치 (아이콘 왼쪽) ──────────────────────────────── */
.ung-talk-left {
    flex-direction: row;
    justify-content: flex-start;
}

/* ── 오른쪽 배치 (아이콘 오른쪽, 말풍선 오른쪽 정렬) ────────── */
.ung-talk-right {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

/* 말풍선 꼬리 (왼쪽) */
.ung-talk-left .ung-talk-bubble::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 14px;
    border-width: 6px 8px 6px 0;
    border-style: solid;
    border-color: transparent;
}
.ung-talk-left.ung-talk-ungnyeo .ung-talk-bubble::before { border-right-color: #ffe3ec; }
.ung-talk-left.ung-talk-beomi   .ung-talk-bubble::before { border-right-color: #ffe8cc; }

/* 말풍선 꼬리 (오른쪽) */
.ung-talk-right .ung-talk-bubble::after {
    content: '';
    position: absolute;
    right: -7px;
    top: 14px;
    border-width: 6px 0 6px 8px;
    border-style: solid;
    border-color: transparent;
}
.ung-talk-right.ung-talk-ungnyeo .ung-talk-bubble::after { border-left-color: #ffe3ec; }
.ung-talk-right.ung-talk-beomi   .ung-talk-bubble::after { border-left-color: #ffe8cc; }

/* 편집 화면에서 말풍선 영역 구분 */
.ck-editor__editable .ung-talk {
    padding: 4px;
}

/* ── 말풍선 삽입 버튼 묶음 ────────────────────────────────── */
.ung-talk-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.ung-talk-bar-label {
    font-size: 13px;
    font-weight: 700;
    font-family: var(--ung-font-title);
    color: var(--ung-sub);
    margin-right: 4px;
}
.ung-talk-btn {
    padding: 6px 12px;
    border: 1px solid var(--ung-border);
    border-radius: var(--ung-radius);
    background: #fff;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--ung-font-title);
    cursor: pointer;
    transition: all .15s;
}
.ung-talk-btn-ungnyeo { color: #c2185b; }
.ung-talk-btn-ungnyeo:hover { background: #ffe3ec; }
.ung-talk-btn-beomi { color: #e8730c; }
.ung-talk-btn-beomi:hover { background: #ffe8cc; }

/* 모바일 */
@media (max-width: 640px) {
    .ung-talk::before { width: 42px; height: 42px; }
    .ung-talk-bubble { max-width: 78%; }
}

/* ───────── 이모티콘 ───────── */
/* 댓글에 박히는 봄돌이 이모티콘 이미지 */
.ung-emoticon-img {
    display: inline-block;
    width: 100px;
    height: 100px;
    vertical-align: middle;
    margin: 0 2px;
}

/* 댓글 폼 푸터 오른쪽 묶음 (이모티콘버튼 + 등록버튼) */
.ung-comment-form-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 이모티콘 토글 버튼 (😊) */
.ung-emoticon-toggle {
    border: 1px solid #e3dcf2 !important;
    background: #fbf9ff !important;
    border-radius: 20px !important;
    width: auto !important;
    height: 36px !important;
    font-size: 14px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: background .15s, transform .1s !important;
    padding: 0 12px !important;
    color: inherit !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
}
.ung-emoticon-toggle:hover { background: #f1ebff !important; }
.ung-emoticon-toggle:active { transform: scale(0.92); }

/* 팝업 박스 */
.ung-comment-form-wrap { position: relative; }
.ung-emoticon-popup {
    position: fixed;
    top: -9999px;
    left: -9999px;
    width: 360px;
    max-width: 94vw;
    background: #fff;
    border: 1px solid #e3dcf2;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(80, 50, 130, 0.16);
    padding: 10px;
    z-index: 9999;
}

/* 탭 */
.ung-emoticon-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.ung-emoticon-tab {
    flex: 1;
    border: none;
    background: #f3eefb;
    color: #6b5b8a;
    border-radius: 9px;
    padding: 7px 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.ung-emoticon-tab.is-active {
    background: #b9e4d0;
    color: #1f4d3a;
}

/* 패널 (그리드) */
.ung-emoticon-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
}
/* hidden 패널은 확실히 숨김 (grid가 hidden을 무시하는 문제 방지) */
.ung-emoticon-panel[hidden] {
    display: none !important;
}
.ung-emoticon-panel[data-panel="emoji"] {
    grid-template-columns: repeat(6, 1fr);
}

/* 개별 이모티콘 버튼 */
.ung-emoticon-item {
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 4px;
    cursor: pointer;
    transition: background .12s, transform .1s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ung-emoticon-item:hover { background: #f1ebff; }
.ung-emoticon-item:active { transform: scale(0.9); }
.ung-emoticon-item img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none; /* 클릭이 버튼으로 가도록 (img가 가로채지 않게) */
}
.ung-emoji-item {
    font-size: 24px;
    line-height: 1;
    aspect-ratio: 1 / 1;
}

/* 모바일 */
@media (max-width: 640px) {
    .ung-emoticon-img { width: 84px; height: 84px; }
    .ung-emoticon-popup { width: 300px; }
    .ung-emoticon-panel[data-panel="emoji"] { grid-template-columns: repeat(5, 1fr); }
}

/* ================================================================
   v2.0.5 추가 오버라이드
   ================================================================ */

/* ── 검색창 + 검색버튼 한 줄 고정 ── */
.ung-board-wrap .ung-board-search {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 18px 0 14px !important;
}
.ung-board-wrap .ung-board-search input[type="text"] {
    flex: 1 1 auto !important;
    height: 46px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    border: 1px solid #e1e8e4 !important;
    border-radius: 10px !important;
    padding: 0 16px !important;
    font-size: 15px !important;
}
.ung-board-wrap .ung-board-search button,
.ung-board-wrap .ung-board-search .ung-btn-submit {
    flex: 0 0 auto !important;
    height: 46px !important;
    min-width: 92px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 999px !important;
    background: #2d6a4f !important;
    color: #fff !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    cursor: pointer !important;
}

/* ── 글보기 상단 작은 목록 버튼 ── */
.ung-board-wrap .ung-meta-list-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 30px !important;
    padding: 5px 14px !important;
    border-radius: 999px !important;
    background: #eef8f3 !important;
    border: 1px solid #b9dfcd !important;
    color: #2d6a4f !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
}

/* ── 하단 전체 목록 버튼 ── */
html body .ung-board-wrap .ung-btn-list {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 30px !important;
    border-radius: 999px !important;
    background: #2d6a4f !important;
    border: none !important;
    color: #fff !important;
    font-weight: 800 !important;
    font-size: 15px !important;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(45,106,79,.22) !important;
}

/* ── 최근글 카드형 목록 ── */
.ung-board-wrap .ung-recent-wrap {
    margin-top: 34px !important;
    padding-top: 22px !important;
    border-top: 1px solid #edf2ef !important;
}
.ung-board-wrap .ung-recent-more {
    margin-bottom: 14px !important;
}
.ung-board-wrap .ung-recent-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #edf2ef !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    background: #fff !important;
}
.ung-board-wrap .ung-recent-item {
    margin: 0 !important;
    padding: 0 !important;
    border-bottom: 1px solid #edf2ef !important;
}
.ung-board-wrap .ung-recent-item:last-child { border-bottom: none !important; }
.ung-board-wrap .ung-recent-item a {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 13px 16px !important;
    color: #333 !important;
    text-decoration: none !important;
}
.ung-board-wrap .ung-recent-item a:hover { background: #f7fbf9 !important; }
.ung-board-wrap .ung-recent-post-title { flex: 1 !important; font-weight: 700 !important; }
.ung-board-wrap .ung-recent-date { color: #999 !important; font-size: 13px !important; }

/* ── 댓글 depth별 들여쓰기 (desktop) ──
   depth0: 0 / depth1: 24px / depth2: 48px / depth3: 72px / depth4+: 72px 고정 */
.ung-nested-list           { padding-left: 24px !important; }
.ung-nested-list.ung-no-indent { padding-left: 0 !important; }

/* ── 말풍선 — 글쓰기 에디터 + 글보기 양쪽 모두 적용 ── */
.ung-view-content .ung-talk,
.ck-editor__editable .ung-talk {
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin: 16px 0 !important;
    width: 100% !important;
}
.ung-view-content .ung-talk::before,
.ck-editor__editable .ung-talk::before {
    content: '' !important;
    flex: 0 0 auto !important;
    width: 52px !important;
    height: 52px !important;
    border-radius: 50% !important;
    background-color: #fff !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    border: 2px solid #eee !important;
}
.ung-view-content .ung-talk-ungnyeo::before { background-image: url('../icons/ungnyeo.png') !important; }
.ung-view-content .ung-talk-beomi::before   { background-image: url('../icons/beomi.png')   !important; }
.ung-view-content .ung-talk-left,
.ck-editor__editable .ung-talk-left  { flex-direction: row !important;         justify-content: flex-start !important; }
.ung-view-content .ung-talk-right,
.ck-editor__editable .ung-talk-right { flex-direction: row-reverse !important; justify-content: flex-start !important; }
.ung-view-content .ung-talk-bubble,
.ck-editor__editable .ung-talk-bubble {
    position: relative !important;
    max-width: 70% !important;
    padding: 12px 16px !important;
    border-radius: 16px !important;
    line-height: 1.75 !important;
    word-break: keep-all !important;
}
.ung-view-content .ung-talk-ungnyeo .ung-talk-bubble { background: #ffe3ec !important; color: #5a2a3a !important; }
.ung-view-content .ung-talk-beomi   .ung-talk-bubble { background: #ffe8cc !important; color: #5a3a1a !important; }
.ung-view-content .ung-talk-bubble p { margin: 0 !important; }

/* 말풍선 꼬리 (왼쪽) */
.ung-view-content .ung-talk-left .ung-talk-bubble::before {
    content: '' !important; position: absolute !important;
    left: -7px !important; top: 18px !important;
    border-width: 6px 8px 6px 0 !important; border-style: solid !important; border-color: transparent !important;
}
.ung-view-content .ung-talk-left.ung-talk-ungnyeo .ung-talk-bubble::before { border-right-color: #ffe3ec !important; }
.ung-view-content .ung-talk-left.ung-talk-beomi   .ung-talk-bubble::before { border-right-color: #ffe8cc !important; }

/* 말풍선 꼬리 (오른쪽) */
.ung-view-content .ung-talk-right .ung-talk-bubble::after {
    content: '' !important; position: absolute !important;
    right: -7px !important; top: 18px !important;
    border-width: 6px 0 6px 8px !important; border-style: solid !important; border-color: transparent !important;
}
.ung-view-content .ung-talk-right.ung-talk-ungnyeo .ung-talk-bubble::after { border-left-color: #ffe3ec !important; }
.ung-view-content .ung-talk-right.ung-talk-beomi   .ung-talk-bubble::after { border-left-color: #ffe8cc !important; }

/* ── 모바일 ── */
@media (max-width: 640px) {
    .ung-board-wrap .ung-board-search { flex-direction: column !important; align-items: stretch !important; }
    .ung-board-wrap .ung-board-search button { width: 100% !important; }
    .ung-nested-list { padding-left: 12px !important; }        /* depth당 12px */
    .ung-nested-list.ung-no-indent { padding-left: 0 !important; } /* depth4+: 멈춤 */
    .ung-view-content .ung-talk::before { width: 42px !important; height: 42px !important; }
    .ung-view-content .ung-talk-bubble  { max-width: 78% !important; }
}

/* ================================================================
   v2.1.0 카드형 목록 (썸네일 + 줄거리)
   ================================================================ */

.ung-post-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.ung-post-card {
    display: flex;
    gap: 14px;
    padding: 16px;
    border: 1px solid #edf2ef;
    border-radius: 12px;
    background: #fff;
    transition: box-shadow .15s;
}
.ung-post-card:hover { box-shadow: 0 2px 12px rgba(45,106,79,.1); }
.ung-post-card--notice { border-left: 3px solid var(--ung-primary); }

/* 썸네일 */
.ung-post-thumb {
    flex: 0 0 100px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    display: block;
}
.ung-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 카드 본문 */
.ung-post-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ung-post-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ung-post-card-date {
    font-size: 12px;
    color: var(--ung-sub);
}

.ung-post-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #222;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}
.ung-post-card-title:hover { color: var(--ung-primary); }

.ung-post-card-excerpt {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ung-post-card-foot {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--ung-sub);
    margin-top: auto;
}

/* 줄거리 textarea */
.ung-excerpt-input {
    resize: vertical;
    min-height: 56px;
    font-size: 14px;
}

/* 모바일 */
@media (max-width: 640px) {
    .ung-post-thumb { flex: 0 0 80px; height: 64px; }
    .ung-post-card-title { font-size: 15px; }
    .ung-post-card-excerpt { -webkit-line-clamp: 1; }
}

/* ── 카드 글씨 크기 상향 + 미디어 업로더 ── */
.ung-post-card-title   { font-size: 17px !important; }
.ung-post-card-excerpt { font-size: 14px !important; }
.ung-post-card-meta,
.ung-post-card-foot    { font-size: 13px !important; }

.ung-thumb-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.ung-btn-media {
    background: #4a90a4 !important;
    color: #fff !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    border: none !important;
    cursor: pointer !important;
}
.ung-btn-thumb-clear {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    color: #888;
    cursor: pointer;
}
.ung-thumb-preview {
    width: 100%;
    margin-top: 8px;
}
.ung-thumb-preview img {
    max-width: 200px;
    max-height: 140px;
    border-radius: 8px;
    border: 1px solid #eee;
    object-fit: cover;
    display: block;
}

/* 줄거리 textarea — 테마 간섭 방지 */
.ung-board-wrap .ung-excerpt-input {
    display: block !important;
    width: 100% !important;
    resize: vertical !important;
    min-height: 60px !important;
    font-size: 14px !important;
    pointer-events: auto !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    cursor: text !important;
    box-sizing: border-box !important;
}

/* 카드 제목/줄거리 색상 구분 */
.ung-post-card-title       { color: #1a3a2a !important; }
.ung-post-card-title:hover { color: #2d6a4f !important; }
.ung-post-card-excerpt     { color: #7a6a5a !important; }

/* ── 닉네임 ── */
.ung-comment-nick-bar,
.ung-nick-display {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #555;
}
.ung-nick-label  { color: #888; }
.ung-nick-value  { font-weight: 700; color: #2d6a4f; }
.ung-nick-edit-btn, .ung-nick-save-btn {
    background: none !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    padding: 2px 8px !important;
    font-size: 12px !important;
    color: #666 !important;
    cursor: pointer !important;
}
.ung-nick-change-input {
    border: 1px solid #2d6a4f !important;
    border-radius: 6px !important;
    padding: 4px 10px !important;
    font-size: 13px !important;
    outline: none !important;
}
.ung-comment-nick-first {
    margin-bottom: 8px;
}
.ung-nick-first-input {
    margin-bottom: 4px !important;
}
.ung-nick-hint {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

/* ── 닉네임 설정 팝업 ── */
.ung-nick-popup-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 99999;
}
.ung-nick-popup-box {
    background: #fff;
    border-radius: 16px;
    padding: 32px 28px;
    width: 90%; max-width: 360px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.ung-nick-popup-title {
    font-size: 18px; font-weight: 800;
    color: #1a3a2a; margin: 0 0 8px;
}
.ung-nick-popup-desc {
    font-size: 14px; color: #666;
    margin: 0 0 18px; line-height: 1.6;
}
.ung-nick-popup-input {
    width: 100%; box-sizing: border-box;
    border: 1.5px solid #2d6a4f !important;
    border-radius: 8px !important;
    padding: 10px 14px !important;
    font-size: 15px !important;
    margin-bottom: 14px;
    outline: none;
}
.ung-nick-popup-btns {
    display: flex; flex-direction: column; gap: 8px;
}
.ung-nick-popup-skip {
    background: none; border: none;
    color: #aaa; font-size: 13px;
    cursor: pointer; padding: 4px;
}
.ung-nick-popup-skip:hover { color: #666; }
