/* ═══════════════════════════════════════════════════════════════
   select 전역 리셋 — iOS Safari가 padding/height 무시하는 문제 해결
   - appearance:none으로 네이티브 스타일 리셋
   - 커스텀 SVG 화살표 data URL로 기본 드롭다운 아이콘 제공
   - 페이지별 .class 규칙은 특정성 높아 padding/width 등 개별 값 유지
   ═══════════════════════════════════════════════════════════════ */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  line-height: 1.4;
  box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════════
   Viewport 폭 계산 완전 일치 보장
   - 세로 스크롤바 항상 강제 (콘텐츠 길이에 관계없이 viewport 폭 동일)
   - 가로 스크롤은 body에서 차단 (html에 overflow-x:hidden 주면 sticky 깨짐)
   - sticky nav 보정: scrollIntoView 시 nav 가림 방지 (nav 97px + gap 10px = 107px)
   ═══════════════════════════════════════════════════════════════ */
html {
  overflow-y: scroll;
  scroll-padding-top: 107px;
}
body {
  overflow-x: clip;
  max-width: 100%;
}

/* 로고 이미지 크기 제한 — nav-top-bg(56px) 초과 방지로 레이아웃 shift 차단 */
.nav-logo img { max-height: 56px; width: auto; }
.footer-logo img { max-height: 48px; width: auto; }

/* ── 로고 placeholder (이미지 미업로드 시 회색 영역) ── */
.nav-logo:empty {
  min-width: 140px;
  min-height: 32px;
  background: #e5e7eb;
  border-radius: 4px;
  display: inline-block;
}
.footer-logo:empty {
  min-width: 120px;
  min-height: 24px;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}

/* ── 레벨 배지 ── */
.level-badge {
  display: inline-block;
  border-radius: 3px;
  background: #e91e63;
  color: #fff;
  border: 1px solid #000;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 7px;
  min-width: 32px;
  box-sizing: border-box;
  flex-shrink: 0;
  text-align: center;
}
.level-badge-xs {
  display: inline-block;
  border-radius: 3px;
  background: #e91e63;
  color: #fff;
  border: 1px solid #000;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  min-width: 26px;
  box-sizing: border-box;
  flex-shrink: 0;
  text-align: center;
  vertical-align: middle;
}
.level-badge-sm {
  display: inline-block;
  border-radius: 3px;
  background: #e91e63;
  color: #fff;
  border: 1px solid #000;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 6px;
  min-width: 29px;
  box-sizing: border-box;
  flex-shrink: 0;
  text-align: center;
  vertical-align: middle;
}

.level-badge-lg {
  display: inline-block;
  border-radius: 3px;
  background: #e91e63;
  color: #fff;
  border: 1px solid #000;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 8px;
  min-width: 35px;
  box-sizing: border-box;
  flex-shrink: 0;
  text-align: center;
}

/* ── 게시글 배지 ── */
.post-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: var(--navy-mid);
  background: var(--navy-pale);
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.post-badge.debate { background: var(--red); color: #fff; border-radius: 4px; margin-left: 5px; }
.post-badge.flair { background: var(--gray-100); color: var(--gray-800); }

/* ── 네비 플레어 드롭다운 ── */
.nav-item { position: relative; display: flex; align-items: center; }
.nav-item::after { content: ''; position: absolute; top: 100%; left: 0; right: 0; height: 10px; }
.nav-dropdown { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--gray-100); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.14); padding: 10px; z-index: 500; display: grid; grid-auto-flow: column; grid-template-rows: repeat(5, auto); gap: 2px; opacity: 0; visibility: hidden; transition: opacity 0.15s, visibility 0.15s; pointer-events: none; min-width: 120px; }
.nav-item:hover .nav-dropdown,
.nav-item.nav-expanded .nav-dropdown { opacity: 1; visibility: visible; pointer-events: auto; }
.nav-dropdown-item { font-size: 12px; font-weight: 600; padding: 5px 8px; border-radius: 6px; text-decoration: none; text-align: center; display: block; transition: background 0.1s; white-space: nowrap; }
.nav-dropdown-item:hover { background: #e2e6ea; }

/* ── 닉네임 팝업 ── */
.user-popup {
  display: none;
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.16);
  min-width: 180px;
  overflow: hidden;
}
.user-popup .popup-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #e8f1fb 0%, #f0f5fc 100%);
  border-bottom: 1px solid var(--border);
}
.user-popup .popup-nick {
  font-size: 14px;
  font-weight: 700;
  color: #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-popup .popup-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Noto Sans KR', sans-serif;
  transition: background 0.1s;
}
.user-popup .popup-btn:hover { background: var(--gray-50); }
.user-popup .popup-arrow { color: var(--gray-400); font-size: 14px; }

/* ── 종 아이콘 빨간 점 ── */
.bell-dot {
  display: none;
  position: absolute;
  top: 2px;
  right: 2px;
  width: 7px;
  height: 7px;
  background: #e53935;
  border-radius: 50%;
}

/* ── 알림 팝업 ── */
.bell-popup {
  display: none;
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.16);
  width: 340px;
  max-width: calc(100vw - 20px);
  max-height: calc(100vh - 140px);
  overflow: hidden;
}
.bell-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, #e8f1fb 0%, #f0f5fc 100%);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.bell-popup-list {
  max-height: 300px;
  overflow-y: auto;
}
.bell-popup-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--gray-100);
  line-height: 1.5;
  position: relative;
}
.bell-popup-item .notif-label {
  color: var(--gray-400);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
  padding-top: 1px;
  width: 58px;
  text-align: center;
}
.bell-popup-item .notif-title {
  font-weight: 700;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-width: 0;
  flex: 1;
  text-align: left;
}
.bell-popup-item .notif-time {
  color: var(--gray-400);
  font-size: 11px;
  flex-shrink: 0;
  white-space: nowrap;
  padding-top: 1px;
}
.bell-popup-item:hover { background: var(--gray-50); }
.bell-popup-item.notif-unread { background: rgba(255, 235, 59, 0.15); }
.notif-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  background: #e53935;
  border-radius: 50%;
}
.bell-popup-empty {
  padding: 20px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--gray-400);
}

/* ── 광고 공용 스타일 ── */
.ad-placeholder {
  background: #e5e7eb;
  border: 1px dashed #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
  box-sizing: border-box;
}
.ad-placeholder .ad-ph-label { display: block; font-size: 13px; }
.ad-placeholder .ad-ph-size  { display: block; font-size: 11px; font-weight: 400; color: #9ca3af; margin-top: 2px; }

/* 좌우 사이드 레일 — JS(updateRailVisibility)가 뷰포트/레일폭 기반으로 표시/숨김 제어 */
.ad-rail {
  position: fixed;
  top: 500px; /* 안전 기본값 — hero 아래, JS가 정확한 위치로 덮어씀 */
  width: 160px;
  height: 600px;
  z-index: 50;
  display: none; /* 기본 숨김. JS가 조건 만족 시 block */
}
.ad-rail-left  { left: calc(50% - 720px); }
.ad-rail-right { left: calc(50% + 560px); }

/* 정적 슬롯 — 공간 항상 예약 (CLS 방지). 광고 없으면 placeholder만 숨김 */
.ad-slot[data-slot] { display: block; box-sizing: border-box; }
.ad-slot[data-slot]:not(.has-ad) .ad-placeholder { visibility: hidden; }
/* 네이티브 슬롯(8,9번)은 광고 없으면 공간도 없앰 (본문 흐름에 영향 없게) */
.ad-slot[data-slot="board_notice"]:not(.has-ad),
.ad-slot[data-slot="board_inline"]:not(.has-ad) { display: none; }

/* 사이드바 내부 광고 카드 (250x250) */
.ad-sidebar {
  width: 100%;
  height: 250px;
  border-radius: var(--radius);
}

/* 가로 배너 (728x90) */
.ad-banner-728 {
  width: 100%;
  max-width: 728px;
  height: 90px;
  margin: 0 auto;
}

/* 슬롯 컨테이너 기본 크기 — 공간 예약. 관리자 설정값(width/height)이 있으면 JS가 style로 덮어씀 */
.ad-slot[data-slot="sidebar_top"],
.ad-slot[data-slot="sidebar_mid"] {
  width: 100%;
  max-width: 250px;
  height: 250px;
  overflow: hidden;
}
.ad-slot[data-slot="post_top"],
.ad-slot[data-slot="post_middle"],
.ad-slot[data-slot="main_best"] {
  width: 100%;
  max-width: 728px;
  height: 90px;
  margin: 0 auto;
  overflow: hidden;
}
/* 모바일 기본값: 320x100 (5,6,7번) */
@media (max-width: 767px) {
  .ad-slot[data-slot="post_top"],
  .ad-slot[data-slot="post_middle"],
  .ad-slot[data-slot="main_best"] {
    max-width: 320px;
    height: 100px;
  }
}

/* 본문 사이 네이티브 광고 (게시글 한 행처럼 보임) */
.board-table tbody tr.ad-row { background: #f5faff; }
.board-table tbody tr.ad-row:hover { background: #e8f3fd; }
.board-table tbody tr.ad-row td { padding: 11px 14px; }
@media (min-width: 769px) {
  .board-table tbody tr.ad-row td { padding: 2px 14px; }
}
.board-table tbody tr.ad-row td.col-title { overflow: visible; }
.board-table tbody tr.ad-row td.col-title .td-title,
.board-table tbody tr.ad-row td.col-title .td-title-main { overflow: visible; }
.board-table tbody tr.ad-row td.col-title .td-title-text {
  color: var(--text);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.flair-ad { color: #185FA5 !important; font-weight: 700 !important; }

/* ═══════════════════════════════════════════════════════════════
   반응형: 1100px 이하에서 사이드바 숨기고 단일 컬럼으로 전환
   - 전 페이지 동일 동작 (board/post/notice/register-result 포함)
   - 가로 스크롤 절대 발생하지 않음
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1099px) {
  .layout,
  .page-wrap {
    grid-template-columns: 1fr !important;
    min-width: 0 !important;
  }
  .sidebar,
  .admin-menu {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   검색창 높이 통일: 최상단 네비 검색(.nav-search)
   전 페이지 공통 적용, flair-select(콤보박스)와 같은 36px로 맞춤
   ═══════════════════════════════════════════════════════════════ */
.nav-search {
  height: 36px;
  box-sizing: border-box;
}
.nav-search input,
.nav-search-btn {
  height: 100%;
  padding-top: 0;
  padding-bottom: 0;
  box-sizing: border-box;
}
.nav-search-btn {
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   콤보 prefix 표시 (.combo-wrap + .combo-face)
   - 드롭다운: plain 옵션 텍스트
   - 선택 후 화면: "게시판: 자유게시판" / "분류: 전체" / "정렬: 최신순"
   - prefix는 파란색, 값은 기본색
   ═══════════════════════════════════════════════════════════════ */
.combo-wrap { position: relative; display: inline-block; }
.combo-wrap .flair-select {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  width: 100%;
}
/* 드롭다운이 열리면 option 텍스트는 기본색으로 복원 (select 상속 방지) */
.combo-wrap .flair-select option {
  color: var(--text) !important;
  -webkit-text-fill-color: var(--text) !important;
  background: #fff;
}
.combo-face {
  position: absolute;
  inset: 0;
  padding: 0 26px 0 10px;
  display: flex;
  align-items: center;
  font-size: 13px;
  font-family: 'Noto Sans KR', sans-serif;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  color: var(--text);
}
.combo-face .label-prefix {
  color: var(--navy-mid);
  font-weight: 600;
  margin-right: 4px;
  flex-shrink: 0;
}

/* ── 검색 활성 상태: chip으로 변환 ("토론 게시판 > 민주주의" + X) ── */
.nav-search.has-query {
  background: rgba(133, 183, 235, 0.2);
  border-color: transparent;
}
.nav-chip {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 12px;
  font-size: 13px;
  color: var(--navy);
  font-weight: 700;
  font-family: 'Noto Sans KR', sans-serif;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
}
.nav-chip-scope {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex-shrink: 1;
}
.nav-chip-sep {
  color: var(--navy-mid);
  flex-shrink: 0;
  opacity: 0.5;
  font-weight: 400;
}
.nav-chip-query {
  flex-shrink: 0;
}
.nav-chip-x {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 10px;
  color: var(--navy);
  display: flex;
  align-items: center;
  height: 100%;
  opacity: 0.7;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.nav-chip-x:hover { opacity: 1; }

/* ═══════════════════════════════════════════════════════════════
   네비 하단: 게시판 버튼 자연 wrap + 글쓰기/햄버거 고정 오른쪽
   - nav-bottom을 grid 3컬럼으로: [nav-links(1fr)] [글쓰기] [햄버거]
   - nav-links는 flex-wrap으로 좁아지면 2~3줄로 자연 wrap
   - nav-link는 white-space:nowrap으로 글자 세로 쪼개짐 방지
   - 햄버거는 ≤1099px에서만 표시
   ═══════════════════════════════════════════════════════════════ */
.nav-bottom {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: start;
  gap: 4px;
  min-height: 48px;
  height: auto;
  padding: 6px 10px;
}
/* 햄버거가 사라지는 데스크톱(≥1100px)에서는 4번째 컬럼 제거 — 글쓰기 버튼 우측 여백 방지 */
@media (min-width: 1100px) {
  .nav-bottom { grid-template-columns: auto minmax(0, 1fr) auto; }
}
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  row-gap: 4px;
  align-items: center;
  min-height: 36px;
}
.nav-link {
  white-space: nowrap;
  height: 36px !important;
  padding: 0 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  box-sizing: border-box !important;
}
/* 글쓰기 버튼 공통 36px 높이 */
.btn-write {
  height: 36px !important;
  padding: 0 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  line-height: 1 !important;
  box-sizing: border-box !important;
}
.btn-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--navy-light);
  border: none;
  color: #e03131;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Noto Sans KR', sans-serif;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  box-sizing: border-box;
}
.btn-hamburger:hover { background: #3a8fe0; }
html.logged-in .btn-hamburger { color: #22c55e; }
.btn-hamburger svg { display: block; }
@media (max-width: 1099px) {
  .btn-hamburger { display: inline-flex; }
}

/* ─── 홈 버튼 (모든 크기 공통, 정사각 36x36) ─── */
.btn-mobile-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--navy-light);
  border: none;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: background 0.15s;
}
.btn-mobile-home:hover { background: #3a8fe0; }
.btn-mobile-home svg { display: block; }

/* ─── 모바일 게시판 드롭다운 (≤768px) ─── */
.nav-mobile-dropdown {
  display: none;
  position: relative;
  flex: 1;
  min-width: 0;
}
.nav-mobile-dropdown-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--navy-light);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Noto Sans KR', sans-serif;
  padding: 0 14px;
  cursor: pointer;
  gap: 8px;
  height: 36px;
  box-sizing: border-box;
  line-height: 1;
  transition: background 0.15s;
}
.nav-mobile-dropdown-btn:active { background: #3a8fe0; }
.nav-mobile-dropdown-arrow {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #fff;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.nav-mobile-dropdown.open .nav-mobile-dropdown-arrow { transform: rotate(180deg); }
.nav-mobile-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  z-index: 200;
  max-height: 320px;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  padding: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}
.nav-mobile-dropdown-menu::-webkit-scrollbar { width: 6px; -webkit-appearance: none; }
.nav-mobile-dropdown-menu::-webkit-scrollbar-track { background: transparent; }
.nav-mobile-dropdown-menu::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
.nav-mobile-dropdown-menu::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
.nav-mobile-dropdown.open .nav-mobile-dropdown-menu { display: block; }
.nav-mobile-dropdown-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: none;
  text-align: left;
  font-size: 13px;
  font-family: 'Noto Sans KR', sans-serif;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s;
  box-sizing: border-box;
}
.nav-mobile-dropdown-item:active,
.nav-mobile-dropdown-item:hover { background: var(--gray-100); }
.nav-mobile-dropdown-item.active {
  background: var(--navy);
  color: #fff;
  font-weight: 700;
}
@media (max-width: 768px) {
  /* 가로 스크롤 방지 — hidden은 sticky를 깨므로 clip 사용 (주석: 22번째 라인 참고) */
  html { overflow-x: clip; }
  body { max-width: 100vw; overflow-x: clip; }
  .nav-inner,
  .layout,
  .nav-bottom { max-width: 100% !important; box-sizing: border-box !important; }
  .nav-links { display: none !important; }
  .nav-mobile-dropdown { display: block; }
  .nav-bottom-wrap { overflow: visible; }
  .nav-bottom {
    overflow: visible;
    align-items: center;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }
  .nav-top-bg {
    height: auto !important;
    overflow: hidden !important;
    background: var(--white);
  }
  .nav-top {
    flex-direction: row !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    gap: 10px !important;
    align-items: center !important;
  }
  .nav-inner {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 10px !important;
    gap: 10px !important;
    align-items: center !important;
  }
  .nav-logo {
    display: inline-flex !important;
    flex: 1 !important;
    flex-shrink: 0;
  }
  /* 모바일: 로고가 검색창 높이(36px)와 맞도록 제한 — fit 모드만 적용 */
  .nav-logo img:not([data-size="natural"]) { max-height: 36px !important; }
  .nav-search {
    position: static !important;
    transform: none !important;
    flex: 1 !important;
    width: 0 !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .nav-search input { min-width: 0 !important; flex: 1 !important; }
  .nav-search .search-chip {
    max-width: 100% !important;
    width: 100% !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .hero { display: none !important; }
  img, video, iframe { max-width: 100% !important; }
  table { max-width: 100% !important; }
  pre, code { overflow-x: auto; max-width: 100%; }
  .board-area, .board-section, .post-list,
  .best-top-grid-b,
  .post-card-simple, .post-title-simple,
  .board-section-head { min-width: 0 !important; }
  .post-title-simple { word-break: break-word; overflow-wrap: anywhere; }
  .layout > * { min-width: 0; }
  /* 베스트 TOP4 2열 균일 정사각형 */
  .best-top-grid-b {
    grid-auto-rows: 1fr !important;
    align-items: stretch !important;
  }
  .best-top-b-card {
    width: 100% !important;
    aspect-ratio: 1/1 !important;
    height: auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
  .best-top-b-thumb {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .best-top-b-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }
  .best-top-b-title {
    word-break: keep-all !important;
  }
  /* 베스트 세로리스트 제목만 모바일에서 1px 축소 */
  .post-title { font-size: 13px !important; }
}

/* 좁은 모바일(≤360px): 세로리스트 제목 추가 1px 축소 */
@media (max-width: 360px) {
  .post-title { font-size: 12px !important; }
  .post-title-simple { font-size: 12px !important; }
  .card-stats { font-size: 11px !important; }
  /* 네비/검색창/콤보 축소 (320 기기) */
  .nav-search { height: 34px !important; }
  .nav-search input { font-size: 12px !important; }
  .nav-link { height: 34px !important; font-size: 12px !important; }
  .nav-logo img:not([data-size="natural"]) { max-height: 34px !important; }
  .nav-bottom { min-height: 46px !important; padding: 6px 10px !important; }
  .btn-write { height: 34px !important; font-size: 12px !important; padding: 0 12px !important; }
  .btn-hamburger { width: 34px !important; height: 34px !important; }
  .btn-mobile-home { width: 34px !important; height: 34px !important; }
  .nav-mobile-dropdown-btn { height: 34px !important; font-size: 12px !important; padding: 0 12px !important; }
  /* 콤보박스: wrapper 34px + select도 픽셀값으로 강제 (iOS Safari는 height:100% 무시) */
  .combo-wrap { height: 34px !important; position: relative !important; overflow: hidden !important; }
  .combo-wrap > select.flair-select {
    position: absolute !important;
    top: 0 !important; left: 0 !important; right: 0 !important;
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    width: 100% !important;
    font-size: 12px !important;
    line-height: 1 !important;
    padding: 0 24px 0 8px !important;
    box-sizing: border-box !important;
  }
  .combo-face { font-size: 12px !important; line-height: 1 !important; }
  .nav-chip { font-size: 12px !important; }
  /* 페이지네이션 버튼/select 34×34 + 폰트 12 */
  .page-btn,
  .btn-page {
    width: 34px !important;
    height: 34px !important;
    font-size: 12px !important;
  }
  .page-select {
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    font-size: 12px !important;
    line-height: 32px !important;
    min-width: 56px !important;
    padding: 0 10px !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   햄버거 사이드 드로어 — 플로팅 카드 스타일 (오른쪽 상단)
   - 내용(로그인 폼 또는 사용자 메뉴)만큼만 높이 (auto-shrink)
   - 화면 오른쪽 상단에서 10px 여백 두고 떠있음
   - 내부는 사이드바 `.auth-card` 와 동일한 스타일
   ═══════════════════════════════════════════════════════════════ */
.sidebar-drawer {
  position: fixed;
  inset: 0;
  z-index: 1500;
  pointer-events: none;
  visibility: hidden;
  overflow: hidden;
}
.sidebar-drawer.open { pointer-events: auto; visibility: visible; }
.sidebar-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.25s;
}
.sidebar-drawer.open .sidebar-drawer-overlay { background: rgba(0,0,0,0.45); }
.sidebar-drawer-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 250px;
  max-width: calc(100vw - 20px);
  max-height: calc(100vh - 20px);
  max-height: calc(100dvh - 20px);
  overflow-y: auto;
  transform: translateX(calc(100% + 20px));
  transition: transform 0.25s;
  filter: drop-shadow(0 12px 36px rgba(0,0,0,0.2));
}
.sidebar-drawer.open .sidebar-drawer-panel { transform: translateX(0); }

/* ─── 공통 로그인 카드 양식 (사이드바 / 드로어 / 모달 공용) ─── */
.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(15,45,82,0.07);
}
.auth-head {
  background: var(--navy);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.2px;
}
.auth-head-dot,
.auth-card .side-card-head-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #85b7eb;
  flex-shrink: 0;
}
.auth-inputs {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px 14px 0;
}
.auth-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 11px;
  font-size: 13px;
  font-family: 'Noto Sans KR', sans-serif;
  color: var(--text);
  background: var(--gray-50);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  box-sizing: border-box;
}
.auth-input:focus { border-color: var(--navy-mid); background: #fff; }
.auth-input::placeholder { color: var(--gray-400); }
.pw-wrap { position: relative; }
.pw-wrap .auth-input { padding-right: 36px; }
.pw-toggle {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 0;
  color: var(--gray-400); display: flex; align-items: center;
  transition: color 0.15s;
}
.pw-toggle:hover { color: var(--navy-mid); }
.auth-btn-login {
  display: block;
  width: calc(100% - 28px);
  margin: 7px 14px 0;
  padding: 9px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  transition: background 0.15s;
}
.auth-btn-login:hover { background: var(--navy-mid); }
.auth-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px 12px;
}
.auth-auto {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--gray-600);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.auth-auto input { cursor: pointer; }
.auth-links {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}
.auth-link {
  background: none; border: none;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 11px;
  color: var(--gray-600);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.auth-link:hover { color: var(--navy-mid); }
.auth-divider { color: var(--gray-200); }

/* ─── 로그인 상태: user-profile / user-menu / logout 버튼 ─── */
.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: linear-gradient(135deg, #e8f1fb 0%, #f0f5fc 100%);
  border-bottom: 1px solid var(--border);
}
.user-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 14px;
  font-weight: 700;
  color: #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
  flex-shrink: 1;
}
.user-level-label {
  font-size: 11px;
  color: var(--navy-mid);
  font-weight: 600;
  margin-top: 2px;
}
.user-menu { display: flex; flex-direction: column; }
.user-menu-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--gray-100);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 12px;
  color: var(--gray-800);
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
  width: 100%;
}
.user-menu-btn:hover { background: var(--gray-50); color: var(--navy-mid); }
.menu-arrow { color: var(--gray-400); font-size: 15px; line-height: 1; }
.auth-btn-logout {
  display: block;
  width: calc(100% - 28px);
  margin: 10px 14px 12px;
  padding: 7px;
  background: none;
  color: var(--red);
  border: 1px solid #ffd0d0;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.auth-btn-logout:hover { background: #fff0f0; border-color: var(--red); }

/* 드로어 내 에러 메시지 */
.sidebar-drawer .drawer-error {
  color: var(--red);
  font-size: 12px;
  padding: 6px 14px 0;
  min-height: 18px;
}
.sidebar-drawer .auth-user {
  padding: 12px 14px 14px;
}

/* 드로어·로그인팝업의 auth-card 는 외곽선 제거 (box-shadow 만으로 분리) */
.sidebar-drawer .auth-card,
#loginModal .auth-card {
  border: none;
}
.sidebar-drawer .drawer-user-nick {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  padding: 6px 0 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.sidebar-drawer .drawer-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  background: none;
  border: none;
  border-radius: 6px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s;
}
.sidebar-drawer .drawer-btn:hover { background: var(--gray-50); }
.sidebar-drawer .drawer-btn-arrow { color: var(--gray-400); }
.sidebar-drawer .drawer-btn-logout {
  color: var(--red);
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  border-radius: 0;
}

/* 햄버거 / 드로어 알림 빨간점 */
.btn-hamburger { position: relative; }
.hamburger-dot {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  background: #e53935;
  border-radius: 50%;
  border: 1px solid var(--navy-light);
}
.hamburger-dot.on { display: block; }
.drawer-menu-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #e53935;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── 페이지네이션 공통 (buildPaginationHtml 스타일) ── */
.page-select-wrap {
  display: inline-flex;
  align-items: center;
  height: 36px;
  box-sizing: border-box;
}
@media (max-width: 360px) {
  .page-select-wrap { height: 34px; }
}
.page-select {
  background: #fff;
  background-image: none !important;
  border: 1px solid var(--border);
  border-radius: 6px;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  padding: 0 12px;
  font-size: 13px;
  font-family: 'Noto Sans KR', sans-serif;
  color: var(--gray-600);
  cursor: pointer;
  outline: none;
  text-align: center;
  text-align-last: center;
  min-width: 64px;
  line-height: 34px;
  box-sizing: border-box;
  vertical-align: middle;
}
.page-select:hover:not(:disabled) { border-color: var(--navy-mid); color: var(--navy-mid); }
.page-select:disabled { opacity: 0.35; cursor: default; }

/* 화살표 버튼 (« ‹ › ») 정사각형 36×36 통일 + 내부 텍스트 중앙 정렬 */
.page-btn,
.btn-page {
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box;
  line-height: 1 !important;
  font-size: 13px !important;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
}

/* 풋터 링크 / 카피라이트 폰트 */
.footer-links { font-size: 13px; }
.footer-copyright { font-size: 12px; }
@media (max-width: 360px) {
  .footer-links { font-size: 12px; }
  .footer-copyright { font-size: 11px; }
}

/* ========== 폼 레이아웃 공통 (reg-card 패턴) ========== */
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 24px;
  text-align: center;
}

.reg-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 36px;
  margin-top: -6px;
}

.field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}
.field:last-of-type { margin-bottom: 0; }

.field-label {
  width: 130px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  padding-top: 10px;
}
.field-label .req { color: var(--red); margin-left: 2px; }

.field-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inp {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: 'Noto Sans KR', sans-serif;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s;
}
.inp:focus { border-color: var(--navy-mid); }
.inp.error { border-color: var(--red); }
.inp.success { border-color: var(--green); }
.inp[readonly] { background: var(--gray-50); color: var(--gray-600); cursor: default; }

.inp-row { display: flex; gap: 8px; }
.inp-row .inp { flex: 1; }

.btn-check {
  height: 36px;
  padding: 0 16px;
  background: var(--navy-pale);
  color: var(--navy-mid);
  border: 1px solid var(--navy-light);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-check:hover { background: var(--navy-mid); color: #fff; }

.msg { font-size: 12px; display: none; }
.msg.show { display: block; }
.msg.ok  { color: var(--green); }
.msg.err { color: var(--red); }
.hint { font-size: 12px; color: var(--gray-400); }
.msg.show ~ .hint { display: none; }

/* 모바일 ≤768 - 폼 공통 */
@media (max-width: 768px) {
  .page-title { font-size: 15px; }
  .reg-card { padding: 15px; }
  .field { margin-bottom: 10px; }
  .field-label { width: 100px; font-weight: 500; color: var(--gray-600); }
}

/* 모바일 ≤360 - 폼 공통 */
@media (max-width: 360px) {
  .page-title { font-size: 14px; }
  .field-label { width: 85px; font-size: 12px; }
  .inp { height: 34px; font-size: 12px; }
  .btn-check { height: 34px; font-size: 12px; }
  .hint { font-size: 11px; }
  .msg { font-size: 11px; }
}

/* ========== 네비게이션 공통 ========== */
/* nav 배경 = 페이지 bg(navy-bg)로 통일. nav-bottom-wrap은 자체 navy 배경으로 덮음. */
nav { background: var(--navy-bg); position: sticky; top: 0; z-index: 100; }
.nav-inner { max-width: 1080px; margin: 0 auto; padding: 0 10px; }
.nav-top { display: flex; align-items: center; height: 56px; gap: 16px; position: relative; }
.nav-logo { font-family: 'DM Serif Display', serif; font-size: 22px; color: var(--navy); letter-spacing: -0.5px; flex-shrink: 0; text-decoration: none; }
.nav-logo span { color: #85b7eb; }
.nav-search {
  position: absolute; left: 50%; transform: translateX(-50%);
  width: 360px; display: flex; align-items: center;
  background: var(--gray-100); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; transition: border-color 0.15s, background 0.15s;
}
.nav-search:focus-within { border-color: var(--navy-mid); background: #fff; }
.nav-search input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-size: 13px; font-family: 'Noto Sans KR', sans-serif; padding: 8px 12px; }
.nav-search input::placeholder { color: var(--gray-400); }
.nav-search-btn { background: transparent; border: none; cursor: pointer; padding: 8px 12px; color: var(--gray-600); display: flex; align-items: center; transition: color 0.15s; }
.nav-search-btn:hover { color: var(--navy-mid); }
.nav-bottom-wrap { background: var(--navy); }
.nav-bottom { max-width: 1080px; margin: 0 auto; }
.nav-link { color: rgba(255,255,255,0.7); font-size: 13px; padding: 5px 12px; border-radius: 8px; cursor: pointer; transition: all 0.15s; border: none; background: transparent; font-family: 'Noto Sans KR', sans-serif; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.1); color: #fff; }
.btn-write { background: var(--navy-light); border: none; color: #fff; padding: 6px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; font-family: 'Noto Sans KR', sans-serif; font-weight: 500; transition: background 0.15s; }
.btn-write:hover { background: #3a8fe0; }
