:root {
  --bg: #000000;
  --header-bg: rgba(10, 10, 10, 0.98);
  --card: #111111;
  --accent: #007bff;
  --text: #ffffff;
  --secondary-text: #94a3b8;
  --border: #222;
}
* { box-sizing: border-box; }
body {
  font-family: 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }

/* HEADER */
header {
  background: var(--header-bg);
  padding: 15px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.logo { font-size: 1.25rem; font-weight: 800; text-decoration: none; }
.logo .white { color: #ffffff; }
.logo .blue { color: var(--accent); }

/* SEARCH */
.search-form { width: 100%; margin-bottom: 15px; }
.search-input {
  width: 100%;
  background: #1a1a1a;
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: 25px;
  color: #fff;
  font-size: 0.9rem;
  text-align: center;
  outline: none;
  transition: 0.3s;
}
.search-input::placeholder { color: var(--secondary-text); }
.search-input:focus { border-color: var(--accent); text-align: left; }

/* QUICK NAV */
.quick-nav {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 5px;
}
.quick-nav::-webkit-scrollbar { display: none; }
.nav-btn {
  background: #111;
  border: 1px solid var(--border);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  transition: 0.2s;
  cursor: pointer;
}
.nav-btn:hover { border-color: var(--accent); color: var(--accent); }
.nav-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.nav-btn.active:hover { color: #fff; }

.content { padding-bottom: 20px; max-width: 1200px; margin: 0 auto; }

/* HERO SECTION */
.hero-wrapper { position: relative; width: 100%; margin-bottom: 25px; }
.hero-container {
  width: 100%;
  overflow-x: auto;
  display: flex;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.hero-container::-webkit-scrollbar { display: none; }
.hero-slide {
  min-width: 100%;
  scroll-snap-align: center;
  padding: 30px 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  position: relative;
  min-height: 220px;
  overflow: hidden;
  cursor: pointer;
}
.hero-slide-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-size: cover;
  background-position: center;
  filter: blur(5px) brightness(0.4);
  z-index: 0;
  transform: scale(1.05);
}
.hero-content { flex: 1; z-index: 2; min-width: 0; }
.hero-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.3;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-desc {
  font-size: 0.8rem;
  color: #ccc;
  margin-bottom: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.btn-read {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 8px 18px;
  border-radius: 20px;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.8rem;
}
.hero-img {
  width: 110px;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 12px;
  z-index: 2;
  border: 1px solid rgba(255,255,255,0.1);
  background: #111;
}
.hero-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: -15px;
  position: relative;
  z-index: 5;
  padding-bottom: 10px;
}
.dot {
  width: 6px;
  height: 6px;
  background: #444;
  border-radius: 50%;
  transition: 0.3s;
}
.dot.active { background: var(--accent); width: 16px; border-radius: 3px; }

/* SECTION / SLIDER GRID */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 15px 12px 15px;
  gap: 10px;
}
.section-title {
  font-size: 1rem;
  border-left: 4px solid var(--accent);
  padding-left: 10px;
  text-transform: uppercase;
  margin: 0;
}
.see-all {
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: bold;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
}
.slider-section { margin-bottom: 25px; }
.slider-grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 15px 10px 15px;
  scrollbar-width: none;
}
.slider-grid::-webkit-scrollbar { display: none; }
.populer-card {
  min-width: 135px;
  max-width: 135px;
  text-decoration: none;
  color: inherit;
  position: relative;
  cursor: pointer;
}
.type-tag {
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(30, 41, 59, 0.8);
  color: #fff;
  font-size: 0.65rem;
  padding: 3px 8px;
  border-bottom-right-radius: 8px;
  z-index: 5;
  backdrop-filter: blur(4px);
}
.populer-card img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #111;
  display: block;
}
.populer-info { margin-top: 8px; text-align: left; }
.populer-title {
  font-size: 0.85rem;
  font-weight: bold;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.2;
}
.populer-meta { font-size: 0.72rem; color: var(--secondary-text); margin-top: 3px; }

/* CONTROLS + GRID */
.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 0 15px 12px;
}
.controls select {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #111;
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
}
.stats { color: var(--secondary-text); font-size: 0.8rem; }
.stats b { color: var(--text); }
#updated { text-align: center; padding: 4px 15px 16px; }
.grid {
  display: grid;
  gap: 12px;
  padding: 0 15px;
  grid-template-columns: repeat(3, 1fr);
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(6, 1fr); } }
.grid .populer-card { min-width: 0; max-width: none; }
.btn {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #111;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.load-wrap { text-align: center; padding: 24px 0 8px; }
.empty { text-align: center; color: var(--secondary-text); padding: 48px 16px; }
.loading { padding: 15px; text-align: center; color: var(--secondary-text); font-size: 0.85rem; }

footer {
  text-align: center;
  padding: 30px 15px;
  background: #0a0a0a;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--secondary-text);
}

/* MODAL */
.modal-back {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.78);
  display: none; align-items: flex-start; justify-content: center;
  padding: 24px 12px; overflow-y: auto;
}
.modal-back.open { display: flex; }
.modal {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 760px;
  width: 100%;
  padding: 20px;
  position: relative;
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px;
  border-radius: 50%; border: 1px solid var(--border);
  background: #111; color: var(--text);
  cursor: pointer; font-size: 18px; line-height: 1;
}
.modal-top { display: flex; gap: 16px; flex-wrap: wrap; }
.modal-top img {
  width: 160px; border-radius: 12px; object-fit: cover;
  aspect-ratio: 3/4; background: #111; border: 1px solid var(--border);
}
.modal-info { flex: 1; min-width: 240px; }
.modal-info h2 { margin: 0 0 6px; font-size: 22px; line-height: 1.25; }
.modal-info .alt { color: var(--secondary-text); font-size: 13px; margin-bottom: 10px; }
.modal-info p { margin: 6px 0; font-size: 14px; }
.modal-info p b { color: var(--secondary-text); font-weight: 600; }
.modal-desc { margin-top: 16px; font-size: 14px; white-space: pre-wrap; color: #ccc; line-height: 1.5; }
.chapters { margin-top: 16px; }
.chapters h3 { margin: 0 0 8px; font-size: 15px; }
.ch-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 6px; color: var(--text); font-size: 14px;
  background: #111;
}
.ch-row:hover { border-color: var(--accent); text-decoration: none; background: #1a1a1a; }
.ch-row span { color: var(--secondary-text); font-size: 13px; white-space: nowrap; }
.ch-empty { color: var(--secondary-text); font-size: 14px; padding: 8px 0; }
#chMore { margin-top: 10px; }
.modal-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 560px) {
  .modal-top { flex-direction: column; align-items: center; text-align: center; }
  .modal-info { min-width: 0; width: 100%; }
  .modal-actions { justify-content: center; }
  .hero-slide { padding: 30px 20px; }
}

/* READER */
.reader { max-width: 800px; margin: 0 auto; }
.reader img { display: block; width: 100%; height: auto; min-height: 160px; background: #111; }
.rbar {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px;
  align-items: center; padding: 12px 15px;
}
.rbar > :first-child { justify-self: start; }
.rbar > :last-child { justify-self: end; }
.rtitle { text-align: center; padding: 14px 15px 0; line-height: 1.3; }
.rtitle span { display: block; font-size: 0.78rem; color: var(--secondary-text); }
.rtitle b { font-size: 1.05rem; }
.error { margin: 15px; padding: 18px; border: 1px dashed var(--accent); border-radius: 10px; text-align: center; font-size: 0.85rem; color: var(--secondary-text); }
.pbtn {
  background: #111; border: 1px solid var(--border); color: #fff;
  padding: 8px 16px; border-radius: 20px; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.pbtn.main { background: var(--accent); border-color: var(--accent); }
.pbtn.off { opacity: 0.35; pointer-events: none; }

@media (min-width: 768px) {
  .hero-slide { padding: 40px 15%; gap: 50px; }
  .hero-img { width: 180px; }
  .hero-title { font-size: 2.2rem; }
}
