/* ==========================================
   디자인 토큰
   ========================================== */
:root {
    --bg: #F4F5F7;
    --surface: #FFFFFF;
    --surface-muted: #F9FAFB;
    --border: #E5E7EB;
    --border-soft: #EEF0F3;
    --divider: #F1F2F4;
    --text: #111827;
    --text-body: #1F2937;
    --text-2: #374151;
    --text-3: #4B5563;
    --muted: #5F6673;
    --accent: #2563EB;
    --accent-ink: #1D4ED8;
    --accent-weak: #EEF3FE;
    --ok-bg: #ECFDF3;
    --ok-text: #166534;
    --ok-dot: #16A34A;
    --video-bg: #FFF4E5;
    --video-text: #8A4100;
    --danger-bg: #FDECEC;
    --danger-text: #A11D1D;
    --radius: 14px;
    --font: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; -webkit-text-size-adjust: 100%; }
button, input, select { font-family: inherit; }
a { color: var(--accent-ink); }
[hidden] { display: none !important; }
/* 관리자로 로그인한 기기(body.is-admin)에서만 관리 버튼·게시판 만들기, 로그인 전에는 자물쇠 버튼만 */
body:not(.is-admin) .admin-only, body.is-admin .guest-only { display: none !important; }

/* 화면 폭에 따라 데스크톱(사이드바)과 모바일(키워드 칩) 요소 전환 */
.mobile-only { display: none !important; }
@media (max-width: 899px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; }
}

/* ==========================================
   공용 버튼·입력
   ========================================== */
.btn { height: 36px; padding: 0 14px; border-radius: 8px; border: none; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-decoration: none; }
.btn-outline { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.btn-outline:hover { background: var(--surface-muted); }
.btn-primary { background: var(--accent); color: #FFFFFF; font-weight: 700; }
.btn-primary:hover { background: var(--accent-ink); }
.btn:disabled { opacity: 0.6; cursor: default; }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-muted); }
.icon-btn.small { width: 28px; height: 28px; border: none; background: #F3F4F6; border-radius: 6px; }
.icon-btn.ghost { border: none; background: transparent; width: 44px; height: 44px; border-radius: 10px; }
.link-btn { padding: 0; border: none; background: none; color: var(--accent-ink); font-size: 12px; font-weight: 500; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.input { height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid #D1D5DB; background: var(--surface); font-size: 14px; color: var(--text); min-width: 0; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.select { padding: 0 8px; }

/* ==========================================
   상단 바
   ========================================== */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-row { height: 56px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.brand-link { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.brand-name { font-size: 16px; font-weight: 700; white-space: nowrap; }
.brand-link:hover .brand-name { color: var(--accent); }
/* 상태 표시: 누르면 새로고침 (오른쪽 작은 화살표로 누를 수 있음을 보임) */
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: none; border-radius: 999px; background: var(--ok-bg); color: var(--ok-text); font-size: 12px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.status-pill:hover { filter: brightness(0.96); }
.status-refresh { opacity: 0.7; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok-dot); }
.status-pill.is-error { background: var(--danger-bg); color: var(--danger-text); }
.status-pill.is-error .status-dot { background: var(--danger-text); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* 검색창: 데스크톱은 상단 바 가운데, 모바일은 돋보기 버튼으로 펼침 */
/* 검색창: 데스크톱은 상단 바 오른쪽(관리 버튼들 옆), 모바일은 돋보기 버튼으로 펼침 */
.search-form { flex: 0 1 240px; min-width: 160px; position: relative; display: flex; align-items: center; }
.narrow-desktop-only { display: none !important; }
/* 좁은 데스크톱(1360px 미만): 보기 탭 자리를 위해 '수집 중' 글자는 점만 남기고, 검색창은 돋보기 버튼으로 접었다가 펼침(보기 탭 위에 겹쳐 뜸) */
@media (min-width: 900px) and (max-width: 1359px) {
    .narrow-desktop-only { display: inline-flex !important; }
    #status-text { display: none; }
    .status-pill { padding: 6px; }
    .search-form { display: none; position: absolute; right: 200px; top: 9px; width: 300px; z-index: 5; }
    .topbar.search-open .search-form { display: flex; }
    .topbar-row { position: relative; }
    /* 보기 칸이 로고와 버튼 사이에 들어가도록 칸 여백·글자를 조금 줄임 (아래 기본 규칙보다 앞에 있어 선택자를 한 단계 더 구체적으로) */
    .view-bar-tabs .view-bar-tab { padding: 0 7px; gap: 4px; font-size: 12px; }
    .view-bar-tabs .view-bar-tab .count-badge { font-size: 11px; }
}
/* 더 좁으면 '키워드 모니터' 글자도 숨김 (로고로 홈 이동) */
@media (min-width: 900px) and (max-width: 1099px) {
    .brand-name { display: none; }
}
.search-icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search-input { width: 100%; height: 38px; padding: 0 12px 0 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-muted); font-size: 14px; color: var(--text); }
.search-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--surface); }
mark { background: #FEF08A; color: inherit; padding: 0 1px; border-radius: 2px; }

.chip-row { gap: 8px; overflow-x: auto; padding: 0 16px 12px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-body); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.chip-count { font-size: 12px; color: var(--muted); }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.chip-dot + .chip-dot { margin-left: -2px; }
.chip-dot-comments { background: #EA580C; }
/* 고른 칩은 파란 바탕이라 안 읽은 글 점은 흰색으로, 새 댓글 점은 흰 테두리를 둘러 보이게 */
.chip.active .chip-dot { background: #FFFFFF; }
.chip.active .chip-dot-comments { background: #EA580C; box-shadow: 0 0 0 1.5px #FFFFFF; }
.chip.active { border-color: var(--accent); background: var(--accent); color: #FFFFFF; font-weight: 700; }
.chip.active .chip-count { color: #FFFFFF; opacity: 0.85; }
/* 모바일 보기 선택 (모든 글·안 읽은 글·새 댓글·동영상·이미지와 더보기, 글 수는 고른 게시판 기준) */
.view-tabs { gap: 2px; margin: 0 16px 8px; padding: 3px; border-radius: 10px; background: #E9EBEF; }
.view-tab { flex: 1 1 0; min-width: 0; height: 40px; padding: 0 1px; border: none; border-radius: 8px; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; cursor: pointer; }
.view-tab[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 2px rgba(17,24,39,0.08); color: var(--text); font-weight: 700; }
/* 보기 칸 글 수 배지 (데스크톱 사이드바). 모바일 보기 칸은 높이를 줄이려고 배지 대신 작은 숫자만 */
.count-badge { min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: #EEF0F3; color: var(--text-2); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; justify-content: center; }
.count-badge.is-unread { background: var(--accent); color: #FFFFFF; }
.count-badge.is-comments { background: #EA580C; color: #FFFFFF; }
.view-tab .count-badge, .view-bar-tab .count-badge { min-width: 0; height: auto; padding: 0; background: none; color: var(--muted); font-size: 11px; line-height: 1.3; }
.view-tab .count-badge.is-unread, .view-bar-tab .count-badge.is-unread { color: var(--accent); }
.view-tab .count-badge.is-comments, .view-bar-tab .count-badge.is-comments { color: #EA580C; }
/* 데스크톱 보기 탭: 상단 바 가운데. 모바일 보기 칸과 같은 모양(회색 바탕 위 흰 칸)·숫자 색 */
.view-bar-tabs { flex: 0 1 auto; min-width: 0; margin: 0 auto; display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: #E9EBEF; }
.view-bar-tab { height: 32px; padding: 0 10px; border: none; border-radius: 8px; background: transparent; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap; cursor: pointer; }
.view-bar-tab:hover { background: rgba(255,255,255,0.6); }
.view-bar-tab[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 2px rgba(17,24,39,0.08); color: var(--text); font-weight: 700; }
.view-bar-tab .count-badge { font-size: 12px; }
/* 보기 탭 끝 '더보기': 보관함·삭제됨을 아래로 펼친 목록에서 고름 (고른 상태면 버튼에 그 보기 이름) */
.view-more { position: relative; display: flex; }
.view-tabs .view-more { flex: 1 1 0; min-width: 0; }
.view-tabs .view-more-btn { width: 100%; }
.view-more-btn > span { display: inline-flex; align-items: center; gap: 2px; }
.view-more-btn svg { width: 12px; height: 12px; color: var(--muted); }
.view-more-list { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 140px; padding: 4px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); box-shadow: 0 8px 24px rgba(17,24,39,0.14); display: flex; flex-direction: column; gap: 2px; }
.view-more-option { height: 38px; padding: 0 10px 0 12px; border: none; border-radius: 8px; background: transparent; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 500; color: var(--text-2); white-space: nowrap; cursor: pointer; }
.view-more-option:hover { background: var(--surface-muted); }
.view-more-option[aria-pressed="true"] { background: var(--accent-weak); color: var(--accent); font-weight: 700; }

/* 모바일에서 아래로 내리면 맨 위 제목 줄만 위로 밀어 숨김 (보기 칸·게시판 칩은 남김, --title-row-h는 app.js가 잼) */
.topbar { transition: transform 0.2s ease; }
.topbar.title-hidden { transform: translateY(calc(-1 * var(--title-row-h, 60px))); }

/* ==========================================
   레이아웃 / 사이드바
   ========================================== */
.layout { display: flex; align-items: stretch; min-height: calc(100vh - 57px); }
.sidebar { flex: 0 0 248px; position: sticky; top: 57px; align-self: flex-start; height: calc(100vh - 57px); overflow-y: auto; padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--border); flex-direction: column; gap: 18px; display: flex; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; font-size: 13px; font-weight: 700; color: var(--text-2); }
#keyword-groups { display: flex; flex-direction: column; gap: 18px; }
.kw-group { display: flex; flex-direction: column; gap: 2px; }
.kw-group .sidebar-head { min-height: 28px; margin-bottom: 4px; }
.kw-group-name { padding: 0 8px 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.kw-item { width: 100%; height: 38px; padding: 0 8px 0 10px; border: none; border-radius: 8px; background: transparent; display: flex; align-items: center; justify-content: space-between; cursor: pointer; text-align: left; font-size: 14px; font-weight: 500; color: var(--text-body); }
.kw-item:hover { background: var(--surface-muted); }
.kw-item.active { background: var(--accent-weak); color: var(--accent); font-weight: 700; }
.kw-side { display: flex; align-items: center; gap: 8px; }
.kw-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #FFFFFF; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.kw-comments { background: #EA580C; }
/* 수집 사이트 표시 (FM: 에펨코리아 파랑, DC: 디시인사이드 보라). 사이드바 사이트 제목·모바일 칩·글의 키워드 표시·관리 화면 */
.site-tag { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 16px; padding: 0 3px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.02em; margin-right: 6px; vertical-align: 1px; }
.site-fmkorea { background: #E0EAFF; color: #1D4ED8; }
.site-dcinside { background: #EDE9FE; color: #5B21B6; }
.site-multi { background: #DCFCE7; color: #166534; }
/* 사이드바: 사이트마다 옅은 색 상자로 게시판을 묶고, 제목 옆에 그 사이트의 안 읽은 새 글 수 */
.site-box { margin-top: 8px; padding: 4px; border-radius: 10px; display: flex; flex-direction: column; gap: 2px; }
.site-box-folder { background: #F5F7FA; border: 1px solid #E3E7ED; }
/* 사이트 제목 줄: 이름 부분(누르면 사이트 전체 게시판)과 오른쪽 끝 접기·펼치기 칸 */
.site-head { display: flex; align-items: center; gap: 2px; border-radius: 8px; }
.site-head.active { background: #FFFFFF; box-shadow: 0 1px 2px rgba(17,24,39,0.06); }
.site-open { flex: 1 1 auto; min-width: 0; height: 34px; padding: 0 6px; border: none; border-radius: 8px; background: transparent; display: flex; align-items: center; gap: 6px; cursor: pointer; text-align: left; font-size: 13px; font-weight: 700; color: var(--text); }
.site-open:hover { background: rgba(255,255,255,0.7); }
.site-head.active .site-open { color: var(--accent); }
.site-open .site-tag { margin-right: 0; }
.site-head-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-toggle { flex: 0 0 auto; width: 30px; height: 30px; border: none; border-radius: 6px; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.site-toggle:hover { background: rgba(255,255,255,0.8); color: var(--text); }
.site-box .kw-item:hover { background: rgba(255,255,255,0.7); }
.site-box .kw-item.active { background: #FFFFFF; box-shadow: 0 1px 2px rgba(17,24,39,0.06); }
/* 모바일 칩: 테두리를 사이트 색으로 */
.chip-sep { flex: 0 0 auto; width: 1px; align-self: stretch; margin: 6px 2px; background: var(--border); }
/* 모바일 사이트 칩: 이름 부분(사이트 전체 게시판 열기) | 오른쪽 아이콘 칸(게시판 칩 펼치기·접기) */
.site-chip { flex: 0 0 auto; height: 36px; border-radius: 999px; display: inline-flex; align-items: stretch; overflow: hidden; }
.site-chip-folder { background: #F3F4F6; border: 1px solid #D1D5DB; color: var(--text); }
.site-chip-folder .site-chip-toggle { border-left-color: rgba(17,24,39,0.15); }
.site-chip.active.site-chip-folder { background: #374151; border-color: #374151; color: #FFFFFF; }
.site-chip button { border: none; background: transparent; color: inherit; cursor: pointer; font-size: 14px; font-weight: 700; }
.site-chip-open { display: inline-flex; align-items: center; gap: 5px; padding: 0 8px 0 10px; white-space: nowrap; }
.site-chip-open .site-tag { margin-right: 0; background: #FFFFFF; }
.site-chip-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #FFFFFF; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.site-chip .site-chip-toggle { width: 36px; display: inline-flex; align-items: center; justify-content: center; border-left: 1px solid rgba(91,33,182,0.25); }
.site-chip.active .site-chip-toggle { border-left-color: rgba(255,255,255,0.35); }
.site-chip.active .site-chip-count { background: #FFFFFF; color: var(--accent); }
/* 묶음 칩 펼침·접힘 구분: 접히면 ▾ + 숨은 게시판 수(+N), 펼치면 ▴ + 묶음 칩과 안의 게시판 칩을 파란 테두리 상자로 감쌈
   (상자 안 칩을 조금 낮춰 상자 전체가 다른 칩과 같은 36px, 펼쳐도 칩 줄 높이가 변하지 않게) */
.site-chip-hidden { font-size: 12px; font-weight: 500; color: var(--muted); }
.site-chip.active .site-chip-hidden { color: #FFFFFF; opacity: 0.8; }
.site-chip-toggle svg { transition: transform 0.15s; }
.site-chip-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.chip-folder-box { flex: 0 0 auto; height: 36px; display: inline-flex; align-items: center; gap: 4px; padding: 0 3px; border-radius: 999px; background: var(--accent-weak); border: 1px solid #BFD3FB; }
.chip-folder-box .chip, .chip-folder-box .site-chip { height: 28px; }
.chip-folder-box .chip { padding: 0 11px; font-size: 13px; }
.chip-folder-box .site-chip-toggle { width: 30px; }
.chip.active .site-tag { background: rgba(255,255,255,0.25); color: #FFFFFF; }
.kw-chip .site-tag { margin-right: 4px; }
/* 관리 화면 사이트 이름 편집 줄: 표시 · 이름 · 짧은 표시 · 저장 */
.site-row { align-items: center; gap: 8px; }
.site-row .site-tag { margin-right: 0; }
.site-name-input { flex: 1 1 auto; min-width: 0; height: 36px; }
.site-short-input { flex: 0 0 64px; width: 64px; height: 36px; text-align: center; }
.kw-count {font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 400; }

/* ==========================================
   피드
   ========================================== */
.feed-wrap { flex: 1 1 auto; min-width: 0; padding: 24px 24px 64px; }
.feed { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.feed-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 4px; }
.feed-title { margin: 0; font-size: 22px; font-weight: 700; }
.feed-sub { font-size: 13px; color: var(--text-3); }
.feed-sub strong { color: var(--accent); }
.feed-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pager-mini { display: flex; align-items: center; gap: 6px; }
.pager-mini .icon-btn { width: 32px; height: 32px; }
.pager-mini .icon-btn:disabled { background: var(--surface-muted); color: #9CA3AF; cursor: default; }
.page-jump { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.page-select { height: 32px; min-width: 56px; padding: 0 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer; }
.page-select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.sort-select { min-width: 0; padding: 0 8px; font-weight: 500; }
.page-total { color: var(--muted); }
.pager .page-select { height: 40px; min-width: 64px; border-radius: 10px; }
/* 맨 아래 페이지 선택: 버튼 위쪽으로 열리는 목록 */
.page-menu { position: relative; display: inline-flex; }
.page-menu-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; }
.page-menu-btn svg { color: var(--muted); transition: transform 0.15s; }
.page-menu-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.page-menu-list { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 30; min-width: 100%; max-height: min(320px, 50vh); overflow-y: auto; padding: 4px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); box-shadow: 0 8px 24px rgba(17,24,39,0.14); display: flex; flex-direction: column; gap: 2px; }
.page-menu-list[hidden] { display: none; }
.page-menu-option { min-height: 36px; padding: 0 16px; border: none; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 14px; font-variant-numeric: tabular-nums; cursor: pointer; }
.page-menu-option:hover { background: var(--surface-muted); }
.page-menu-option[aria-selected="true"] { background: var(--accent-weak); color: var(--accent); font-weight: 700; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 8px; }
.pager .btn { height: 40px; padding: 0 16px; border-radius: 10px; }
.pager .btn-outline:disabled { background: var(--surface-muted); color: #6B7280; }

.feed-head-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.feed-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn-small { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }

/* 1분마다 확인한 새 글 알림 배너 (피드 위에 떠서 표시, 공간은 차지하지 않음) */
.new-banner-wrap { position: sticky; top: 68px; z-index: 30; height: 0; display: flex; justify-content: center; }
.new-banner { height: 38px; padding: 0 16px; border: none; border-radius: 999px; background: var(--accent); color: #FFFFFF; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; box-shadow: 0 6px 16px rgba(37,99,235,0.35); }
.new-banner:hover { background: var(--accent-ink); }

/* 통합 피드·검색에서 글이 모인 키워드 표시 */
.kw-chip { padding: 2px 8px; border-radius: 999px; background: #F1F3F6; color: var(--text-3); font-size: 11px; font-weight: 500; }

/* 카드 끝 표식: 화면에 지나가면 읽음 처리 (2단 배치에서도 카드 맨 아래에 위치) */
.read-sentinel { height: 1px; grid-column: 1 / -1; }

.new-divider { display: flex; align-items: center; gap: 12px; padding: 4px 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.new-divider::before, .new-divider::after { content: ""; flex: 1 1 auto; height: 1px; background: #D9DCE1; }

.empty-card { padding: 40px 16px; border-radius: var(--radius); background: var(--surface); text-align: center; color: var(--muted); }

/* 글 카드 */
.post-card { background: var(--surface); border: 1px solid #E8EAEE; border-radius: var(--radius); padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; word-break: break-word; transition: background-color 1s ease; }
.post-card.highlight { background-color: #FFF9C4; }
.post-card.is-deleted { background: #FDF6F6; border-style: dashed; border-color: #E8BDBD; }
.post-head { display: flex; flex-direction: column; gap: 8px; }
.badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.badge { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.badge-new { background: var(--accent); color: #FFFFFF; font-weight: 700; }
.badge-video { background: var(--video-bg); color: var(--video-text); }
.badge-sync { background: var(--ok-bg); color: var(--ok-text); }
.badge-deleted { background: var(--danger-bg); color: var(--danger-text); font-weight: 700; }
.badge-new-comments { background: #FFEDD5; color: #9A3412; font-weight: 700; }
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.post-title { margin: 0; font-size: 19px; line-height: 1.45; font-weight: 700; }
.title-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.star-btn { width: 32px; height: 32px; border: 1px solid #D1D5DB; border-radius: 8px; background: var(--surface); color: var(--text-3); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.star-btn:hover { background: var(--surface-muted); }
.star-btn[aria-pressed="true"] { color: #D97706; border-color: #FCD34D; background: #FFFBEB; }
.star-btn[aria-pressed="true"] svg { fill: currentColor; }
/* 공유: 휴대폰 공유 창이 없을 때(https가 아닐 때) 버튼 아래에 '링크 복사'·'텔레그램으로 보내기' 목록 */
.share-wrap { position: relative; display: inline-flex; }
.share-btn[aria-expanded="true"] { background: var(--surface-muted); color: var(--text); }
.share-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 35; min-width: 170px; padding: 4px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); box-shadow: 0 8px 24px rgba(17,24,39,0.14); display: flex; flex-direction: column; gap: 2px; }
.share-menu a.view-more-option { text-decoration: none; }
/* 잠깐 뜨는 안내 (링크 복사 등) */
.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); z-index: 120; padding: 10px 16px; border-radius: 999px; background: var(--text); color: #FFFFFF; font-size: 13px; font-weight: 500; box-shadow: 0 6px 16px rgba(17,24,39,0.25); white-space: nowrap; }
.btn-original { flex: 0 0 auto; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid #D1D5DB; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--text); text-decoration: none; background: var(--surface); }
.btn-original:hover { background: var(--surface-muted); color: var(--text); }
.btn-original.bottom { display: none; height: 44px; border-radius: 10px; border-color: var(--border); justify-content: center; font-size: 13px; }
.post-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); }
.post-meta .author { font-weight: 500; color: var(--text); }

.post-content { font-size: 15px; line-height: 1.75; color: var(--text-body); }
.content-spacer { height: 12px; }
.content-line { margin: 4px 0; }
.post-content a { color: var(--accent-ink) !important; font-weight: inherit !important; }


/* 댓글: 항상 모두 펼쳐서 표시 */
.comments { border-top: 1px solid var(--divider); padding-top: 14px; display: flex; flex-direction: column; }
.comments-title { margin: 0 0 4px; font-size: 13px; font-weight: 700; }
/* 댓글 하나하나가 구분되도록: 원댓글 사이 구분선 + 프로필 원 + 답글은 회색 상자로 묶음 */
.comment { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-top: 1px solid #E9EBEF; }
.comments-title + .comment { border-top: none; padding-top: 6px; }
/* 답글의 답글은 깊이(--depth, 최대 4)마다 한 단계씩 더 안쪽으로. 화면 폭에 따라 첫 들여쓰기와 단계 폭만 바꿈 */
.comments { --reply-indent: 40px; --reply-step: 24px; }
.comment.reply { margin: 0 0 8px calc(var(--reply-indent) + var(--reply-step) * (var(--depth, 1) - 1)); padding: 10px 12px; border-top: none; border-radius: 10px; background: #F5F6F8; }
.comment.reply + .comment.reply { margin-top: -2px; }
/* 답글은 원댓글에서 이어지는 꺾인 연결선과 들여쓰기로 일반 댓글(특히 새 댓글 강조)과 구분 */
.comment.reply { position: relative; }
.comment.reply::before { content: ''; position: absolute; left: -16px; top: -10px; height: calc(50% + 10px); width: 11px; border-left: 2px solid #CBD2DC; border-bottom: 2px solid #CBD2DC; border-bottom-left-radius: 8px; pointer-events: none; }
/* 마지막으로 읽은 뒤 달린 새 댓글 */
.comment.is-new-comment { background: #FFF7ED; padding-left: 10px; padding-right: 10px; border-radius: 10px; }
.comment.reply.is-new-comment { background: #FFEDD5; }
.new-comment-badge { padding: 1px 5px; border-radius: 4px; background: #EA580C; color: #FFFFFF; font-size: 10px; font-weight: 700; }
.comment-avatar { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; line-height: 1; }
.comment.reply .comment-avatar { flex-basis: 24px; width: 24px; height: 24px; font-size: 11px; }
.av-0 { background: #E0E7FF; color: #3730A3; }
.av-1 { background: #FCE7F3; color: #9D174D; }
.av-2 { background: #DCFCE7; color: #166534; }
.av-3 { background: #FEF3C7; color: #92400E; }
.av-4 { background: #E0F2FE; color: #075985; }
.av-5 { background: #EDE9FE; color: #5B21B6; }
.comment-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.comment-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.comment-author { font-size: 13px; font-weight: 500; color: var(--text); }
.op-badge { padding: 1px 5px; border-radius: 4px; background: var(--accent); color: #FFFFFF; font-size: 10px; font-weight: 700; }
.comment-votes { margin-left: auto; }
.comment-body { font-size: 14px; line-height: 1.6; color: var(--text-body); }
.comment-line { margin: 0; }
/* 댓글 없는 글의 빈 댓글 칸: 2단 배치(넓은 화면)에서만 자리를 차지하고, 그 외에는 숨김 */
.comments.is-empty { display: none; }
.comments-empty { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.comment-body { overflow-wrap: anywhere; }
.comment-body img, .comment-body video, .comment-body iframe { max-width: 100%; height: auto; }
/* 수집 시 붙은 @멘션 링크 인라인 스타일을 피드 디자인에 맞게 덮어씀 */
.comment-body a { color: var(--accent) !important; background: none !important; padding: 0 !important; border-radius: 0 !important; font-weight: 500 !important; text-decoration: none !important; margin-right: 4px !important; }

/* ==========================================
   넓은 데스크톱: 화면을 꽉 채우고 본문(왼쪽)·댓글(오른쪽) 2단
   (본문 칸이 너무 좁아지지 않도록 1360px 이상에서만 적용, 그보다 좁으면 한 줄 피드)
   ========================================== */
@media (min-width: 1360px) {
    .feed { max-width: none; }
    .feed-wrap { padding: 24px 32px 64px; }
    /* 댓글 글자 영역이 에펨코리아 모바일 화면(폰 폭 약 390px) 이상이 되도록 댓글 칸 폭 확보 */
    /* 댓글 칸이 길어져 생기는 남는 높이는 본문 줄(2행) 아래로만 가게 해서, 짧은 본문도 제목 바로 아래에 붙도록 */
    .post-card.has-comments { display: grid; grid-template-columns: minmax(0, 1fr) 480px; grid-template-rows: auto 1fr; column-gap: 28px; align-items: start; }
    .post-card.has-comments > .post-head,
    .post-card.has-comments > .post-content { grid-column: 1; }
    .post-card.has-comments > .comments {
        grid-column: 2; grid-row: 1 / span 2;
        border-top: none; padding: 0 4px 0 18px; border-left: 1px solid #E9EBEF; scrollbar-width: thin;
        /* 댓글이 길면 오른쪽 칸 안에서 따로 스크롤하고, 본문을 내려도 화면에 붙어 있도록 고정 */
        position: sticky; top: 72px; max-height: calc(100vh - 96px); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
    }
    .post-card.has-comments > .comments.is-empty { display: flex; }
    /* 좁은 칸에서는 답글 들여쓰기를 줄여 답글 글자 영역도 넓게 */
    .post-card.has-comments > .comments { --reply-indent: 18px; --reply-step: 14px; }
    .post-card.has-comments > .comments .comment.reply { padding: 10px; }
    .post-content { font-size: 16px; }
}
@media (min-width: 1800px) {
    .post-card.has-comments { grid-template-columns: minmax(0, 1fr) 560px; }
}

/* ==========================================
   떠 있는 버튼
   ========================================== */
/* 위에서부터 맨 위로·다음 글. 두 버튼은 같은 크기로 맞추고 색으로만 구분 (새로고침은 상단 상태 표시) */
.floating { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 12px; z-index: 40; }
.fab { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 6px 16px rgba(17,24,39,0.18); }
.fab-top { border: 1px solid var(--border); background: var(--surface); color: var(--text); opacity: 0; visibility: hidden; transition: opacity 0.2s ease; }
.fab-top.visible { opacity: 1; visibility: visible; }
.fab-next { border: none; background: var(--text); color: #FFFFFF; }
.fab-next[hidden] { display: none; }

/* ==========================================
   관리 패널 (데스크톱: 오른쪽 패널, 모바일: 전체 화면)
   ========================================== */
.settings-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(17,24,39,0.35); display: flex; justify-content: flex-end; }
.settings-panel { width: 420px; max-width: 100%; height: 100%; background: var(--bg); display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(17,24,39,0.12); }
.settings-head { flex: 0 0 auto; height: 56px; padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 4px; }
.settings-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
/* 관리 화면 탭 (게시판·묶음·알림·카테고리·수집 상태): 한 번에 한 칸만 */
.settings-tabs { flex: 0 0 auto; display: flex; gap: 2px; padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tab { flex: 0 0 auto; height: 42px; padding: 0 12px; border: none; border-bottom: 2px solid transparent; background: transparent; color: var(--text-3); font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.settings-tab:hover { color: var(--text); }
.settings-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.settings-body { flex: 1 1 auto; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.settings-pane { display: flex; flex-direction: column; gap: 14px; }
.settings-logout { margin-left: auto; margin-right: 8px; }
/* 관리자 로그인 창: 화면 가운데 작은 상자 */
.login-backdrop { position: fixed; inset: 0; z-index: 110; background: rgba(17,24,39,0.35); display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 320px; max-width: 100%; padding: 20px; border-radius: var(--radius); background: var(--surface); box-shadow: 0 12px 32px rgba(17,24,39,0.18); display: flex; flex-direction: column; gap: 12px; }
.login-card h2 { margin: 0; font-size: 17px; font-weight: 700; }
.login-error { font-size: 13px; color: var(--danger-text); }
.login-actions { display: flex; justify-content: flex-end; gap: 8px; }
/* 게시판 편집 양식의 '고급 설정' (무시할 표현·게시판 합치기) */
.settings-advanced { border-top: 1px solid var(--divider); padding-top: 10px; }
.settings-advanced > summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--text-2); }
.settings-advanced > summary .settings-hint { font-weight: 400; margin-left: 4px; }
.settings-advanced-body { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }
.settings-card { padding: 16px; border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.settings-label { font-size: 13px; font-weight: 700; }
.settings-hint { font-size: 12px; color: var(--muted); }
.add-row { display: flex; gap: 8px; }
.add-row .select { flex: 0 0 100px; }
.add-row #group-kw-input, .add-row #category-input { flex: 1 1 auto; min-width: 0; }
.add-row .btn { flex: 0 0 auto; height: 44px; border-radius: 10px; padding: 0 16px; white-space: nowrap; }
.keyword-tags { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.board-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.board-check { height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; display: inline-flex; align-items: center; cursor: pointer; }
.board-check .site-tag { margin-right: 4px; }
.board-check[aria-pressed="true"] { border-color: var(--accent); background: #EEF4FF; color: var(--text); font-weight: 700; }
#group-kw-target { flex: 0 0 130px; }
.kw-tag { height: 32px; padding: 0 4px 0 12px; border-radius: 999px; background: #F3F4F6; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-body); }
.kw-tag-board { color: var(--muted); }
.kw-tag .site-tag { margin-right: 2px; }
.kw-tag button { width: 28px; height: 28px; border: none; border-radius: 50%; background: transparent; color: var(--text-3); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.kw-tag button:hover { background: #E5E7EB; }
.kw-tag.is-paused { background: #F9FAFB; color: var(--muted); border: 1px dashed #D1D5DB; }
.kw-tag-paused { margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: #E5E7EB; color: var(--text-3); font-size: 11px; }
/* 묶음 게시판 만들기: 키워드를 눌러서 고르는 선택 목록과 만든 게시판 목록 */
.group-form-actions { display: flex; gap: 8px; }
.group-form-actions .btn { height: 40px; border-radius: 10px; padding: 0 18px; }
.group-list { display: flex; flex-direction: column; }
.group-list:not(:empty) { border-top: 1px solid var(--divider); margin-top: 4px; }
.group-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--divider); }
.group-row:last-child { border-bottom: none; }
.group-row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.group-row-name { font-size: 14px; font-weight: 700; }
.group-row-members { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.btn-danger { color: var(--danger-text); }
.group-row .btn-small { flex: 0 0 auto; white-space: nowrap; }
.group-row-arrange { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.select-small { height: 30px; width: auto; max-width: 160px; padding-top: 0; padding-bottom: 0; font-size: 12px; }
.group-row .icon-btn.small:disabled { opacity: 0.35; cursor: default; }
#group-folder-select { flex: 0 0 auto; width: auto; max-width: 40%; }
#group-folder-select[hidden] { display: none; }
/* 관리 패널 '카테고리': 확인 상태 표시 */
.cat-status { display: inline-block; white-space: nowrap; margin-left: 4px; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 500; vertical-align: 1px; }
.cat-ok { background: var(--ok-bg); color: var(--ok-text); }
.cat-pending { background: #FEF3C7; color: #92400E; }
.cat-invalid { background: var(--danger-bg); color: var(--danger-text); }
.cat-message { font-size: 12px; color: var(--danger-text); overflow-wrap: anywhere; }

.alert-head { display: flex; align-items: center; justify-content: space-between; }
/* 관리 패널 '수집 상태' */
.status-list { display: flex; flex-direction: column; }
.status-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--divider); font-size: 13px; line-height: 1.5; }
.status-row:first-child { border-top: none; padding-top: 0; }
.status-label { color: var(--muted); }
.status-value { overflow-wrap: anywhere; }
.status-ok { color: #15803D; font-weight: 700; }
.status-warn { color: #C2410C; font-weight: 700; }
.status-row-block { grid-template-columns: 1fr; gap: 4px; }
.status-problems { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-body); }
.status-problems li { overflow-wrap: anywhere; }
.status-time { color: var(--muted); margin-right: 6px; font-variant-numeric: tabular-nums; }
.alert-cols { display: flex; gap: 12px; font-size: 11px; color: var(--muted); }
.alert-cols span { width: 44px; text-align: center; white-space: nowrap; }
.alert-row { height: 52px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--divider); }
.alert-row-name { font-size: 14px; font-weight: 500; }
.alert-switches { display: flex; gap: 12px; }
.alert-hint { display: block; padding: 10px 0 2px; border-top: 1px solid var(--divider); }
.merge-box { display: flex; flex-direction: column; gap: 8px; }
.merge-box[hidden] { display: none; }
.merge-note:empty { display: none; }
.merge-note { color: var(--accent); font-weight: 500; }
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .slider { position: absolute; inset: 0; border-radius: 999px; background: #D1D5DB; transition: background 0.2s; }
.switch .slider::before { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: transform 0.2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==========================================
   모바일
   ========================================== */
@media (max-width: 899px) {
    .topbar-row { padding: 0 8px 0 16px; height: 60px; }
    .brand-mark { display: none; }
    .brand { flex-direction: column; align-items: flex-start; gap: 2px; }
    .brand-name { font-size: 18px; }
    .status-pill { padding: 0; background: none; }
    .status-pill.is-error { background: none; }
    .topbar-actions .btn-outline { width: 44px; height: 44px; padding: 0; border: none; }
    .topbar-row { flex-wrap: wrap; height: auto; min-height: 60px; }
    .search-form { display: none; order: 3; flex-basis: 100%; max-width: none; margin: 0 0 10px; padding-right: 8px; }
    .topbar.search-open .search-form { display: flex; }
    .search-input { height: 42px; font-size: 15px; }
    .new-banner-wrap { top: 120px; }
    .layout { min-height: 0; display: block; }
    /* 맨 아래까지 내렸을 때 떠 있는 버튼(맨 위로·다음 글)이 하단 페이지 이동을 가리지 않도록 여백 확보 */
    .feed-wrap { padding: 12px 10px 120px; }
    .feed { gap: 10px; }
    .feed-head { padding: 0 6px 2px; align-items: center; }
    .feed-title { font-size: 18px; }
    /* 모바일은 페이지 이동을 제목 아래 한 줄에 배치 */
    .feed-tools { width: 100%; justify-content: space-between; }
    .pager-mini .icon-btn { width: 40px; height: 40px; }
    .pager-mini .page-select { height: 40px; min-width: 60px; font-size: 14px; }
    .post-card { padding: 16px; gap: 12px; }
    .post-title { font-size: 17px; }
    .title-row .btn-original { display: none; }
    .star-btn { width: 40px; height: 40px; margin: -4px -4px 0 0; border-color: transparent; background: transparent; }
    .btn-original.bottom { display: flex; }
    .post-meta { gap: 10px; font-size: 12px; }
    .comments { --reply-indent: 24px; --reply-step: 12px; }
    .new-divider { padding: 2px 6px; }
    .pager { justify-content: space-between; padding: 6px 6px 0; }
    .pager .btn { height: 44px; padding: 0 18px; font-size: 14px; }
    .pager .page-select { height: 44px; font-size: 14px; }
    .floating { right: 16px; bottom: 20px; }
    .settings-panel { width: 100%; box-shadow: none; }
    .settings-backdrop { background: var(--bg); }
}

/* ==========================================
   수집된 본문 미디어 크기 보정 (에펨코리아 원본 마크업)
   ========================================== */
.post-content video, .post-content iframe, .post-content embed, .post-content object { max-width: 100%; }
.auto_media_wrapper,
.auto_media_wrapper.full.pc,
.height_keep {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    padding: 0 !important;
    padding-bottom: 0 !important;
    margin: 8px auto !important;
    display: block !important;
}
.post-content img { max-width: 100%; height: auto; border-radius: 8px; margin: 6px 0; display: block; }
.post-content video {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 70vh !important;
    object-fit: contain;
    border-radius: 10px;
    margin: 8px 0;
    display: block;
    background: #000;
}
.post-content iframe {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
    border-radius: 10px;
    border: 0;
    display: block;
}
/* 인스타그램·X는 게시물이 알려 주는 내용 높이로 app.js가 높이를 맞춤. 그 전까지는 세로로 긴 기본 크기 */
.post-content iframe[src*="platform.twitter.com/embed"] {
    aspect-ratio: auto !important;
    height: 600px !important;
    max-width: 550px !important;
    margin: 8px auto;
    background: #fff;
}
.post-content iframe[src*="instagram.com"] {
    aspect-ratio: auto !important;
    height: 600px !important;
    max-width: 540px !important;
    margin: 8px auto;
    background: #fff;
}
.mejs__container, .mejs__embed, .mejs__player {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
}

/* ==========================================
   불러오는 중: 상단 진행 막대 + 첫 화면 뼈대
   ========================================== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.top-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; overflow: hidden; pointer-events: none; }
.top-progress i { position: absolute; top: 0; left: -40%; width: 40%; height: 100%; background: var(--accent); border-radius: 2px; animation: top-progress 1.1s ease-in-out infinite; }
@keyframes top-progress { from { left: -40%; } to { left: 100%; } }
.sk { display: block; background: #E5E7EB; border-radius: 6px; animation: sk-pulse 1.2s ease-in-out infinite; }
@keyframes sk-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.sk-nav { display: flex; flex-direction: column; gap: 14px; padding: 10px 12px; }
.sk-nav .sk { height: 14px; width: 85%; }
.sk-nav .sk-short { width: 60%; }
.chip-row .sk-chip { flex: 0 0 auto; display: inline-block; width: 72px; height: 32px; border-radius: 999px; }
.sk-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.sk-title { width: 140px; height: 24px; }
.sk-sub { width: 220px; height: 13px; }
.post-card.sk-card { display: flex; flex-direction: column; gap: 10px; }
.sk-badge { width: 70px; height: 18px; }
.sk-line-l { width: 70%; height: 20px; }
.sk-meta { width: 45%; height: 12px; margin-bottom: 8px; }
.sk-line { width: 100%; height: 14px; }
.sk-line-s { width: 55%; height: 14px; }
@media (prefers-reduced-motion: reduce) {
    .sk, .top-progress i { animation: none; }
    .topbar { transition: none; }
    .top-progress i { left: 0; width: 100%; opacity: 0.6; }
}

/* ==========================================
   동영상·이미지 모아보기: 미디어만 격자로, 칸을 누르면 크게 보기
   ========================================== */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.g-cell { position: relative; margin: 0; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #E5E7EB; }
.g-cell.is-video { background: #1F2937; }
/* 동영상 칸(빈 칸 포함)은 가로로 긴 모양 (데스크톱은 화면 높이에 맞춰 늘어남) */
.gallery.is-video .g-cell { aspect-ratio: 16 / 10; }
.g-open { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: none; background: transparent; cursor: zoom-in; display: block; }
.g-open img, .g-open video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.g-play { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); width: 48px; height: 48px; border-radius: 50%; background: rgba(17,24,39,0.6); color: #FFFFFF; display: flex; align-items: center; justify-content: center; }
.g-play svg { width: 20px; height: 20px; margin-left: 3px; }
.g-count { position: absolute; top: 8px; right: 8px; padding: 2px 7px; border-radius: 6px; background: rgba(17,24,39,0.6); color: #FFFFFF; font-size: 11px; font-weight: 700; pointer-events: none; }
.g-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 8px 6px 10px; background: rgba(17,24,39,0.62); color: #FFFFFF; font-size: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.g-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.g-title, .g-src { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.g-title { font-size: 12.5px; font-weight: 600; }
.g-src { font-size: 11px; color: rgba(255,255,255,0.68); }
.g-go { flex: 0 0 auto; height: 26px; padding: 0 10px; border: none; border-radius: 7px; background: rgba(255,255,255,0.94); color: var(--text); font-size: 12px; font-weight: 700; cursor: pointer; }
.g-go:hover { background: #FFFFFF; }
.g-cell.is-blank { background: transparent; border: 1px dashed var(--border); }
/* 데스크톱: 스크롤 없이 한 화면에 고정 칸 수(이미지·동영상 모두 4×3). 칸 크기만 창 크기에 맞추고 페이지 버튼은 항상 맨 아래 */
@media (min-width: 900px) {
    body.gallery-mode .feed-wrap { padding-bottom: 16px; }
    body.gallery-mode .feed { max-width: 1400px; height: calc(100dvh - 57px - 24px - 16px); min-height: 480px; gap: 12px; }
    body.gallery-mode .gallery { flex: 1 1 auto; min-height: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); }
    body.gallery-mode .gallery .g-cell { aspect-ratio: auto; min-height: 0; }
    body.gallery-mode .pager { flex: 0 0 auto; padding-top: 0; }
}

.media-viewer { position: fixed; inset: 0; z-index: 200; background: rgba(10,12,16,0.92); display: flex; flex-direction: column; color: #FFFFFF; }
.media-viewer[hidden] { display: none; }
body.viewer-open { overflow: hidden; }
.mv-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.mv-title { min-width: 0; font-size: 15px; font-weight: 700; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mv-actions { flex: 0 0 auto; display: flex; gap: 8px; }
.mv-btn { height: 36px; padding: 0 14px; border: none; border-radius: 10px; background: #FFFFFF; color: var(--text); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.mv-icon { width: 36px; padding: 0; justify-content: center; background: rgba(255,255,255,0.16); color: #FFFFFF; }
.mv-body { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; gap: 8px; padding: 0 8px; }
.mv-stage { flex: 1 1 auto; min-width: 0; height: 100%; display: flex; align-items: center; justify-content: center; }
.mv-stage img, .mv-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.mv-stage iframe { width: min(100%, 160vh); aspect-ratio: 16 / 9; max-height: 100%; border: none; border-radius: 6px; background: #000000; }
.mv-nav { flex: 0 0 auto; width: 44px; height: 44px; border: none; border-radius: 50%; background: rgba(255,255,255,0.16); color: #FFFFFF; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.mv-nav[hidden] { visibility: hidden; display: flex; }
.mv-nav svg { width: 20px; height: 20px; }
.mv-foot { flex: 0 0 auto; padding: 10px 16px 14px; text-align: center; font-size: 12px; color: #D1D5DB; }
.mv-foot a { color: #FFFFFF; }
@media (max-width: 899px) {
    .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    /* 모바일 동영상은 한 줄에 하나씩 크게 (12개를 세로로) */
    .gallery.is-video { grid-template-columns: minmax(0, 1fr); }
    .g-cap { font-size: 11px; padding: 5px 6px 5px 8px; }
    .g-title { font-size: 11.5px; }
    .g-src { font-size: 10px; }
    .g-go { height: 24px; padding: 0 8px; font-size: 11px; }
    .mv-head { padding: 10px 12px; }
    .mv-btn { padding: 0 10px; }
    .mv-body { padding: 0; gap: 0; }
    .mv-nav { position: absolute; top: 50%; z-index: 1; }
    .mv-nav[data-step="-1"] { left: 6px; }
    .mv-nav[data-step="1"] { right: 6px; }
}
