/* Trang đọc chương — nền tối, ảnh xếp dọc liên tục (webtoon). */
* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  margin: 0;
  background: #14110e;
  color: #e8e2d6;
}

header.rd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #1c1815;
  border-bottom: 1px solid #2c2620;
  position: sticky;
  top: 0;
  z-index: 5;
}

header.rd a.home {
  color: #d8642a;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

header.rd select {
  background: #14110e;
  color: #e8e2d6;
  border: 1px solid #2c2620;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: .9rem;
  max-width: 45vw;
}

.crumb {
  max-width: 820px;
  margin: 10px auto 0;
  padding: 0 16px;
  font-size: .8rem;
  color: #9a8f7f;
}

.crumb a { color: #9a8f7f; text-decoration: none; }
.crumb a:hover { color: #d8642a; }
.crumb span.sep { opacity: .5; }

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
}

main h1 {
  font-size: 1rem;
  font-weight: 600;
  color: #cbc2b2;
  margin: 10px 16px 8px;
  text-align: center;
}

main img {
  display: block;
  width: 100%;
  max-width: 820px;
  height: auto;
  background: #1c1815;
  /* Ảnh chưa có Width/Height trong DB -> giữ khung theo tỉ lệ manga phổ biến, chặn nhảy layout.
     object-fit: contain -> khung sai tỉ lệ thì letterbox chứ KHÔNG kéo giãn ảnh (hết méo). */
  aspect-ratio: 800 / 1200;
  object-fit: contain;
}

/* Có Width/Height (từ DB) HOẶC ảnh đã load xong (JS thêm class) -> dùng tỉ lệ thật */
main img.sized { aspect-ratio: auto; }

.nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 22px 12px 40px;
  flex-wrap: wrap;
}

.nav a, .nav button {
  padding: 11px 22px;
  font-size: .95rem;
  cursor: pointer;
  border: 1px solid #2c2620;
  background: #221d19;
  color: #e8e2d6;
  border-radius: 8px;
  text-decoration: none;
  display: inline-block;
}

.nav a.primary {
  background: #d8642a;
  border-color: #d8642a;
  color: #fff;
  font-weight: 700;
}

.nav a.disabled {
  opacity: .35;
  pointer-events: none;
}

#error { padding: 40px 16px; color: #ff8f6b; text-align: center; }
