@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Webtoon Clean Theme Tokens */
  --primary: #00dc64; 
  --primary-dark: #00b854; 
  --accent: #ff4060;
  
  --bg-1: #ffffff; /* Main pure white background */
  --bg-2: #ffffff; /* Cards background */
  --bg-3: #f8f9fa; /* Hover states, light sections */
  --bg-4: #e5e7eb; /* Borders, dividers */
  
  --text-1: #111111; /* Primary text, headings */
  --text-2: #555555; /* Secondary text, descriptions */
  --text-3: #888888; /* Meta data, small text */
  
  --border: #e2e8f0; 
  --shadow: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-hover: 0 10px 30px rgba(0,0,0,0.1);
  --glass: rgba(255,255,255,0.95); 
  
  --radius: 12px; 
  --radius-sm: 8px;
}

[data-theme="dark"] {
  --bg-1: #121212; --bg-2: #1e1e1e; --bg-3: #2d2d2d; --bg-4: #404040;
  --text-1: #f3f4f6; --text-2: #9ca3af; --text-3: #6b7280;
  --border: #374151; --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --glass: rgba(18,18,18,0.95);
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
  background: var(--bg-1);
  color: var(--text-1); 
  line-height: 1.6; 
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

a { color: var(--primary); text-decoration: none; transition: all 0.2s; }
a:hover { color: var(--primary-dark); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-3); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== NAVBAR ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: var(--glass); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); padding: 0 24px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  transition: all 0.3s;
}
.navbar .logo { font-size: 1.5rem; font-weight: 800; display: flex; align-items: center; gap: 8px; color: var(--text-1); letter-spacing: -0.5px; }
.navbar .logo span { color: var(--primary); }
.nav-links { display: flex; align-items: center; gap: 28px; list-style: none; }
.nav-links a { color: var(--text-1); font-weight: 600; font-size: 0.95rem; padding: 8px 0; position: relative; }
.nav-links a:hover, .nav-links a.active { color: var(--primary); }
.nav-links a.active::after { content:''; position:absolute; bottom:0; left:0; right:0; height:3px; background:var(--primary); border-radius:2px 2px 0 0; }
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-menu-btn {
  display: none;
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-3); color: var(--text-1); font-size: 1.2rem; cursor: pointer;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.nav-menu-btn:hover { background: var(--bg-4); }
.mobile-drawer-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1500;
}
.mobile-drawer-backdrop.open { display: block; }
.mobile-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(86vw, 320px);
  background: var(--bg-1); border-left: 1px solid var(--border); z-index: 1600;
  transform: translateX(100%); transition: transform 0.25s ease;
  padding: 72px 16px 24px; overflow-y: auto; box-shadow: -8px 0 30px rgba(0,0,0,0.12);
}
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer a {
  display: block; padding: 12px 14px; border-radius: 10px; color: var(--text-1);
  font-weight: 600; margin-bottom: 4px;
}
.mobile-drawer a:hover, .mobile-drawer a.active { background: rgba(0,220,100,0.1); color: var(--primary-dark); }
.mobile-drawer .drawer-section {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.nav-search {
  background: var(--bg-3); border: 1px solid transparent; border-radius: 20px;
  padding: 8px 16px; color: var(--text-1); font-size: 0.9rem; width: 240px;
  outline: none; transition: all 0.2s;
}
.nav-search:focus { border-color: var(--primary); background: var(--bg-1); width: 280px; box-shadow: 0 0 0 3px rgba(0,220,100,0.1); }
.nav-search::placeholder { color: var(--text-3); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; 
  padding: 10px 24px; border-radius: 24px; font-weight: 600; font-size: 0.95rem;
  border: none; cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,220,100,0.3); color: #fff; }
.btn-secondary { background: var(--bg-1); color: var(--text-1); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-3); }
.btn-danger { background: var(--accent); color: #fff; }
.btn-danger:hover { background: #e03855; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text-1); background: var(--bg-3); }
.btn-sm { padding: 6px 16px; font-size: 0.85rem; }
.btn-lg { padding: 14px 32px; font-size: 1.05rem; }

/* ===== CARDS ===== */
.card {
  background: var(--bg-2); border-radius: var(--radius);
  overflow: hidden; transition: all 0.3s ease;
  position: relative;
}
.card:hover { transform: translateY(-4px); }
.card-img { width: 100%; aspect-ratio: 3/4; object-fit: fill; border-radius: var(--radius); transition: all 0.3s ease; box-shadow: var(--shadow); }
.card-img.is-loading {
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-4) 50%, var(--bg-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  filter: saturate(0.92);
}
.card:hover .card-img { box-shadow: var(--shadow-hover); }
.card-body { padding: 12px 4px; }
.card-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 2px; color: var(--text-1); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.card-meta { font-size: 0.8rem; color: var(--text-3); display: flex; align-items: center; gap: 10px; font-weight: 500; flex-wrap: wrap; row-gap: 4px; }
.card-badge {
  position: absolute; top: 10px; left: 10px; background: var(--primary); color: #fff;
  padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15); z-index: 2;
}

/* ===== GRID LAYOUTS ===== */
.content-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 24px 20px; padding: 0;
}
.content-grid.list-view {
  grid-template-columns: 1fr; gap: 16px;
}
.content-grid.list-view .card {
  display: flex; flex-direction: row; align-items: flex-start; gap: 16px; padding: 12px;
}
.content-grid.list-view .card-img {
  width: 100px; height: 140px; aspect-ratio: auto; border-radius: var(--radius-sm);
}
.content-grid.list-view .card-body {
  padding: 0; flex: 1; text-align: left;
}
.content-grid.list-view .card-title {
  font-size: 1.1rem; margin-bottom: 8px;
}
.content-grid.list-view .card-desc {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--text-2); font-size: 0.9rem; margin-bottom: 8px; line-height: 1.5;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.page-content { padding-top: 88px; min-height: 100vh; }

/* ===== HERO SECTION ===== */
.hero {
  position: relative; padding: 80px 0 60px; margin-top: 64px;
  background: #f8fcf9; border-bottom: 1px solid var(--border);
  overflow: hidden;
}
[data-theme="dark"] .hero { background: #1a1e1c; }
.hero-content { position: relative; z-index: 1; max-width: 650px; }
.hero-title { font-size: 3rem; font-weight: 900; line-height: 1.15; margin-bottom: 20px; color: var(--text-1); letter-spacing: -1px; }
.hero-title span { color: var(--primary); }
.hero-desc { color: var(--text-2); font-size: 1.15rem; margin-bottom: 32px; font-weight: 400; line-height: 1.6; }

/* ===== SECTIONS ===== */
.section { padding: 48px 0; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.section-title { font-size: 1.5rem; font-weight: 800; color: var(--text-1); letter-spacing: -0.5px; }
.section-link { color: var(--text-2); font-weight: 600; font-size: 0.95rem; }
.section-link:hover { color: var(--primary); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; color: var(--text-1); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 12px 16px; background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-1); font-size: 0.95rem;
  font-family: inherit; outline: none; transition: all 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,220,100,0.1); }
.form-textarea { min-height: 120px; resize: vertical; }

/* ===== AUTH PAGE ===== */
.auth-page { display:flex; min-height:100vh; align-items:center; justify-content:center; padding:24px; background: var(--bg-3); }
.auth-card {
  background: var(--bg-1); border: 1px solid var(--border); border-radius: 20px;
  padding: 48px 40px; width: 100%; max-width: 440px; box-shadow: var(--shadow-hover);
}
.auth-title { font-size: 2rem; font-weight: 800; text-align: center; margin-bottom: 8px; color: var(--text-1); letter-spacing: -0.5px; }
.auth-subtitle { text-align: center; color: var(--text-2); margin-bottom: 32px; font-size: 0.95rem; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 32px; }
.auth-tab {
  flex: 1; padding: 10px; text-align: center; font-weight: 700; font-size: 0.95rem;
  background: var(--bg-3); border: none; border-radius: 24px; color: var(--text-2); cursor: pointer; transition: all 0.2s;
}
.auth-tab.active { background: var(--primary); color: #fff; }

/* ===== COMIC READER (Webtoon style) ===== */
.reader-container { background: #000000; min-height: 100vh; padding-top: 56px; }
.reader-header {
  position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 100;
  background: rgba(255,255,255,0.98); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
  transition: transform 0.3s; border-bottom: 1px solid #e5e5e5;
}
[data-theme="dark"] .reader-header { background: rgba(20,20,20,0.95); border-bottom-color: #333; }
.reader-header.hidden { transform: translateY(-100%); }
.reader-pages { max-width: 720px; margin: 0 auto; background: #000; }
.reader-pages img { width: 100%; display: block; }
.reader-footer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: rgba(255,255,255,0.98); backdrop-filter: blur(10px);
  padding: 12px 20px; display: flex; align-items: center; justify-content: space-between;
  transition: transform 0.3s; border-top: 1px solid #e5e5e5;
}
[data-theme="dark"] .reader-footer { background: rgba(20,20,20,0.95); border-top-color: #333; }
.reader-footer.hidden { transform: translateY(100%); }
.reader-progress { flex: 1; margin: 0 24px; height: 4px; background: #e5e7eb; border-radius: 2px; cursor: pointer; }
[data-theme="dark"] .reader-progress { background: #333; }
.reader-progress-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width 0.1s; }
.reader-nav-btn { color: var(--text-1); font-weight: 600; padding: 8px 16px; border-radius: 20px; background: var(--bg-3); border: none; cursor: pointer; transition: 0.2s; }
.reader-nav-btn:hover { background: var(--border); }
[data-theme="dark"] .reader-nav-btn { color: #fff; background: #333; }
.reader-header .title { font-weight: 700; color: var(--text-1); }
[data-theme="dark"] .reader-header .title { color: #fff; }

/* ===== DASHBOARD LAYOUT ===== */
.dash-layout { display: flex; min-height: 100vh; padding-top: 64px; }
.dash-sidebar {
  width: 260px; background: var(--bg-1); border-right: 1px solid var(--border);
  padding: 32px 0; position: fixed; top: 64px; bottom: 0; overflow-y: auto;
}
.dash-sidebar .nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 24px; margin: 0 16px 4px; border-radius: 8px;
  color: var(--text-2); font-weight: 600; font-size: 0.95rem; transition: all 0.2s;
}
.dash-sidebar .nav-item:hover { background: var(--bg-3); color: var(--text-1); }
.dash-sidebar .nav-item.active { background: rgba(0,220,100,0.1); color: var(--primary-dark); }
.dash-main { flex: 1; margin-left: 260px; padding: 40px; background: var(--bg-3); min-height: calc(100vh - 64px); }
.dash-mobile-nav {
  display: none; gap: 8px; overflow-x: auto; padding: 10px 12px;
  background: var(--bg-1); border-bottom: 1px solid var(--border);
  position: sticky; top: 60px; z-index: 900; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.dash-mobile-nav::-webkit-scrollbar { display: none; }
.dash-mobile-nav a {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; font-size: 0.82rem; font-weight: 700;
  color: var(--text-2); background: var(--bg-3); text-decoration: none; white-space: nowrap;
}
.dash-mobile-nav a.active { background: rgba(0,220,100,0.15); color: var(--primary-dark); }

/* ===== STAT CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin-bottom: 40px; }
.stat-card {
  background: var(--bg-1); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; position: relative; overflow: hidden; border: 1px solid var(--border);
}
.stat-value { font-size: 2.2rem; font-weight: 800; margin-bottom: 4px; color: var(--text-1); letter-spacing: -1px; }
.stat-label { color: var(--text-2); font-size: 0.9rem; font-weight: 500; }
.stat-change { font-size: 0.85rem; color: var(--primary); font-weight: 600; margin-top: 8px; }

/* ===== TABLE ===== */
.table-wrapper { overflow-x: auto; background: var(--bg-1); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th { background: var(--bg-3); padding: 14px 20px; text-align: left; font-weight: 700; font-size: 0.85rem; text-transform: uppercase; color: var(--text-2); letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
td { padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: 0.95rem; color: var(--text-1); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fafb; }
[data-theme="dark"] tr:hover td { background: #2a2a2a; }

/* ===== BADGES ===== */
.badge { display:inline-block; padding:4px 12px; border-radius:20px; font-size:0.75rem; font-weight:700; letter-spacing: 0.5px; }
.badge-green { background:rgba(0,220,100,0.15); color:#00b854; }
.badge-red { background:rgba(255,64,96,0.15); color:#e03855; }
.badge-yellow { background:rgba(245,158,11,0.15); color:#d97706; }
.badge-orange { background:rgba(249,115,22,0.15); color:#ea580c; }
.badge-blue { background:rgba(59,130,246,0.15); color:#2563eb; }

/* ===== TOAST ===== */
.toast-container { position:fixed; top:80px; right:24px; z-index:3000; display:flex; flex-direction:column; gap:8px; }
.toast {
  background: var(--bg-1); color: var(--text-1); border-radius: 8px; font-weight: 600;
  padding: 14px 24px; min-width: 280px; box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1); border-left: 4px solid var(--primary);
}
.toast-error { border-left-color: var(--accent); }
@keyframes slideIn { from{transform:translateX(100%);opacity:0} to{transform:translateX(0);opacity:1} }

/* ===== UPLOAD AREA ===== */
.upload-area {
  border: 2px dashed #cbd5e1; border-radius: var(--radius); padding: 48px 24px;
  text-align: center; cursor: pointer; transition: all 0.2s; background: var(--bg-3);
}
[data-theme="dark"] .upload-area { border-color: #4b5563; }
.upload-area:hover, .upload-area.dragover { border-color: var(--primary); background: rgba(0,220,100,0.05); }
.upload-icon { font-size: 3rem; margin-bottom: 12px; }

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--bg-3); cursor: pointer; display: flex; align-items: center;
  justify-content: center; font-size: 1.1rem; transition: all 0.2s; color: var(--text-1);
}
.theme-toggle:hover { background: var(--bg-4); }

/* ===== SKELETON LOADING ===== */
.skeleton { background:linear-gradient(90deg, var(--bg-3) 25%, var(--bg-4) 50%, var(--bg-3) 75%); background-size:200% 100%; animation:shimmer 1.5s infinite; border-radius:var(--radius-sm); }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ===== TABS ===== */
.tabs { display:flex; gap:16px; border-bottom:1px solid var(--border); margin-bottom:24px; }
.tab {
  padding:12px 8px; font-weight:700; font-size:0.95rem; color:var(--text-2);
  border-bottom:3px solid transparent; cursor:pointer; transition:all 0.2s;
}
.tab.active { color:var(--text-1); border-bottom-color:var(--primary); }
.tab:hover:not(.active) { color: var(--text-1); }

/* ===== SEARCH PAGE ===== */
.search-page { padding-bottom: 28px; }
.search-header { margin-bottom: 18px; }
.search-header h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.search-subtitle { color: var(--text-3); font-size: 0.92rem; }

.search-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 18px;
}
.search-input-wrap { min-width: 0; }
.search-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
}
.search-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filter-select,
.filter-btn {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}
.filter-select {
  min-width: 118px;
  border: 1px solid var(--border);
  background: var(--bg-1);
  color: var(--text-1);
}
.filter-btn {
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text-1);
}

.genre-section {
  margin-bottom: 24px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px 12px;
}
.genre-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 0 4px;
}
.genre-section-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}
.genre-section-hint {
  font-size: 0.74rem;
  color: var(--text-3);
  text-align: right;
  line-height: 1.3;
}

.genre-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 2px 2px;
  overflow: visible;
}

.genre-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-1);
  color: var(--text-2);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  user-select: none;
  font-family: inherit;
  line-height: 1.2;
}
.genre-chip:hover {
  border-color: var(--primary);
  color: var(--text-1);
}
.genre-chip.active {
  background: rgba(0,220,100,0.14);
  border-color: var(--primary);
  color: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(0,220,100,0.12);
}
.genre-chip .genre-count {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text-3);
}
.genre-chip.active .genre-count {
  background: rgba(0,220,100,0.2);
  color: var(--primary-dark);
}

/* ===== AD BANNERS ===== */
.ad-slot {
  margin: 20px 0;
  width: 100%;
  display: block;
}
.ad-slot > div {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.ad-slot-empty {
  width: 100%;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  color: var(--text-3);
  font-size: 0.86rem;
  padding: 14px 16px;
  display: grid;
  gap: 4px;
}
.ad-slot-empty strong {
  color: var(--text-1);
  font-size: 0.8rem;
}
.ad-slot-empty span {
  color: var(--text-3);
}
.ad-banner {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 0;
  width: 100%;
  max-width: 100%;
}
.ad-banner a,
.ad-banner img {
  display: block;
  width: 100%;
  height: 100%;
}
.ad-banner img {
  object-fit: fill;
  object-position: center center;
}
.ad-script-host {
  width: 100%;
  height: 100%;
  min-height: 60px;
}
.ad-size-leaderboard { width: 100%; max-width: 100%; aspect-ratio: 97 / 25; }
.ad-size-billboard { width: 100%; max-width: 100%; aspect-ratio: 97 / 9; }
.ad-size-banner { width: 100%; max-width: 100%; aspect-ratio: 728 / 90; }
.ad-size-medium_rect { width: 100%; max-width: 100%; aspect-ratio: 6 / 5; }
.ad-size-half_page { width: 100%; max-width: 100%; aspect-ratio: 1 / 2; }
.ad-size-mobile_banner { width: 100%; max-width: 100%; aspect-ratio: 16 / 5; }

/* ===== RESPONSIVE ===== */
.detail-grid { display:grid; grid-template-columns:220px 1fr; gap:32px; margin-bottom:32px; }

@media(max-width:1024px) {
  .container { padding: 0 16px; }
  .navbar { padding: 0 14px; }
  .nav-links { gap: 16px; }
  .nav-right { gap: 10px; }
  .content-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 18px 14px; }
  .dash-main { padding: 22px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

  /* Generic inline-grid fix for many admin/publisher pages */
  [style*="display:grid"][style*="grid-template-columns:1fr 1fr"],
  [style*="display:grid"][style*="grid-template-columns: 1fr 1fr"],
  [style*="display:grid"][style*="grid-template-columns:repeat(2"],
  [style*="display:grid"][style*="grid-template-columns: repeat(2"],
  [style*="display:grid"][style*="grid-template-columns:300px 1fr"],
  [style*="display:grid"][style*="grid-template-columns: 300px 1fr"],
  [style*="display:grid"][style*="grid-template-columns:340px 1fr"],
  [style*="display:grid"][style*="grid-template-columns: 340px 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

@media(max-width:768px) {
  .container { padding: 0 12px; }
  .navbar { height: 60px; padding: 0 10px; gap: 8px; }
  .navbar .logo { min-width: 0; flex: 1 1 auto; }
  .navbar .logo img { height: 32px !important; max-width: 100%; }
  .nav-menu-btn { display: inline-flex; }
  .page-content { padding-top: 78px; }
  .section { padding: 28px 0; }
  .section-header { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
  .section-title { font-size: 1.25rem; }
  .btn { padding: 9px 14px; font-size: 0.88rem; }
  .btn-lg { padding: 10px 16px; font-size: 0.9rem; }
  .theme-toggle { width: 36px; height: 36px; }
  .detail-grid { grid-template-columns: 1fr; gap: 24px; }
  .content-grid { grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:14px 10px; }
  .card-body { padding: 8px 2px; }
  .card-title { font-size: 0.9rem; }
  .card-meta { font-size: 0.75rem; gap: 6px; }
  .content-grid.list-view .card { flex-direction: column; }
  .content-grid.list-view .card-img { width: 100%; height: auto; aspect-ratio: 3/4; }
  .nav-links { display:none; }
  .nav-search { display:none; }
  .hero { padding: 28px 0; margin-top: 60px; }
  .hero-title { font-size: 1.6rem; line-height: 1.25; }
  .hero-desc { font-size: 0.95rem; margin-bottom: 16px; }
  .dash-sidebar { display:none; }
  .dash-mobile-nav { display: flex; }
  .dash-main { margin-left:0; padding: 14px; min-height: calc(100vh - 60px); }
  .dash-main h1 { font-size: 1.35rem !important; margin-bottom: 16px !important; }
  .detail-grid h1 { font-size: 1.45rem !important; line-height: 1.25 !important; }
  .stats-grid { grid-template-columns:repeat(2,1fr); gap: 16px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.45rem; }
  .stat-label { font-size: 0.82rem; }
  .auth-card { padding:32px 24px; border-radius: 12px; border: none; box-shadow: none; }
  .auth-page { padding: 0; background: var(--bg-1); align-items: flex-start; }
  .auth-title { font-size: 1.55rem; }
  .auth-subtitle { margin-bottom: 18px; }
  .auth-tabs { margin-bottom: 18px; }
  .tabs { gap: 10px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 2px; }
  .tab { white-space: nowrap; padding: 10px 6px; font-size: 0.88rem; }

  .search-header h1 { font-size: 1.45rem; }
  .search-subtitle { font-size: 0.86rem; }
  .search-toolbar {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }
  .search-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .search-filters .filter-select,
  .search-filters .filter-btn {
    width: 100%;
    min-width: 0;
    text-align: center;
  }
  .search-filters .filter-btn { grid-column: 1 / -1; }
  .genre-section {
    margin-bottom: 18px;
    padding: 12px 10px 10px;
  }
  .genre-section-hint { font-size: 0.7rem; max-width: 52%; }
  .genre-chip { padding: 8px 12px; font-size: 0.8rem; }

  .table-wrapper { border-radius: 10px; }
  table { min-width: 680px; }
  th, td { padding: 10px 12px; font-size: 0.83rem; white-space: nowrap; }

  .form-input, .form-select, .form-textarea { font-size: 16px; } /* avoid iOS zoom */
  .form-textarea { min-height: 100px; }

  .upload-area { padding: 22px 12px; }
  .upload-icon { font-size: 2rem; }
  .empty-state { padding: 40px 16px; }
  .empty-state .icon { font-size: 2.4rem; margin-bottom: 10px; }
  .empty-state h3 { font-size: 1.05rem; }

  /* Reader/Ebook shared compact mode */
  .reader-header, .ebook-header {
    height: 48px !important;
    padding: 0 10px !important;
    gap: 6px !important;
  }
  .reader-header .title {
    font-size: 0.9rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 48vw;
  }
  .reader-left, .ebook-header-left {
    min-width: 0 !important;
    flex: 1 1 auto;
    overflow: hidden;
  }
  .reader-footer, .ebook-controls {
    padding: 8px 10px !important;
    gap: 8px !important;
    height: 56px !important;
  }
  .reader-progress { margin: 0 10px; }
  .reader-nav-btn { padding: 7px 10px; font-size: 0.78rem; }

  /* Generic inline-style fixes used across pages */
  [style*="max-width:800px"],
  [style*="max-width: 800px"],
  [style*="max-width:960px"],
  [style*="max-width: 960px"],
  [style*="max-width:1080px"],
  [style*="max-width: 1080px"] {
    max-width: 100% !important;
  }
  [style*="padding:32px"],
  [style*="padding: 32px"] {
    padding: 16px !important;
  }
  [style*="padding:40px"],
  [style*="padding: 40px"] {
    padding: 16px !important;
  }
  [style*="margin-top:40px"],
  [style*="margin-top: 40px"] {
    margin-top: 12px !important;
  }
  [style*="min-width:200px"],
  [style*="min-width: 200px"],
  [style*="min-width:220px"],
  [style*="min-width: 220px"],
  [style*="min-width:240px"],
  [style*="min-width: 240px"] {
    min-width: 0 !important;
  }
  [style*="width:250px"],
  [style*="width: 250px"],
  [style*="width:320px"],
  [style*="width: 320px"] {
    width: 100% !important;
  }
  [style*="display:flex"][style*="gap:16px"],
  [style*="display:flex"][style*="gap: 16px"],
  [style*="display:flex"][style*="gap:12px"],
  [style*="display:flex"][style*="gap: 12px"] {
    flex-wrap: wrap !important;
  }
  [style*="display:grid"][style*="grid-template-columns:1fr 1fr"],
  [style*="display:grid"][style*="grid-template-columns: 1fr 1fr"],
  [style*="display:grid"][style*="grid-template-columns:repeat(2"],
  [style*="display:grid"][style*="grid-template-columns: repeat(2"],
  [style*="display:grid"][style*="grid-template-columns:300px 1fr"],
  [style*="display:grid"][style*="grid-template-columns: 300px 1fr"],
  [style*="display:grid"][style*="grid-template-columns:340px 1fr"],
  [style*="display:grid"][style*="grid-template-columns: 340px 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Keep mobile dropdowns visible and inside viewport */
  #notifDropdown,
  .user-dropdown {
    position: fixed !important;
    top: 66px !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-height: 70vh !important;
    z-index: 1600 !important;
  }

  /* Save space in navbar user button on mobile */
  .user-menu-wrap > .btn > span:first-child {
    display: none;
  }
}

@media(max-width:576px) {
  .content-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 8px; }
  .toast-container { right: 10px; left: 10px; top: 72px; }
  .toast { min-width: 0; width: 100%; padding: 12px 14px; }
  .stats-grid { grid-template-columns: 1fr; gap: 12px; }
  .btn-block { width: 100%; }
  .detail-grid .btn-lg { width: 100%; }
  .auth-card .btn { width: 100%; }
  .mobile-nav-item { font-size: 0.68rem; }
  .mobile-nav-item .icon { font-size: 1.2rem; }
  .reader-nav-btn { padding: 6px 8px; font-size: 0.74rem; }
  .section[style*="padding:60px"] { padding: 32px 12px !important; }
  .section[style*="padding:60px"] h2 { font-size: 1.35rem !important; }
}

/* ===== MOBILE NAV ===== */
.mobile-nav {
  position:fixed; bottom:0; left:0; right:0; z-index:1000;
  background:var(--bg-1); border-top:1px solid var(--border);
  display:none; padding:8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
}
.mobile-nav-items { display:flex; justify-content:space-around; }
.mobile-nav-item { display:flex; flex-direction:column; align-items:center; gap:4px; padding:4px; color:var(--text-3); font-size:0.75rem; font-weight:600; text-decoration:none; min-width: 0; flex: 1; }
.mobile-nav-item.active { color:var(--primary); }
.mobile-nav-item .icon { font-size:1.4rem; }
@media(max-width:768px) {
  .mobile-nav{display:block;}
  body.has-mobile-nav{padding-bottom:calc(70px + env(safe-area-inset-bottom, 0px));}
  body.has-mobile-nav footer { margin-bottom: 12px; }
  img, video, svg { max-width: 100%; height: auto; }

}

/* ===== UTILS ===== */
.fade-in { animation:fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes fadeIn { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }
.empty-state { text-align:center; padding:80px 24px; color:var(--text-3); background: var(--bg-1); border-radius: var(--radius); border: 1px dashed var(--border); }
.empty-state .icon { font-size:4rem; margin-bottom:20px; opacity:0.6; }
.empty-state h3 { font-size:1.3rem; margin-bottom:8px; color:var(--text-1); font-weight: 700; }
