/* ============================================
   전역 스타일 - CSS 변수 기반 테마 시스템
   ============================================ */

* {
  box-sizing: border-box;
}

body {
  background-color: var(--bg, #f8fafc);
  color: var(--text, #0f172a);
  font-family: var(--font-family-site, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', Roboto, sans-serif);
  font-size: var(--font-size-base, 15px);
  margin: 0;
  min-height: 100vh;
}
@media (max-width: 640px) {
  body {
    font-size: var(--font-size-base-mobile, 14px);
  }
}

/* 관리자 설정 기반 글씨 크기 유틸리티 클래스 */
.text-site-heading {
  font-size: var(--font-size-heading, 20px);
}
.text-site-menu {
  font-size: var(--font-size-menu, 14px);
}
.text-site-small {
  font-size: var(--font-size-small, 12px);
}
@media (max-width: 640px) {
  .text-site-heading {
    font-size: var(--font-size-heading-mobile, 18px);
  }
  .text-site-menu {
    font-size: var(--font-size-menu-mobile, 13px);
  }
  .text-site-small {
    font-size: var(--font-size-small-mobile, 11px);
  }
}

/* ============================================
   메뉴(카테고리) 개별/전역 폰트·아이콘 크기 설정 반영용 유틸리티
   각 메뉴 항목에 인라인으로 --menu-font-pc/--menu-font-mobile,
   --menu-icon-pc/--menu-icon-mobile 커스텀 프로퍼티를 지정하면
   PC/모바일 미디어쿼리에 따라 자동으로 알맞은 값이 적용된다.
   ============================================ */
.menu-item-sized {
  font-size: var(--menu-font-pc, inherit);
}
@media (max-width: 640px) {
  .menu-item-sized {
    font-size: var(--menu-font-mobile, var(--menu-font-pc, inherit));
  }
}
.menu-icon-sized {
  width: var(--menu-icon-pc, 20px);
  height: var(--menu-icon-pc, 20px);
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
}
@media (max-width: 640px) {
  .menu-icon-sized {
    width: var(--menu-icon-mobile, var(--menu-icon-pc, 18px));
    height: var(--menu-icon-mobile, var(--menu-icon-pc, 18px));
  }
}

a {
  color: inherit;
  text-decoration: none;
}

/* 레이아웃 */
.site-header {
  background-color: var(--surface, #fff);
  border-bottom: 1px solid var(--border, #e2e8f0);
  position: sticky;
  top: 0;
  z-index: 40;
}

.nav-menu-item {
  color: var(--text, #0f172a);
  transition: color 0.15s ease;
}
.nav-menu-item:hover {
  color: var(--primary, #4f46e5);
}
.nav-menu-item.active {
  color: var(--primary, #4f46e5);
  font-weight: 700;
}

/* 카드 공통 */
.card {
  background-color: var(--card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  border-color: var(--primary, #4f46e5);
}

/* 버튼 */
.btn-primary {
  background-color: var(--primary, #4f46e5);
  color: white;
  border-radius: 8px;
  transition: opacity 0.15s ease;
}
.btn-primary:hover {
  opacity: 0.9;
}
.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border, #e2e8f0);
  color: var(--text, #0f172a);
  border-radius: 8px;
}
.btn-danger {
  background-color: var(--danger, #ef4444);
  color: white;
  border-radius: 8px;
}

.muted-text {
  color: var(--muted, #64748b);
}
/* 2026-09-07 (요청1) 카테고리 상세페이지 설명문(빨간박스) 전용 폰트 크기 - PC/모바일 개별 지정
   관리자 > 폰트/상세페이지 설정에서 조정. 홈 화면 TOP10 카드 설명문(.group-card-description)에는 영향 없음.
   줄바꿈은 원래처럼 자연스럽게 허용하되, 단어가 컨테이너보다 길어 가로 스크롤을 유발하는 것만 방지. */
.category-detail-description {
  font-size: var(--detail-desc-font-size-pc, 15px);
  overflow-wrap: break-word;
  word-break: break-word;
}
@media (max-width: 640px) {
  .category-detail-description {
    font-size: var(--detail-desc-font-size-mobile, 14px);
  }
}
.accent-text {
  color: var(--accent, #6366f1);
}
.border-theme {
  border-color: var(--border, #e2e8f0) !important;
}
.surface-bg {
  background-color: var(--surface, #fff) !important;
}

/* TOP10 순위 카드 그리드 (카테고리 상세 페이지) */
.rank-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1024px) {
  .rank-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .rank-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}

.rank-card {
  background-color: var(--card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 16px;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.rank-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}
.rank-card-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: inherit;
  text-decoration: none;
}
.favorite-btn {
  border: none;
  cursor: pointer;
  color: var(--muted, #64748b);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.favorite-btn i {
  margin-right: 2px;
}
.favorite-btn.favorited,
.favorite-btn.is-favorited {
  background: color-mix(in srgb, var(--primary, #4f46e5) 15%, transparent);
  color: #f59e0b;
}
.favorite-btn.is-favorited i {
  color: #f59e0b;
}
.rank-badge-num {
  position: absolute;
  top: 10px;
  left: 12px;
  font-weight: 800;
  font-size: 20px;
  color: var(--muted, #94a3b8);
}
.rank-medal {
  /* 버그 수정(2026-09-02): 기본 이모지(🥇🥈🥉🏅)도 관리자에서 설정한 크기(--rank-icon-pc/mobile)를
     반영해야 하는데, 이전에는 font-size가 28px로 고정되어 있어 "사이즈조절"이 이모지에는
     전혀 반영되지 않는 버그가 있었다. 커스텀 이미지(.rank-icon-sized)와 동일한 변수를 공유하도록 수정. */
  font-size: var(--rank-icon-pc, 28px);
  margin-bottom: 6px;
  line-height: 1;
}
/* 순위 아이콘 PC/모바일 개별·전역 크기 반영용 유틸리티 (RankCard, GroupCard 공용) */
.rank-icon-sized {
  width: var(--rank-icon-pc, 28px);
  height: var(--rank-icon-pc, 28px);
  object-fit: contain;
}
@media (max-width: 640px) {
  .rank-medal {
    font-size: var(--rank-icon-mobile, var(--rank-icon-pc, 24px));
  }
  .rank-icon-sized {
    width: var(--rank-icon-mobile, var(--rank-icon-pc, 24px));
    height: var(--rank-icon-mobile, var(--rank-icon-pc, 24px));
  }
}
.rank-logo-box {
  width: 100%;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0;
  border-radius: 8px;
  overflow: hidden;
}
.rank-badge-favorite {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  padding: 3px 8px;
}
@media (max-width: 640px) {
  .rank-card { padding: 10px; }
  .rank-logo-box { height: 44px; }
  /* 버그 수정(2026-09-02): 여기서 20px로 고정 덮어쓰기 하던 것을 제거 -
     위쪽 미디어쿼리의 var(--rank-icon-mobile) 규칙이 우선 적용되도록 함 */
}

/* ============================================
   TOP3(1~3위) 전용 강조 디자인 (네온/Glow/Pulse)
   - .top3-effect-text: 색상/크기/굵기는 인라인 style로 지정되므로 여기서는 레이아웃만 살짝 보정
   - .top3-effect-glow: 정적 네온 Glow(그림자) - --top3-glow-color/--top3-glow-blur 는 인라인 style로 주입
   - .top3-effect-pulse: 빠른 깜빡임이 아닌 2.4초 부드러운 Pulse(약→강→약) 애니메이션
   - .top3-effect-icon: 순위 아이콘/메달(이모지)에도 동일한 Glow를 적용하기 위한 클래스(텍스트 색상 변경 없음)
   ============================================ */
.top3-effect-text {
  display: inline-block;
  line-height: 1.2;
}
.top3-effect-glow {
  text-shadow:
    0 0 calc(var(--top3-glow-blur, 8px) * 0.4) var(--top3-glow-color, currentColor),
    0 0 var(--top3-glow-blur, 8px) var(--top3-glow-color, currentColor),
    0 0 calc(var(--top3-glow-blur, 8px) * 1.8) var(--top3-glow-color, currentColor);
}
.rank-medal.top3-effect-glow,
.group-card-rank.top3-effect-glow {
  filter: drop-shadow(0 0 var(--top3-glow-blur, 8px) var(--top3-glow-color, currentColor));
  text-shadow: none;
}
@keyframes top3GlowPulse {
  0%, 100% {
    text-shadow:
      0 0 calc(var(--top3-glow-blur, 8px) * 0.25) var(--top3-glow-color, currentColor),
      0 0 calc(var(--top3-glow-blur, 8px) * 0.6) var(--top3-glow-color, currentColor);
  }
  50% {
    text-shadow:
      0 0 calc(var(--top3-glow-blur, 8px) * 0.6) var(--top3-glow-color, currentColor),
      0 0 var(--top3-glow-blur, 8px) var(--top3-glow-color, currentColor),
      0 0 calc(var(--top3-glow-blur, 8px) * 2.2) var(--top3-glow-color, currentColor);
  }
}
@keyframes top3GlowPulseIcon {
  0%, 100% { filter: drop-shadow(0 0 calc(var(--top3-glow-blur, 8px) * 0.35) var(--top3-glow-color, currentColor)); }
  50% { filter: drop-shadow(0 0 calc(var(--top3-glow-blur, 8px) * 1.4) var(--top3-glow-color, currentColor)); }
}
.top3-effect-pulse {
  animation: top3GlowPulse 2.4s ease-in-out infinite;
}
.rank-medal.top3-effect-pulse,
.group-card-rank.top3-effect-pulse {
  animation: top3GlowPulseIcon 2.4s ease-in-out infinite;
  text-shadow: none;
}

/* ----------------------------------------------
   Shimmer(빛이 스치는 효과) - 사이트명 글씨 전용, 순위 아이콘/메달에는 적용하지 않음
   - 원래 글자색 → 흰색 하이라이트 밴드 → 원래 글자색 그라데이션(인라인 backgroundImage로 주입)을
     background-clip:text로 글자 모양에만 잘라서 보이게 하고, 그 배경 위치를 3초 주기로 좌→우 이동시킨다.
   ---------------------------------------------- */
.top3-effect-shimmer {
  background-size: 200% auto;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: top3ShimmerSweep 3s linear infinite;
}
@keyframes top3ShimmerSweep {
  0% { background-position: 160% 0; }
  100% { background-position: -60% 0; }
}

/* ----------------------------------------------
   Sparkle(반짝이는 별 파티클 효과) - 사이트명 글씨 전용, 순위 아이콘/메달에는 적용하지 않음
   - 글씨 우측상단/좌측하단에 별(✦) 모양 pseudo-element 2개를 배치하고, 서로 다른 지연시간으로
     확대/축소+회전하며 반짝이듯(twinkle) 나타났다 사라지는 애니메이션을 반복한다.
   ---------------------------------------------- */
.top3-effect-sparkle {
  position: relative;
  display: inline-block;
}
.top3-effect-sparkle::before,
.top3-effect-sparkle::after {
  content: '✦';
  position: absolute;
  color: var(--top3-sparkle-color, #fff);
  text-shadow: 0 0 4px var(--top3-sparkle-color, #fff), 0 0 8px var(--top3-sparkle-color, #fff);
  pointer-events: none;
  line-height: 1;
}
.top3-effect-sparkle::before {
  top: -0.4em;
  right: -0.7em;
  font-size: 0.6em;
  animation: top3SparkleTwinkle 1.8s ease-in-out infinite;
}
.top3-effect-sparkle::after {
  bottom: -0.25em;
  left: -0.6em;
  font-size: 0.4em;
  animation: top3SparkleTwinkle 1.8s ease-in-out infinite 0.9s;
}
@keyframes top3SparkleTwinkle {
  0%, 100% { opacity: 0; transform: scale(0.3) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.2) rotate(25deg); }
}

/* 랭크카드 메타 행(조회수/좋아요/URL상태) - 반드시 한 줄로만 표시 */
.rank-card-meta-row {
  overflow: hidden;
  max-width: 100%;
}
.rank-card-meta-row > span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
/* URL 상태 배지 - 관리자 링크관리의 STATUS_DISPLAY 색상을 인라인 style로 주입받아 사용 */
.rank-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  line-height: 1.6;
  flex-shrink: 0;
}
.rank-status-badge i {
  font-size: 9px;
}

/* 게시판(콘텐츠) 그리드: PC 4열 / 모바일 2열 */
.board-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1024px) {
  .board-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .board-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}

/* 로고 링크바 */
.logo-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
}
.logo-bar-align-center {
  justify-content: center;
}
.logo-bar-align-right {
  justify-content: flex-end;
}
.logo-bar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  background: var(--surface, #fff);
  font-size: 13px;
  transition: border-color 0.15s ease;
}
.logo-bar-item:hover {
  border-color: var(--primary, #4f46e5);
}
.logo-bar-item img {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

/* 관리자 레이아웃 */
.admin-sidebar {
  background-color: #1e1e2d;
  color: #cfd2e3;
  min-height: 100vh;
  width: 240px;
}
.admin-sidebar a {
  color: #cfd2e3;
  display: block;
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 6px;
  margin: 2px 8px;
  transition: background 0.15s ease;
}
.admin-sidebar a:hover,
.admin-sidebar a.active {
  background-color: #2c2c3f;
  color: #fff;
}
.admin-sidebar .group-title {
  color: #6b7280;
  font-size: 11px;
  padding: 16px 20px 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-main {
  flex: 1;
  background-color: #f1f2f6;
  min-height: 100vh;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 10px;
  overflow: hidden;
}
.admin-table th {
  background: #f8f9fb;
  text-align: left;
  padding: 10px 12px;
  font-size: 13px;
  color: #6b7280;
  border-bottom: 1px solid #eee;
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f2f2f2;
  font-size: 14px;
  vertical-align: middle;
}
.admin-table tr:hover td {
  background: #fafbfc;
}

.theme-swatch {
  width: 100%;
  height: 60px;
  border-radius: 8px;
  display: flex;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}
.theme-swatch span {
  flex: 1;
}

.drag-handle {
  cursor: grab;
  color: #9ca3af;
}
.drag-handle:active {
  cursor: grabbing;
}

.sortable-ghost {
  opacity: 0.4;
}

/* 모바일 메뉴 드로어 */
.mobile-drawer {
  transform: translateX(100%);
  transition: transform 0.2s ease;
}
.mobile-drawer.open {
  transform: translateX(0);
}

/* ============================================
   헤더 상단바 (PC 한 줄: 날짜/시간 - 인기검색어 - 로고 - 검색)
   ============================================ */
.header-top-bar {
  background-color: var(--header-bg, var(--surface));
  color: var(--header-text, var(--text));
  border-bottom: 1px solid var(--border, #e2e8f0);
  font-size: 13px;
}

.header-main-bar {
  background-color: var(--header-bg, var(--surface));
  color: var(--header-text, var(--text));
  border-bottom: 1px solid var(--border, #e2e8f0);
}

/* ============================================
   PC 가로형 메뉴판(main-nav-top) - 관리자 설정 최대 너비 적용
   2026-09-07 신규: 관리자(헤더/로고 설정)에서 1440/1600(기본)/1800px 중 선택 가능.
   - 배경(.pc-menu-bar-full)은 항상 화면 전체 폭(Full-width)을 사용한다.
   - 실제 메뉴 내용(.pc-menu-bar-inner)만 --pc-menu-max-width 기준으로 중앙 정렬한다.
   - 이 규칙은 PC 전용 미디어쿼리(min-width:1024px) 안에서만 적용되며, 모바일/태블릿
     카테고리 Pill(#mobile-nav-top)이나 드로어 메뉴에는 전혀 영향을 주지 않는다.
   - 브라우저 폭이 설정값보다 작아지면 width:100%로 자연스럽게 줄어들어 가로 스크롤이 생기지 않는다.
   ============================================ */
.pc-menu-bar-full {
  width: 100%;
  background-color: var(--header-bg, var(--surface));
  color: var(--header-text, var(--text));
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.pc-menu-bar-inner {
  width: 100%;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
  /* 메뉴 항목에 flex:1을 주지 않고, 필요한 너비만 사용 + 남는 공간은 justify-content로 자연 분배.
     2026-09-07 (요청3): 관리자(헤더/로고 설정 > 상단 가로 메뉴 정렬)에서 좌/중앙/우측 선택 가능
     (--pc-menu-justify, renderer.tsx에서 주입). 모바일 카테고리 Pill(#mobile-nav-top)에는 영향 없음. */
  justify-content: var(--pc-menu-justify, flex-start);
}
@media (min-width: 1024px) {
  .pc-menu-bar-inner {
    max-width: min(100%, var(--pc-menu-max-width, 1600px));
    padding-left: 24px;
    padding-right: 24px;
  }
}
/* 메뉴명 글씨 깨짐/찌그러짐/줄바꿈 방지 - 각 메뉴 항목은 필요한 만큼만 폭을 차지 */
.pc-menu-bar-inner .nav-menu-item {
  flex: 0 0 auto;
  white-space: nowrap;
}

.header-datetime {
  font-weight: 600;
  white-space: nowrap;
  color: var(--header-text, var(--text));
  letter-spacing: 0.02em;
}

.header-trending {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}
.header-trending-label {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--primary, #4f46e5);
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary, #4f46e5) 12%, transparent);
  font-size: 11px;
}
.header-trending-list {
  position: relative;
  height: 18px;
  overflow: hidden;
  min-width: 0;
}
.header-trending-item {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.header-trending-item.active {
  opacity: 1;
  transform: translateY(0);
  position: relative;
}
.header-trending-rank {
  font-weight: 800;
}

.header-logo-pc img {
  display: block;
  object-fit: contain;
}

/* 검색엔진 선택 + 검색창 */
.search-form {
  display: flex;
  align-items: center;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface, #fff);
}
.search-engine-select {
  border: none;
  background: transparent;
  padding: 6px 6px 6px 12px;
  font-size: 12px;
  color: var(--text, #0f172a);
  border-right: 1px solid var(--border, #e2e8f0);
  cursor: pointer;
  outline: none;
  max-width: 90px;
}
.search-input {
  border: none;
  outline: none;
  background: transparent;
  padding: 6px 8px;
  font-size: 13px;
  width: 200px;
  color: var(--text, #0f172a);
}
.search-submit-btn {
  border: none;
  background-color: var(--primary, #4f46e5);
  color: #fff;
  width: 34px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.search-submit-btn:hover {
  opacity: 0.9;
}

/* 모바일 상단 카테고리 바로가기 (가로 스크롤) */
.mobile-category-scroll-wrap {
  background-color: var(--header-bg, var(--surface));
}
.mobile-category-scroll {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 14px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mobile-category-scroll::-webkit-scrollbar {
  display: none;
}
.mobile-category-scroll-item {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--header-text, var(--text));
}
.mobile-category-scroll-item.active {
  color: var(--primary, #4f46e5);
  font-weight: 700;
}

/* 모바일 카테고리 Pill 버튼 (관리자 설정 반영: 높이/폰트/아이콘/간격/모서리/색상) */
.mobile-category-scroll-wrap .mobile-category-scroll {
  gap: var(--pill-gap, 8px);
}
.mobile-category-pill {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  height: var(--pill-height, 36px);
  padding: 0 14px;
  border-radius: var(--pill-radius, 999px);
  border: 1px solid var(--pill-border, var(--border, #e2e8f0));
  background: var(--pill-bg, var(--surface, #fff));
  color: var(--pill-text, var(--header-text, var(--text)));
  font-size: var(--pill-font-size, 13px);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.mobile-category-pill .menu-icon-sized {
  width: var(--pill-icon-size, 16px);
  height: var(--pill-icon-size, 16px);
}
.mobile-category-pill:hover,
.mobile-category-pill.active {
  border-color: var(--pill-hover, var(--primary, #4f46e5));
  color: var(--pill-hover, var(--primary, #4f46e5));
  font-weight: 700;
}

/* 모바일 검색엔진 바로가기(로고바): 카테고리 Pill과 약간 구분되는 스타일(사각 라운드) */
.logo-bar-item-mobile {
  border-radius: 8px;
}

/* ============================================
   모바일 햄버거 드로어 개편: 로그인그룹 / 카테고리 박스 그리드 / 퀵링크 목록 / 구분선
   (관리자 설정값은 Header.tsx의 inline style로 CSS 변수 형태로 주입됨 - menuDisplay.ts 참고)
   ============================================ */

/* 상단/하단 구분선: 로그인그룹 - 카테고리 그리드 - 퀵링크 사이를 시각적으로 분리 */
.drawer-divider {
  border: none;
  border-top: 1px solid var(--border, #e2e8f0);
  margin: 0;
}

/* 로그인/회원가입/찜목록/문의(URL) 그룹 - 카테고리 박스와 약간 다른 스타일(핑크 배경 기본, pill형 라운드) */
.drawer-auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border-radius: 10px;
  background: #fbcfe8;
  color: #1f2937;
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.drawer-auth-btn:hover {
  opacity: 0.85;
}
.drawer-auth-btn:active {
  transform: scale(0.98);
}

/* 카테고리 2열 박스 그리드 (이모지 아이콘 + 이름) */
.drawer-category-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.drawer-category-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--drawer-cat-box-size, 76px);
  padding: 8px 4px;
  border-radius: var(--drawer-cat-box-radius, 12px);
  background: var(--drawer-cat-box-bg, var(--surface, #fff));
  color: var(--drawer-cat-box-text, var(--text, #0f172a));
  border: 1px solid var(--drawer-cat-box-border, var(--border, #e2e8f0));
  text-decoration: none;
  text-align: center;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.drawer-category-box-icon {
  font-size: 1.8em;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.drawer-category-box-name {
  font-size: var(--menu-font-mobile, 13px);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.drawer-category-box:hover,
.drawer-category-box.active {
  border-color: var(--primary, #4f46e5);
  color: var(--primary, #4f46e5);
}

/* 카테고리 그리드 좌우/상하 간격을 관리자 설정값(간격)으로 오버라이드 */
.drawer-category-grid.grid {
  gap: var(--drawer-cat-box-gap, 10px) !important;
}

/* 퀵링크 세로 목록 (공식채널/텔레그램고객센터/바뀐도메인주소 등, 이모지 포함 가능, 항목별 색상 우선) */
.drawer-quicklink-list {
  gap: var(--quicklink-gap, 8px);
}
.drawer-quicklink-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--quicklink-height, 48px);
  border-radius: var(--quicklink-radius, 8px);
  background: var(--quicklink-bg, #2563eb);
  color: var(--quicklink-text, #ffffff);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  padding: 0 12px;
  transition: opacity 0.15s ease;
}
.drawer-quicklink-item:hover {
  opacity: 0.88;
}

/* PC 퀵링크 바로가기 (공식채널/텔레그램고객센터/바뀐도메인주소 등) - 헤더 상단 정보바(날짜/시간·인기검색어와 같은 줄), PC(md 이상)에서만 노출 */
.pc-quicklink-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.pc-quicklink-item {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--quicklink-bg, #2563eb);
  color: var(--quicklink-text, #ffffff);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}
.pc-quicklink-item:hover {
  opacity: 0.88;
}

/* 모바일 헤더 */
.header-mobile-bar {
  background-color: var(--header-bg, var(--surface));
  color: var(--header-text, var(--text));
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.header-logo-mobile img {
  display: block;
  object-fit: contain;
}
.mobile-icon-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: var(--surface, #fff);
  color: var(--text, #0f172a);
  font-size: 15px;
}
.header-mobile-meta {
  overflow: hidden;
}
.header-mobile-meta .header-trending {
  flex: 1;
}
.mobile-search-bar .search-form {
  width: 100%;
}
.mobile-search-bar .search-input {
  flex: 1;
  width: auto;
}

/* ============================================
   배너 그리드: PC 4열, 모바일 2열, 이미지 비율 유지
   ============================================ */
.banner-grid-wrap {
  max-width: 1152px;
  margin: 0 auto;
  /* 위 여백 = 고정배너 영역 ~ 상단 배너그리드 사이 간격 (관리자: 헤더/로고 설정 > 섹션 간격, PC/모바일 개별) */
  padding: var(--gap-fixed-top-pc, 16px) 16px 0;
}
@media (max-width: 640px) {
  .banner-grid-wrap {
    padding-top: var(--gap-fixed-top-mobile, 16px);
  }
}
.banner-grid {
  display: grid;
  grid-template-columns: repeat(var(--banner-cols-pc, 4), minmax(0, 1fr));
  gap: var(--banner-gap-pc, 10px);
}
.banner-item {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border, #e2e8f0);
  aspect-ratio: 4 / 1; /* 기본값(4:1, 400x100 권장 사이즈 비율) - size_type별 클래스로 재정의됨 */
  background: var(--surface, #fff);
}
.banner-item-4-1 {
  aspect-ratio: 4 / 1;
}
.banner-item-3-1 {
  aspect-ratio: 3 / 1; /* 300x100 배너 사이즈 비율 */
}
.banner-item img,
.banner-item picture {
  display: block;
  width: 100%;
  height: 100%;
}
.banner-item img {
  object-fit: cover;
}
.banner-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted, #94a3b8);
  font-size: 12px;
}
/* 배너별 PC/모바일 노출 필터 (show_pc/show_mobile) */
@media (min-width: 641px) {
  .banner-hide-pc {
    display: none !important;
  }
}
@media (max-width: 640px) {
  .banner-grid {
    grid-template-columns: repeat(var(--banner-cols-mobile, 2), minmax(0, 1fr));
    gap: var(--banner-gap-mobile, 8px);
  }
  .banner-hide-mobile {
    display: none !important;
  }
}

/* ============================================
   고정 배너 영역 (zone='fixed') - 배너그리드/TOP10과 동일한 콘텐츠 폭(1152px)을
   배너 1개가 한 줄 전체를 꽉 채우며, 최대 3줄까지 세로로 쌓임.
   위/아래 여백은 관리자 설정(margin_top/margin_bottom)에 따라 CSS 변수로 제어되며 PC/모바일 동일 적용.
   ============================================ */
.fixed-banner-stack {
  max-width: 1152px;
  margin: 0 auto;
  padding: var(--fixed-banner-margin-top, 16px) 16px var(--fixed-banner-margin-bottom, 0px);
  display: flex;
  flex-direction: column;
  /* 고정배너 1번째~2번째~3번째 줄 사이 간격 (관리자: 헤더/로고 설정 > 섹션 간격, PC) */
  gap: var(--gap-fixed-rows-pc, 10px);
}
@media (max-width: 640px) {
  .fixed-banner-stack {
    gap: var(--gap-fixed-rows-mobile, 10px);
  }
}
.fixed-banner-item {
  display: block;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--surface, #fff);
}
.fixed-banner-item-100 {
  aspect-ratio: 12 / 1; /* 1200x100 - PC/모바일 동일 비율 유지 (모바일에서 비율을 바꾸면 아래 object-fit:cover와 만나 이미지 좌우가 잘려 보이는 문제가 있었음) */
}
.fixed-banner-item-150 {
  aspect-ratio: 8 / 1; /* 1200x150 - PC/모바일 동일 비율 유지 */
}
.fixed-banner-item img,
.fixed-banner-item picture {
  display: block;
  width: 100%;
  height: 100%;
}
.fixed-banner-item img {
  /* cover 대신 contain을 사용해 업로드된 이미지 비율이 컨테이너 비율과 정확히 일치하지 않아도
     절대 잘리지 않고 전체 이미지가 항상 보이도록 함(모바일 잘림 현상 방지) */
  object-fit: contain;
}

/* ============================================
   슬라이드 배너 영역 (zone='slide') - TOP10 카테고리 카드 아래, zone='top' 배너 풀을 재사용해
   슬롯별로 계속 자동 회전(클라이언트: /static/slide-banner.js)
   ============================================ */
.slide-banner-wrap {
  display: grid;
  grid-template-columns: repeat(var(--slide-slot-count, 2), minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 0;
}
.slide-banner-slot {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--surface, #fff);
  aspect-ratio: 4 / 1;
}
.slide-banner-slot a {
  display: block;
  width: 100%;
  height: 100%;
}
.slide-banner-slot picture,
.slide-banner-slot img {
  display: block;
  width: 100%;
  height: 100%;
}
.slide-banner-slot img {
  object-fit: cover;
}
@media (max-width: 640px) {
  .slide-banner-wrap {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   팝업 배너 (zone='popup') - 페이지 진입 시 화면 중앙에 노출되는 384x624px 세로형 배너.
   기본 hidden 상태로 렌더링되며 클라이언트 JS(/static/popup-banner.js)가 delay_sec 후 노출시킨다.
   ============================================ */
.popup-banner-root {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup-banner-root.hidden {
  display: none !important;
}
.popup-banner-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.popup-banner-modal {
  position: relative;
  width: var(--popup-width-pc, 384px);
  max-width: 92vw;
  background: var(--surface, #fff);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.popup-banner-slide-wrap {
  width: 100%;
  aspect-ratio: 384 / 624;
  background: var(--surface, #fff);
}
.popup-banner-slide-wrap a,
.popup-banner-slide-wrap img {
  display: block;
  width: 100%;
  height: 100%;
}
.popup-banner-slide-wrap img {
  object-fit: cover;
}
.popup-banner-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup-banner-close:hover {
  background: rgba(0, 0, 0, 0.7);
}
.popup-banner-nav {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  transform: translateY(-50%);
  padding: 0 8px;
  pointer-events: none;
}
.popup-banner-prev,
.popup-banner-next {
  pointer-events: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup-banner-prev:hover,
.popup-banner-next:hover {
  background: rgba(0, 0, 0, 0.6);
}
.popup-banner-dontshow {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.popup-banner-dontshow input {
  cursor: pointer;
}
@media (max-width: 640px) {
  .popup-banner-modal {
    width: var(--popup-width-mobile, 300px);
  }
}

/* ============================================
   안내 문구 영역
   ============================================ */
.notice-banner {
  max-width: 1152px;
  margin: 12px auto 0;
  padding: 10px 16px;
  border: 1px solid;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
}
@media (max-width: 640px) {
  .notice-banner {
    margin: 8px 16px 0;
  }
}

/* ============================================
   메인 콘텐츠 영역 (TOP10 그리드 / 카테고리 목록 등을 감싸는 <main>)
   위쪽 여백 = 안내 문구 ~ 카테고리/상단 콘텐츠 사이 간격
   (관리자: 헤더/로고 설정 > 섹션 간격, PC/모바일 개별). 기존 Tailwind py-8(32px)을 대체.
   ============================================ */
.site-main-content {
  padding-top: var(--gap-notice-content-pc, 32px);
  padding-bottom: 32px;
}
@media (max-width: 640px) {
  .site-main-content {
    padding-top: var(--gap-notice-content-mobile, 32px);
  }
}

/* ============================================
   좌측 카테고리 Sidebar (헤더 레이아웃 sidebar / 카테고리 위치 sidebar)
   ============================================ */
.layout-with-sidebar {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
/* 2026-09-07 (사이드바 상단 정렬 수정): 사이드바가 있는 페이지는 상단배너그리드/안내문구/로고링크바를
   본문 컬럼(.layout-main-content) 맨 위, 즉 사이드바(aside)와 같은 flex 줄 안에서 렌더링한다
   (siteChrome.tsx의 MainLayout 참고). 이 경우 <main>이 이미 px-4로 좌우 여백을 확보하고 있으므로,
   원래 페이지 최상단(풀폭)에서 쓰이던 배너그리드/고정배너의 자체 좌우 padding·max-width는
   여기서는 중복이 되어 TOP10 그리드보다 안쪽으로 밀려 보이는 문제가 생긴다 - 사이드바 컨텍스트에서는 0으로 리셋.
   또한 최상단 여백(page 최상단은 site-main-content의 padding-top이 이미 담당)도 중복되지 않도록 제거한다. */
.sidebar-top-chrome .banner-grid-wrap,
.sidebar-top-chrome .fixed-banner-stack {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
  padding-top: 0;
}
.sidebar-top-chrome .notice-banner {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}
/* 배너그리드/안내문구 ~ 그 아래 실제 콘텐츠(TOP10/카테고리 목록 등) 사이 간격.
   사이드바가 없는 페이지에서는 이 간격을 site-main-content의 padding-top이 담당하지만,
   사이드바 페이지는 배너그리드가 site-main-content 안쪽(본문 컬럼 맨 위)으로 들어왔으므로 여기서 별도로 확보한다. */
.sidebar-top-chrome {
  margin-bottom: var(--gap-notice-content-pc, 32px);
}
@media (max-width: 640px) {
  .sidebar-top-chrome {
    margin-bottom: var(--gap-notice-content-mobile, 32px);
  }
}
/* 사이드바가 있는 페이지의 <main>(.site-main-content)은 상단 여백을 이미 sidebar-top-chrome 안의
   배너그리드 자체 padding-top(--gap-fixed-top-pc)이 담당하므로, 기존 "안내문구~콘텐츠" 간격(32px)을
   중복 적용하지 않도록 0으로 리셋한다 (사이드바 없는 기존 페이지는 그대로 32px 유지). */
main.site-main-content:has(> .layout-with-sidebar) {
  padding-top: 0;
}
/* 2026-09-07 (요청2) 사이드바 사용 시, 사이드바+본문을 감싸는 <main>의 최대 너비/좌우 패딩을
   PC 가로형 메뉴판(.pc-menu-bar-inner)과 완전히 동일한 기준(--pc-menu-max-width, 24px 패딩)으로 맞춘다.
   기존에는 이 <main>이 Tailwind max-w-6xl(1152px)+px-4(16px)로 메뉴판과 다른 기준을 쓰고 있어,
   메뉴판을 1600/1800px로 넓게 설정해도 사이드바는 1152px 안쪽(중앙 쪽)에서 시작하는 문제가 있었다.
   사이드바가 없는 페이지(.max-w-6xl 단독 사용)에는 이 규칙이 적용되지 않아 기존 레이아웃 그대로 유지된다. */
@media (min-width: 1024px) {
  main.site-main-content:has(> .layout-with-sidebar) {
    max-width: min(100%, var(--pc-menu-max-width, 1600px));
    padding-left: 24px;
    padding-right: 24px;
  }
}
.category-sidebar {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: 84px;
}
.sidebar-category-nav {
  background-color: var(--card, #fff);
  border: 1px solid var(--card-border, var(--border));
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-category-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text, #0f172a);
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.sidebar-category-item:hover {
  background-color: var(--hover-bg, color-mix(in srgb, var(--primary, #4f46e5) 8%, transparent));
}
.sidebar-category-item.active {
  background-color: var(--primary, #4f46e5);
  color: #fff;
}
.layout-with-sidebar .layout-main-content {
  flex: 1;
  min-width: 0;
}

/* 카테고리 사이드바 헤더(제목 + PC 전용 접기/펼치기 토글 버튼) */
.category-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 8px;
}
.category-sidebar-header-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted-text, #64748b);
  letter-spacing: 0.02em;
}
.category-sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--muted-text, #64748b);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.category-sidebar-toggle-btn:hover {
  background-color: var(--hover-bg, color-mix(in srgb, var(--primary, #4f46e5) 8%, transparent));
}
.sidebar-category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-category-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 카테고리 사이드바 PC 전용 접힘 상태: 아이콘만 남기고 폭 축소 (board-sidebar.is-collapsed-pc와 동일 패턴) */
.category-sidebar.is-collapsed-pc {
  width: 56px;
}
.category-sidebar.is-collapsed-pc .category-sidebar-header-title,
.category-sidebar.is-collapsed-pc .sidebar-category-label {
  display: none;
}
.category-sidebar.is-collapsed-pc .category-sidebar-header {
  justify-content: center;
}
.category-sidebar.is-collapsed-pc .sidebar-category-item {
  justify-content: center;
  padding: 9px 0;
}
.category-sidebar.is-collapsed-pc .sidebar-category-icon {
  margin-right: 0 !important;
}
.category-sidebar.is-collapsed-pc .category-sidebar-toggle-btn i {
  transform: rotate(180deg);
}

/* ============================================
   TOP10 그룹 카드 그리드: PC 3~6열(관리자 설정, 기본 5), 모바일 2열
   --top10-columns / --top10-gap-pc / --top10-gap-mobile 은
   /admin/menus 의 "TOP10 카드 표시 설정"에서 관리자가 직접 조정한다 (menuDisplay.ts의 getTop10GridStyle).
   ============================================ */
.top10-grid {
  display: grid;
  grid-template-columns: repeat(var(--top10-columns, 5), minmax(0, 1fr));
  gap: var(--top10-gap-pc, 16px);
}
@media (max-width: 1024px) {
  .top10-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .top10-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--top10-gap-mobile, 8px);
  }
}
/* 좌측 사이드바 레이아웃일 때는 메인 콘텐츠 폭이 줄어드므로 그리드 열 수 축소 */
.layout-with-sidebar .top10-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1280px) {
  .layout-with-sidebar .top10-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .layout-with-sidebar .top10-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.layout-with-sidebar .rank-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1280px) {
  .layout-with-sidebar .rank-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .layout-with-sidebar .rank-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.group-card {
  background-color: var(--top10-group-bg, var(--card));
  border: 1px solid var(--card-border, var(--border));
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.group-card:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}
.group-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.group-card-more {
  font-size: 11px;
  opacity: 0.7;
}
/* 기능 추가(2026-09-06): "○○ TOP10" 카드 헤더 아이콘(카테고리 앞에 붙는 이미지/이모지) 크기.
   메뉴(카테고리) 편집 모달의 "PC/모바일 카드 아이콘 크기"에서 카테고리별로 개별 조절 가능(--card-icon-pc/mobile).
   값이 비어있으면 다른 아이콘 크기 설정(상단 메뉴바 아이콘 기본값)과 동일하게 PC 20px / 모바일 18px로 폴백한다. */
.group-card-header-icon {
  flex-shrink: 0;
  width: var(--card-icon-pc, 20px);
  height: var(--card-icon-pc, 20px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 이모지(fallback, <span>)는 width/height가 아니라 font-size로 글리프 크기가 결정되므로 함께 지정.
     이미지(<img>)에는 font-size가 렌더링에 영향 없으므로 부작용 없다. */
  font-size: var(--card-icon-pc, 20px);
  line-height: 1;
}
@media (max-width: 640px) {
  .group-card-header-icon {
    width: var(--card-icon-mobile, var(--card-icon-pc, 18px));
    height: var(--card-icon-mobile, var(--card-icon-pc, 18px));
    font-size: var(--card-icon-mobile, var(--card-icon-pc, 18px));
  }
}
.group-card-list {
  list-style: none;
  margin: 0;
  padding: 4px 8px 8px;
}
/* TOP10 헤더 아래 설명문구 (예: "OTT 및 방송사 공식 서비스 모음") - 카테고리 편집창의 description(🌐 공용)에서 입력.
   값이 없으면 컴포넌트 자체가 렌더링되지 않으므로 빈 여백이 남지 않고 자연스럽게 반응형으로 채워진다. */
.group-card-description {
  margin: 0;
  padding: 8px 14px 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted, #94a3b8);
}
@media (max-width: 640px) {
  .group-card-description { padding: 6px 12px 0; font-size: 11px; }
}
.group-card-item {
  border-radius: 8px;
}
.group-card-item-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
}
.group-card-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}
.group-card-link:hover {
  background-color: var(--hover-bg, color-mix(in srgb, var(--primary, #4f46e5) 8%, transparent));
}
.group-card-rank {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  font-weight: 800;
  /* 기능 추가(2026-09-02): TOP10 카드형(홈화면 그룹카드) 전용 크기 설정(rank_icon_group_card_size_*)을
     반영. 카테고리 상세 리스트뷰(.rank-medal, --rank-icon-pc)와는 완전히 독립된 변수(--rank-icon-group-pc)를 사용. */
  font-size: var(--rank-icon-group-pc, 18px);
  color: var(--muted, #94a3b8);
}
.group-card-rank-icon {
  flex-shrink: 0;
  /* 버그 수정(2026-09-02): 18px/18px 고정 -> 관리자에서 조절 가능한 CSS 변수로 대체.
     기존에는 "순위 아이콘 관리"에서 크기를 바꿔도 홈화면 TOP10 카드형 뷰에는 전혀 반영되지 않았다. */
  width: var(--rank-icon-group-pc, 18px);
  height: var(--rank-icon-group-pc, 18px);
  object-fit: contain;
}
@media (max-width: 640px) {
  .group-card-rank {
    font-size: var(--rank-icon-group-mobile, var(--rank-icon-group-pc, 16px));
  }
  .group-card-rank-icon {
    width: var(--rank-icon-group-mobile, var(--rank-icon-group-pc, 16px));
    height: var(--rank-icon-group-mobile, var(--rank-icon-group-pc, 16px));
  }
}
.group-card-logo {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  background: color-mix(in srgb, var(--muted, #94a3b8) 12%, transparent);
}
.group-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.group-card-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}
@media (max-width: 640px) {
  .group-card-header { padding: 10px 12px; font-size: 13px; }
  .group-card-name { font-size: 12px; }
}

/* TOP10 카테고리별 접기(is_collapsed): 헤더(아이콘+이름+TOP10+화살표)만 남기고 순위 리스트를 숨김.
   display:none 기반이라 별도 미디어쿼리 없이 PC/모바일에 동일하게 적용된다. */
.group-card.is-collapsed .group-card-list {
  display: none;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
  background-color: var(--footer-bg, transparent);
  color: var(--footer-text, inherit);
}
.footer-links-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  font-size: 13px;
}
.footer-links-row a:hover {
  color: var(--primary, #4f46e5);
}
.footer-sep {
  color: var(--border, #e2e8f0);
}
.footer-info-row {
  text-align: center;
}
.footer-visitor-count::before {
  content: '';
}
/* A2: 현재 접속자 뒷배경 박스 스타일 (관리자에서 ON/OFF + 배경색/글씨색 커스터마이즈) */
.footer-visitor-count--box {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background-color: var(--visitor-box-bg, #eef2ff);
  color: var(--visitor-box-text, #4f46e5);
  font-weight: 600;
}
@media (min-width: 768px) {
  .footer-links-row {
    justify-content: flex-start;
  }
  .footer-info-row {
    text-align: left;
  }
  .footer-meta-row {
    justify-content: flex-start !important;
  }
}
@media (max-width: 640px) {
  .footer-links-row {
    flex-wrap: wrap;
    font-size: 12px;
  }
}

/* 이용약관/개인정보처리방침 공개 페이지 */
.legal-content {
  line-height: 1.8;
}
.legal-content img {
  max-width: 100%;
}

/* ============================================
   초보자용 SEO + GEO + GSC + Sitemap 자동관리 - 전용 UI 컴포넌트
   ============================================ */

/* 토글 스위치 (ON/OFF) */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #d1d5db;
  border-radius: 999px;
  transition: background-color 0.15s ease;
}
.switch .slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.switch input:checked + .slider {
  background-color: var(--primary, #4f46e5);
}
.switch input:checked + .slider::before {
  transform: translateX(20px);
}
.switch input:disabled + .slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* "[? 사용방법]" 도움말 팝오버 */
.seo-help-wrap {
  position: relative;
}
.seo-help-popover {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}
.seo-help-popover.hidden {
  display: none;
}

/* 용어 옆 작은 물음표(?) 도움말 아이콘 */
.seo-q {
  position: relative;
}
.seo-q-tip {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  line-height: 1.5;
  pointer-events: none;
}
.seo-q-tip.hidden {
  display: none;
}
.seo-q.seo-q-open .seo-q-tip {
  display: block;
}

/* SEO 시작하기 마법사 - 단계 표시 원(dot) */
.wizard-step-dot {
  transition: background-color 0.15s ease, color 0.15s ease;
}
.wizard-step-dot.is-active {
  background-color: var(--primary, #4f46e5) !important;
  color: #fff !important;
}
.wizard-step-dot.is-done {
  background-color: #16a34a !important;
  color: #fff !important;
}

/* 글자수 카운터 상태 색상 (부족/적정/초과) */
.seo-count-warn {
  color: #d97706 !important;
}
.seo-count-good {
  color: #16a34a !important;
}
.seo-count-bad {
  color: #dc2626 !important;
}

/* ============================================
   링크 관리 - URL 상태 통합 (섹션 19~41)
   "1개 링크 = 1개 Compact Row" 가 핵심이므로
   행이 커지지 않도록 폰트/패딩을 최소화한다.
   ============================================ */

/* 상단 Compact 상태 요약 바 (섹션 26, 27) */
.status-summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.status-summary-chip:hover {
  background: #e5e7eb;
}
.status-summary-chip.active {
  background: var(--primary, #4f46e5);
  color: #fff;
}
.status-summary-chip.status-ok.active { background: #16a34a; }
.status-summary-chip.status-redirect.active { background: #2563eb; }
.status-summary-chip.status-caution.active { background: #d97706; }
.status-summary-chip.status-error.active { background: #dc2626; }
.status-summary-chip.status-unreachable.active { background: #7f1d1d; }
.status-summary-chip.status-unchecked.active { background: #6b7280; }

/* 링크 관리 PC 테이블: 한 줄 유지가 최우선 (섹션 20) */
.link-compact-table td,
.link-compact-table th {
  white-space: nowrap;
}
.link-compact-table .link-name-cell {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-compact-table td:last-child {
  white-space: nowrap;
}

/* URL 상태 뱃지 (행 안에서 작게, 섹션 24) */
.link-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  line-height: 1.5;
  white-space: nowrap;
}
.link-status-badge:hover {
  filter: brightness(0.96);
}

/* 상태가 이전 검사와 달라졌을 때 표시하는 작은 뱃지 (섹션 40 - 크게 만들지 말 것) */
.link-changed-badge {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}

/* 응답시간/검사시각은 부가정보이므로 무채색으로 눈에 덜 띄게 (섹션 21) */
.link-resptime-cell,
.link-checktime-cell {
  color: #9ca3af;
}

/* 모바일 Compact Row (섹션 22 - 1~2줄 유지) */
.link-row-mobile {
  background: #fff;
}
.link-row-mobile .link-status-badge {
  font-size: 11px;
  padding: 2px 8px;
}

/* 검사 중인 행 표시 (진행 중 살짝 흐리게) */
.link-row.is-checking,
.link-row-mobile.is-checking {
  opacity: 0.55;
}

/* 상세보기 Drawer (섹션 21, 33) */
#link-detail-drawer.hidden {
  display: none;
}
#link-detail-body dt {
  color: #6b7280;
  font-size: 12px;
  margin-top: 10px;
}
#link-detail-body dd {
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
}

/* ===== 링크 관리 - 순위/수동조회/실제클릭/합산 복구 (처음 구축 당시 기능 복구) ===== */
.link-rank-badge {
  display: inline-block;
  min-width: 34px;
  text-align: center;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f46e5;
}
.link-views-cell b { color: #111827; }

/* ===== 링크 관리 표 재설계 (2026-08) =====
   - 가로 스크롤바 없이 표가 화면 폭 전체를 사용 (AdminLayout fullWidth 옵션과 함께 사용)
   - 체크박스를 선택하면 해당 <tr>이 팝업 없이 바로 인라인 편집 상태로 바뀜
   - 이미지(로고)는 원본 사이즈와 무관하게 항상 동일한 고정 크기로 표시 */
.link-compact-table-full {
  table-layout: auto;
  width: 100%;
}
.link-compact-table-full .link-name-cell {
  max-width: none; /* 표가 전체 폭을 쓰므로 더 이상 사이트명을 좁게 자르지 않음 */
}
.link-url-cell .truncate-cell {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* 이미지(로고) 썸네일 - 업로드 원본 사이즈가 달라도 항상 동일 크기로 표시 */
.link-logo-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: contain;
  background: #f8f9fb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.link-logo-thumb-sm {
  width: 24px;
  height: 24px;
}
.link-logo-initial {
  font-size: 12px;
  font-weight: 700;
}
.link-image-cell {
  position: relative;
}
.link-image-edit {
  display: flex;
  align-items: center;
  gap: 6px;
}
.link-edit-logo-upload-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px dashed #c7c9d9;
  background: #fff;
  color: #6b7280;
  font-size: 11px;
  cursor: pointer;
  flex-shrink: 0;
}
.link-edit-logo-upload-btn:hover {
  border-color: var(--primary, #4f46e5);
  color: var(--primary, #4f46e5);
}

/* 인라인 편집 입력요소 - 표 폭 안에서 적당히 작게 */
.link-edit-input {
  border: 1px solid #c7c9d9;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  width: 100%;
  min-width: 60px;
  box-sizing: border-box;
}
.link-edit-rank,
.link-edit-manual-views {
  min-width: 56px;
  text-align: center;
}
.link-rank-cell,
.link-image-cell {
  min-width: 60px;
}

/* 체크박스로 선택되어 편집 중인 줄 강조 (사용자 스크린샷의 "파란 부분") */
tr.link-row.is-editing {
  background: #eef2ff;
}
tr.link-row.is-editing td {
  background: #eef2ff;
}

/* URL상태 칸 안에 응답시간/검사시각을 아주 작게 보조로 표시 */
.link-status-sub {
  margin-top: 2px;
  font-size: 10px;
  color: #9ca3af;
  white-space: nowrap;
}

/* 작업(검사/삭제) 아이콘 버튼 - 좁은 폭에서도 잘 보이게 */
.link-actions-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}
.link-actions-cell button {
  color: #6b7280;
  font-size: 13px;
  width: 24px;
  height: 24px;
}
.link-actions-cell .btn-check-link:hover { color: #4f46e5; }
.link-actions-cell .btn-delete-link:hover { color: #dc2626; }

/* 링크 관리 상단 상태바 - [저장] 버튼이 항상 눈에 보이도록 스크롤해도 화면 위에 고정 */
.status-summary-bar-sticky {
  position: sticky;
  top: 8px;
  z-index: 30;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* 작은 사이즈 토글 스위치 (숨김 컬럼 전용 - 기존 .switch보다 살짝 작게) */
.switch-sm {
  width: 36px;
  height: 20px;
}
.switch-sm .slider::before {
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
}
.switch-sm input:checked + .slider::before {
  transform: translateX(16px);
}

/* ============================================
   회원(로그인) 시스템 - 헤더 로그인영역 / 로그인·회원가입·찜목록 모달 / 토스트
   (member-auth.js가 클래스를 토글/생성하며 사용)
   ============================================ */

/* 헤더 로그인 영역 (PC/모바일 공통, member-auth.js가 innerHTML로 채움) */
.member-auth-area {
  display: flex;
  align-items: center;
}
.member-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--border, #e2e8f0);
  color: var(--text, #0f172a);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.member-login-btn:hover {
  border-color: var(--primary, #4f46e5);
  color: var(--primary, #4f46e5);
}
.member-logged-in {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.member-nickname {
  font-weight: 700;
  color: var(--text, #0f172a);
}
.member-fav-link,
.member-logout-link {
  background: transparent;
  border: none;
  color: var(--muted, #64748b);
  cursor: pointer;
  padding: 4px 2px;
  font-size: 13px;
  font-weight: 600;
  transition: color 0.15s ease;
}
.member-fav-link:hover,
.member-logout-link:hover {
  color: var(--primary, #4f46e5);
}
.member-fav-link {
  position: relative;
  padding-left: 12px;
  border-left: 1px solid var(--border, #e2e8f0);
}

/* 로그인/회원가입/찜목록 모달 공통 레이아웃 */
.member-auth-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 100;
}
.member-auth-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 101;
  width: 100%;
  max-width: 380px;
  padding: 0 16px;
}
.member-auth-modal-box {
  background: var(--card, #fff);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  max-height: 85vh;
  overflow-y: auto;
}
.member-auth-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 16px;
  color: var(--text, #0f172a);
}
.member-auth-modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted, #64748b);
  font-size: 16px;
  padding: 4px;
  line-height: 1;
}
.member-auth-modal-close:hover {
  color: var(--text, #0f172a);
}

/* 로그인/회원가입 폼 */
.member-auth-form {
  display: flex;
  flex-direction: column;
}
.member-auth-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, #64748b);
  margin-top: 10px;
  margin-bottom: 4px;
}
.member-auth-label:first-child {
  margin-top: 0;
}
.member-auth-input {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  width: 100%;
  background: var(--surface, #fff);
  color: var(--text, #0f172a);
}
.member-auth-input:focus {
  outline: none;
  border-color: var(--primary, #4f46e5);
}
.member-auth-error {
  color: var(--danger, #ef4444);
  font-size: 12px;
  margin-top: 10px;
}
.member-auth-submit {
  width: 100%;
  margin-top: 16px;
  padding: 10px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
}
.member-auth-switch {
  text-align: center;
  font-size: 12px;
  color: var(--muted, #64748b);
  margin-top: 14px;
}
.member-auth-link {
  background: transparent;
  border: none;
  color: var(--primary, #4f46e5);
  font-weight: 700;
  cursor: pointer;
  padding: 0 0 0 4px;
  font-size: 12px;
  text-decoration: underline;
}

/* 찜목록 모달 - 카테고리 상세페이지 랭크카드(.rank-grid/.rank-card)와 동일한 카드형 그리드로 표시.
   PC: 5칸 x 2줄(최대 10개 한도와 정확히 일치), 모바일: 2칸.
   외곽 .member-auth-modal 컨테이너 자체의 max-width(380px)를 찜목록 모달에서만 넓혀준다. */
#member-favorites-modal.member-auth-modal {
  max-width: 640px;
}
.member-favorites-box {
  max-width: 640px;
}
.member-favorites-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 65vh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 640px) {
  .member-favorites-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}
.member-favorites-item {
  position: relative;
  background-color: var(--card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 12px 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.member-favorites-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}
.member-favorites-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: inherit;
  text-decoration: none;
}
.member-favorites-logo-box {
  width: 100%;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  border-radius: 8px;
  overflow: hidden;
}
.member-favorites-logo-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.member-favorites-logo-fallback {
  font-weight: 800;
  font-size: 16px;
}
.member-favorites-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text, #0f172a);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  margin-bottom: 4px;
}
.member-favorites-link:hover .member-favorites-name {
  color: var(--primary, #4f46e5);
}
/* 찜목록 카드의 조회수/좋아요/URL상태 배지 메타 행 - 카드 폭이 좁으므로(5칸 그리드) 10px로 축소해 한 줄 유지 */
.member-favorites-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 10px;
  color: var(--muted, #64748b);
}
.member-favorites-meta-row > span {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .member-favorites-meta-row { font-size: 9px; gap: 4px; }
}
.member-favorites-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.06);
  border: none;
  border-radius: 999px;
  color: var(--muted, #94a3b8);
  cursor: pointer;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.member-favorites-remove:hover {
  color: #fff;
  background: var(--danger, #ef4444);
}
.member-favorites-empty {
  text-align: center;
  color: var(--muted, #64748b);
  font-size: 13px;
  padding: 24px 0;
}
@media (max-width: 640px) {
  .member-favorites-item { padding: 8px 6px; }
  .member-favorites-logo-box { height: 44px; }
}

/* 찜 10개 제한 등 안내 토스트 - 하단 고정, fade in/out */
.member-favorite-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 12px);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 90vw;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-favorite-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 640px) {
  .member-auth-modal,
  #member-favorites-modal.member-auth-modal {
    max-width: none;
  }
  .member-auth-modal-box {
    padding: 18px;
  }
  .member-nickname {
    display: none;
  }
}

/* B2: 상하 스크롤 버튼 (TOP / BOTTOM) */
.scroll-buttons {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.scroll-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.scroll-btn:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}
.scroll-buttons--hide-pc {
  display: none;
}
.scroll-buttons--hide-mobile {
  display: flex;
}
@media (max-width: 768px) {
  .scroll-buttons--hide-pc {
    display: flex;
  }
  .scroll-buttons--hide-mobile {
    display: none;
  }
  .scroll-btn {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }
}

/* B1: 모바일 "홈 화면 추가(즐겨찾기)" 플로팅 버튼 - 모바일 전용, PC에서는 항상 숨김 */
.mobile-bookmark-btn {
  display: none;
}
@media (max-width: 768px) {
  .mobile-bookmark-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    position: fixed;
    left: 16px;
    bottom: 20px;
    z-index: 60;
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  }
}
.mobile-bookmark-btn-icon-img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  border-radius: 4px;
}
.mobile-bookmark-guide-section {
  margin-bottom: 14px;
}
.mobile-bookmark-guide-section:last-child {
  margin-bottom: 0;
}
.mobile-bookmark-guide-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text, #0f172a);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mobile-bookmark-guide-text {
  font-size: 12.5px;
  color: var(--muted, #64748b);
  white-space: pre-line;
  line-height: 1.6;
}

/* ===== F1: 최소한의 콘텐츠 보호 - 텍스트 드래그 선택 차단 (공개 페이지 전용) =====
   입력창(input/textarea)은 제외해 로그인/검색 등 정상 입력 동작에는 영향 없음. */
body:not(.admin-body) {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}
body:not(.admin-body) input,
body:not(.admin-body) textarea,
body:not(.admin-body) .allow-select,
body:not(.admin-body) .ql-editor,
body:not(.admin-body) .ql-toolbar,
body:not(.admin-body) .board-editor-content,
body:not(.admin-body) .board-editor-toolbar,
body:not(.admin-body) [contenteditable="true"] {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}

/* ============================================
   커뮤니티 게시판 시스템 - PC/모바일 공통 "하단 노출" 콘텐츠 영역
   2026-09-07 후속: 게시판 전용 좌측 사이드바(BoardSidebar)는 폐기되었다.
   게시판 페이지는 이제 홈/카테고리 페이지와 완전히 동일한 공용 크롬
   (Header 상단메뉴 + PC 전용 .category-sidebar + Footer)을 재사용하며,
   게시판 콘텐츠(.board-bottom-section)는 그 메인 콘텐츠 영역 안에 위치한다.
   - PC: 좌측 카테고리 사이드바(있는 경우) + 상단메뉴 + 콘텐츠 하단에 게시판
   - 모바일: 사이드바 없음 + 상단메뉴 + 콘텐츠 하단에 게시판 (완전히 동일한 구조)
   ============================================ */
.board-bottom-section {
  max-width: 1152px;
  margin: 32px auto 48px;
}

/* ============================================
   게시판 목록/글쓰기/상세 콘텐츠 영역
   ============================================ */
.board-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.board-page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text, #0f172a);
}
.board-list-card {
  background-color: var(--card, #fff);
  border: 1px solid var(--card-border, var(--border, #e2e8f0));
  border-radius: 12px;
  overflow: hidden;
}
.board-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.board-list-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted, #64748b);
  border-bottom: 1px solid var(--border, #e2e8f0);
  background-color: color-mix(in srgb, var(--border, #e2e8f0) 40%, transparent);
}
.board-list-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  color: var(--text, #0f172a);
}
.board-list-table tr:last-child td {
  border-bottom: none;
}
.board-list-table a.board-post-title-link {
  color: var(--text, #0f172a);
  font-weight: 500;
}
.board-list-table a.board-post-title-link:hover {
  color: var(--primary, #4f46e5);
}
.board-empty-row {
  text-align: center;
  padding: 48px 0;
  color: var(--muted, #94a3b8);
  font-size: 14px;
}
/* 게시판 목록 테이블 모바일 대응: 좁은 화면에서 열이 강제로 압축되어 글자가
   세로로 깨지는 것을 방지하기 위해 번호/작성자/작성일 열을 숨기고 제목 위주로 재구성한다. */
@media (max-width: 640px) {
  .board-list-table {
    table-layout: fixed;
  }
  .board-list-table th:nth-child(1),
  .board-list-table td:nth-child(1),
  .board-list-table th:nth-child(3),
  .board-list-table td:nth-child(3),
  .board-list-table th:nth-child(4),
  .board-list-table td:nth-child(4) {
    display: none;
  }
  .board-list-table th:nth-child(2),
  .board-list-table td:nth-child(2) {
    width: auto;
    white-space: normal;
    word-break: break-word;
  }
  .board-list-table th:nth-child(5),
  .board-list-table td:nth-child(5) {
    width: 56px;
    white-space: nowrap;
  }
  .board-list-table th,
  .board-list-table td {
    padding: 9px 10px;
    font-size: 13px;
  }
}
.board-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
}
.board-pagination a,
.board-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text, #0f172a);
  border: 1px solid var(--border, #e2e8f0);
}
.board-pagination a:hover {
  background-color: var(--hover-bg, color-mix(in srgb, var(--primary, #4f46e5) 8%, transparent));
}
.board-pagination .current {
  background-color: var(--primary, #4f46e5);
  color: #fff;
  border-color: var(--primary, #4f46e5);
}
.board-detail-card {
  background-color: var(--card, #fff);
  border: 1px solid var(--card-border, var(--border, #e2e8f0));
  border-radius: 12px;
  padding: 24px;
}
.board-detail-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text, #0f172a);
  margin-bottom: 8px;
}
.board-detail-meta {
  display: flex;
  gap: 14px;
  font-size: 12.5px;
  color: var(--muted, #64748b);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.board-detail-content {
  /* 2026-09-08: TipTap Rich Text Paste 도입으로 본문을 실제 HTML(p/h1~h4/ul/ol 등)로 저장/렌더링하도록
     변경되어, 과거 plain-text 저장 시절 줄바꿈 보존용이었던 white-space: pre-wrap은 제거한다.
     (pre-wrap을 켠 채로 두면 HTML 태그 사이의 개행/들여쓰기 공백까지 그대로 보여 문단 사이 간격이 중복됨) */
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text, #0f172a);
  min-height: 120px;
  word-break: break-word;
}
.board-detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border, #e2e8f0);
}
.board-comment-section {
  margin-top: 24px;
}
.board-comment-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.board-comment-item:last-child {
  border-bottom: none;
}
.board-comment-meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--muted, #64748b);
  margin-bottom: 4px;
}
.board-comment-content {
  font-size: 13.5px;
  color: var(--text, #0f172a);
  white-space: pre-wrap;
}
.board-write-form input[type="text"],
.board-write-form textarea {
  width: 100%;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}
.board-write-form textarea {
  min-height: 260px;
  resize: vertical;
  font-family: inherit;
}

/* ----- 게시글 대표 이미지 업로드 (이벤트 게시판 등 card_image 목록용, 글쓰기/수정 폼 공통) ----- */
.board-image-upload {
  border: 1px dashed var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 12px;
}
.board-image-upload input[type="file"] {
  font-size: 13px;
}
.board-image-preview {
  margin-top: 10px;
}
.board-image-preview img {
  max-width: 240px;
  max-height: 160px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border, #e2e8f0);
}

/* ============================================
   게시판 글쓰기/수정 - TipTap 기반 Rich Text 에디터 (2026-09-08, Quill 대체)
   src/client/board-write-editor.ts (esbuild 번들 -> public/static/board-write-editor.js) 대응 스타일
   ============================================ */
.board-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid var(--border, #e2e8f0);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: var(--surface-muted, #f8fafc);
}
.board-editor-toolbar-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text, #0f172a);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.board-editor-toolbar-btn:hover {
  background: var(--border, #e2e8f0);
}
.board-editor-toolbar-btn.is-active {
  background: var(--primary, #2563eb);
  color: #fff;
  border-color: var(--primary, #2563eb);
}
.board-editor-content {
  min-height: 250px;
  padding: 12px 14px;
  border: 1px solid var(--border, #e2e8f0);
  border-top: none;
  border-radius: 0 0 8px 8px;
  font-size: 14px;
  line-height: 1.7;
  background: #fff;
}
.board-editor-content:focus,
.board-editor-content:focus-within {
  outline: none;
}
.board-editor-content .ProseMirror {
  outline: none;
  min-height: 220px;
}
.board-editor-content .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--muted, #94a3b8);
  pointer-events: none;
  height: 0;
}
.board-editor-content h1,
.board-editor-content h2,
.board-editor-content h3,
.board-editor-content h4 {
  font-weight: 700;
  line-height: 1.35;
  margin: 1.1em 0 0.5em;
}
.board-editor-content h1 { font-size: 1.6em; }
.board-editor-content h2 { font-size: 1.4em; }
.board-editor-content h3 { font-size: 1.2em; }
.board-editor-content h4 { font-size: 1.05em; }
.board-editor-content p { margin: 0.5em 0; }
.board-editor-content ul,
.board-editor-content ol {
  padding-left: 1.4em;
  margin: 0.5em 0;
}
.board-editor-content blockquote {
  margin: 0.8em 0;
  padding: 4px 14px;
  border-left: 3px solid var(--border, #e2e8f0);
  color: var(--muted, #64748b);
}
.board-editor-content hr {
  border: none;
  border-top: 1px solid var(--border, #e2e8f0);
  margin: 1.4em 0;
}
.board-editor-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.board-editor-content a {
  color: var(--primary, #2563eb);
  text-decoration: underline;
}

/* 게시글 상세 본문(sanitize된 HTML 렌더링 영역)도 에디터와 동일한 타이포그래피를 사용해서
   "작성 시 보이는 모습 = 상세 페이지에 보이는 모습"이 최대한 일치하도록 한다. */
.board-detail-content h1,
.board-detail-content h2,
.board-detail-content h3,
.board-detail-content h4 {
  font-weight: 700;
  line-height: 1.35;
  margin: 1.1em 0 0.5em;
}
.board-detail-content h1 { font-size: 1.6em; }
.board-detail-content h2 { font-size: 1.4em; }
.board-detail-content h3 { font-size: 1.2em; }
.board-detail-content h4 { font-size: 1.05em; }
.board-detail-content p { margin: 0.6em 0; line-height: 1.75; }
.board-detail-content ul,
.board-detail-content ol {
  padding-left: 1.4em;
  margin: 0.6em 0;
}
.board-detail-content blockquote {
  margin: 0.9em 0;
  padding: 4px 14px;
  border-left: 3px solid var(--border, #e2e8f0);
  color: var(--muted, #64748b);
}
.board-detail-content hr {
  border: none;
  border-top: 1px solid var(--border, #e2e8f0);
  margin: 1.6em 0;
}
.board-detail-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.board-detail-content a {
  color: var(--primary, #2563eb);
  text-decoration: underline;
}

/* ----- 게시글 상세: 대표 이미지 ----- */
.board-detail-image {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 16px;
}

/* ============================================
   이벤트 게시판 전용: 이미지+제목+날짜 카드형 목록 (list_style='card_image')
   PC/모바일 공통 반응형 그리드 - 공지사항/자유게시판(text)의 .board-list-table과 완전히 별개.
   ============================================ */
.board-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.board-card-item {
  display: block;
  background-color: var(--card, #fff);
  border: 1px solid var(--card-border, var(--border, #e2e8f0));
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.board-card-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}
.board-card-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: color-mix(in srgb, var(--border, #e2e8f0) 40%, transparent);
}
.board-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.board-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted, #94a3b8);
  font-size: 28px;
}
.board-card-body {
  padding: 12px 14px;
}
.board-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #0f172a);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 2.6em;
}
.board-card-date {
  font-size: 12px;
  color: var(--muted, #64748b);
  margin-top: 6px;
}
/* 이벤트 카드 그리드 반응형: PC 4열 -> 태블릿 3열 -> 모바일 2열 (PC/모바일 공통 노출, 열 수만 조정) */
@media (max-width: 1024px) {
  .board-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .board-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .board-card-body {
    padding: 8px 10px;
  }
  .board-card-title {
    font-size: 12.5px;
  }
  .board-card-date {
    font-size: 11px;
  }
}

/* ============================================
   메인페이지 하단 게시판 A/B그룹 위젯 (요구사항 1~3)
   - .top10-grid(주소관리 영역) 바로 아래에 위치. 위쪽 영역이 없거나(카드 0개) 게시판이 없으면
     해당 블록 자체가 렌더링되지 않으므로(server 조건부 렌더링) 빈 공간이 남지 않는다.
   - 그룹(A/B) 내부는 top10-grid와 동일한 "CSS 커스텀 프로퍼티 + 노출 카드만 매핑" 패턴으로
     1~5칸 자동배치한다(--board-group-columns, menuDisplay.ts의 getBoardGroupGridStyle).
   ============================================ */
.board-home-groups {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.board-home-group-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text, #0f172a);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.board-home-group-grid {
  display: grid;
  grid-template-columns: repeat(var(--board-group-columns, 5), minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1024px) {
  .board-home-group-grid {
    grid-template-columns: repeat(min(3, var(--board-group-columns, 5)), minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .board-home-group-grid {
    grid-template-columns: repeat(min(2, var(--board-group-columns, 5)), minmax(0, 1fr));
    gap: 10px;
  }
}
.layout-with-sidebar .board-home-group-grid {
  grid-template-columns: repeat(min(4, var(--board-group-columns, 5)), minmax(0, 1fr));
}
@media (max-width: 1280px) {
  .layout-with-sidebar .board-home-group-grid {
    grid-template-columns: repeat(min(3, var(--board-group-columns, 5)), minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .layout-with-sidebar .board-home-group-grid {
    grid-template-columns: repeat(min(2, var(--board-group-columns, 5)), minmax(0, 1fr));
  }
}
.board-home-card {
  background-color: var(--card, #fff);
  border: 1px solid var(--card-border, var(--border, #e2e8f0));
  border-radius: 12px;
  padding: 14px 16px;
  min-width: 0;
}
.board-home-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.board-home-card-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text, #0f172a);
}
.board-home-card-title:hover {
  color: var(--primary, #4f46e5);
}
.board-home-card-more {
  font-size: 11.5px;
  color: var(--muted, #94a3b8);
}
.board-home-card-more:hover {
  color: var(--primary, #4f46e5);
}
.board-home-post-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.board-home-post-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text, #0f172a);
  white-space: nowrap;
  overflow: hidden;
}
.board-home-post-item a {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}
.board-home-post-item a:hover {
  color: var(--primary, #4f46e5);
}
.board-home-post-date {
  font-size: 11px;
  color: var(--muted, #94a3b8);
  flex-shrink: 0;
}
.board-home-empty {
  font-size: 12.5px;
  color: var(--muted, #94a3b8);
  padding: 10px 0;
  text-align: center;
}

/* ============================================
   게시판 하부카테고리(서브카테고리) 탭 - 게시판 목록/글쓰기 페이지 상단
   ============================================ */
.board-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.board-category-tab {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border, #e2e8f0);
  color: var(--muted, #64748b);
  background-color: var(--card, #fff);
}
.board-category-tab:hover {
  color: var(--primary, #4f46e5);
}
.board-category-tab.active {
  background-color: var(--primary, #4f46e5);
  border-color: var(--primary, #4f46e5);
  color: #fff;
}

/* ============================================
   회원 레벨 아이콘 - 게시글/댓글 작성자 닉네임 옆에 표시 (요구사항 7)
   PC/모바일 크기는 인라인 style(--level-icon-size-*)로 개별 조정된다(관리자 설정값).
   ============================================ */
.member-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
}
.member-level-icon {
  width: var(--level-icon-size-pc, 16px);
  height: var(--level-icon-size-pc, 16px);
  object-fit: contain;
  flex-shrink: 0;
}
.member-level-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
@media (max-width: 640px) {
  .member-level-icon {
    width: var(--level-icon-size-mobile, 14px);
    height: var(--level-icon-size-mobile, 14px);
  }
}
