:root {
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-elevated: #1e293b;
  --bg-hover: #2a2a4a;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #94a3b8;
  --accent-primary: #e50914;
  --accent-secondary: #b20710;
  --accent: #e50914;
  --accent-hover: #b20710;
  --accent-gold: #ffd700;
  --accent-blue: #3b82f6;
  --accent-green: #22c55e;
  --accent-purple: #a855f7;
  --bg-tertiary: #0d1117;
  --danger: #ef4444;
  --border-color: #2a2a3a;
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(229, 9, 20, 0.3);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'Cairo', 'Tajawal', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "liga" 1, "calt" 1, "kern" 1;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-primary);
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.search-box input:focus {
  outline: none;
}

img {
  max-width: 100%;
  height: auto;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==================== NAVBAR ==================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(15, 15, 15, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  transition: transform 0.3s ease;
  overflow: visible;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
  min-width: 0;
  overflow: visible;
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-inline-end: auto;
}

.navbar-logo img {
  height: 48px;
  width: 48px;
  border-radius: 10px;
}

.navbar-logo .logo-text {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1px;
}

.navbar-logo .logo-accent {
  background: linear-gradient(135deg, #FBBF24, #ff6b35);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  min-width: 0;
  overflow: hidden;
}

.navbar-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.navbar-nav a.active {
  color: var(--accent-primary);
}

.navbar-nav a i {
  font-size: 1rem;
}

.search-box {
  position: relative;
  flex: 1;
  width: 280px;
  min-width: 120px;
  max-width: 280px;
  overflow: visible;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 48px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 50px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.15);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box button {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent-primary);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.search-box button:hover {
  background: var(--accent-secondary);
}

.search-results-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  margin-top: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  overflow: visible;
  display: none;
  max-height: 400px;
  overflow-y: auto;
}

.search-results-dropdown.active,
.search-results-dropdown[style*="display: block"] {
  display: block !important;
}

.search-result-item:hover {
  background: var(--bg-hover) !important;
}

.mobile-nav.open {
  display: block;
}

.mobile-nav-content {
  position: absolute;
  top: 0;
  right: 0;
  width: 280px;
  height: 100%;
  background: var(--bg-primary);
  padding: 20px;
  overflow-y: auto;
}

.mobile-nav-close {
  position: absolute;
  top: 15px;
  left: 15px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
}

/* ==================== AD SPACES ==================== */
.ad-space {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  margin: 20px auto;
  max-width: 1400px;
  position: relative;
  overflow: hidden;
  transition: opacity 0.3s;
}

.ad-space::before {
  content: 'إعلان';
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: normal;
  opacity: 0.5;
}

.ad-space-lg {
  min-height: 90px;
  max-width: 728px;
}

.ad-space-sm {
  min-height: 60px;
  max-width: 300px;
}

.ad-space-sidebar {
  min-height: 600px;
  width: 100%;
}

.ad-space-banner {
  min-height: 100px;
  max-width: 728px;
}

.ad-space-300x250 {
  width: 300px;
  min-height: 250px;
  max-width: 300px;
  margin: 0 auto 20px;
}

.ad-space-160x300 {
  width: 160px;
  min-height: 300px;
  max-width: 160px;
  margin: 0 auto 20px;
}

.ad-space-160x600 {
  width: 160px;
  min-height: 600px;
  max-width: 160px;
  margin: 0 auto 20px;
}

.ad-space-mobile-sticky {
  display: none;
  position: fixed;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 50px;
  z-index: 998;
  margin: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.9);
}

@media (max-width: 768px) {
  .ad-space-banner,
  .ad-space-lg {
    display: none;
  }
  
  .ad-space {
    min-height: 60px;
    margin: 10px auto;
  }
}

/* ==================== HERO SECTION ==================== */
#hero-container {
  min-height: 420px;
}

.hero-section {
  position: relative;
  padding: 20px 0 10px;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center, rgba(229, 9, 20, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-slider {
  position: relative;
  width: 100%;
  height: 400px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.hero-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.8s ease;
  will-change: transform;
}

.hero-slide.active {
  opacity: 1;
}

.hero-slide-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(3px) brightness(0.3);
  transform: scale(1.1);
}

.hero-slide-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15, 15, 15, 1) 0%, rgba(15, 15, 15, 0.4) 50%, transparent 100%);
}

.hero-slide-content {
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  padding: 40px;
  display: flex;
  gap: 30px;
  align-items: flex-end;
}

.hero-cover {
  width: 180px;
  height: 260px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
  border: 2px solid var(--accent-primary);
}

.hero-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-info {
  flex: 1;
}

.hero-info h2 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-info p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-info .btn-read {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--accent-primary);
  color: white;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1rem;
  transition: all var(--transition-normal);
  border: none;
  cursor: pointer;
}

.hero-info .btn-read:hover {
  background: var(--accent-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
  color: white;
}

.hero-badge {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 4px 14px;
  border-radius: 50px;
  background: var(--accent-primary);
  color: white;
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 10;
}

.hero-genres {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.hero-genre-pill {
  padding: 3px 10px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: white;
  font-size: 0.75rem;
}

.hero-dots {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.hero-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.hero-dot.active {
  background: var(--accent-primary);
  width: 30px;
  border-radius: 5px;
}

/* ==================== SECTION HEADINGS ==================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid;
  border-image: linear-gradient(to left, var(--accent-primary), transparent) 1;
}

.section-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 800;
}

.section-header h2 i {
  color: var(--accent-primary);
  font-size: 1.3rem;
}


.section-header .view-all {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.section-header .view-all:hover {
  gap: 10px;
}

/* ==================== RECOMMENDED CARDS ==================== */
.rec-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 20px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-primary) transparent;
}

.rec-track::-webkit-scrollbar {
  height: 4px;
}
.rec-track::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 4px;
}

/* ── Desktop card (rich) ── */
.rec-card {
  flex: 0 0 auto;
  min-width: 145px;
  max-width: 165px;
  background: linear-gradient(180deg, #1a1a2e 0%, #141420 100%);
  border: 1px solid rgba(229, 9, 20, 0.15);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  scroll-snap-align: start;
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.rec-card:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 8px 25px rgba(229, 9, 20, 0.25);
  border-color: var(--accent-primary);
}

.rec-cover {
  width: 100%;
  height: 165px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.rec-card:hover .rec-cover {
  transform: scale(1.05);
}

.rec-info {
  padding: 10px 10px 12px;
  position: relative;
  z-index: 1;
}

.rec-info::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(transparent, #141420);
  pointer-events: none;
}

.rec-title {
  font-size: 12px;
  color: #f0f0f0;
  font-weight: 700;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
  transition: color 0.2s ease;
}

.rec-card:hover .rec-title {
  color: var(--accent-primary);
}

.rec-stars {
  display: none;
}

.rec-meta {
  font-size: 10px;
  color: #666;
  font-weight: 500;
}

.rec-rank {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, #e50914, #ff2d55);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(229, 9, 20, 0.5);
  backdrop-filter: blur(4px);
  letter-spacing: 0.3px;
}

.rec-see-all {
  display: none;
}

.section-header-sm h2 {
  font-size: 1.5rem;
}

/* ==================== LOADING SKELETON ==================== */
.skeleton-card {
  aspect-ratio: 3/4;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  position: relative;
  overflow: hidden;
}
.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.04) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ==================== MANHWA GRID ==================== */
.manhwa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 42vw), 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.manhwa-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  transition: all var(--transition-normal);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.manhwa-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.manhwa-card-cover {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
}

.manhwa-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.manhwa-card:hover .manhwa-card-cover img {
  transform: scale(1.1);
}

.manhwa-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-normal);
  display: flex;
  align-items: flex-end;
  padding: 15px;
}

.manhwa-card:hover .manhwa-card-overlay {
  opacity: 1;
}

.manhwa-card-overlay .btn-read {
  width: 100%;
  padding: 10px;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: center;
}

.btn-read {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 50px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.btn-fav-detail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 50px;
  font-weight: 700;
  cursor: pointer;
}

.reader-nav a,
.reader-nav button {
  padding: 8px 16px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  text-decoration: none;
}

.reader-nav button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.reader-footer a,
.reader-footer button {
  padding: 12px 24px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
}

.reader-footer button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.manhwa-card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.badge {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: normal;
  word-spacing: normal;
}

.badge-new {
  background: var(--accent-primary);
  color: white;
  animation: pulse 2s infinite;
}

.badge-hot {
  background: #f97316;
  color: white;
}

.badge-complete {
  background: var(--accent-green);
  color: white;
}

.badge-update {
  background: var(--accent-blue);
  color: white;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.manhwa-card-chapter {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.manhwa-card-chapter span {
  font-size: 0.75rem;
  color: var(--accent-primary);
  font-weight: 700;
}

.manhwa-card-chapter small {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.manhwa-card-info {
  padding: 12px;
}

.manhwa-card-info h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.manhwa-card-info .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.manhwa-card-info .meta i {
  color: var(--accent-gold);
}

.manhwa-card-progress {
  height: 3px;
  background: var(--bg-hover);
  overflow: hidden;
}

.manhwa-card-progress .progress-bar {
  height: 100%;
  background: var(--accent-primary);
  transition: width 0.3s ease;
}

/* ==================== CHAPTERS LIST ==================== */
.chapters-section {
  margin-top: 30px;
}

.chapter-quick-nav {
  display: flex;
  gap: 8px;
}

.chapter-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: var(--accent-primary);
  color: white;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.chapter-quick-btn:hover {
  background: var(--accent-hover, #e50914);
  transform: scale(1.05);
}

.chapters-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chapter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.chapter-item:hover {
  background: var(--bg-hover);
  transform: translateX(-4px);
}

.chapter-item.chapter-current {
  border-right: 3px solid var(--accent-primary);
  background: var(--bg-hover);
}

.chapter-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chapter-number {
  background: var(--accent-primary);
  color: white;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 50px;
  text-align: center;
}

.chapter-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.chapter-item-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

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

.chapter-item-right i {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.chapter-item:hover .chapter-item-right i {
  color: var(--accent-primary);
}

/* ==================== READER PAGE ==================== */
.reader-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.reader-header h1 {
  font-size: 1.2rem;
  font-weight: 700;
}

.reader-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reader-nav button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.reader-nav button:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.reader-nav select {
  padding: 8px 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
}

.reader-images {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.reader-images img {
  width: 100%;
  max-width: 800px;
  display: block;
  height: auto;
}

.reader-strip {
  width: 100%;
  max-width: 800px;
}

.reader-slice {
  position: relative;
  width: 100%;
  max-width: 800px;
  overflow: hidden;
  background: #10101c;
}

.reader-slice-img {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  max-width: none;
}

.reader-page:fullscreen {
  background: #000;
  padding: 0;
}

.reader-page:fullscreen .reader-header,
.reader-page:fullscreen .reader-footer,
.reader-page:fullscreen .ad-space {
  display: none;
}

.reader-page:fullscreen .reader-images {
  padding: 0;
}

.reader-page:fullscreen .reader-images img {
  max-width: 100%;
}

.reader-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 30px 0;
}

.reader-footer button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--accent-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.reader-footer button:hover {
  background: var(--accent-secondary);
}

.reader-footer button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==================== MANHWA DETAIL ==================== */
.manhwa-detail {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 30px;
  padding: 30px 0;
}

.detail-cover {
  position: relative;
}

.detail-cover img {
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--border-color);
}

.detail-cover .status-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
}

.detail-info h1 {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 10px;
  line-height: 1.3;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
}

.detail-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.detail-meta-item i {
  color: var(--accent-primary);
}

.detail-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.genre-tag {
  padding: 5px 14px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.genre-tag:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* ==================== SIDEBAR ==================== */
.layout-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 30px;
  padding: 10px 0 30px;
}

/* Grid/flex items must be allowed to shrink below their content's min-width
   (min-width: auto). Without this, a wide nowrap child — e.g. the
   horizontally-scrollable filter chips on /manga-list — stretches the whole
   grid track to thousands of px on phones and blows out the mobile layout. */
.layout-with-sidebar > *,
.manhwa-detail > * {
  min-width: 0;
}

.layout-with-sidebar:has(.sidebar:empty) {
  grid-template-columns: 1fr;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.sidebar-widget {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border-color);
}

.sidebar-widget h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-primary);
}

.sidebar-widget h3 i {
  color: var(--accent-primary);
}

.popular-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.popular-item:last-child {
  border-bottom: none;
}

.popular-item:hover {
  transform: translateX(-3px);
}

.popular-item-cover {
  width: 55px;
  height: 75px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.popular-item-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.popular-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.popular-item-info h4 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.popular-item-info small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.popular-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  background: var(--accent-primary);
  color: white;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
  align-self: center;
}

/* ==================== FILTER BAR ==================== */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 25px;
  border: 1px solid var(--border-color);
}

.filter-bar input {
  padding: 10px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast);
  width: 100%;
}

.filter-bar .filter-input {
  cursor: text;
}

.filter-bar input:focus {
  border-color: var(--accent-primary);
}

.filter-chips-row {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}

.filter-chips-row::-webkit-scrollbar {
  display: none;
}

/* --- Mobile filter bottom-sheet ---
   On phones the six wide horizontal chip strips are replaced by a single
   "تصفية" button that opens a bottom sheet where the chips WRAP naturally
   (the sheet scrolls vertically). Desktop keeps the in-place wrapping rows. */
.filter-bar-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-sheet-trigger {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-sheet-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.72rem;
  font-weight: 800;
}

@media (max-width: 768px) {
  .filter-chips-wrapper {
    display: none;
  }

  .filter-sheet-trigger {
    display: inline-flex;
  }
}

.filter-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.filter-sheet-backdrop[hidden] {
  display: none;
}

.filter-sheet-backdrop.open {
  opacity: 1;
}

.filter-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  background: var(--bg-secondary);
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s ease;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

.filter-sheet-backdrop.open .filter-sheet {
  transform: translateY(0);
}

.filter-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 8px;
}

.filter-sheet-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.filter-sheet-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 8px;
  margin: -8px;
}

.filter-sheet-body {
  overflow-y: auto;
  padding: 8px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Inside the sheet chips wrap naturally — never a horizontal strip */
.filter-sheet-body .filter-chips-row {
  flex-wrap: wrap;
  overflow: visible;
  -webkit-mask-image: none;
  mask-image: none;
}

.filter-sheet-body .filter-chips-label {
  width: 100%;
}

.filter-sheet-footer {
  display: flex;
  gap: 10px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-color);
}

.filter-sheet-reset {
  flex: 1;
  padding: 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.filter-sheet-apply {
  flex: 2;
  padding: 12px;
  background: var(--accent-primary);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
}

body.sheet-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .filter-sheet-backdrop,
  .filter-sheet {
    transition: none;
  }
}

.filter-chips-label {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.filter-chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  line-height: 1.2;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.filter-chip:active {
  transform: scale(0.96);
}

.filter-chip.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  font-weight: 700;
}

@media (min-width: 769px) {
  .filter-chips-row {
    flex-wrap: wrap;
    overflow: visible;
  }
}

/* ==================== PAGINATION ==================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 30px 0;
}

.pagination button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pagination button:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.pagination button.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==================== FOOTER ==================== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 30px 0 16px;
  margin-top: 20px;
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 30px;
}

.footer-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 15px;
  color: var(--accent-primary);
}

.footer-section p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 8px;
}

.footer-section ul a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.footer-section ul a:hover {
  color: var(--accent-primary);
  padding-inline-start: 5px;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.85rem;
}

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

#hero-container:empty {
  display: none;
}

.sidebar:empty {
  display: none;
}

/* ==================== SCROLL TO TOP ==================== */
.scroll-top {
  position: fixed;
  bottom: 30px;
  left: 30px;
  width: 50px;
  height: 50px;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  z-index: 999;
  box-shadow: var(--shadow-glow);
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top:hover {
  transform: translateY(-3px);
}

/* ==================== TOAST ==================== */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 14px 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-lg);
}

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

.toast.success {
  border-right: 4px solid var(--accent-green);
}

.toast.error {
  border-right: 4px solid var(--accent-primary);
}

/* ==================== RESPONSIVE ==================== */

/* --- TABLET (max-width: 1024px) --- */
@media (max-width: 1024px) {
  .layout-with-sidebar {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .manhwa-detail {
    grid-template-columns: 200px 1fr;
  }

  .manhwa-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* --- TABLET (max-width: 1024px) --- */
@media (max-width: 1024px) {
  .navbar-inner {
    gap: 8px;
    padding: 0 8px;
  }

  .navbar-nav a {
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .search-box {
    width: 200px;
  }

  .navbar-logo .logo-text {
    font-size: 1.1rem;
  }
}

/* --- MOBILE (max-width: 768px) --- */
@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  .container {
    padding: 0 12px;
  }

  /* NAVBAR */
  .navbar-nav {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
  }

  .auth-buttons,
  .auth-user {
    display: none !important;
  }

  .navbar-inner {
    height: 56px;
    gap: 10px;
  }

  .navbar-logo img {
    height: 40px;
    width: 40px;
  }

  .navbar-logo .logo-text {
    font-size: 1rem;
  }

  .search-box {
    max-width: none;
    flex: 1;
  }

  .search-box input {
    padding: 10px 44px 10px 14px;
    font-size: 0.85rem;
  }

  .search-box button {
    width: 38px;
    height: 38px;
  }

  /* HERO */
  #hero-container {
    min-height: 320px;
  }
  .hero-section {
    padding: 10px 0;
  }

  .hero-slider {
    height: 300px;
    border-radius: var(--radius-md);
  }

  .hero-slide-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px;
    gap: 8px;
  }

  .hero-dots {
    bottom: 8px;
    gap: 6px;
  }

  .hero-dot {
    width: 8px;
    height: 8px;
  }

  .hero-cover {
    width: 100px;
    height: 140px;
    border-radius: var(--radius-sm);
  }

  .hero-info h2 {
    font-size: 1.2rem;
    margin-bottom: 6px;
  }

  .hero-info p {
    font-size: 0.82rem;
    -webkit-line-clamp: 2;
    margin-bottom: 10px;
  }

  .hero-info .btn-read {
    padding: 10px 22px;
    font-size: 0.9rem;
  }

  /* GRID */
  .manhwa-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
  }

  .manhwa-card {
    border-radius: var(--radius-sm);
  }

  .manhwa-card-cover {
    aspect-ratio: 3/4;
  }

  .manhwa-card-info {
    padding: 8px 10px;
  }

  .manhwa-card-info h3 {
    font-size: 0.78rem;
    line-height: 1.5;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .manhwa-card-chapter {
    padding: 5px 8px;
    font-size: 0.7rem;
  }

  .manhwa-card-overlay .btn-read {
    padding: 6px 14px;
    font-size: 0.8rem;
  }

  /* DETAIL PAGE */
  .manhwa-detail {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 0;
  }

  .detail-cover {
    max-width: 200px;
    margin: 0 auto;
  }

  .detail-info h1 {
    font-size: 1.4rem;
    text-align: center;
  }

  .detail-meta {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .detail-genres {
    justify-content: center;
    flex-wrap: wrap;
  }

  .detail-section {
    padding: 14px;
    margin-top: 16px;
  }

  .btn-read,
  .btn-fav-detail {
    display: flex;
    width: 100%;
    justify-content: center;
    padding: 14px !important;
    font-size: 1rem !important;
    min-height: 44px;
  }

  /* ── RECOMMENDED SECTION - mobile redesign ── */
  .rec-track {
    gap: 8px;
    padding-bottom: 4px;
    margin-bottom: 12px;
  }

  .rec-card {
    min-width: 100px;
    max-width: 110px;
    background: none;
    border: none;
    border-radius: 6px;
    transition: transform 0.2s ease;
  }

  .rec-card:hover {
    transform: translateY(-2px);
    box-shadow: none;
    border-color: transparent;
  }

  .rec-cover {
    height: 140px;
    border-radius: 6px;
    transition: transform 0.2s ease;
  }

  .rec-card:hover .rec-cover {
    transform: scale(1.04);
  }

  .rec-info {
    padding: 4px 2px 0;
  }

  .rec-info::before {
    display: none;
  }

  .rec-title {
    font-size: 10px;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }

  .rec-stars {
    display: block;
    font-size: 9px;
    color: #f5b642;
    letter-spacing: 0;
    line-height: 1.2;
  }

  .rec-meta {
    display: none;
  }

  .rec-rank {
    display: none;
  }

  .rec-see-all {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--accent-primary);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
  }

  .rec-see-all i {
    font-size: 10px;
  }

  .section-header-sm h2 {
    font-size: 1rem;
    margin-bottom: 0;
  }

  .section-header-sm {
    margin-bottom: 10px;
    padding-bottom: 6px;
  }

  /* CONTINUE READING (reader.js grid override) */
  #continue-reading > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  #continue-reading > div[style*="grid-template-columns"] a {
    flex-direction: row;
    gap: 12px;
    padding: 12px;
  }

  /* STREAK WIDGET */
  #streak-widget > div {
    margin-bottom: 12px;
  }

  /* CHAPTERS LIST */
  .chapter-item {
    padding: 12px 14px;
  }

  .chapter-number {
    padding: 3px 10px;
    font-size: 0.75rem;
    min-width: 40px;
  }

  .chapter-title {
    font-size: 0.85rem;
  }

  .chapter-date {
    display: none;
  }

  .chapter-item-right i {
    display: none;
  }

  /* READER */
  .reader-page {
    padding: 10px;
  }

  .reader-header {
    flex-direction: column;
    text-align: center;
    padding: 12px;
    gap: 10px;
  }

  .reader-header h1 {
    font-size: 1rem;
    line-height: 1.4;
    word-break: break-word;
  }

  .reader-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    width: 100%;
  }

  .reader-nav a,
  .reader-nav button {
    padding: 10px 14px;
    font-size: 0.82rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
  }

  .reader-nav select {
    flex: 1;
    min-width: 0;
    padding: 10px 8px;
    font-size: 0.82rem;
    max-width: 200px;
  }

  .reader-images img {
    max-width: 100%;
  }

  .reader-footer {
    flex-direction: column;
    gap: 10px;
    padding: 20px 0;
  }

  .reader-footer a,
  .reader-footer button {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
    font-size: 0.9rem;
    min-height: 48px;
  }

  /* SIDEBAR */
  .sidebar {
    grid-template-columns: 1fr;
  }

  .popular-item {
    padding: 10px;
  }

  .popular-item-cover img {
    width: 45px;
    height: 60px;
  }

  .popular-item-info h4 {
    font-size: 0.85rem;
  }

  /* FILTER */
  .filter-bar {
    padding: 12px;
  }

  /* PAGINATION */
  .pagination {
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .pagination button {
    min-width: 44px;
    min-height: 44px;
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  /* FOOTER */
  .footer-content {
    grid-template-columns: 1fr;
    gap: 25px;
    text-align: center;
  }

  .footer-section ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .footer-section li {
    margin-bottom: 0;
  }

  .footer-section a {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  /* LAYOUT SPACING */
  .layout-with-sidebar {
    gap: 10px;
    padding: 0 0 16px;
  }

  .continue-reading-list {
    margin-bottom: 16px;
  }

  .section-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
  }

  .section-header h2 {
    font-size: 1.1rem;
  }

  /* AD SPACES */
  .ad-space-banner,
  .ad-space-lg,
  .ad-space-300x250,
  .ad-space-160x300,
  .ad-space-160x600 {
    display: none;
  }

  .ad-space-mobile-sticky {
    display: block;
  }

  .ad-space {
    min-height: 60px;
    margin: 8px auto;
  }

  /* SCROLL TOP */
  .scroll-top {
    width: 44px;
    height: 44px;
    right: 12px;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    font-size: 1.2rem;
  }

  /* LAYOUT */
  .detail-layout,
  .reader-layout {
    flex-direction: column;
  }

  /* TOAST */
  .toast {
    left: 12px;
    right: 12px;
    bottom: 20px;
    font-size: 0.85rem;
  }
}

/* --- SMALL PHONE (max-width: 480px) --- */
@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  #hero-container {
    min-height: 200px;
  }
  .hero-slider {
    height: 220px;
  }

  .hero-cover {
    width: 70px;
    height: 100px;
  }

  .hero-info h2 {
    font-size: 0.95rem;
    margin-bottom: 4px;
  }

  .hero-info p {
    display: none;
  }

  .hero-slide-content {
    padding: 10px;
    gap: 8px;
  }

  .manhwa-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .manhwa-card-info {
    padding: 4px 6px;
  }

  .manhwa-card-info h3 {
    font-size: 0.72rem;
    -webkit-line-clamp: 1;
  }

  .manhwa-card-chapter span {
    font-size: 0.65rem;
  }

  .manhwa-card-chapter small {
    display: none;
  }

  /* CONTINUE READING smaller */
  .continue-reading-item {
    padding: 8px 10px;
    gap: 10px;
  }

  .continue-reading-item img {
    width: 44px;
    height: 62px;
  }

  .continue-reading-info h4 {
    font-size: 0.78rem;
  }

  .continue-reading-info span {
    font-size: 0.7rem;
  }

  .continue-reading-btn {
    width: 32px;
    height: 32px;
    font-size: 0.7rem;
  }

  /* SECTION HEADER smaller */
  .section-header h2 {
    font-size: 0.95rem;
  }

  .section-header {
    margin-bottom: 8px;
    padding-bottom: 6px;
  }

  .section-header-sm h2 {
    font-size: 0.95rem;
  }

  /* RECOMMENDED - smaller on small phones */
  .rec-card {
    min-width: 90px;
    max-width: 100px;
  }

  .rec-cover {
    height: 128px;
    border-radius: 4px;
  }

  .rec-info {
    padding: 3px 1px 0;
  }

  .rec-title {
    font-size: 9px;
  }

  .rec-stars {
    font-size: 7px;
  }

  .rec-rank {
    font-size: 8px;
    padding: 2px 5px;
    top: 4px;
    right: 4px;
  }

  .detail-cover {
    max-width: 160px;
  }

  .detail-info h1 {
    font-size: 1.2rem;
  }

  .chapter-item {
    padding: 10px 12px;
  }

  .chapter-title {
    font-size: 0.8rem;
  }

  .reader-header h1 {
    font-size: 0.9rem;
  }

  .reader-nav a,
  .reader-nav button {
    padding: 8px 10px;
    font-size: 0.78rem;
  }
}

body.menu-open {
  overflow: hidden;
}

/* --- MOBILE MENU --- */
.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav.open {
  display: block;
}

.mobile-nav-content {
  position: absolute;
  top: 0;
  right: 0;
  width: 280px;
  height: 100%;
  background: var(--bg-primary);
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-nav-close {
  position: absolute;
  top: 15px;
  left: 15px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-nav-links {
  margin-top: 60px;
  list-style: none;
}

.mobile-nav-links li {
  margin-bottom: 4px;
}

.mobile-nav-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  min-height: 48px;
}

.mobile-nav-links a:hover,
.mobile-nav-links a.active {
  background: var(--bg-hover);
  color: var(--accent-primary);
}

.mobile-nav-links a i {
  width: 24px;
  text-align: center;
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* ==================== TOUCH HELPERS ==================== */
@media (hover: none) and (pointer: coarse) {
  .manhwa-card:hover {
    transform: none;
  }

  .manhwa-card:hover .manhwa-card-overlay {
    opacity: 0;
  }

  .chapter-item:hover {
    transform: none;
  }

  .chapter-item:hover .chapter-item-right i {
    color: var(--text-muted);
  }
}

/* ==================== BOTTOM NAV ==================== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 15, 15, 0.97);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition-fast);
  min-width: 60px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.bottom-nav-item i {
  font-size: 1.2rem;
}

.bottom-nav-item.active,
.bottom-nav-item:active {
  color: var(--accent-primary);
}

.bottom-nav-item.active i {
  font-size: 1.4rem;
  filter: drop-shadow(0 0 6px rgba(229,9,20,0.5));
}

.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 2px;
  width: 32px;
  height: 3px;
  background: var(--accent-primary);
  border-radius: 2px;
}

/* ==================== SAFE AREAS ==================== */
@supports (padding: env(safe-area-inset-top)) {
  .navbar {
    padding-top: env(safe-area-inset-top);
  }
  .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (max-width: 768px) {
  body {
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }
  .footer {
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
}

/* ==================== READER PROGRESS ==================== */
.reader-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(0,0,0,0.3);
  z-index: 1100;
}

.reader-progress-bar {
  height: 100%;
  background: var(--accent-primary);
  transition: width 0.15s ease;
  width: 0%;
}

.reader-page-counter {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: white;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 1050;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.reader-page-counter.visible {
  opacity: 1;
}

@media (max-width: 768px) {
  .reader-page-counter {
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  }
}
/* ==================== LOAD MORE ==================== */
.load-more-container {
  text-align: center;
  margin: 10px 0 20px;
}

.load-more-btn {
  padding: 12px 40px;
  background: var(--bg-secondary);
  border: 2px solid var(--accent-primary);
  border-radius: 50px;
  color: var(--accent-primary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.load-more-btn:hover {
  background: var(--accent-primary);
  color: white;
}

.load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==================== FAVORITES PAGE ==================== */
.favorites-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.favorites-empty i {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.3;
  color: var(--accent-primary);
}

.favorites-empty h3 {
  font-size: 1.3rem;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.favorites-empty p {
  font-size: 0.9rem;
}

.btn-favorite {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.btn-favorite.favorited {
  color: var(--accent-primary);
  background: rgba(229, 9, 20, 0.2);
}

.btn-favorite:active {
  transform: scale(0.9);
}

/* ==================== SEARCH PAGE MOBILE ==================== */
.search-page-header {
  padding: 20px 0;
}

.search-page-header h1 {
  font-size: 1.5rem;
  margin-bottom: 15px;
}

.search-page-input {
  width: 100%;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 50px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-page-input:focus {
  border-color: var(--accent-primary);
}

/* ==================== READER SINGLE TAP ZONE ==================== */
.reader-tap-hint {
  position: fixed;
  bottom: 50%;
  left: 50%;
  transform: translate(-50%, 50%);
  background: rgba(0,0,0,0.6);
  color: white;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.8rem;
  z-index: 1060;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
}

/* ==================== NO RESULTS ==================== */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results i {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.3;
}

.no-results h3 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

/* Hide PropellerAds visible overlays — popunder still works via click events */
[data-zone] {
  position: fixed !important;
  top: -9999px !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: auto !important;
}

/* Hide empty ad containers on reader page */
#reader-ad-bottom:empty {
  display: none !important;
}

#reader-ad-bottom:not(:empty) {
  text-align: center;
  margin: 20px auto;
}

/* Hide highperformanceformat "إعلان" label when ad fails to load */
#reader-ad-bottom > div:only-child:not(:has(iframe)):not(:has(script)) {
  display: none !important;
}

/* =============================================
   Detail & Reader Sidebar Layout (160x600 ad)
   ============================================= */
.detail-layout {
  display: flex;
  gap: 20px;
}
.detail-main {
  flex: 1;
  min-width: 0;
}
.reader-layout {
  display: flex;
  gap: 20px;
  max-width: 100%;
}
.reader-layout .reader-main {
  flex: 1;
  min-width: 0;
}
.page-sidebar {
  width: 260px;
  flex-shrink: 0;
}
.page-sidebar:empty {
  display: none;
}
.page-sidebar > * {
  position: sticky;
  top: 80px;
}

.sidebar-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
}
.sidebar-block-title {
  font-size: 0.85rem;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
}
.sidebar-sim-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  text-decoration: none;
  color: var(--text-primary);
  align-items: center;
}
.sidebar-sim-item:last-child {
  border-bottom: none;
}
.sidebar-sim-item img {
  width: 40px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.sidebar-sim-title {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sidebar-sim-rating {
  font-size: 0.75rem;
  color: var(--accent-gold);
  margin-top: 2px;
}
.sidebar-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-stat {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 3px 0;
}
.sidebar-stat span:first-child {
  color: var(--text-muted);
}
.sidebar-stat span:last-child {
  color: var(--text-primary);
  font-weight: 600;
}
.sidebar-coll-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.82rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.sidebar-coll-item:last-child {
  margin-bottom: 0;
}
.sidebar-coll-item i {
  color: var(--accent-primary);
  width: 16px;
}

@media (max-width: 1024px) {
  .page-sidebar {
    display: none !important;
  }
}

/* === AUTH STYLES === */
.auth-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.auth-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  font-family: inherit;
}

.auth-btn-login {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.auth-btn-login:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.auth-btn-register {
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
}

.auth-btn-register:hover {
  background: var(--accent-hover);
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.2s;
}

.auth-user-btn:hover {
  background: var(--bg-tertiary);
}

.auth-user-btn i {
  font-size: 20px;
  color: var(--accent);
}

.auth-btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
  font-size: 16px;
}

.auth-btn-logout:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* Auth Page Forms */
.auth-form-container {
  max-width: 420px;
  margin: 40px auto;
  padding: 0 16px;
}

.auth-form-card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 32px;
  border: 1px solid var(--border-color);
}

.auth-form-card h2 {
  text-align: center;
  margin-bottom: 8px;
  font-size: 24px;
  color: var(--text-primary);
}

.auth-form-card .auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 14px;
}

.auth-form-group {
  margin-bottom: 16px;
}

.auth-form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.auth-form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.auth-form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-form-submit {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
  margin-top: 8px;
}

.auth-form-submit:hover {
  background: var(--accent-hover);
}

.auth-form-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
}

.auth-password-wrap {
  position: relative;
}

.auth-password-wrap input {
  padding-left: 44px;
}

.auth-password-toggle {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1rem;
}

.auth-password-toggle:hover {
  color: var(--text-primary);
}

.auth-success {
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  line-height: 1.6;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.auth-divider span {
  padding: 0 12px;
}

.auth-social-btn {
  width: 100%;
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  margin-bottom: 12px;
}

.auth-social-btn:hover {
  border-color: var(--accent);
  background: var(--bg-secondary);
}

.auth-social-btn img {
  width: 20px;
  height: 20px;
}

.auth-form-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-muted);
}

.auth-form-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.auth-form-footer a:hover {
  text-decoration: underline;
}

.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
}

.auth-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
}

/* Profile Page */
.profile-container {
  max-width: 600px;
  margin: 40px auto;
  padding: 0 16px;
}

.profile-card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 32px;
  border: 1px solid var(--border-color);
}

.profile-header {
  text-align: center;
  margin-bottom: 24px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 36px;
  color: white;
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-email {
  font-size: 14px;
  color: var(--text-muted);
}

.profile-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.profile-section h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.profile-stat {
  text-align: center;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: 12px;
}

.profile-stat-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.profile-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.profile-form-group {
  margin-bottom: 16px;
}

.profile-form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.profile-form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  box-sizing: border-box;
}

.profile-form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.profile-btn {
  padding: 12px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}

.profile-btn:hover {
  background: var(--accent-hover);
}

.profile-btn-danger {
  background: transparent;
  border: 1px solid #ef4444;
  color: #ef4444;
}

.profile-btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Auth mobile styles */
@media (max-width: 768px) {
  .auth-buttons .auth-btn {
    padding: 6px 12px;
    font-size: 13px;
  }

  .auth-form-container {
    margin: 20px auto;
  }

  .auth-form-card {
    padding: 24px;
  }

  .profile-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .auth-buttons {
    gap: 4px;
  }

  .auth-btn {
    padding: 5px 10px;
    font-size: 12px;
  }
}

/* Continue Reading */
.continue-reading-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 32px;
}

.continue-reading-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}

.continue-reading-item:hover {
  background: var(--bg-hover);
}

.continue-reading-item img {
  width: 55px;
  height: 75px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.continue-reading-info {
  flex: 1;
  min-width: 0;
}

.continue-reading-info h4 {
  font-size: 0.9rem;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.continue-reading-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.continue-reading-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary);
  color: #fff;
  border-radius: 50%;
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* Library Page */
.library-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
}

.library-title {
  font-size: 1.5rem;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.library-title i {
  color: var(--accent-primary);
  margin-left: 8px;
}

.library-section {
  margin-bottom: 32px;
}

.library-section h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.library-section h2 i {
  color: var(--accent-primary);
  margin-left: 8px;
}

.library-history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.library-history-item img {
  width: 50px;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.library-history-info {
  flex: 1;
  min-width: 0;
}

.library-history-info h4 {
  margin: 0 0 4px;
  font-size: 0.9rem;
}

.library-history-info h4 a {
  color: var(--text-primary);
  text-decoration: none;
}

.library-history-info h4 a:hover {
  color: var(--accent-primary);
}

.library-history-info span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.library-history-info small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.library-read-btn {
  padding: 8px 16px;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.library-read-btn:hover {
  background: var(--accent-hover);
}

/* Notification Bell */
.nav-notification-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 50%;
  transition: background var(--transition-fast);
}

.nav-notification-bell:hover {
  background: var(--bg-hover);
}

.notification-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--accent-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
}

/* Notifications Page */
.notifications-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px 16px;
}

.notifications-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.notifications-header h1 {
  font-size: 1.4rem;
  color: var(--text-primary);
}

.notifications-header h1 i {
  color: var(--accent-primary);
  margin-left: 8px;
}

.notif-mark-all {
  padding: 6px 14px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.notif-mark-all:hover {
  background: var(--accent-primary);
  color: #fff;
}

.notif-empty {
  text-align: center;
  padding: 48px 0;
  color: var(--text-muted);
}

.notif-empty i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: opacity 0.3s ease, background var(--transition-fast);
}

.notif-item:not(.notif-read) {
  border-right: 3px solid var(--accent-primary);
}

.notif-item.notif-read {
  opacity: 0.6;
}

.notif-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border-radius: 50%;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-content h4 {
  margin: 0 0 4px;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.notif-content p {
  margin: 0 0 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.notif-content small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.notif-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.notif-btn-read,
.notif-btn-delete {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background var(--transition-fast);
}

.notif-btn-read {
  background: var(--bg-hover);
  color: var(--accent-green);
}

.notif-btn-read:hover {
  background: var(--accent-green);
  color: #fff;
}

.notif-btn-delete {
  background: var(--bg-hover);
  color: var(--danger);
}

.notif-btn-delete:hover {
  background: var(--danger);
  color: #fff;
}

.notif-load-more {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.notif-load-more:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.notif-load-more:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .nav-notification-bell {
    width: 32px;
    height: 32px;
  }

  .notifications-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .notif-item {
    padding: 12px;
  }
}

/* Admin Dashboard */
.admin-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 16px;
}

.admin-title {
  font-size: 1.4rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.admin-title i {
  color: var(--accent-primary);
  margin-left: 8px;
}

.admin-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.admin-nav-link {
  padding: 8px 16px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.admin-nav-link:hover,
.admin-nav-link.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.admin-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}

.admin-stat-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin: 0 auto 10px;
  font-size: 1.2rem;
}

.admin-stat-count {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
}

.admin-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.admin-section {
  margin-bottom: 32px;
}

.admin-section h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.admin-section h2 i {
  color: var(--accent-primary);
  margin-left: 8px;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
}

.admin-table td {
  padding: 10px 12px;
  border-top: 1px solid var(--border-color);
  color: var(--text-primary);
}

.admin-table tr:hover td {
  background: var(--bg-hover);
}

.log-msg {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
}

.badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.admin-view-all {
  display: inline-block;
  margin-top: 12px;
  color: var(--accent-primary);
  text-decoration: none;
  font-size: 0.85rem;
}

.admin-view-all:hover {
  text-decoration: underline;
}

.admin-sync-section {
  margin-bottom: 24px;
}

.admin-sync-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.admin-sync-card h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--text-primary);
}

.admin-sync-card h3 i {
  color: var(--accent-blue);
  margin-left: 8px;
}

.admin-sync-card p {
  margin: 4px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.admin-sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.admin-source-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.admin-source-card.source-disabled {
  opacity: 0.5;
}

.source-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.source-header h3 {
  margin: 0;
  font-size: 1rem;
}

.source-details {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.source-details a {
  color: var(--accent-primary);
  text-decoration: none;
}

@media (max-width: 768px) {
  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-sources-grid {
    grid-template-columns: 1fr;
  }
}

/* =============================================
   Community: Ratings, Comments, Likes
   ============================================= */

/* Stars container */
.stars {
  position: relative;
}

.star-btn {
  transition: color 0.15s ease, transform 0.15s ease, filter 0.15s ease !important;
  position: relative;
}

/* Hover: scale up + glow */
.star-btn:hover {
  transform: scale(1.35);
  filter: drop-shadow(0 0 6px var(--accent-gold));
  z-index: 2;
  color: var(--accent-gold) !important;
}

/* Stars AFTER hovered dim */
.star-btn:hover ~ .star-btn {
  color: var(--text-muted) !important;
  transform: scale(1);
  filter: none;
}

/* Click: press down */
.star-btn:active {
  transform: scale(0.85) !important;
  transition: transform 0.08s !important;
}

/* Pop animation on rating select */
.star-btn.clicked {
  animation: starPop 0.4s ease;
}

@keyframes starPop {
  0%   { transform: scale(1); }
  25%  { transform: scale(1.5); filter: drop-shadow(0 0 12px var(--accent-gold)); }
  50%  { transform: scale(0.9); }
  75%  { transform: scale(1.15); }
  100% { transform: scale(1); filter: drop-shadow(0 0 4px var(--accent-gold)); }
}

/* Ripple ring on click */
.star-btn.ripple::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 30px; height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-gold), transparent 70%);
  opacity: 0;
  animation: starRipple 0.5s ease-out;
  pointer-events: none;
}

@keyframes starRipple {
  0%   { transform: scale(0); opacity: 0.7; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* Active stars glow */
.star-btn.active-star {
  color: var(--accent-gold) !important;
  filter: drop-shadow(0 0 4px rgba(255,215,0,0.4));
}

/* Remove button */
.star-btn-remove {
  transition: color 0.2s, transform 0.2s;
}
.star-btn-remove:hover {
  color: #ff4444 !important;
  transform: scale(1.2);
}

.comment-item {
  transition: border-color 0.2s;
}

.comment-item:hover {
  border-color: var(--accent-primary);
}

.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Advanced Search */
.adv-result-card {
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s !important;
}
.adv-result-card:hover {
  border-color: var(--accent-primary) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#advanced-search-page select,
#advanced-search-page input[type="range"] {
  transition: border-color 0.2s;
}
#advanced-search-page select:focus {
  border-color: var(--accent-primary);
  outline: none;
}
#advanced-search-page input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
#advanced-search-page input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
}

@media (max-width: 768px) {
  .comment-form {
    flex-direction: column;
  }

  .comment-form button {
    align-self: stretch;
  }
}

/* ==================== UX SUITABILITY ==================== */
.detail-section {
  margin-top: 24px;
  padding: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}
.detail-section h3 {
  font-size: 1rem;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}
.detail-summary-text {
  line-height: 1.8;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.ux-suitability {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-hover));
  border-color: var(--accent-primary);
}
.ux-grid {
  display: flex;
  gap: 16px;
}
.ux-card {
  padding: 0;
}
.ux-card-main {
  flex: 1;
}
.ux-card-secondary {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
}
.ux-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.ux-score {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-gold);
  line-height: 1;
}
.ux-stars {
  color: var(--accent-gold);
  font-size: 1.1rem;
  letter-spacing: 2px;
}
.ux-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}
.ux-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.ux-tag {
  padding: 4px 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--text-primary);
}
.ux-meta {
  display: flex;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.ux-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
}
.ux-row span:first-child {
  color: var(--text-muted);
}
.ux-row span:last-child {
  color: var(--text-primary);
  font-weight: 600;
}

/* ==================== AI FACTS ==================== */
.ai-facts-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-fact {
  display: flex;
  gap: 8px;
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 8px 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
}
.ai-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 100px;
  flex-shrink: 0;
}
.ai-label i {
  color: var(--accent-primary);
  width: 16px;
}
.ai-theme-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 0.8rem;
  color: var(--accent-primary);
  text-decoration: none;
  margin: 1px 2px;
}
.ai-theme-tag:hover {
  background: var(--accent-primary);
  color: white;
}

@media (max-width: 768px) {
  .ux-grid {
    flex-direction: column;
  }
  .ux-card-secondary {
    width: auto;
  }
}

/* ==================== MOBILE APP LAYER ==================== */
@media (max-width: 768px) {
  :root {
    --mobile-appbar-h: 56px;
    --mobile-tabbar-h: 64px;
  }

  html {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
  }

  * {
    -webkit-tap-highlight-color: transparent;
  }

  button,
  a,
  input,
  select {
    touch-action: manipulation;
  }

  body {
    padding-bottom: calc(var(--mobile-tabbar-h) + env(safe-area-inset-bottom, 0px));
  }

  .container {
    padding: 0 12px;
  }

  /* APP BAR */
  .navbar {
    background: rgba(13, 13, 16, 0.88);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
  }

  .navbar-inner {
    height: var(--mobile-appbar-h);
    gap: 8px;
  }

  .navbar-logo img {
    height: 34px;
    width: 34px;
    border-radius: 9px;
  }

  .navbar-logo .logo-text {
    font-size: 0.95rem;
    letter-spacing: 0.5px;
  }

  .search-box {
    max-width: none;
    flex: 1;
  }

  .search-box input {
    height: 40px;
    padding: 0 16px;
    border-radius: 22px;
    background: var(--bg-secondary);
    border-color: transparent;
    font-size: 0.85rem;
  }

  .search-box input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.15);
  }

  .search-box button {
    width: 34px;
    height: 34px;
  }

  .search-results-dropdown {
    position: fixed;
    top: 56px;
    left: 12px;
    right: 12px;
    max-height: 60vh;
    overflow-y: auto;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
  }

  .mobile-menu-btn {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  /* BOTTOM TAB BAR */
  .bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    height: var(--mobile-tabbar-h);
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: rgba(13, 13, 16, 0.94);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .bottom-nav-item {
    flex: 1;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    font-size: 0.6rem;
  }

  .bottom-nav-item i {
    font-size: 1.15rem;
    transition: transform 0.2s ease;
  }

  .bottom-nav-item.active i {
    font-size: 1.15rem;
    filter: none;
    transform: translateY(-1px);
  }

  .bottom-nav-item.active {
    color: var(--accent-primary);
  }

  .bottom-nav-item.active::before {
    top: 0;
    width: 40px;
    height: 3px;
    border-radius: 0 0 3px 3px;
  }

  /* HERO */
  #hero-container {
    min-height: 0;
  }

  .hero-section {
    padding: 8px 0 4px;
  }

  .hero-slider {
    height: 260px;
    border-radius: 18px;
    box-shadow: var(--shadow-md);
  }

  .hero-slide-content {
    flex-direction: row;
    align-items: flex-end;
    padding: 14px;
    gap: 12px;
  }

  .hero-cover {
    width: 84px;
    height: 120px;
    border-radius: 10px;
    border: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  }

  .hero-info {
    min-width: 0;
  }

  .hero-info h2 {
    font-size: 1.05rem;
    margin-bottom: 4px;
  }

  .hero-info p {
    display: none;
  }

  .hero-info .btn-read {
    padding: 8px 18px;
    font-size: 0.85rem;
    border-radius: 50px;
  }

  .hero-genres {
    display: none;
  }

  .hero-dots {
    bottom: 8px;
  }

  /* SECTION HEADERS */
  .section-header {
    margin: 16px 0 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    border-image: none;
  }

  .section-header h2 {
    font-size: 1.05rem;
    font-weight: 800;
  }

  .section-header h2 i {
    font-size: 1rem;
  }

  /* CARDS GRID */
  .manhwa-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
  }

  .manhwa-card {
    border-radius: 14px;
    background: var(--bg-card);
    overflow: hidden;
  }

  .manhwa-card:hover {
    transform: none;
    box-shadow: none;
  }

  .manhwa-card-cover {
    aspect-ratio: 3/4;
  }

  .manhwa-card-cover img {
    transition: none;
  }

  .manhwa-card-info {
    padding: 8px 10px 10px;
  }

  .manhwa-card-info h3 {
    font-size: 0.82rem;
    line-height: 1.5;
    -webkit-line-clamp: 2;
    min-height: calc(1.5em * 2);
  }

  .manhwa-card-chapter {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.4) 100%);
    padding: 6px 10px;
  }

  .manhwa-card-chapter span {
    font-size: 0.72rem;
  }

  .manhwa-card-chapter small {
    font-size: 0.62rem;
  }

  .manhwa-card-badge {
    top: 8px;
    right: 8px;
  }

  .badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.62rem;
  }

  /* RECOMMENDED TRACK */
  .rec-card {
    min-width: 118px;
    max-width: 132px;
    border-radius: 12px;
  }

  .rec-cover {
    height: 168px;
  }

  .rec-title {
    font-size: 0.72rem;
  }

  .rec-rank {
    top: 6px;
    right: 6px;
    font-size: 9px;
    padding: 2px 7px;
    border-radius: 5px;
  }

  /* CONTINUE READING */
  .continue-reading-item {
    padding: 10px 12px;
    border-radius: 14px;
  }

  .continue-reading-item img {
    width: 48px;
    height: 68px;
    border-radius: 8px;
  }

  /* DETAIL PAGE */
  .manhwa-detail {
    gap: 16px;
    padding: 16px 0;
  }

  .detail-cover {
    max-width: 160px;
  }

  .detail-cover img {
    border-radius: 14px;
    border-width: 1px;
  }

  .detail-cover .status-badge {
    top: 12px;
    right: 12px;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.72rem;
  }

  .detail-info h1 {
    font-size: 1.3rem;
  }

  .detail-meta-item {
    font-size: 0.8rem;
  }

  .detail-section {
    padding: 14px;
    border-radius: 14px;
  }

  /* CHAPTERS */
  .chapter-item {
    padding: 12px 14px;
    border-radius: 12px;
  }

  /* READER */
  .reader-header {
    padding: 12px 14px;
    border-radius: 14px;
  }

  .reader-header h1 {
    font-size: 0.95rem;
  }

  .reader-nav {
    flex-wrap: wrap;
  }

  .reader-images {
    gap: 4px;
  }

  .reader-images img {
    border-radius: 0;
  }

  /* FILTER */
  .filter-bar {
    padding: 10px;
    border-radius: 14px;
  }

  /* FOOTER */
  .footer {
    margin-bottom: calc(var(--mobile-tabbar-h) + env(safe-area-inset-bottom, 0px));
  }

  .footer-content {
    gap: 20px;
  }

  .footer-section h3 {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  :root {
    --mobile-appbar-h: 52px;
    --mobile-tabbar-h: 60px;
  }

  html {
    font-size: 14px;
  }

  .container {
    padding: 0 10px;
  }

  .navbar-logo img {
    height: 30px;
    width: 30px;
  }

  .search-box input {
    height: 38px;
    font-size: 0.8rem;
  }

  .manhwa-grid {
    gap: 10px;
    /* Phones get 2 columns by default (this is the LAST .manhwa-grid rule
       in the file, so it wins the cascade). The homepage's "أحدث التحديثات"
       grid opts back into a denser 3-per-row layout via .home-updates-grid. */
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .manhwa-grid.home-updates-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .manhwa-card-info {
    padding: 6px 8px 8px;
  }

  .manhwa-card-info h3 {
    font-size: 0.82rem;
    line-height: 1.5;
    -webkit-line-clamp: 2;
    min-height: calc(1.5em * 2);
  }

  .manhwa-card-chapter {
    padding: 4px 8px;
  }

  .manhwa-card-chapter span {
    font-size: 0.72rem;
  }

  .hero-slider {
    height: 220px;
    border-radius: 14px;
  }

  .hero-cover {
    width: 72px;
    height: 104px;
  }

  .hero-info h2 {
    font-size: 0.95rem;
  }

  .hero-info .btn-read {
    padding: 7px 14px;
    font-size: 0.78rem;
  }

  .rec-card {
    min-width: 104px;
    max-width: 116px;
  }

  .rec-cover {
    height: 148px;
  }

  .rec-title {
    font-size: 0.66rem;
  }

  .detail-cover {
    max-width: 140px;
  }
}

/* --- LARGE (min-width: 1024px): cap grid at 4 columns --- */
@media (min-width: 1024px) {
  .manhwa-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
}
/* One Piece imported */

/* deploy 2026-08-26 00:36 */
