/* ================================================================
   웅녀범이 자유게시판 - 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;
    position: relative;
}

/* ── 제목 ──────────────────────────────────────────────────── */
.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;
}

/* 글 시작 인사 영상 — 제목 옆에 float로 자연스럽게 흐름 */
.ung-greeting-video {
    float: right;
    width: 110px;
    margin: 0 0 10px 14px;
}
.ung-greeting-video video {
    width: 100%;
    display: block;
    border-radius: 16px;
}

.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 수정 ──────────────────── */
/* position: relative를 주면 CKEditor가 balloon 위치를 계산하는 기준(뷰포트)이
   깨져서 ALT 입력창 등이 엉뚱한 위치(우측 상단 등)에 렌더링된다. 반드시 제거. */
.ck-body-wrapper {
    z-index: 9999999 !important;
}
.ck.ck-balloon-panel {
    z-index: 9999999 !important;
}

/* ── 커스텀 버튼 바(이미지+설명 블록, 말풍선) ──────────────
   .ck-editor 바깥에 독립적으로 배치되므로 balloon 위치 계산에 영향 없음 */
.ung-custom-editor-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
    position: relative;
    z-index: 10;
}
/* balloon이 뷰포트 위쪽으로 잘리지 않도록 */
.ck.ck-balloon-panel[class*="arrow_n"] {
    margin-top: 8px;
}

/* 에디터 바깥 wrapper만 visible — balloon이 잘리지 않도록.
   editable(입력창) 자체는 아래에서 고정 높이+스크롤 처리하므로 여기서 제외한다. */
.ck.ck-editor__main {
    overflow: visible !important;
}

/* 글쓰기 칸(입력창) 고정 높이 + 내부 스크롤 — 글이 길어져도 페이지 자체는 안 늘어나고
   이 상자 안에서만 스크롤됨 */
.ung-board-wrap .ck.ck-editor__editable_inline {
    max-height: 500px !important;
    min-height: 380px;
    overflow-y: auto !important;
    overflow-x: hidden;
}

/* 임시저장 버튼 + 상태 표시 */
.ung-btn-draft {
    background: #f3effc !important;
    color: #7a5cc4 !important;
    border: 1px solid #d9ccf3 !important;
}
.ung-draft-status {
    font-size: 12px;
    color: #888;
    margin-left: 8px;
    align-self: center;
}

/* 이전 임시저장 글 복구 안내 배너 */
.ung-draft-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    background: #fff8e6;
    border: 1px solid #f0d98c;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 10px;
    font-size: 14px;
}
.ung-draft-banner button {
    border: none;
    border-radius: 4px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 13px;
}
.ung-draft-banner .ung-draft-restore { background: #2d6a4f; color: #fff; }
.ung-draft-banner .ung-draft-discard { background: #eee; color: #444; }

/* 이미지 좌/우 배치 스타일 */
.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 1 auto;               /* 커질 땐 내용 크기까지, 좁으면 줄어듦 */
    min-width: 0;                  /* 큰 이미지가 flex 축소를 막지 않도록 */
    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-compare-insert-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #7a5cc4;
    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-compare-insert-btn:hover {
    background: #6746ad;
}

.ung-quiz-insert-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #d18700;
    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-quiz-insert-btn:hover {
    background: #ad6f00;
}

.ung-mareu-insert-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #6b8e4e;
    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-mareu-insert-btn:hover {
    background: #567340;
}

.ung-overlay-insert-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #3a6ea5;
    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-overlay-insert-btn:hover {
    background: #2c5580;
}

/* ── [v2.9.0] 퀴즈 정답 지정 버튼 ───────────────────────── */
.ung-quiz-answer-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #2d7a3a;
    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-quiz-answer-btn:hover {
    background: #1f5829;
}

/* ── 자주 쓰는 이미지 갤러리 ─────────────────────────────── */
.ung-gallery-wrap {
    position: relative;
    display: inline-block;
}
.ung-gallery-insert-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #8a6d3b;
    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-gallery-insert-btn:hover {
    background: #6f5730;
}
.ung-gallery-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    background: #ffffff;
    border: 1px solid #d8dde3;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    padding: 10px;
    z-index: 50;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 320px;
}
.ung-gallery-menu.ung-gallery-open {
    display: flex;
}
.ung-gallery-thumb {
    width: 70px;
    height: 70px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    padding: 0;
    cursor: pointer;
    background: #f5f5f5;
}
.ung-gallery-thumb:hover {
    border-color: #8a6d3b;
}
.ung-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.ung-gallery-empty {
    font-size: 13px;
    color: #999;
    margin: 0;
    padding: 8px;
}

/* ── 임의의 이미지 위 캡션 오버레이 — 어떤 이미지든 하단에 자연스럽게 얹힘 ── */
.ung-overlay-img {
    position: relative;
    max-width: 500px;
    margin: 20px auto;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 8px;
    overflow: hidden;
    isolation: isolate;  /* 아래 일반 콘텐츠에 ::before가 영향 안 주게 격리 */
}
/* ::before — JS가 background-image를 CSS 변수로 이동시킨 뒤 여기서 흐리게 표시 */
.ung-overlay-img::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--ung-overlay-bg, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.6;
    border-radius: 8px;
    z-index: 0;
}
/* CKEditor 에디터 안에서만 overflow:hidden — 엔터 쳐도 이미지 크기 고정 */
.ck-editor__editable .ung-overlay-img {
    overflow: hidden;
    contain: layout;
}
.ung-overlay-text {
    position: absolute;
    top: 8%;
    left: 6%;
    right: 6%;
    max-height: 80%;
    overflow: hidden;
    margin: 0;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.6;
    color: #222;
    z-index: 1;
    word-break: keep-all;
}
@media (max-width: 480px) {
    .ung-overlay-text {
        font-size: 12px;
        line-height: 1.5;
        padding: 4px 6px;
    }
}

/* ── 마르 스크롤 — 이미지 여백 위에 글씨 겹쳐 쓰기 ───────────── */
.ung-mareu-scroll {
    position: relative;
    max-width: 500px;
    margin: 20px auto;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), 0 1px 4px rgba(0, 0, 0, 0.08);
}
.ung-mareu-text {
    position: absolute;
    top: 8%;
    left: 6%;
    width: 44%;
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    color: #4a3b2a;
    word-break: keep-all;
}
@media (max-width: 480px) {
    .ung-mareu-text {
        font-size: 12px;
        line-height: 1.5;
    }
}

/* ── 확인퀴즈 박스 (글 보기 화면) ─────────────────────────── */
.ung-quiz-box {
    background: #f7f9fc;
    border: 1px solid #d8e0ea;
    border-radius: 12px;
    padding: 18px 20px;
    margin: 24px 0;
}
/* 퀴즈를 내는 캐릭터(범이/웅녀) 헤더 */
.ung-quiz-host {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
/* [v2.9.4] img 태그 없는 새 방식 — ::before로 아이콘 표시
   기존 저장글에 img가 있으면 ::before는 숨김 (아이콘 2개 방지) */
.ung-quiz-host-beomi::before,
.ung-quiz-host-ungnyeo::before {
    content: "";
    display: block;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #fff;
    background-size: cover;
    background-position: center;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.ung-quiz-host-beomi:has(.ung-quiz-host-icon)::before,
.ung-quiz-host-ungnyeo:has(.ung-quiz-host-icon)::before {
    display: none;
}
/* 기존 저장된 글 호환성 — img 태그가 있는 이전 게시글은 그대로 표시 */
.ung-quiz-host-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #fff;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.ung-quiz-host-bubble {
    position: relative;
    margin: 0;
    padding: 8px 14px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 15px;
}
.ung-quiz-host-bubble::before {
    content: "";
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    border: 7px solid transparent;
}
.ung-quiz-host-beomi .ung-quiz-host-bubble {
    background: #ffe8cc;
    color: #5a3a1a;
}
.ung-quiz-host-beomi .ung-quiz-host-bubble::before {
    border-right-color: #ffe8cc;
}
.ung-quiz-host-ungnyeo .ung-quiz-host-bubble {
    background: #ffe3ec;
    color: #5a2a3a;
}
.ung-quiz-host-ungnyeo .ung-quiz-host-bubble::before {
    border-right-color: #ffe3ec;
}
.ung-quiz-text {
    font-weight: 700;
    margin: 4px 0 12px;
}
/* [v2.9.4] CKEditor 에디터 내부에서는 퀴즈 보기가 텍스트처럼 편집 가능해야 함
   — cursor, transform, user-select를 에디터 전용으로 override */
.ck-editor__editable .ung-quiz-option {
    cursor: text !important;
}
.ck-editor__editable .ung-quiz-option:hover {
    transform: none !important;
    background: #eef4fb;
}
.ck-editor__editable .ung-quiz-box,
.ck-editor__editable .ung-quiz-box * {
    user-select: text !important;
}
.ung-quiz-option {
    position: relative;
    background: #ffffff;
    border: 1px solid #ccd6e0;
    border-radius: 8px;
    padding: 10px 14px;
    margin: 6px 0;
    cursor: pointer;
    transition: background .15s, transform .15s;
    overflow: hidden;
}
.ung-quiz-option:hover {
    background: #eef4fb;
}
.ung-quiz-box.ung-answered .ung-quiz-option {
    cursor: default;
}
.ung-quiz-box.ung-answered .ung-quiz-option.ung-quiz-correct {
    background: #2d6a4f;
    color: #fff;
    border-color: #2d6a4f;
    font-weight: 700;
    animation: ung-quiz-pop .5s ease;
}
.ung-quiz-box.ung-answered .ung-quiz-option.ung-quiz-fade-out {
    animation: ung-quiz-fadeout .4s ease forwards;
}
.ung-quiz-box.ung-answered .ung-quiz-option.ung-quiz-wrong-flash {
    animation: ung-quiz-wrongflash .35s ease;
}
@keyframes ung-quiz-pop {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.12); }
    65%  { transform: scale(0.96); }
    100% { transform: scale(1); }
}
@keyframes ung-quiz-fadeout {
    0%   { opacity: 1; max-height: 60px; margin: 6px 0; padding: 10px 14px; }
    100% { opacity: 0; max-height: 0; margin: 0; padding: 0 14px; border-width: 0; }
}
@keyframes ung-quiz-wrongflash {
    0%, 100% { background: #ffffff; }
    40%      { background: #ffe1e1; border-color: #e53e3e; }
}
.ung-quiz-explain {
    display: none;
    margin-top: 12px;
    padding: 10px 14px;
    background: #fffbe6;
    border-left: 4px solid #f0c419;
    border-radius: 4px;
    font-size: 14px;
    color: #665500;
}
/* 구 방식 */
.ung-quiz-box.ung-answered .ung-quiz-explain {
    display: block;
}
/* 새 방식 — is-answered */
.ung-quiz-box.is-answered .ung-quiz-explain {
    display: block;
    animation: ung-quiz-slide-in .3s ease;
}

/* ── [v2.9.6] 새 방식 정답/오답 클래스 ───────────────────────── */

/* 정답 선택 */
.ung-quiz-option.is-correct {
    background: #e8f7ee;
    border-color: #34a853;
    color: #1a5c2a;
    font-weight: 700;
    cursor: default;
}
/* 오답 선택 (잠깐 빨갛게 — 다시 선택 가능) */
.ung-quiz-option.is-wrong {
    background: #fff0f0;
    border-color: #e57373;
    color: #b71c1c;
    animation: ung-quiz-wrongflash .35s ease;
}
/* 정답 맞힌 뒤 — 나머지 보기 흐리게 */
.ung-quiz-box.is-answered .ung-quiz-option:not(.is-correct) {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

/* 결과 메시지 박스 */
.ung-quiz-result {
    display: none;
    margin: 8px 0 0;
    padding: 9px 14px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    transition: opacity .2s;
}
/* 오답 메시지 */
.ung-quiz-result.is-wrong-msg {
    display: block;
    background: #fff8e6;
    color: #7a5c00;
    border: 1px solid #f0c419;
}
/* 정답 메시지 */
.ung-quiz-box.is-answered .ung-quiz-result {
    display: block;
    background: #e8f7ee;
    color: #1a5c2a;
    border: 1px solid #34a853;
}

/* 해설 슬라이드 인 */
@keyframes ung-quiz-slide-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── CKEditor 작성 화면 — 해설 항상 표시 (작성자 확인용) ──────── */
.ck-editor__editable .ung-quiz-explain {
    display: block !important;
    opacity: 0.65;
}
.ck-editor__editable .ung-quiz-result {
    display: none !important;  /* 작성 화면에서는 결과 메시지 숨김 */
}

/* 정답 맞췄을 때 튀는 작은 축하 이모지 */
.ung-quiz-burst {
    position: absolute;
    font-size: 18px;
    pointer-events: none;
    left: 50%;
    top: 50%;
    animation: ung-quiz-burst-move .8s ease-out forwards;
}
@keyframes ung-quiz-burst-move {
    0%   { transform: translate(-50%, -50%) scale(0.6); opacity: 1; }
    100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.3); opacity: 0; }
}


/* ── 글 보기 카드 블록 정렬 보강 ──────────────────────────── */
.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); }

/* 썸네일 */
/* [v3.2.3] 100×80 직사각형이 작아 보인다는 피드백으로 100×100 정사각형으로 확대.
   홈 최신글 위젯(ung-latest-thumb)과 크기를 통일해 사이트 전체가 일관되게 보이도록 함 */
.ung-post-thumb {
    flex: 0 0 100px;
    height: 100px;
    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); }

/* [v3.2.1] 원래 2줄에서 잘리던 것(overflow:hidden + line-clamp)을 제거해
   줄거리 전체 텍스트가 다 보이도록 변경 */
.ung-post-card-excerpt {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin: 0;
}

.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 70px; height: 70px; }
    .ung-post-card-title { font-size: 15px; }
    /* [v3.2.1] 모바일 1줄 잘림(line-clamp:1) 규칙도 제거 — PC와 동일하게 전체 표시 */
}

/* ── 카드 글씨 크기 상향 + 미디어 업로더 ── */
.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; }

/* ── [v2.9.5] 확인퀴즈 입력 모달 ────────────────────────────── */
.ungq-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999999;
    align-items: center;
    justify-content: center;
}
.ungq-modal.ungq-open {
    display: flex;
}
.ungq-modal-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    width: min(480px, 96vw);
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.ungq-modal-head {
    padding: 18px 24px 14px;
    font-size: 17px;
    font-weight: 700;
    border-bottom: 1px solid #e8ecf0;
    color: #1a2233;
}
.ungq-modal-body {
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ungq-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ungq-label {
    font-size: 13px;
    font-weight: 700;
    color: #444;
    min-width: 52px;
    flex-shrink: 0;
}
.ungq-label small {
    font-weight: 400;
    color: #888;
    margin-left: 2px;
}
.ungq-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ccd6e0;
    border-radius: 7px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s;
}
.ungq-input:focus {
    border-color: #2d6a4f;
}
/* 출제자 선택 */
.ungq-row-host {
    gap: 16px;
}
.ungq-host-opt {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}
.ungq-host-opt img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    object-fit: cover;
}
.ungq-host-opt input[type="radio"] {
    accent-color: #2d6a4f;
}
/* 보기 헤더 */
.ungq-row-opts-head {
    padding-bottom: 2px;
    border-bottom: 1px solid #eee;
}
.ungq-label-opt {
    min-width: 52px;
    text-align: center;
}
.ungq-opt-hint {
    font-size: 12px;
    color: #888;
}
/* 보기 행 */
.ungq-opt-row {
    gap: 8px;
}
.ungq-correct-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 52px;
    cursor: pointer;
}
.ungq-correct-wrap input[type="radio"] {
    accent-color: #2d6a4f;
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.ungq-opt-num {
    font-weight: 700;
    font-size: 15px;
    color: #2d6a4f;
}
/* 하단 버튼 */
.ungq-modal-foot {
    padding: 14px 24px 18px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #e8ecf0;
}
.ungq-btn-cancel {
    padding: 9px 20px;
    border: 1px solid #ccc;
    border-radius: 7px;
    background: #f5f5f5;
    color: #555;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.ungq-btn-cancel:hover { background: #e8e8e8; }
.ungq-btn-submit {
    padding: 9px 24px;
    border: none;
    border-radius: 7px;
    background: #2d6a4f;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.ungq-btn-submit:hover { background: #1f5829; }

/* ── [v2.9.20] 글 보기 화면 — 오버레이/마르스크롤 잘림 해결 ─────
   position:absolute 텍스트는 부모 높이에 반영되지 않아
   글이 길어지면 잘리는 문제. 글 보기 화면에서만 overflow 해제. */
.ung-view-content .ung-overlay-img {
    overflow: visible !important;
    height: auto !important;
    min-height: unset !important;
    margin-bottom: 32px !important;
}
.ung-view-content .ung-overlay-text {
    overflow: visible !important;
    max-height: none !important;
}
.ung-view-content .ung-mareu-scroll {
    overflow: visible !important;
    height: auto !important;
    min-height: unset !important;
    margin-bottom: 32px !important;
}
.ung-view-content .ung-mareu-text {
    overflow: visible !important;
    max-height: none !important;
}

/* ── [v2.9.21] 한 줄 생각 — 이미지·본문 분리 구조 ─────────────── */
.ung-thought-box {
    margin: 40px 0;
}
.ung-thought-image-wrap {
    position: relative;
    max-width: 520px;
    margin: 0 auto 24px auto;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 8px;
}
.ung-thought-quote {
    position: absolute;
    top: 14%;
    left: 8%;
    right: 8%;
    margin: 0;
    color: #e53935;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.8;
    z-index: 2;
    word-break: keep-all;
    text-shadow:
        0 0 6px rgba(255, 255, 255, 0.95),
        0 0 12px rgba(255, 255, 255, 0.9);
}
.ung-thought-desc {
    max-width: 520px;
    margin: 0 auto;
    color: #222;
    font-size: 15px;
    line-height: 1.9;
    word-break: keep-all;
}
@media (max-width: 480px) {
    .ung-thought-quote { font-size: 14px; line-height: 1.6; }
    .ung-thought-desc  { font-size: 14px; }
}

/* ── [v3.0.0] textarea 기반 에디터 — 신규 버튼 스타일 ─────────── */
.ung-media-insert-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #6b46c1;
    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-media-insert-btn:hover {
    background: #553c9a;
}

.ung-preview-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #2d6a4f;
    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;
    margin-left: auto;   /* 툴바 오른쪽 끝에 배치 */
}
.ung-preview-toggle-btn:hover {
    background: #1f5829;
}

/* 미리보기 영역 — 실제 글 보기 화면과 동일 폭·여백으로 표시 */
.ung-editor-preview {
    min-height: 380px;
    max-height: 640px;
    overflow-y: auto;
    padding: 20px;
    border: 1px solid #d8dde3;
    border-radius: var(--ung-radius);
    background: #fff;
}

/* textarea 자체 — CKEditor 없이도 통일된 느낌으로 */
#ung-editor.ung-form-textarea {
    font-family: var(--ung-font-body, inherit);
    font-size: 15px;
    line-height: 1.7;
    min-height: 380px;
    tab-size: 4;
}

/* ══════════════════════════════════════════════════════════
   [v3.1.0] 웅녀범이 전용 CMS 블록 — 이미지 3종 + 콘텐츠 블록 6종
   ══════════════════════════════════════════════════════════ */

/* ── 블록 삽입 버튼 공통 스타일 (한줄생각/잠깐질문/판례/해외사례/표/결론) ── */
.ung-block-insert-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #4a5568;
    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-block-insert-btn:hover {
    background: #2d3748;
}

/* ── 이미지 3종 — 대표이미지 / 인포그래픽 / 일반이미지 ────────── */

/* 대표이미지 — 글 최상단, 화면 꽉 채우는 큰 이미지 */
.ung-cover-img {
    margin: 0 0 24px;
}
.ung-cover-img img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
}

/* 인포그래픽 — 정보 전달용, 중앙 정렬 + 살짝 그림자로 카드처럼 */
.ung-infographic {
    max-width: 640px;
    margin: 24px auto;
    text-align: center;
}
.ung-infographic img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* 일반이미지 — 본문 중간에 자연스럽게 삽입 */
.ung-img-box {
    max-width: 560px;
    margin: 20px auto;
}
.ung-img-box img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
}

/* ── 한 줄 생각 (이미지 없는 간단 버전) ───────────────────────── */
.ung-thought-simple {
    max-width: 560px;
    margin: 32px auto;
    padding: 20px 24px;
    background: linear-gradient(135deg, #fff9e6, #fff4d6);
    border-left: 4px solid #f0c419;
    border-radius: 8px;
}
.ung-thought-simple-quote {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 700;
    color: #7a5c00;
    line-height: 1.6;
}
.ung-thought-simple-desc {
    margin: 0;
    font-size: 14.5px;
    color: #444;
    line-height: 1.8;
}

/* ── 잠깐 질문 박스 ───────────────────────────────────────────── */
.ung-pause-question {
    max-width: 640px;
    margin: 32px auto;
    padding: 20px 24px;
    background: #eef6ff;
    border: 1px solid #b8d9f5;
    border-radius: 10px;
}
.ung-pause-question h3 {
    margin-top: 0;
}
.ung-pause-question p {
    margin: 8px 0;
    line-height: 1.8;
}

/* ── 판례/법조항 박스 ─────────────────────────────────────────── */
.ung-law-box {
    max-width: 640px;
    margin: 20px auto;
    padding: 16px 20px;
    background: #f7f5ff;
    border-left: 4px solid #7c5cbf;
    border-radius: 6px;
    font-size: 14.5px;
    line-height: 1.8;
}

/* ── 해외 사례 박스 ───────────────────────────────────────────── */
.ung-abroad-box {
    max-width: 640px;
    margin: 20px auto;
    padding: 16px 20px;
    background: #f0faf5;
    border-left: 4px solid #38a169;
    border-radius: 6px;
    font-size: 14.5px;
    line-height: 1.8;
}

/* ── 결론(오늘의 한 줄) 박스 ──────────────────────────────────── */
.ung-conclusion-box {
    max-width: 640px;
    margin: 32px auto 20px;
    padding: 20px 24px;
    background: #e8f7ee;
    border: 1px solid #a8dfc0;
    border-radius: 10px;
    text-align: center;
}
.ung-conclusion-box h3 {
    margin-top: 0;
}
.ung-conclusion-box p {
    margin: 6px 0 0;
    font-size: 16px;
    line-height: 1.8;
}

/* ── 서버 백업 복구 배너 ── 기존 .ung-draft-banner 스타일(위쪽에 이미 정의됨)을
   그대로 재사용. ☁️/📝 아이콘 구분은 JS 텍스트로만 처리하고 별도 CSS 불필요. */

/* ══════════════════════════════════════════════════════════
   [v3.2.0] CodeMirror 코드 에디터 통합
   ══════════════════════════════════════════════════════════ */

/* CodeMirror 기본 틀 — textarea와 통일된 테두리/폰트로 */
.CodeMirror {
    border: 1px solid #d8dde3;
    border-radius: var(--ung-radius);
    font-family: 'D2Coding', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    height: 480px;
}
.CodeMirror-gutters {
    background: #f7f8fa;
    border-right: 1px solid #e2e6ea;
}
.CodeMirror-linenumber {
    color: #9aa5b1;
}

/* ── 문법 하이라이트 색상 (요청 사양 그대로) ──────────────────
   태그명 파란색 / 속성명 보라색 / 속성값(문자열) 초록색 /
   텍스트 기본 검정 / 주석 회색.
   테마 CSS를 별도로 불러오지 않고 직접 지정 — CDN 의존성을
   최소화하고 정확한 색상을 보장하기 위함. */
.CodeMirror {
    color: #1a1a1a;                 /* 텍스트 기본 검정 */
}
.CodeMirror .cm-tag {
    color: #2b6cb0;                 /* 태그명 파란색 */
    font-weight: 600;
}
.CodeMirror .cm-attribute {
    color: #7c3aed;                 /* 속성명 보라색 */
}
.CodeMirror .cm-string {
    color: #15803d;                 /* 속성값(문자열) 초록색 */
}
.CodeMirror .cm-comment {
    color: #888888;                 /* 주석 회색 */
    font-style: italic;
}
.CodeMirror .cm-bracket {
    color: #444444;
}

/* matchTags/matchBrackets 애드온 — 짝이 맞는 태그·괄호 강조 */
.CodeMirror .CodeMirror-matchingtag {
    background: rgba(43, 108, 176, 0.18);
}
.CodeMirror .CodeMirror-matchingbracket {
    color: #2b6cb0 !important;
    font-weight: 700;
    background: rgba(43, 108, 176, 0.12);
}

/* 닫히지 않은 태그 / 짝 없는 닫는 태그 — 빨간 물결 밑줄 경고 */
.ung-cm-tag-issue {
    text-decoration: underline;
    text-decoration-color: #e53e3e;
    text-decoration-style: wavy;
    background: rgba(229, 62, 62, 0.08);
}

/* ── 상태 표시줄 (현재 태그 위치 + 태그 오류 개수) ────────────── */
.ung-editor-statusbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 10px;
    margin-bottom: 4px;
    font-size: 12px;
    color: #667;
    background: #f7f8fa;
    border: 1px solid #e2e6ea;
    border-bottom: none;
    border-radius: var(--ung-radius) var(--ung-radius) 0 0;
}
.ung-editor-tagpos {
    font-family: 'D2Coding', 'Consolas', monospace;
}
.ung-editor-tagwarn.ung-tagwarn-ok {
    color: #2d6a4f;
    font-weight: 700;
}
.ung-editor-tagwarn.ung-tagwarn-bad {
    color: #e53e3e;
    font-weight: 700;
}

/* ── 신규 버튼 3종 (HTML 정리 / 닫는 태그 검사 / 저장) ────────── */
.ung-format-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #718096;
    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-format-btn:hover { background: #4a5568; }

.ung-tagcheck-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #b7791f;
    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-tagcheck-btn:hover { background: #975a16; }

.ung-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: #1a5c2a;
    color: #fff;
    border: none;
    border-radius: var(--ung-radius);
    font-size: 13px;
    font-weight: 800;
    font-family: var(--ung-font-title);
    cursor: pointer;
    transition: background .15s;
}
.ung-save-btn:hover { background: #0f3d1c; }

/* ================================================================
   v3.2.5 목록 3열 카드형
   - PC/모바일 모두 한 줄 3개
   - 기존 100×100 목록 이미지를 그대로 사용
   - 이미지 아래에 회차와 제목 전체 표시
   - 카드 전체 클릭 + 마우스 오버 확대
   ================================================================ */
.ung-board-wrap .ung-post-list {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 18px 14px !important;
    margin-bottom: 24px !important;
}

.ung-board-wrap .ung-post-card {
    display: block !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: 1px solid #e7eee9 !important;
    border-radius: 12px !important;
    background: #fff !important;
    overflow: hidden !important;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease !important;
}

.ung-board-wrap .ung-post-card:hover {
    transform: translateY(-3px) scale(1.015) !important;
    box-shadow: 0 8px 22px rgba(45,106,79,.14) !important;
    border-color: #b8d4c5 !important;
}

.ung-board-wrap .ung-post-card--notice {
    border-left: 1px solid #e7eee9 !important;
    border-top: 3px solid var(--ung-primary) !important;
}

.ung-board-wrap .ung-post-card-link {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
    padding: 12px 10px 14px !important;
    color: inherit !important;
    text-decoration: none !important;
}

.ung-board-wrap .ung-post-card-link--locked {
    cursor: default !important;
    opacity: .72 !important;
}

.ung-board-wrap .ung-post-thumb {
    flex: none !important;
    width: 100px !important;
    height: 100px !important;
    margin: 0 auto 10px !important;
    border-radius: 9px !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f1f6f3 !important;
}

.ung-board-wrap .ung-post-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.ung-board-wrap .ung-post-thumb--empty {
    color: #789486 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-align: center !important;
}

.ung-board-wrap .ung-post-card-body {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
    gap: 6px !important;
    text-align: center !important;
}

.ung-board-wrap .ung-post-card-meta {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    min-height: 20px !important;
    gap: 5px !important;
}

.ung-board-wrap .ung-post-card-title {
    display: block !important;
    width: 100% !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    word-break: keep-all !important;
    overflow-wrap: anywhere !important;
    font-size: 15px !important;
    line-height: 1.45 !important;
    font-weight: 750 !important;
    color: #1a3a2a !important;
    text-align: center !important;
}

.ung-board-wrap .ung-post-card-link:hover .ung-post-card-title {
    color: var(--ung-primary) !important;
}

/* 3열 카드에서는 줄거리를 숨겨 제목과 이미지에 집중 */
.ung-board-wrap .ung-post-card-excerpt {
    display: none !important;
}

@media (max-width: 640px) {
    .ung-board-wrap .ung-post-list {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 10px 7px !important;
    }
    .ung-board-wrap .ung-post-card-link {
        padding: 8px 4px 10px !important;
    }
    .ung-board-wrap .ung-post-thumb {
        width: min(100px, 100%) !important;
        height: auto !important;
        aspect-ratio: 1 / 1 !important;
        margin-bottom: 7px !important;
        border-radius: 7px !important;
    }
    .ung-board-wrap .ung-post-card-title {
        font-size: 12px !important;
        line-height: 1.4 !important;
    }
    .ung-board-wrap .ung-post-card-meta {
        min-height: 17px !important;
        gap: 3px !important;
    }
    .ung-board-wrap .ung-series-badge,
    .ung-board-wrap .ung-notice-badge,
    .ung-board-wrap .ung-private-badge {
        font-size: 9px !important;
        padding: 2px 4px !important;
    }
}

/* ================================================================
   [v3.2.6] 글쓰기 말풍선 아이콘 — 웅녀·범이·마르
   ================================================================ */
.ung-talk-mareu::before { background-image: url(../icons/mareu.png); }

.ung-talk-mareu .ung-talk-bubble {
    background: #e8f5df;
    color: #355428;
}
.ung-talk-left.ung-talk-mareu .ung-talk-bubble::before {
    border-right-color: #e8f5df;
}
.ung-talk-right.ung-talk-mareu .ung-talk-bubble::after {
    border-left-color: #e8f5df;
}

.ung-talk-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 4px 10px 4px 5px;
}
.ung-talk-btn-icon {
    display: inline-block;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 50%;
    background-color: #fff;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid rgba(0,0,0,.09);
}
.ung-talk-btn-ungnyeo .ung-talk-btn-icon { background-image: url(../icons/ungnyeo.png); }
.ung-talk-btn-beomi .ung-talk-btn-icon   { background-image: url(../icons/beomi.png); }
.ung-talk-btn-mareu .ung-talk-btn-icon   { background-image: url(../icons/mareu.png); }
.ung-talk-btn-mareu { color: #4d7d34; }
.ung-talk-btn-mareu:hover { background: #e8f5df; }
.ung-talk-btn-text { white-space: nowrap; }

@media (max-width: 640px) {
    .ung-talk-bar { gap: 5px; }
    .ung-talk-btn { padding: 4px 7px 4px 4px; font-size: 12px; }
    .ung-talk-btn-icon { width: 26px; height: 26px; flex-basis: 26px; }
}

/* ================================================================
   v3.2.7 화면 폭·이미지·목록 최종 정리
   - 게시판 최대 폭 800px 유지
   - 본문 이미지 최대 750px, 가운데 정렬
   - 목록은 PC/모바일 모두 3열 유지
   - 베이지색 바깥 배경 제거
   - 글 안의 연재 회차 목록도 3열 카드형
   ================================================================ */

/* 게시판 자체는 800px, 바깥쪽은 흰색으로 정리 */
html body:has(.ung-board-wrap),
html body:has(.ung-board-wrap) .site,
html body:has(.ung-board-wrap) .site-content,
html body:has(.ung-board-wrap) .ast-container,
html body:has(.ung-board-wrap) .content-area,
html body:has(.ung-board-wrap) .site-main,
html body:has(.ung-board-wrap) article,
html body:has(.ung-board-wrap) .entry-content {
    background: #fff !important;
}

.ung-board-wrap {
    max-width: 800px !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    background: #fff !important;
}

/* 본문 이미지는 750px를 넘지 않게 하고 중앙 정렬 */
.ung-view-content img,
.ung-view-content figure.image,
.ung-view-content .image,
.ung-view-content .wp-caption {
    max-width: 750px !important;
}

.ung-view-content > img,
.ung-view-content > figure.image,
.ung-view-content > .image,
.ung-view-content > .wp-caption,
.ung-view-content p > img:only-child {
    display: block !important;
    width: auto !important;
    height: auto !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.ung-view-content figure.image img,
.ung-view-content .image img,
.ung-view-content .wp-caption img {
    width: 100% !important;
    max-width: 750px !important;
    height: auto !important;
}

/* 메인 목록: 한 줄 3개 */
.ung-board-wrap .ung-post-list {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 18px 14px !important;
}

/* 글 안의 연재 회차 목록도 세로 긴 목록 대신 3열 카드로 표시 */
.ung-series-panel-body {
    max-height: none !important;
    overflow: visible !important;
    padding: 12px !important;
}

.ung-series-episode-list {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
}

.ung-series-episode-item,
.ung-series-episode-item.current {
    min-width: 0 !important;
    border: 1px solid #e1ebe5 !important;
    border-radius: 9px !important;
    background: #fff !important;
    overflow: hidden !important;
}

.ung-series-episode-item a,
.ung-series-episode-item > span,
.ung-series-episode-item.current > * {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 5px !important;
    min-height: 78px !important;
    padding: 10px !important;
    box-sizing: border-box !important;
}

.ung-series-episode-item a:hover {
    background: #f4faf6 !important;
}

.ung-series-episode-item.current {
    border-color: var(--ung-primary) !important;
    box-shadow: 0 0 0 1px rgba(45,106,79,.08) !important;
}

.ung-series-episode-item .ung-ep-title {
    width: 100% !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
    white-space: normal !important;
    word-break: keep-all !important;
    overflow-wrap: anywhere !important;
}

@media (max-width: 640px) {
    .ung-board-wrap {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .ung-board-wrap .ung-post-list {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 10px 7px !important;
    }

    .ung-series-panel-body {
        padding: 8px !important;
    }

    .ung-series-episode-list {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px !important;
    }

    .ung-series-episode-item a,
    .ung-series-episode-item > span,
    .ung-series-episode-item.current > * {
        min-height: 70px !important;
        padding: 7px 6px !important;
    }

    .ung-series-episode-item .ung-ep-title {
        font-size: 11px !important;
        line-height: 1.35 !important;
    }

    .ung-series-episode-item .ung-ep-num,
    .ung-series-episode-item .ung-ep-current-mark {
        font-size: 9px !important;
    }
}

/* ================================================================
   v3.2.8 테마 배경 강제 정리 및 캐시 대응
   게시판이 있는 페이지에 JS가 body.ung-board-page 클래스를 추가한다.
   :has() 미지원 브라우저에서도 베이지/크림색 바깥 영역을 흰색으로 변경한다.
   ================================================================ */
html body.ung-board-page,
body.ung-board-page #page,
body.ung-board-page .site,
body.ung-board-page .site-content,
body.ung-board-page .content-area,
body.ung-board-page .site-main,
body.ung-board-page .ast-container,
body.ung-board-page .ast-separate-container,
body.ung-board-page .ast-article-single,
body.ung-board-page .ast-article-post,
body.ung-board-page article,
body.ung-board-page .entry-content,
body.ung-board-page .wp-site-blocks,
body.ung-board-page main,
body.ung-board-page .container,
body.ung-board-page .content-wrap {
    background-color: #ffffff !important;
    background-image: none !important;
}

/* Astra의 박스형 콘텐츠가 남기는 좌우 패딩/그림자를 게시판 페이지에서만 제거 */
body.ung-board-page .ast-container,
body.ung-board-page .site-content > .ast-container {
    max-width: none !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}
body.ung-board-page .ast-separate-container .ast-article-single,
body.ung-board-page .ast-separate-container .ast-article-post,
body.ung-board-page article {
    box-shadow: none !important;
}

/* 게시판 실제 영역은 800px, 내부 이미지는 750px */
body.ung-board-page .ung-board-wrap {
    width: min(800px, 100%) !important;
    max-width: 800px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    background: #fff !important;
}
body.ung-board-page .ung-view-content img {
    max-width: min(750px, 100%) !important;
    height: auto !important;
}

/* 목록과 본문 속 회차 목록은 3열 */
body.ung-board-page .ung-post-list,
body.ung-board-page .ung-series-episode-list {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

/* =============================================================
 * v3.3.0 카드 목록 정리
 * - 게시판 800px / 이미지 750px 유지
 * - 목록 및 본문 하단 3열 카드
 * - 연재 빨간 배지 / 일반 제목 검정 / 공지만 초록
 * - 제목 24자 서버 제한 + 화면 2줄 제한
 * ============================================================= */
.ung-board-wrap {
    width: min(800px, calc(100% - 24px)) !important;
    max-width: 800px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}
.ung-post-content img {
    display: block;
    width: auto;
    max-width: min(750px, 100%) !important;
    height: auto;
    margin-left: auto;
    margin-right: auto;
}
.ung-board-wrap .ung-post-list,
.ung-board-wrap .ung-recent-card-grid,
.ung-board-wrap .ung-series-card-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 14px !important;
    align-items: stretch;
}
.ung-board-wrap .ung-post-card,
.ung-board-wrap .ung-mini-card {
    min-width: 0;
    height: 100%;
    background: #fff;
    border: 1px solid #e1e8e4;
    border-radius: 13px;
    box-shadow: 0 3px 12px rgba(22, 67, 47, .05);
}
.ung-board-wrap .ung-post-card-link,
.ung-board-wrap .ung-mini-card {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 10px 15px !important;
    text-align: center;
    text-decoration: none !important;
    color: #111 !important;
}
.ung-board-wrap .ung-post-thumb,
.ung-board-wrap .ung-mini-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px !important;
    height: 100px !important;
    margin: 0 auto 9px !important;
    overflow: hidden;
    border-radius: 10px;
    background: #f6f8f7;
}
.ung-board-wrap .ung-post-thumb img,
.ung-board-wrap .ung-mini-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}
.ung-mini-thumb-empty {
    font-size: 12px;
    color: #6d7f75;
}
.ung-board-wrap .ung-post-card-body {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.ung-board-wrap .ung-post-card-meta,
.ung-mini-badge-wrap {
    min-height: 25px;
    margin: 0 0 7px;
}
.ung-series-badge {
    display: inline-flex !important;
    align-items: center;
    gap: 3px;
    max-width: 100%;
    padding: 3px 7px !important;
    border-radius: 5px !important;
    background: #e53935 !important;
    color: #fff !important;
    font-size: 11px !important;
    line-height: 1.35;
    font-weight: 800 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ung-notice-badge {
    display: inline-flex !important;
    align-items: center;
    gap: 3px;
    padding: 3px 7px !important;
    border-radius: 5px !important;
    background: #2e7d32 !important;
    color: #fff !important;
    font-size: 11px !important;
    line-height: 1.35;
    font-weight: 800 !important;
}
.ung-board-wrap .ung-post-card-title,
.ung-board-wrap .ung-mini-title {
    display: -webkit-box !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    width: 100%;
    min-height: 2.9em;
    max-height: 2.9em;
    color: #111 !important;
    font-size: 15px !important;
    line-height: 1.45 !important;
    font-weight: 700 !important;
    word-break: keep-all;
    overflow-wrap: anywhere;
}
.ung-board-wrap .ung-post-card-link:hover .ung-post-card-title,
.ung-board-wrap .ung-mini-card:hover .ung-mini-title {
    color: #111 !important;
}
.ung-board-wrap .ung-post-card--notice .ung-post-card-title,
.ung-board-wrap .ung-mini-card--notice .ung-mini-title {
    color: #2e7d32 !important;
}
.ung-board-wrap .ung-post-card--notice .ung-post-card-link:hover .ung-post-card-title,
.ung-board-wrap .ung-mini-card--notice:hover .ung-mini-title {
    color: #1b5e20 !important;
}
.ung-recent-wrap {
    margin: 30px 0 0 !important;
}
.ung-recent-head {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}
.ung-series-panel--cards {
    margin-top: 28px !important;
    padding-top: 21px;
    border-top: 1px solid #e5ebe8;
}
.ung-series-panel-title {
    margin-bottom: 14px;
    color: #204f39;
    font-size: 17px;
    font-weight: 800;
}
.ung-series-card-grid .ung-mini-card--current {
    border: 2px solid #2d6a4f !important;
    box-shadow: 0 0 0 3px rgba(45,106,79,.08);
}
.ung-current-chip {
    display: inline-block;
    margin-top: 7px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #edf7f2;
    color: #2d6a4f;
    font-size: 10px;
    font-weight: 800;
}
@media (max-width: 640px) {
    .ung-board-wrap {
        width: calc(100% - 16px) !important;
    }
    .ung-board-wrap .ung-post-list,
    .ung-board-wrap .ung-recent-card-grid,
    .ung-board-wrap .ung-series-card-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 7px !important;
    }
    .ung-board-wrap .ung-post-card-link,
    .ung-board-wrap .ung-mini-card {
        padding: 8px 4px 10px !important;
    }
    .ung-board-wrap .ung-post-thumb,
    .ung-board-wrap .ung-mini-thumb {
        width: min(82px, 100%) !important;
        height: auto !important;
        aspect-ratio: 1 / 1;
    }
    .ung-series-badge,
    .ung-notice-badge {
        font-size: 9px !important;
        padding: 2px 4px !important;
    }
    .ung-board-wrap .ung-post-card-title,
    .ung-board-wrap .ung-mini-title {
        font-size: 12px !important;
        line-height: 1.4 !important;
        min-height: 2.8em;
        max-height: 2.8em;
    }
}


/* ── [v3.4.0] 책 넘김 선택 기능 ───────────────────────── */
.ung-book-option-row{background:#f8fbf8;border:1px solid #d7eadc;border-radius:10px;padding:12px 14px}
.ung-book-break-btn{background:#6f42c1!important;color:#fff!important;border-color:#6f42c1!important}
.ung-book-break{border:0;border-top:2px dashed #9b7bd4;margin:28px 0;position:relative}
.ung-book-reader{max-width:750px;margin:0 auto 28px;scroll-margin-top:90px}
.ung-book-pages{position:relative;background:#fffdf8;border:1px solid #e5ded0;border-radius:6px;box-shadow:0 14px 35px rgba(54,43,24,.12), inset -18px 0 30px rgba(80,60,30,.025);overflow:hidden}
.ung-book-page{display:none;min-height:560px;padding:46px 54px 58px;animation:ungPageIn .28s ease}
.ung-book-page.is-active{display:block}
.ung-book-page img{max-width:100%;height:auto}
.ung-book-controls{display:flex;align-items:center;justify-content:center;gap:18px;margin-top:18px}
.ung-book-controls button{border:0;border-radius:999px;background:#2d6a4f;color:#fff;padding:10px 18px;font-weight:700;cursor:pointer}
.ung-book-controls button:disabled{opacity:.35;cursor:not-allowed}
.ung-book-counter{min-width:70px;text-align:center;font-weight:800;color:#23372d}
@keyframes ungPageIn{from{opacity:.35;transform:translateX(12px)}to{opacity:1;transform:none}}
@media(max-width:640px){.ung-book-page{min-height:70vh;padding:28px 22px 38px}.ung-book-controls{gap:8px}.ung-book-controls button{padding:9px 12px;font-size:13px}}


/* ── [v3.4.1] 회차 3개 제한·책 휠 넘김 보완 ───────────────── */
.ung-series-card-grid > .ung-mini-card:nth-child(n+4){display:none!important}
.ung-book-reader{outline:none}
.ung-book-reader:focus-visible{outline:2px solid #7daf95;outline-offset:8px;border-radius:8px}
.ung-book-pages{overflow:visible!important}
.ung-book-page{height:auto!important;max-height:none!important;overflow:visible!important}
.ung-book-page.is-active{display:block!important}
.ung-book-page img{display:block;max-width:750px!important;width:auto;height:auto;margin:18px auto}

/* ================================================================
   v3.5.0 고정 높이 전자책 · 모바일 전체 폭/메뉴 보정
   - PC/모바일 모두 3:4 종이 비율
   - 화면 좌우 여백 5px
   - 문단은 JS가 다음 장으로 자동 이동
   ================================================================ */
body.ung-board-page .ung-board-wrap,
.ung-board-wrap {
    width: min(800px, calc(100% - 10px)) !important;
    max-width: 800px !important;
}

.ung-book-reader {
    width: min(750px, 100%) !important;
    max-width: 750px !important;
    margin: 0 auto 30px !important;
}

.ung-book-pages {
    width: 100% !important;
    height: clamp(520px, 68vh, 680px) !important;
    min-height: 520px !important;
    overflow: hidden !important;
    border: 1px solid #ded5c5 !important;
    border-radius: 8px !important;
    background: #fffdf8 !important;
    box-shadow: 0 14px 34px rgba(54,43,24,.14), inset -16px 0 28px rgba(80,60,30,.025) !important;
}

.ung-book-page,
.ung-book-page.is-active {
    display: none !important;
    box-sizing: border-box !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    padding: clamp(24px, 6.1vw, 46px) clamp(20px, 7.2vw, 54px) clamp(32px, 7.7vw, 58px) !important;
    overflow: hidden !important;
}
.ung-book-page.is-active { display: block !important; }

.ung-book-page > :first-child { margin-top: 0 !important; }
.ung-book-page > :last-child { margin-bottom: 0 !important; }
.ung-book-page p,
.ung-book-page blockquote,
.ung-book-page li {
    word-break: keep-all;
    overflow-wrap: anywhere;
}
.ung-book-page img {
    display: block !important;
    width: auto !important;
    max-width: 100% !important;
    max-height: 47% !important;
    height: auto !important;
    object-fit: contain !important;
    margin: clamp(10px, 2.4vw, 18px) auto !important;
}
.ung-book-page figure { margin-left: 0 !important; margin-right: 0 !important; }
.ung-book-page figure img { max-height: 44% !important; }
.ung-book-page table { font-size: .92em; }

.ung-book-controls {
    position: static;
    z-index: 1;
    width: fit-content;
    max-width: calc(100% - 10px);
    margin: 12px auto 0 !important;
    padding: 5px;
    gap: 8px !important;
    border: 1px solid rgba(45,106,79,.15);
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.ung-book-controls button {
    min-height: 42px;
    padding: 9px 15px !important;
    touch-action: manipulation;
}

/* 모바일 홈 카드와 게시판 내부는 좌우 5px를 기준으로 사용 */
@media (max-width: 640px) {
    body.ung-board-page .ung-board-wrap,
    .ung-board-wrap {
        width: calc(100% - 10px) !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    .ung-book-reader { width: 100% !important; }
    .ung-book-pages {
        height: clamp(460px, 72svh, 620px) !important;
        min-height: 460px !important;
        border-radius: 5px !important;
    }
    .ung-book-page,
    .ung-book-page.is-active {
        padding: 24px 18px 32px !important;
        font-size: clamp(15px, 4.15vw, 17px);
        line-height: 1.68;
    }
    .ung-book-controls button {
        min-width: 96px;
        min-height: 44px;
        padding: 8px 10px !important;
        font-size: 13px !important;
    }
    .ung-book-counter { min-width: 54px !important; font-size: 13px; }
    .ung-board-wrap .ung-post-list,
    .ung-board-wrap .ung-recent-card-grid,
    .ung-board-wrap .ung-series-card-grid {
        gap: 6px !important;
    }
}

/* 워드프레스/Astra 계열 모바일 메뉴: 가장자리 5px, 큰 터치 영역 */
@media (max-width: 921px) {
    body.ung-board-page .site-header .ast-container,
    body.ung-board-page .main-header-bar .ast-container,
    body.ung-board-page header .container,
    body.ung-board-page header .wp-block-group {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }
    body.ung-board-page .menu-toggle,
    body.ung-board-page .ast-mobile-menu-trigger-minimal,
    body.ung-board-page button[aria-controls*="menu"] {
        min-width: 44px !important;
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        touch-action: manipulation;
    }
    body.ung-board-page .main-header-menu .menu-link,
    body.ung-board-page .ast-header-break-point .main-navigation ul .menu-item .menu-link,
    body.ung-board-page .wp-block-navigation__responsive-container a {
        min-height: 46px;
        display: flex;
        align-items: center;
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }
    body.ung-board-page .ast-mobile-header-content,
    body.ung-board-page .wp-block-navigation__responsive-container.is-menu-open {
        max-height: calc(100dvh - 56px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}

/* ── [v3.5.2] 책 이동 메뉴는 화면 고정이 아닌 책 아래 일반 배치 ── */
.ung-book-reader .ung-book-controls {
    position: static !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    float: none !important;
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 10px 0 0 !important;
    padding: 8px 0 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    justify-content: center !important;
}
.ung-book-reader .ung-book-controls::before,
.ung-book-reader .ung-book-controls::after {
    display: none !important;
}
.ung-book-reader .ung-book-controls button {
    border: 1px solid #d8e7dd !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #294c3b !important;
    box-shadow: none !important;
}


/* ── [v3.5.3] 이미지 전용 페이지·잘림 방지 ─────────────────── */
.ung-book-page.is-media-page,
.ung-book-page.is-media-page.is-active {
    padding: 24px !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
}
.ung-book-page.is-media-page.is-active {
    display: flex !important;
}
.ung-book-page.is-media-page > img,
.ung-book-page.is-media-page > video,
.ung-book-page.is-media-page > iframe {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 auto !important;
    object-fit: contain !important;
}
.ung-book-page.is-media-page > figure {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}
.ung-book-page.is-media-page > figure > img,
.ung-book-page.is-media-page > figure > video,
.ung-book-page.is-media-page > figure > iframe {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: calc(100% - 34px) !important;
    margin: 0 auto !important;
    object-fit: contain !important;
    flex: 0 1 auto !important;
}
.ung-book-page.is-media-page figcaption {
    flex: 0 0 auto !important;
    width: 100% !important;
    margin: 8px 0 0 !important;
    text-align: center !important;
}
/* 일반 글 페이지에 이미지가 남더라도 절대 바깥으로 잘리지 않게 함 */
.ung-book-page:not(.is-media-page) > img,
.ung-book-page:not(.is-media-page) > figure {
    max-height: 52% !important;
    overflow: hidden !important;
}
@media (max-width: 640px) {
    .ung-book-page.is-media-page,
    .ung-book-page.is-media-page.is-active {
        padding: 10px !important;
    }
}

/* ── [v3.5.4] 전자책을 화면 고정 팝업(모달)로 표시 ───────────── */
body.ung-book-modal-open {
    overflow: hidden !important;
}
body.ung-book-modal-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 999998;
    background: rgba(24, 28, 25, .58);
    backdrop-filter: blur(3px);
}
.ung-book-reader {
    position: fixed !important;
    inset: 12px !important;
    z-index: 999999 !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    margin: 0 !important;
    padding: 54px 16px 72px !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f6f3ec !important;
    border-radius: 14px !important;
    box-shadow: 0 22px 70px rgba(0,0,0,.34) !important;
    overflow: hidden !important;
}
.ung-book-modal-bar {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 50px !important;
    padding: 0 14px 0 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: rgba(255,255,255,.94) !important;
    border-bottom: 1px solid #e4ded2 !important;
    box-sizing: border-box !important;
}
.ung-book-modal-title {
    font-weight: 700 !important;
    color: #294c3b !important;
}
.ung-book-close {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: #333 !important;
    font-size: 30px !important;
    line-height: 1 !important;
    cursor: pointer !important;
}
.ung-book-close:hover,
.ung-book-close:focus-visible {
    background: #eef4ef !important;
}
.ung-book-pages {
    width: min(760px, calc(100vw - 64px)) !important;
    height: min(680px, calc(100dvh - 150px)) !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: 0 1 auto !important;
}
.ung-book-reader .ung-book-controls {
    position: absolute !important;
    left: 50% !important;
    bottom: 12px !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    max-width: calc(100% - 24px) !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    background: transparent !important;
}
.ung-book-reader .ung-book-controls button {
    white-space: nowrap !important;
}
@media (max-width: 640px) {
    .ung-book-reader {
        inset: 5px !important;
        padding: 50px 5px 64px !important;
        border-radius: 9px !important;
    }
    .ung-book-pages {
        width: 100% !important;
        height: calc(100dvh - 124px) !important;
        border-radius: 5px !important;
    }
    .ung-book-modal-bar {
        height: 46px !important;
        padding-left: 12px !important;
    }
    .ung-book-reader .ung-book-controls {
        bottom: 8px !important;
        width: calc(100% - 10px) !important;
        justify-content: center !important;
    }
    .ung-book-reader .ung-book-controls button {
        min-width: 0 !important;
        flex: 0 1 115px !important;
    }
}


/* ── [v3.5.5] 마지막 줄·문단 하단 잘림 방지 ───────────────── */
.ung-book-page,
.ung-book-page.is-active {
    padding-bottom: calc(clamp(32px, 7.7vw, 58px) + 18px) !important;
}
.ung-book-page > :last-child {
    margin-bottom: 8px !important;
}
.ung-book-page p,
.ung-book-page blockquote,
.ung-book-page li {
    padding-bottom: 1px;
}
@media (max-width: 640px) {
    .ung-book-page,
    .ung-book-page.is-active {
        padding-bottom: 48px !important;
    }
}


/* ── [v3.5.6] 페이지 안 팝업창 형태 + 하단 3% 여유 보정 ───────── */
body.ung-book-modal-open::before {
    background: rgba(24, 28, 25, .45) !important;
}
.ung-book-reader {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    inset: auto !important;
    transform: translate(-50%, -50%) !important;
    width: min(96vw, 1180px) !important;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(100dvh - 6vh) !important;
    height: auto !important;
    margin: 0 !important;
    padding: 54px 16px calc(58px + 3vh) !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    background: #f6f3ec !important;
    border: 1px solid #d7cfbf !important;
    border-radius: 18px !important;
    box-shadow: 0 24px 72px rgba(0,0,0,.30) !important;
    overflow: hidden !important;
}
.ung-book-pages {
    width: min(760px, calc(100vw - 90px)) !important;
    height: min(680px, calc(100dvh - 170px - 3vh)) !important;
    max-height: calc(100dvh - 170px - 3vh) !important;
    min-height: 0 !important;
    flex: 0 1 auto !important;
}
.ung-book-page,
.ung-book-page.is-active {
    padding-bottom: calc(clamp(32px, 7.7vw, 58px) + 3%) !important;
}
.ung-book-reader .ung-book-controls {
    position: absolute !important;
    left: 50% !important;
    bottom: max(12px, 3vh) !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    max-width: calc(100% - 28px) !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
    background: transparent !important;
}
.ung-book-reader .ung-book-controls button,
.ung-book-reader .ung-book-counter {
    white-space: nowrap !important;
}
@media (max-width: 640px) {
    .ung-book-reader {
        width: calc(100vw - 10px) !important;
        max-width: calc(100vw - 10px) !important;
        max-height: calc(100dvh - 6vh) !important;
        padding: 50px 5px calc(54px + 3vh) !important;
        border-radius: 10px !important;
    }
    .ung-book-pages {
        width: 100% !important;
        height: calc(100dvh - 118px - 3vh) !important;
        max-height: calc(100dvh - 118px - 3vh) !important;
        border-radius: 5px !important;
    }
    .ung-book-reader .ung-book-controls {
        bottom: max(8px, 3vh) !important;
        width: calc(100% - 10px) !important;
        justify-content: center !important;
    }
    .ung-book-page,
    .ung-book-page.is-active {
        padding-bottom: calc(48px + 3%) !important;
    }
}


/* ── [v3.5.7] 테마 고정폭/transform 영향 제거: 뷰포트 정중앙 모달 ── */
.ung-book-reader {
    position: fixed !important;
    top: 3vh !important;
    right: 16px !important;
    bottom: 3vh !important;
    left: 16px !important;
    inset: 3vh 16px !important;
    transform: none !important;
    width: min(1180px, calc(100vw - 32px)) !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 auto !important;
}
.ung-book-pages {
    width: min(760px, calc(100vw - 90px)) !important;
    height: calc(94dvh - 128px) !important;
    max-height: 680px !important;
}
@media (max-width: 640px) {
    .ung-book-reader {
        inset: 3vh 5px !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
    }
    .ung-book-pages {
        width: 100% !important;
        height: calc(94dvh - 112px) !important;
        max-height: none !important;
    }
}


/* ── [v3.5.8] 모달 제거: 게시글 안 전자책 + 댓글 접근 가능 ───── */
body.ung-book-modal-open {
    overflow: auto !important;
}
body.ung-book-modal-open::before {
    display: none !important;
    content: none !important;
}
.ung-book-reader {
    position: static !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    width: min(750px, 100%) !important;
    max-width: 750px !important;
    height: auto !important;
    max-height: none !important;
    margin: 24px auto 36px !important;
    padding: 0 !important;
    display: block !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
}
.ung-book-modal-bar,
.ung-book-close {
    display: none !important;
}
.ung-book-pages {
    width: 100% !important;
    height: clamp(500px, 68vh, 680px) !important;
    max-height: 680px !important;
    min-height: 500px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fffdf8 !important;
    overflow: hidden !important;
}
.ung-book-page,
.ung-book-page.is-active {
    padding-bottom: calc(clamp(32px, 7.7vw, 58px) + 3%) !important;
}
.ung-book-reader .ung-book-controls {
    position: static !important;
    inset: auto !important;
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 12px 0 0 !important;
    padding: 0 !important;
    display: flex !important;
    justify-content: center !important;
    gap: 10px !important;
}
@media (max-width: 640px) {
    .ung-book-reader {
        width: 100% !important;
        max-width: 100% !important;
        margin: 12px auto 28px !important;
    }
    .ung-book-pages {
        width: 100% !important;
        height: clamp(460px, 70svh, 620px) !important;
        max-height: 620px !important;
        min-height: 460px !important;
    }
    .ung-book-page,
    .ung-book-page.is-active {
        padding-bottom: calc(40px + 3%) !important;
    }
}


/* ── [v3.5.9] 다시 팝업창 형식: 본문 영향 차단 + 현재 크기 유지 ── */
body.ung-book-modal-open {
    overflow: hidden !important;
}
body.ung-book-modal-open::before {
    display: block !important;
    content: "" !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 999998 !important;
    background: rgba(24, 28, 25, .42) !important;
    backdrop-filter: blur(2px) !important;
}
.ung-book-reader {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    inset: auto !important;
    transform: translate(-50%, -50%) !important;
    width: min(860px, calc(100vw - 32px)) !important;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(94dvh) !important;
    margin: 0 !important;
    padding: 58px 16px calc(56px + 3vh) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    background: #f6f3ec !important;
    border: 1px solid #d8d0c2 !important;
    border-radius: 18px !important;
    box-shadow: 0 24px 72px rgba(0,0,0,.28) !important;
    overflow: hidden !important;
    z-index: 999999 !important;
}
.ung-book-modal-bar {
    display: flex !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 50px !important;
    padding: 0 16px 0 22px !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: rgba(255,255,255,.92) !important;
    border-bottom: 1px solid #e4ded2 !important;
    box-sizing: border-box !important;
}
.ung-book-modal-title {
    font-weight: 700 !important;
    color: #294c3b !important;
}
.ung-book-close {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: #333 !important;
    font-size: 30px !important;
    line-height: 1 !important;
    cursor: pointer !important;
}
.ung-book-close:hover,
.ung-book-close:focus-visible {
    background: #eef4ef !important;
}
.ung-book-pages {
    width: min(750px, 100%) !important;
    height: clamp(500px, 68vh, 680px) !important;
    max-height: calc(94dvh - 132px - 3vh) !important;
    min-height: 500px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fffdf8 !important;
    overflow: hidden !important;
}
.ung-book-page,
.ung-book-page.is-active {
    padding-bottom: calc(clamp(32px, 7.7vw, 58px) + 3%) !important;
}
.ung-book-reader .ung-book-controls {
    position: absolute !important;
    left: 50% !important;
    bottom: max(12px, 3vh) !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    max-width: calc(100% - 24px) !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 10px !important;
    background: transparent !important;
    justify-content: center !important;
}
@media (max-width: 640px) {
    .ung-book-reader {
        width: calc(100vw - 10px) !important;
        max-width: calc(100vw - 10px) !important;
        max-height: 94dvh !important;
        padding: 50px 5px calc(54px + 3vh) !important;
        border-radius: 10px !important;
    }
    .ung-book-modal-bar {
        height: 46px !important;
        padding-left: 12px !important;
    }
    .ung-book-pages {
        width: 100% !important;
        height: calc(94dvh - 112px) !important;
        max-height: calc(94dvh - 112px - 3vh) !important;
        min-height: 460px !important;
    }
    .ung-book-reader .ung-book-controls {
        bottom: max(8px, 3vh) !important;
        width: calc(100% - 10px) !important;
    }
}


/* ── [v3.6.1] 팝업 표시 최종 보정: inset 충돌 제거·뷰포트 중앙 고정 ── */
html body.ung-book-modal-open { overflow: hidden !important; }
html body.ung-book-modal-open::before {
    content: "" !important;
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 2147483000 !important;
    background: rgba(24, 28, 25, .46) !important;
    backdrop-filter: blur(2px) !important;
}
html body > .ung-book-reader {
    box-sizing: border-box !important;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    z-index: 2147483001 !important;
    width: min(860px, calc(100vw - 32px)) !important;
    max-width: calc(100vw - 32px) !important;
    height: min(94dvh, 820px) !important;
    max-height: 94dvh !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 58px 16px calc(56px + 3vh) !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    background: #f6f3ec !important;
    border: 1px solid #d8d0c2 !important;
    border-radius: 18px !important;
    box-shadow: 0 24px 72px rgba(0,0,0,.28) !important;
    overflow: hidden !important;
}
html body > .ung-book-reader .ung-book-modal-bar {
    box-sizing: border-box !important;
    display: flex !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 50px !important;
    padding: 0 12px 0 20px !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: rgba(255,255,255,.96) !important;
    border-bottom: 1px solid #e4ded2 !important;
    z-index: 2 !important;
}
html body > .ung-book-reader .ung-book-close {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: #222 !important;
    font-size: 30px !important;
    line-height: 1 !important;
    cursor: pointer !important;
}
html body > .ung-book-reader .ung-book-pages {
    box-sizing: border-box !important;
    width: min(750px, 100%) !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    background: #fffdf8 !important;
    overflow: hidden !important;
}
html body > .ung-book-reader .ung-book-controls {
    position: absolute !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    bottom: max(10px, 3vh) !important;
    transform: translateX(-50%) !important;
    z-index: 3 !important;
    width: auto !important;
    margin: 0 !important;
}
@media (max-width: 640px) {
    html body > .ung-book-reader {
        width: calc(100vw - 10px) !important;
        max-width: calc(100vw - 10px) !important;
        height: 94dvh !important;
        max-height: 94dvh !important;
        padding: 50px 5px calc(54px + 3vh) !important;
        border-radius: 10px !important;
    }
    html body > .ung-book-reader .ung-book-modal-bar { height: 46px !important; }
    html body > .ung-book-reader .ung-book-pages { width: 100% !important; height: 100% !important; }
}

/* ── [v3.6.2] 전자책을 게시글 안쪽 카드로 표시: 댓글 접근 가능 ───── */
html body.ung-book-modal-open,
body.ung-book-modal-open {
    overflow: auto !important;
}
html body.ung-book-modal-open::before,
body.ung-book-modal-open::before {
    content: none !important;
    display: none !important;
}
html body .ung-view-content > .ung-book-reader,
html body .ung-book-reader {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    z-index: 1 !important;
    width: min(100%, 920px) !important;
    max-width: 920px !important;
    height: auto !important;
    max-height: none !important;
    margin: 18px auto 28px !important;
    padding: 54px 16px 76px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    background: #f6f3ec !important;
    border: 1px solid #d7cfbf !important;
    border-radius: 18px !important;
    box-shadow: 0 14px 38px rgba(45, 62, 52, .18) !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}
html body .ung-book-reader[hidden] {
    display: none !important;
}
html body .ung-book-reader .ung-book-modal-bar {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 50px !important;
    z-index: 2 !important;
}
html body .ung-book-reader .ung-book-pages {
    width: min(760px, calc(100% - 24px)) !important;
    height: min(680px, calc(100dvh - 210px)) !important;
    min-height: 520px !important;
    max-height: 680px !important;
    flex: 0 0 auto !important;
    overflow: hidden !important;
}
html body .ung-book-reader .ung-book-controls {
    position: absolute !important;
    left: 50% !important;
    right: auto !important;
    bottom: 18px !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    max-width: calc(100% - 24px) !important;
    margin: 0 !important;
    z-index: 2 !important;
}
html body .ung-engage-bar,
html body .ung-comments-wrap {
    position: relative !important;
    z-index: 2 !important;
}
@media (max-width: 640px) {
    html body .ung-view-content > .ung-book-reader,
    html body .ung-book-reader {
        width: 100% !important;
        max-width: 100% !important;
        margin: 10px auto 22px !important;
        padding: 48px 5px 66px !important;
        border-radius: 10px !important;
    }
    html body .ung-book-reader .ung-book-pages {
        width: 100% !important;
        height: calc(100dvh - 175px) !important;
        min-height: 430px !important;
        max-height: 680px !important;
    }
    html body .ung-book-reader .ung-book-controls {
        bottom: 12px !important;
        width: calc(100% - 10px) !important;
        justify-content: center !important;
    }
}


/* ── [v3.6.4] 버튼을 눌렀을 때만 여는 고정 전자책 팝업 ───────── */
.ung-book-launch {
    display: flex !important;
    justify-content: center !important;
    margin: 24px auto 30px !important;
}
.ung-book-open {
    appearance: none !important;
    border: 1px solid #8fb6a0 !important;
    border-radius: 12px !important;
    background: #2f7251 !important;
    color: #fff !important;
    padding: 13px 24px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    cursor: pointer !important;
    box-shadow: 0 6px 16px rgba(47,114,81,.18) !important;
}
.ung-book-open:hover { filter: brightness(.96) !important; }
.ung-book-open:focus-visible { outline: 3px solid rgba(47,114,81,.28) !important; outline-offset: 3px !important; }

html body.ung-book-modal-open {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    overflow: hidden !important;
}
html body.ung-book-modal-open::before {
    content: "" !important;
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483000 !important;
    background: rgba(28,33,30,.48) !important;
    backdrop-filter: blur(2px) !important;
}
html body > .ung-book-reader[hidden] { display: none !important; }
html body > .ung-book-reader:not([hidden]) {
    box-sizing: border-box !important;
    display: flex !important;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    z-index: 2147483001 !important;
    width: min(920px, calc(100vw - 32px)) !important;
    max-width: calc(100vw - 32px) !important;
    height: min(94dvh, 820px) !important;
    max-height: 94dvh !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 58px 16px calc(58px + 3vh) !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    background: #f6f3ec !important;
    border: 1px solid #d7cfbf !important;
    border-radius: 18px !important;
    box-shadow: 0 24px 72px rgba(0,0,0,.30) !important;
    overflow: hidden !important;
}
html body > .ung-book-reader:not([hidden]) .ung-book-modal-bar {
    display: flex !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 50px !important;
    padding: 0 12px 0 20px !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: rgba(255,255,255,.97) !important;
    border-bottom: 1px solid #e4ded2 !important;
    z-index: 3 !important;
}
html body > .ung-book-reader:not([hidden]) .ung-book-close {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: #222 !important;
    font-size: 30px !important;
    line-height: 1 !important;
    cursor: pointer !important;
}
html body > .ung-book-reader:not([hidden]) .ung-book-pages {
    box-sizing: border-box !important;
    width: min(760px, 100%) !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    background: #fffdf8 !important;
    overflow: hidden !important;
}
html body > .ung-book-reader:not([hidden]) .ung-book-controls {
    position: absolute !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    bottom: max(10px, 3vh) !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    max-width: calc(100% - 20px) !important;
    margin: 0 !important;
    z-index: 3 !important;
}
@media (max-width: 640px) {
    .ung-book-open { width: min(100%, 360px) !important; font-size: 17px !important; }
    html body > .ung-book-reader:not([hidden]) {
        width: calc(100vw - 10px) !important;
        max-width: calc(100vw - 10px) !important;
        height: 94dvh !important;
        max-height: 94dvh !important;
        padding: 50px 5px calc(56px + 3vh) !important;
        border-radius: 10px !important;
    }
    html body > .ung-book-reader:not([hidden]) .ung-book-pages { width: 100% !important; height: 100% !important; }
    html body > .ung-book-reader:not([hidden]) .ung-book-controls { width: calc(100% - 10px) !important; }
}

/* ==============================================================
   독립형 CMS v1.2.0 연결부
============================================================== */
.ung-board-wrap{max-width:800px;margin:0 auto}
.ung-board-head{display:flex;align-items:flex-end;justify-content:space-between;gap:18px;border-bottom:2px solid #2d6a4f;padding-bottom:14px;margin-bottom:20px}
.ung-board-head h1{margin:0;color:#0b5b3f;font-size:clamp(1.65rem,3vw,2.25rem)}
.ung-board-desc{margin:6px 0 0;color:#6b746f}
.ung-card-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
.ung-post-card{position:relative;background:#fff;border:1px solid #dfe7df;border-radius:14px;overflow:hidden;box-shadow:0 4px 14px rgba(30,60,40,.05);transition:.18s ease}
.ung-post-card:hover{transform:translateY(-2px);box-shadow:0 8px 22px rgba(30,60,40,.09)}
.ung-post-card>a{display:block;color:inherit;text-decoration:none;height:100%}
.ung-card-thumb{width:100%;aspect-ratio:1/1;object-fit:cover;background:#f3f0e8;display:block}
.ung-card-thumb-empty{display:grid;place-items:center;color:#98a29c;font-weight:700}
.ung-card-body{padding:13px 14px 15px}
.ung-card-badges{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:8px}
.ung-card-title{font-size:1rem;line-height:1.45;margin:0 0 7px;font-weight:800;color:#26342e;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.ung-card-excerpt{font-size:.88rem;line-height:1.55;color:#68726d;margin:0 0 8px;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.ung-card-meta{font-size:.78rem;color:#8a928e;display:flex;gap:8px;justify-content:space-between}
.ung-count-line{margin-top:18px;padding-top:14px;border-top:1px solid #e9ece9;color:#929a95;font-size:.88rem}
.ung-board-empty{padding:55px 20px;text-align:center;color:#8b928e;border:1px dashed #cbd5cd;border-radius:14px;background:#fff}
.ung-write-link{white-space:nowrap}
.ung-view-wrap{max-width:800px;margin:0 auto}
.ung-view-head{border-bottom:2px solid #2d6a4f;padding-bottom:18px;margin-bottom:26px}
.ung-view-title{font-size:clamp(1.7rem,4vw,2.45rem);line-height:1.35;margin:10px 0 12px;color:#20322a}
.ung-view-meta{display:flex;flex-wrap:wrap;gap:9px 15px;color:#76817b;font-size:.87rem}
.ung-view-content{font-size:17px;line-height:1.92;overflow-wrap:anywhere}
.ung-view-content img{max-width:100%;height:auto}
.ung-engage-bar{display:flex;align-items:center;gap:12px;border-top:1px solid #e2e7e3;border-bottom:1px solid #e2e7e3;padding:14px 0;margin-top:34px}
.ung-like-btn,.ung-comments-title{border:1px solid #cbd7ce;background:#fff;border-radius:999px;padding:9px 14px;cursor:pointer;font:inherit;font-weight:700;color:#315d48}
.ung-like-btn.liked{background:#fff0f2;color:#bd3654;border-color:#efb7c3}
.ung-comments-title{margin-left:auto}
.ung-comments-body{padding:20px 0}
.ung-comment-item{list-style:none;border-top:1px solid #edf0ed;padding:15px 0}
.ung-comment-list,.ung-comment-children{margin:0;padding:0}
.ung-comment-children{margin-left:28px;border-left:3px solid #e7eee8;padding-left:16px}
.ung-comment-head{display:flex;gap:10px;align-items:center;margin-bottom:7px}
.ung-comment-author{font-weight:800;color:#254b39}
.ung-comment-date{font-size:.78rem;color:#929993}
.ung-comment-text{line-height:1.65}
.comment-emoticon{width:64px;height:64px;object-fit:contain;vertical-align:middle}
.ung-comment-actions{display:flex;gap:8px;margin-top:8px}
.ung-comment-actions button{border:0;background:none;color:#687b70;padding:0;cursor:pointer;font-size:.8rem}
.ung-comment-form-wrap{margin-top:20px;background:#f8fbf8;border:1px solid #dbe6dc;border-radius:12px;padding:16px}
.ung-comment-form textarea{width:100%;min-height:100px;border:1px solid #bccbbf;border-radius:10px;padding:12px;font:inherit;resize:vertical}
.ung-comment-form-footer{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-top:10px}
.ung-emoticon-panel{display:none;grid-template-columns:repeat(8,1fr);gap:7px;margin-top:10px;padding:10px;background:#fff;border:1px solid #d9e2da;border-radius:10px}
.ung-emoticon-panel.is-open{display:grid}
.ung-emoticon-choice{border:0;background:#f7f8f7;border-radius:8px;padding:4px;cursor:pointer}
.ung-emoticon-choice img{width:38px;height:38px;object-fit:contain}
.ung-comment-login-msg{padding:18px;text-align:center;background:#f7f7f4;border-radius:10px;color:#6f7772}
.ung-view-admin-actions{display:flex;justify-content:flex-end;gap:8px;margin:18px 0}
.ung-related{margin-top:36px;border-top:2px solid #6d4c41;padding-top:18px}
.ung-related-list{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
.ung-related-card{border:1px solid #e2e5e2;border-radius:10px;padding:12px;background:#fff}
.ung-series-badge{display:inline-flex;padding:5px 9px;border-radius:999px;background:#e8f5e9;color:#23613f;font-weight:800;font-size:.76rem}
.ung-cat-tag{display:inline-flex;padding:5px 9px;border-radius:999px;background:#f7ecdf;color:#744c31;font-weight:800;font-size:.76rem}
.ung-notice-badge{display:inline-flex;padding:5px 9px;border-radius:999px;background:#2f9b45;color:#fff;font-weight:800;font-size:.76rem}
.ung-book-shell{position:relative;background:#f6f1e7;border:1px solid #dfd3bf;border-radius:16px;padding:24px 24px 58px;min-height:420px;box-shadow:inset 0 0 25px rgba(88,64,37,.05)}
.ung-book-page{display:none;background:#fffefb;min-height:330px;padding:24px;border-radius:10px;box-shadow:0 8px 22px rgba(80,60,40,.08)}
.ung-book-page.is-active{display:block}
.ung-book-controls{position:absolute;left:20px;right:20px;bottom:15px;display:flex;justify-content:space-between;align-items:center}
.ung-book-controls button{border:1px solid #bfae93;background:#fff;border-radius:9px;padding:8px 12px;cursor:pointer}
.ung-book-count{color:#7d6d58;font-size:.86rem}
.ung-quiz-box{margin:28px 0;padding:20px;border:2px solid #cfe4d3;background:#f7fcf7;border-radius:14px}
.ung-quiz-options{display:grid;gap:9px;margin-top:12px}
.ung-quiz-option{position:relative;border:1px solid #b8d0bd;background:#fff;border-radius:10px;padding:11px 14px;text-align:left;cursor:pointer;font:inherit}
.ung-quiz-option.is-correct{background:#dff3e3;border-color:#5ca16b}
.ung-quiz-option.is-wrong{background:#fff0ef;border-color:#d6756d}
.ung-quiz-result{font-weight:800;margin-top:10px;color:#2d6a4f}
.member-card{max-width:560px;margin:30px auto;background:#fff;border:1px solid #e1ddd5;border-radius:18px;padding:28px}
.social-login-list{display:grid;gap:10px;margin-top:20px}
.social-login{display:flex;justify-content:center;align-items:center;min-height:48px;border-radius:10px;font-weight:800;text-decoration:none!important;border:1px solid #ddd}
.social-google{background:#fff;color:#333}.social-naver{background:#03c75a;color:#fff;border-color:#03c75a}.social-kakao{background:#fee500;color:#191919;border-color:#fee500}.social-login.is-disabled{background:#f3f3f3;color:#999}
.menu-dropdown{position:relative}.menu-dropdown>summary{cursor:pointer;color:#183d30;font-weight:700;list-style:none}.menu-dropdown>summary::-webkit-details-marker{display:none}.menu-dropdown>div{position:absolute;top:32px;left:0;min-width:180px;background:#fff;border:1px solid #cfd9d1;border-radius:10px;padding:8px;box-shadow:0 8px 24px rgba(0,0,0,.12);z-index:100}.menu-dropdown>div a{display:block;padding:8px 10px}
@media(max-width:800px){.ung-card-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.ung-related-list{grid-template-columns:1fr}.ung-emoticon-panel{grid-template-columns:repeat(6,1fr)}}
@media(max-width:600px){.ung-card-grid{grid-template-columns:1fr}.ung-board-head{align-items:flex-start}.ung-card-thumb{aspect-ratio:16/10}.ung-comment-children{margin-left:10px;padding-left:10px}.ung-book-shell{padding:12px 12px 58px}.ung-book-page{padding:16px}.menu-dropdown>div{position:static;box-shadow:none;margin-top:6px}.ung-emoticon-panel{grid-template-columns:repeat(5,1fr)}}
