/* ==========================================================================
   성젱 아카이브 (SJ ARCHIVE) - Clean Monochrome Responsive Design System
   Pure Vanilla CSS (No External UI Framework)
   ========================================================================== */

:root {
  /* 모던 감성 산세리프 폰트 스택 */
  --font-sans: "Pretendard", -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --font-mono: "SF Mono", "Consolas", monospace;

  /* 완전한 모노톤 컬러 팔레트 - 라이트 모드 (Pure Paper & Obsidian Ink) */
  --bg-page: #f7f7f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: #f0f1f4;
  --bg-hover: #e4e5eb;
  
  --border-subtle: #e2e3e8;
  --border-strong: #111115;
  --border-focus: #000000;
  
  --text-primary: #111115;
  --text-secondary: #36373e;
  --text-muted: #72747f;
  --text-inverse: #ffffff;
  
  --primary: #111115;
  --primary-hover: #000000;
  --primary-subtle: #f0f1f4;
  --primary-glow: rgba(0, 0, 0, 0.12);
  
  --genre-badge-bg: #111115;
  --genre-badge-text: #ffffff;
  --genre-badge-border: #111115;
  
  --tag-bg: #f0f1f4;
  --tag-text: #2a2b30;
  --tag-border: #dcdee4;
  --tag-hover-bg: #111115;
  --tag-hover-text: #ffffff;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.1);
  
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  /* 완전한 모노톤 컬러 팔레트 - 다크 모드 (Obsidian Noir & Moonlit White) */
  --bg-page: #08080a;
  --bg-surface: #121216;
  --bg-surface-elevated: #18181f;
  --bg-subtle: #1a1a22;
  --bg-hover: #262632;
  
  --border-subtle: #24242f;
  --border-strong: #f4f4f7;
  --border-focus: #ffffff;
  
  --text-primary: #f5f5f8;
  --text-secondary: #c7c9d1;
  --text-muted: #828594;
  --text-inverse: #0a0a0d;
  
  --primary: #f5f5f8;
  --primary-hover: #ffffff;
  --primary-subtle: rgba(255, 255, 255, 0.08);
  --primary-glow: rgba(255, 255, 255, 0.2);
  
  --genre-badge-bg: #f5f5f8;
  --genre-badge-text: #0a0a0d;
  --genre-badge-border: #f5f5f8;
  
  --tag-bg: #181820;
  --tag-text: #c0c3cc;
  --tag-border: #282834;
  --tag-hover-bg: #f5f5f8;
  --tag-hover-text: #0a0a0d;
  
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.85);
}

/* ==========================================================================
   기본 리셋 & 레이아웃 안정화 (Strict Constraints)
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  max-width: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-page);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* 이미지 및 멀티미디어 반응형 화면 초과 방지 */
img, picture, video, canvas, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 텍스트 줄바꿈 및 가독성 안정화 */
h1, h2, h3, h4, h5, h6, p, span, a, button, input, textarea, select {
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* ==========================================================================
   상단 사이트 헤더 (Header)
   [SJ] 로고, '성젱 아카이브' 타이틀, '성훈 x 종성' 배지가 한 줄에 정렬
   ========================================================================== */
.site-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* 한 줄로 정렬되는 로고, 타이틀, 배지 그룹 */
.brand-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
  min-width: 0;
}

.brand-badge-logo {
  background-color: var(--text-primary);
  color: var(--bg-surface);
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 0.28rem 0.55rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: transform var(--transition-fast);
}

.brand-badge-logo:hover {
  transform: scale(1.05);
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
}

.brand-pairing-badge {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

/* 우측 액션 버튼 모음 */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* 테마 변경 버튼 */
.theme-toggle-btn {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* 관리자 버튼 (라운드 스타일) */
.admin-nav-btn {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 0.48rem 0.85rem;
  font-size: 0.825rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.admin-nav-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-strong);
}

.admin-badge {
  background-color: var(--text-primary);
  color: var(--text-inverse);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.15rem;
}

/* 글 등록하기 버튼 (라운드 알약형) */
.btn-primary {
  background-color: var(--primary);
  color: var(--text-inverse);
  border: 1px solid var(--border-strong);
  padding: 0.48rem 1.05rem;
  font-size: 0.825rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ==========================================================================
   중앙 메인 레이아웃 컨테이너 (Max-width 960px 중앙 정렬 반응형)
   ========================================================================== */
.app-main-container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
}

/* ==========================================================================
   대표 메인 비주얼 이미지 카드 섹션
   ========================================================================== */
.hero-section {
  width: 100%;
}

.hero-visual-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.hero-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 460px;
  min-height: 220px;
  overflow: hidden;
  background-color: #0c0c0e;
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
  transition: transform 0.5s ease;
}

.hero-visual-card:hover .hero-image {
  transform: scale(1.015);
}

/* 사진 위 감성적인 흑백 오버레이 & 텍스트 */
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.3) 0%,
    rgba(0, 0, 0, 0.15) 35%,
    rgba(0, 0, 0, 0.85) 100%
  );
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #ffffff;
}

.hero-tags {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-pill {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.badge-sub {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-full);
  background-color: #ffffff;
  color: #0c0c0e;
}

.hero-caption {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hero-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
  line-height: 1.25;
}

.hero-desc {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.5;
  max-width: 650px;
  word-break: keep-all;
}

/* 하단 둥근 통계 바 (Stats Bar) */
.hero-stats-bar {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  text-align: center;
}

.stat-box .stat-num {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.stat-box .stat-txt {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-divider {
  color: var(--border-subtle);
  font-size: 0.9rem;
  font-weight: 300;
}

/* ==========================================================================
   검색바, 정렬 드롭다운, 장르 태그 버튼 모음 섹션
   ========================================================================== */
.controls-section {
  width: 100%;
}

.controls-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

/* 검색창 & 정렬 드롭다운 행 */
.search-sort-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-input-wrapper {
  flex: 1 1 240px;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 1.1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.75rem 2.4rem 0.75rem 2.75rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}

.search-input:focus {
  outline: none;
  background-color: var(--bg-surface);
  border-color: var(--border-strong);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.search-clear-btn {
  position: absolute;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  line-height: 1;
}

.search-clear-btn.active {
  display: block;
}

/* 라운드 정렬 드롭다운 */
.sort-select {
  padding: 0.72rem 1.25rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.sort-select:focus {
  outline: none;
  border-color: var(--border-strong);
}

/* 장르 및 태그 버튼 그룹 */
.filter-chips-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chips-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chips-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.chip-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

/* 둥근 라운드 칩 버튼 (Pill Chip) */
.chip {
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  touch-action: manipulation;
}

.chip:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.chip.active {
  background-color: var(--text-primary);
  color: var(--bg-surface);
  border-color: var(--text-primary);
}

/* ==========================================================================
   메인 아카이브 카드 목록 그리드 (데스크톱 2열, 모바일 1열 반응형)
   ========================================================================== */
.main-content {
  width: 100%;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0 0.25rem;
}

.results-count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.results-count strong {
  color: var(--text-primary);
  font-weight: 700;
}

.reset-filter-btn {
  background: none;
  border: none;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
}

.reset-filter-btn:hover {
  color: var(--text-primary);
}

/* 데스크톱 2열, 모바일 1열 반응형 카드 그리드 */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.story-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  overflow: hidden;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.story-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.story-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.story-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}

/* 관리자 전용 게시글 삭제 버튼 */
.btn-card-delete {
  background-color: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.28);
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.725rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
  touch-action: manipulation;
}

.btn-card-delete:hover {
  background-color: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

[data-theme="dark"] .btn-card-delete {
  background-color: rgba(248, 113, 113, 0.12);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.32);
}

[data-theme="dark"] .btn-card-delete:hover {
  background-color: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

.genre-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-full);
  background-color: var(--genre-badge-bg);
  color: var(--genre-badge-text);
  letter-spacing: -0.01em;
}

.created-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.story-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  line-height: 1.35;
  word-break: keep-all;
}

.story-author {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.story-summary {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.55;
  background-color: var(--bg-subtle);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  word-break: keep-all;
  overflow-wrap: break-word;
}

.story-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.story-tag-btn {
  background-color: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--tag-border);
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.story-tag-btn:hover {
  background-color: var(--tag-hover-bg);
  color: var(--tag-hover-text);
}

.story-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: 0.5rem;
}

.link-read-btn {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 0.45rem 0.95rem;
  font-size: 0.825rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

.link-read-btn:hover {
  background-color: var(--text-primary);
  color: var(--bg-surface);
  border-color: var(--text-primary);
}

.like-btn {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.like-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-strong);
}

.like-btn.liked {
  background-color: var(--text-primary);
  color: var(--bg-surface);
  border-color: var(--text-primary);
}

/* 엠티 스테이트 */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3.5rem 1.5rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.empty-state-icon {
  font-size: 2.5rem;
}

.empty-state-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.empty-state-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ==========================================================================
   푸터 (Footer)
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 1.25rem;
  text-align: center;
  margin-top: auto;
}

.footer-content {
  max-width: 960px;
  margin: 0 auto;
  font-size: 0.825rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 500;
}

.footer-content strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* ==========================================================================
   모달 레이아웃 (Add & Admin Modals)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none !important;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.open {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
  z-index: 1005;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
}

/* form 요소가 flex 컨테이너로 동작하여 modal-body 내부 스크롤이 원활하도록 보장 */
.modal-card form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  height: 100%;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
}

.modal-card-sm {
  max-width: 420px;
}

.modal-card-lg {
  max-width: 600px;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-surface);
  flex-shrink: 0;
  user-select: text;
  -webkit-user-select: text;
  pointer-events: auto;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: text;
  -webkit-user-select: text;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-full);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
}

.modal-close-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-hover);
}

/* 모달 내부 본문: 상하 스크롤 및 텍스트 선택/드래그 보장 */
.modal-body {
  padding: 1.35rem 1.5rem;
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(85vh - 130px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  user-select: text;
  -webkit-user-select: text;
  pointer-events: auto;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* 모달 내부 모든 텍스트 및 입력창 드래그/선택 활성화 */
.modal-card input,
.modal-card textarea,
.modal-card select,
.modal-card label,
.modal-card p,
.modal-card span,
.modal-card div,
.modal-card h3,
.modal-card h4 {
  user-select: text;
  -webkit-user-select: text;
  pointer-events: auto;
}

.modal-card button {
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.form-label .required {
  color: var(--text-muted);
  margin-left: 0.2rem;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
  transition: all var(--transition-fast);
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-strong);
  background-color: var(--bg-surface);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.form-textarea {
  min-height: 85px;
  resize: vertical;
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tag-preview-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
  min-height: 22px;
}

.tag-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background-color: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--tag-text);
  font-weight: 600;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: var(--bg-subtle);
  flex-shrink: 0;
}

.btn-secondary {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.5rem 1.15rem;
  font-size: 0.825rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

/* 관리자 모달 스타일 */
.admin-auth-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.admin-auth-error {
  color: #ef4444;
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 0.35rem;
}

.admin-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-pending-pill {
  font-size: 0.75rem;
  font-weight: 800;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  color: var(--text-primary);
}

.admin-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-logout:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

.admin-queue-notice {
  background-color: var(--bg-subtle);
  border-left: 3px solid var(--border-strong);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.admin-queue-body {
  max-height: 60vh;
  overflow-y: auto;
}

.pending-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pending-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.pending-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.pending-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.pending-card-author {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.pending-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.pending-status-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.pending-card-summary {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  background-color: var(--bg-subtle);
  padding: 0.85rem;
  border-radius: var(--radius-md);
}

.pending-card-link-wrap {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pending-card-link {
  color: var(--text-primary);
  text-decoration: underline;
  word-break: break-all;
}

.pending-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-subtle);
}

.btn-approve {
  background-color: var(--primary);
  color: var(--text-inverse);
  border: 1px solid var(--border-strong);
  padding: 0.45rem 1rem;
  font-size: 0.825rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
}

.btn-reject {
  background-color: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 0.45rem 0.95rem;
  font-size: 0.825rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
}

.btn-reject:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.pending-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.pending-empty-icon {
  font-size: 2.2rem;
}

.pending-empty-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.pending-empty-desc {
  font-size: 0.85rem;
}

/* ==========================================================================
   토스트 알림 (Toast Notification)
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  width: 90%;
  max-width: 440px;
}

.toast {
  background-color: var(--text-primary);
  color: var(--bg-surface);
  box-shadow: var(--shadow-lg);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: auto;
  justify-content: center;
  text-align: center;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================================================
   사이트 하단 푸터 (Footer)
   ========================================================================== */
.site-footer {
  width: 100%;
  margin-top: 2rem;
  padding: 1.5rem 1rem 0.5rem 1rem;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
}

.footer-content {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   반응형 최적화 (Mobile & Desktop Media Queries)
   ========================================================================== */
@media (max-width: 768px) {
  .app-main-container {
    padding: 1rem 1rem 2.5rem 1rem;
    gap: 1.15rem;
  }

  .header-container {
    padding: 0.75rem 1rem;
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .brand-title {
    font-size: 1.05rem;
  }

  .brand-pairing-badge {
    font-size: 0.7rem;
    padding: 0.18rem 0.55rem;
  }

  /* 모바일에서 카드 1열 그리드로 전환 */
  .stories-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .hero-caption .hero-title {
    font-size: 1.4rem;
  }

  .hero-caption .hero-desc {
    font-size: 0.825rem;
  }

  .search-sort-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input-wrapper {
    width: 100%;
  }

  .sort-select {
    width: 100%;
  }

  .controls-box {
    padding: 1.1rem;
  }
}

@media (max-width: 480px) {
  .header-container {
    padding: 0.65rem 0.85rem;
  }

  .brand-pairing-badge {
    display: none; /* 초소형 모바일에서는 로고와 타이틀 공간 확보 */
  }

  .header-actions {
    gap: 0.35rem;
    flex-wrap: wrap;
  }

  .btn-primary {
    padding: 0.42rem 0.75rem;
    font-size: 0.78rem;
  }

  .admin-nav-btn {
    padding: 0.42rem 0.7rem;
    font-size: 0.78rem;
  }

  .hero-stats-bar {
    padding: 0.85rem 1rem;
  }

  .stat-box .stat-num {
    font-size: 1.1rem;
  }

  .stat-box .stat-txt {
    font-size: 0.7rem;
  }

  .chip {
    padding: 0.38rem 0.75rem;
    font-size: 0.78rem;
  }

  .story-card {
    padding: 1.1rem;
  }

  .story-card-footer {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}
