/* ===== CSS 변수 ===== */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #e0e7ff;
  --secondary: #f1f5f9;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --error: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --header-h: 56px;
  --sidebar-w: 260px;
  --transition: 0.2s ease;
}

/* ===== 리셋 & 기본 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Pretendard', 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}
input, select, textarea, button { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }

.hidden { display: none !important; }
.screen { min-height: 100dvh; }

/* ===== 버튼 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.9rem;
  transition: all var(--transition); cursor: pointer;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: background var(--transition);
}
.icon-btn:hover { background: var(--secondary); }

/* ===== 폼 요소 ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.83rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-group input:disabled { background: var(--secondary); color: var(--text-muted); }
.form-group textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { color: var(--error); font-size: 0.82rem; margin: 8px 0 0; min-height: 1em; }
.required { color: var(--error); }
.form-link { text-align: center; font-size: 0.85rem; color: var(--text-secondary); margin-top: 14px; }

/* ===== 로그인 / 회원가입 ===== */
#auth-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh; padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.auth-container { width: 100%; max-width: 400px; }
.auth-logo { text-align: center; margin-bottom: 28px; }
.logo-icon { font-size: 3rem; }
.logo-title { font-size: 1.8rem; font-weight: 800; color: #fff; margin-top: 8px; }
.logo-subtitle { color: rgba(255,255,255,0.8); font-size: 0.9rem; margin-top: 4px; }
.auth-card {
  background: var(--surface); border-radius: 20px;
  padding: 28px 24px; box-shadow: var(--shadow-lg);
}
.form-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 20px; }

/* ===== 헤더 ===== */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  box-shadow: var(--shadow);
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header-title { font-weight: 700; font-size: 1rem; }
.header-right { display: flex; align-items: center; gap: 8px; position: relative; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem; cursor: pointer;
  flex-shrink: 0;
}
.user-menu {
  position: absolute; top: calc(100% + 10px); right: 0;
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  min-width: 200px; z-index: 200; overflow: hidden;
}
.user-menu-info { padding: 14px 16px; }
.user-menu-info span { display: block; font-weight: 700; font-size: 0.95rem; }
.user-menu-email { font-size: 0.78rem !important; color: var(--text-muted) !important; font-weight: 400 !important; }
.user-menu button {
  display: block; width: 100%; text-align: left;
  padding: 11px 16px; font-size: 0.9rem; color: var(--text);
  transition: background var(--transition);
}
.user-menu button:hover { background: var(--secondary); }
.logout-btn { color: var(--error) !important; }
.menu-divider { border: none; border-top: 1px solid var(--border); }

/* ===== 사이드바 ===== */
.sidebar-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(2px);
}
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 160;
  width: var(--sidebar-w); background: var(--surface);
  box-shadow: var(--shadow-lg); overflow-y: auto;
  transform: translateX(-100%); transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}
.sidebar.open { transform: translateX(0); }
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; font-weight: 700; font-size: 1rem;
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}
.sidebar-nav { padding: 10px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 0.93rem; color: var(--text-secondary);
  transition: all var(--transition); text-align: left;
}
.nav-item:hover, .nav-item.active {
  background: var(--primary-light); color: var(--primary); font-weight: 600;
}
.nav-icon { font-size: 1.1rem; }
.sidebar-stats {
  margin: 16px 16px; padding: 14px;
  background: var(--secondary); border-radius: var(--radius-sm);
}

/* ===== 메인 콘텐츠 ===== */
.app-main {
  margin-top: var(--header-h);
  padding: 16px;
  max-width: 900px; margin-left: auto; margin-right: auto;
}
.page { display: none; }
.page.active { display: block; }

/* ===== 필터/검색 ===== */
.filter-bar {
  position: sticky; top: var(--header-h); z-index: 50;
  background: var(--bg); padding: 12px 0 8px;
  margin-bottom: 14px;
}
.search-wrap {
  position: relative; margin-bottom: 10px;
}
.search-wrap .search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
#search-input {
  width: 100%; padding: 10px 13px 10px 36px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
#search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.filter-tabs {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
  padding: 7px 14px; border-radius: 999px; font-size: 0.82rem; font-weight: 600;
  background: var(--surface); border: 1.5px solid var(--border);
  color: var(--text-secondary); white-space: nowrap;
  transition: all var(--transition);
}
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-row {
  display: flex; gap: 8px; margin-top: 10px;
}
.filter-row select {
  flex: 1; padding: 8px 10px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); font-size: 0.83rem; outline: none;
}
.sort-dir-btn {
  flex-shrink: 0; width: 36px; height: 36px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-secondary);
  font-size: 1rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.sort-dir-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.sort-dir-btn.asc { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }

/* ===== 통계 카드 ===== */
.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 12px 10px; text-align: center;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.stat-value { font-size: 1.4rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* ===== 스켈레톤 ===== */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
.skeleton-line, .skeleton-thumb, .skeleton-badge {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 6px;
}
.skeleton-card { pointer-events: none; }
.skeleton-thumb { aspect-ratio: 3/4; width: 100%; border-radius: 0; }
.skeleton-thumb-abs {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border-radius: 0; z-index: 1;
}
.skeleton-title  { height: 14px; width: 85%; margin-bottom: 8px; }
.skeleton-author { height: 11px; width: 55%; margin-bottom: 10px; }
.skeleton-ep     { height: 11px; width: 45%; margin-top: 10px; }
.skeleton-badges { display: flex; gap: 5px; margin-bottom: 4px; }
.skeleton-badge  { height: 18px; width: 46px; border-radius: 999px; }

/* ===== 웹툰 그리드 ===== */
.webtoon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 14px;
}

.webtoon-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  overflow: hidden; transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer; display: flex; flex-direction: column;
}
.webtoon-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.card-thumbnail {
  aspect-ratio: 3/4; background: var(--secondary);
  overflow: hidden; position: relative; flex-shrink: 0;
}

/* 썸네일 fade-in */
.thumb-wrap { width: 100%; height: 100%; position: relative; }
.thumb-img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 0.3s ease, transform 0.3s ease;
  position: relative; z-index: 2;
}
.thumb-img.loaded { opacity: 1; }
.webtoon-card:hover .thumb-img { transform: scale(1.04); }
.thumbnail-placeholder-card {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.75rem; gap: 6px;
}
.thumbnail-placeholder-card .ph-icon { font-size: 2.2rem; }

.card-body { padding: 10px; flex: 1; display: flex; flex-direction: column; }
.card-title {
  font-weight: 700; font-size: 0.88rem; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 4px;
}
.card-author { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 6px; }

.card-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; white-space: nowrap;
}
.badge-platform { background: var(--secondary); color: var(--text-secondary); }
.badge-subscribing { background: #dcfce7; color: #166534; }
.badge-completed   { background: #dbeafe; color: #1e40af; }
.badge-paused      { background: #fef3c7; color: #92400e; }
.badge-dropped     { background: #fee2e2; color: #991b1b; }

/* ===== 진행률 바 ===== */
.progress-wrap {
  height: 3px; background: var(--border); overflow: hidden; flex-shrink: 0;
}
.progress-bar {
  height: 100%; border-radius: 0 2px 2px 0;
  transition: width 0.4s ease;
  min-width: 2px;
}

/* ===== 화수 영역 ===== */
.episode-row {
  margin-top: auto; display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border); padding-top: 8px;
}
.episode-left { display: flex; align-items: baseline; gap: 1px; }
.ep-num { color: var(--primary); font-weight: 800; font-size: 0.9rem; }
.ep-total { font-size: 0.72rem; color: var(--text-muted); }
.episode-text { font-size: 0.78rem; color: var(--text-secondary); }

.episode-btns { display: flex; align-items: center; gap: 4px; }
.ep-plus-btn {
  height: 26px; padding: 0 8px;
  border-radius: var(--radius-sm);
  background: var(--primary); color: #fff;
  font-size: 0.75rem; font-weight: 800;
  transition: background var(--transition), transform var(--transition);
  line-height: 1;
}
.ep-plus-btn:hover  { background: var(--primary-dark); }
.ep-plus-btn:active { transform: scale(0.93); }
.ep-plus-btn:disabled { background: var(--text-muted); cursor: not-allowed; }

.episode-quick-btn {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--secondary); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; transition: background var(--transition), color var(--transition);
}
.episode-quick-btn:hover { background: var(--primary-light); color: var(--primary); }

/* ===== 업데이트 날짜 ===== */
.card-updated {
  font-size: 0.68rem; color: var(--text-muted);
  margin-top: 5px; text-align: right;
}

/* ===== 중복 경고 ===== */
.dup-warning { font-size: 0.8rem; min-height: 1em; margin-top: 5px; color: transparent; }
.dup-warning-show { color: var(--warning); font-weight: 600; }

.card-actions {
  display: flex; gap: 4px; padding: 0 10px 10px;
}
.card-action-btn {
  flex: 1; padding: 6px; border-radius: var(--radius-sm);
  font-size: 0.75rem; font-weight: 600;
  text-align: center; transition: all var(--transition);
}
.edit-btn { background: var(--secondary); color: var(--text-secondary); }
.edit-btn:hover { background: var(--primary-light); color: var(--primary); }
.del-btn { background: #fee2e2; color: var(--error); }
.del-btn:hover { background: var(--error); color: #fff; }

/* ===== 빈 상태 ===== */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-search {
  padding: 48px 20px;
}
.empty-state-search #empty-search-msg {
  font-size: 0.92rem; word-break: break-all;
  margin-bottom: 14px; color: var(--text-secondary);
}
.empty-icon { font-size: 3.5rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; margin-bottom: 16px; }

/* ===== 페이지 헤더 ===== */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-top: 4px;
}
.page-header h2 { font-size: 1.2rem; font-weight: 800; }

/* ===== 플랫폼 목록 ===== */
.platform-list { display: flex; flex-direction: column; gap: 10px; }
.platform-item {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow);
}
.platform-color-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.platform-info { flex: 1; min-width: 0; }
.platform-name { font-weight: 700; font-size: 0.95rem; }
.platform-url { font-size: 0.78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.platform-count { font-size: 0.78rem; color: var(--text-secondary); background: var(--secondary); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.platform-actions { display: flex; gap: 6px; flex-shrink: 0; }
.platform-btn {
  padding: 5px 10px; border-radius: var(--radius-sm); font-size: 0.78rem; font-weight: 600;
  transition: all var(--transition);
}
.platform-edit-btn { background: var(--secondary); color: var(--text-secondary); }
.platform-edit-btn:hover { background: var(--primary-light); color: var(--primary); }
.platform-del-btn { background: #fee2e2; color: var(--error); }
.platform-del-btn:hover { background: var(--error); color: #fff; }

/* ===== 프로필 ===== */
.profile-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 24px;
  max-width: 480px; box-shadow: var(--shadow);
}
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 800; margin: 0 auto 20px;
}
.section-divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.section-title { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }

/* ===== 네이버 가져오기 섹션 ===== */
.fetch-section {
  background: #f0f4ff; border: 1.5px solid #c7d2fe;
  border-radius: var(--radius-sm); padding: 12px; margin-bottom: 4px;
}
.fetch-row { display: flex; gap: 8px; align-items: center; }
.fetch-input-wrap {
  flex: 1; display: flex; align-items: center;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.fetch-label {
  width: 30px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: #03c75a; color: #fff; font-weight: 900; font-size: 0.85rem;
  flex-shrink: 0;
}
.fetch-input-wrap input {
  flex: 1; border: none; padding: 8px 10px;
  font-size: 0.82rem; outline: none; background: transparent;
  min-width: 0;
}
.btn-fetch {
  padding: 8px 14px; background: var(--primary); color: #fff;
  border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 700;
  white-space: nowrap; flex-shrink: 0; transition: background var(--transition);
}
.btn-fetch:hover { background: var(--primary-dark); }
.btn-fetch:disabled { background: var(--text-muted); cursor: not-allowed; }

.fetch-preview {
  margin-top: 10px; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-radius: var(--radius-sm);
  border: 1px solid var(--border); padding: 8px 10px;
}
.fetch-thumb-img {
  width: 44px; height: 60px; object-fit: cover;
  border-radius: 4px; flex-shrink: 0; background: var(--secondary);
}
.fetch-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fetch-info strong { font-size: 0.88rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fetch-info span { font-size: 0.75rem; color: var(--text-secondary); }
.fetch-apply-btn {
  padding: 6px 12px; background: #dcfce7; color: #166534;
  border-radius: var(--radius-sm); font-size: 0.78rem; font-weight: 700;
  white-space: nowrap; flex-shrink: 0; transition: all var(--transition);
}
.fetch-apply-btn:hover { background: #22c55e; color: #fff; }

.fetch-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0 10px; color: var(--text-muted); font-size: 0.78rem;
}
.fetch-divider::before, .fetch-divider::after {
  content: ''; flex: 1; border-top: 1px solid var(--border);
}

/* ===== 모달 ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
@media (min-width: 640px) {
  .modal-overlay { align-items: center; padding: 20px; }
}
.modal {
  background: var(--surface); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 540px; max-height: 92dvh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s cubic-bezier(0.4,0,0.2,1);
}
@media (min-width: 640px) {
  .modal { border-radius: 20px; max-height: 88vh; }
}
.modal-sm { max-width: 380px; }
@keyframes slideUp { from { transform: translateY(100%); opacity: 0.5; } to { transform: translateY(0); opacity: 1; } }
@media (min-width: 640px) {
  @keyframes slideUp { from { transform: translateY(20px) scale(0.97); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 800; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; gap: 10px; padding: 14px 20px;
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.modal-footer .btn { flex: 1; }

/* ===== 썸네일 업로드 ===== */
.thumbnail-upload-area {
  aspect-ratio: 16/9; background: var(--secondary);
  border-radius: var(--radius-sm); border: 2px dashed var(--border);
  cursor: pointer; overflow: hidden; position: relative; margin-bottom: 16px;
  transition: border-color var(--transition), background var(--transition);
}
.thumbnail-upload-area:hover { border-color: var(--primary); background: var(--primary-light); }
.thumbnail-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--text-muted); font-size: 0.82rem;
}
.upload-icon { font-size: 2rem; }
.upload-hint { font-size: 0.73rem; }
.thumbnail-preview { width: 100%; height: 100%; object-fit: contain; }
.thumbnail-remove {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; z-index: 10;
}

/* ===== 화수 카운터 ===== */
.episode-modal-webtoon-title {
  font-weight: 700; text-align: center; margin-bottom: 16px;
  color: var(--text-secondary); font-size: 0.9rem;
}
.episode-counter {
  display: flex; align-items: center; gap: 8px; justify-content: center;
}
.episode-btn {
  padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 700; font-size: 0.9rem;
  background: var(--secondary); color: var(--text-secondary);
  transition: all var(--transition);
}
.episode-btn:hover { background: var(--border); }
.episode-btn-plus { background: var(--primary-light); color: var(--primary); }
.episode-btn-plus:hover { background: var(--primary); color: #fff; }
.episode-input {
  width: 80px; text-align: center; padding: 10px 6px;
  border: 2px solid var(--primary); border-radius: var(--radius-sm);
  font-size: 1.2rem; font-weight: 800; color: var(--primary);
  background: var(--surface); outline: none;
}

/* ===== 색상 선택 ===== */
.color-picker-row { display: flex; align-items: center; gap: 10px; }
.color-picker-row input[type=color] { width: 40px; height: 38px; border-radius: 6px; border: 1.5px solid var(--border); cursor: pointer; padding: 2px; }
.color-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.color-preset { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; transition: transform var(--transition), border-color var(--transition); }
.color-preset:hover { transform: scale(1.15); border-color: var(--text); }

/* ===== 토스트 ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff;
  padding: 12px 22px; border-radius: 999px;
  font-size: 0.88rem; font-weight: 600;
  box-shadow: var(--shadow-lg); z-index: 999;
  white-space: nowrap; pointer-events: none;
  animation: fadeInUp 0.3s ease;
}
.toast.error { background: var(--error); }
.toast.success { background: var(--success); }
@keyframes fadeInUp { from { opacity: 0; transform: translateX(-50%) translateY(12px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ===== 사이드바 통계 ===== */
.sidebar-stat-item { display: flex; justify-content: space-between; font-size: 0.82rem; margin-bottom: 6px; }
.sidebar-stat-item:last-child { margin-bottom: 0; }
.sidebar-stat-label { color: var(--text-secondary); }
.sidebar-stat-value { font-weight: 700; color: var(--text); }

/* ===== 상세보기 모달 ===== */
.modal-detail { max-width: 500px; }
.detail-modal-body { display: flex; flex-direction: column; gap: 16px; }
.detail-top { display: flex; gap: 16px; }
.detail-thumb-wrap {
  width: 110px; flex-shrink: 0;
  aspect-ratio: 3/4; border-radius: var(--radius-sm);
  overflow: hidden; background: var(--secondary);
}
.detail-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.detail-thumb-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; color: var(--text-muted);
}
.detail-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.detail-author { font-size: 0.82rem; color: var(--text-muted); }
.detail-episode { font-size: 0.95rem; font-weight: 700; color: var(--primary); }
.detail-progress-wrap {
  height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; position: relative;
}
.detail-progress-bar {
  height: 100%; border-radius: 999px; transition: width 0.4s ease;
}
.detail-progress-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; display: block; }
.detail-platform-link {
  font-size: 0.78rem; color: var(--primary); font-weight: 600;
  text-decoration: underline; text-underline-offset: 2px;
}
.detail-section-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.03em; text-transform: uppercase; }
.detail-notes { background: var(--secondary); border-radius: var(--radius-sm); padding: 12px 14px; }
.detail-notes-text { font-size: 0.88rem; color: var(--text); white-space: pre-wrap; line-height: 1.6; }
.detail-dates { display: flex; flex-direction: column; gap: 3px; }
.detail-dates span { font-size: 0.75rem; color: var(--text-muted); }

/* ===== 반응형 ===== */
@media (max-width: 480px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .webtoon-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .filter-row { flex-direction: column; }
  .app-main { padding: 12px; }
}
@media (min-width: 481px) and (max-width: 640px) {
  .webtoon-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 641px) {
  .webtoon-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
  .app-main { padding: 20px 24px; }
}
@media (min-width: 900px) {
  .webtoon-grid { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); }
}
