/* =========================================================
   AnimeVibesVN - Giao dien web doc manga
   Bang mau lay tu logo kenh: xanh dien + do crimson
   ========================================================= */

/* ---------- CHE DO TOI (mac dinh) ---------- */
:root {
  --nen:        #080b14;
  --nen-2:      #0e1322;
  --nen-3:      #161d31;
  --nen-doc:    #05070d;
  --vien:       #1f2942;
  --chu:        #e8edf7;
  --chu-mo:     #8e9bb8;
  --chu-nhat:   #5f6b87;

  --xanh:       #2f7dff;
  --xanh-sang:  #5b9cff;
  --xanh-dam:   #1b4fd8;
  --do:         #e5323f;
  --do-sang:    #ff5a63;

  --gradient:   linear-gradient(135deg, #2f7dff 0%, #00c6ff 100%);
  --gradient-2: linear-gradient(135deg, #e5323f 0%, #ff7a3d 100%);

  --hop-bong:   0 14px 34px rgba(0, 0, 0, .5);
  --hop-nhan:   0 12px 30px rgba(47, 125, 255, .3);

  --bo-goc:     14px;
  --bo-goc-nho: 9px;
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --rong: 1240px;
}

/* ---------- CHE DO SANG ---------- */
[data-theme="sang"] {
  --nen:        #ffffff;
  --nen-2:      #f4f6fb;
  --nen-3:      #eaeef7;
  --nen-doc:    #f2f4f9;
  --vien:       #dde3ef;
  --chu:        #10141f;
  --chu-mo:     #5c6780;
  --chu-nhat:   #8c96ad;

  --xanh:       #1a5fe0;
  --xanh-sang:  #1a5fe0;
  --xanh-dam:   #0f47b3;
  --do:         #d92330;
  --do-sang:    #d92330;

  --hop-bong:   0 10px 26px rgba(16, 20, 31, .10);
  --hop-nhan:   0 10px 26px rgba(26, 95, 224, .22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--nen);
  color: var(--chu);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.boc {
  width: 100%;
  max-width: var(--rong);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.dau-trang {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--nen) 84%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--vien);
}
.dau-trang .boc {
  display: flex; align-items: center; gap: 18px; height: 66px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 18.5px;
  letter-spacing: -.4px; white-space: nowrap;
}
.logo img {
  width: 38px; height: 38px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px var(--vien);
}
.logo-chu {
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.o-tim { flex: 1; max-width: 400px; position: relative; }
.o-tim input {
  width: 100%; height: 40px;
  padding: 0 16px 0 40px;
  border-radius: 999px;
  border: 1px solid var(--vien);
  background: var(--nen-2);
  color: var(--chu);
  font-family: inherit; font-size: 14px;
  outline: none;
  transition: border-color .18s, background .18s;
}
.o-tim input:focus { border-color: var(--xanh); background: var(--nen-3); }
.o-tim input::placeholder { color: var(--chu-nhat); }
.o-tim .icon-tim {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--chu-nhat); font-size: 15px; pointer-events: none;
}

.day-header { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.nut-tron {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--nen-2);
  border: 1px solid var(--vien);
  color: var(--chu-mo);
  cursor: pointer; font-size: 15px; font-family: inherit;
  transition: transform .16s, border-color .16s, background .16s, color .16s;
}
.nut-tron:hover {
  transform: translateY(-2px);
  border-color: var(--xanh); background: var(--nen-3); color: var(--chu);
}
.nut-tron svg { width: 17px; height: 17px; fill: currentColor; }

/* ---------- Hero gon ---------- */
.hero { padding: 40px 0 10px; position: relative; overflow: hidden; }
.hero::before {
  content: "";
  position: absolute; inset: -60% 30% auto -15%; height: 380px;
  background: radial-gradient(ellipse at center, rgba(47,125,255,.22), transparent 66%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute; inset: -50% -10% auto 45%; height: 340px;
  background: radial-gradient(ellipse at center, rgba(229,50,63,.14), transparent 66%);
  pointer-events: none;
}
[data-theme="sang"] .hero::before { opacity: .5; }
[data-theme="sang"] .hero::after  { opacity: .45; }
.hero .boc { position: relative; }
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 4.4vw, 38px);
  line-height: 1.15; letter-spacing: -1px; font-weight: 800;
}
.hero h1 span {
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { margin: 0; color: var(--chu-mo); font-size: 15.5px; max-width: 620px; }
.the-nho {
  display: inline-block; padding: 5px 13px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--xanh) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--xanh) 34%, transparent);
  color: var(--xanh-sang);
  font-size: 11.5px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase;
  margin-bottom: 14px;
}

/* ---------- Tieu de khu vuc ---------- */
.tieu-de-khu {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin: 34px 0 20px;
}
.tieu-de-khu h2 {
  margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.3px;
  display: flex; align-items: center; gap: 10px;
}
.tieu-de-khu h2::before {
  content: ""; width: 4px; height: 20px;
  border-radius: 3px; background: var(--gradient);
}
.dem { color: var(--chu-mo); font-size: 13px; font-weight: 500; }

/* ---------- Luoi truyen ---------- */
.luoi {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 24px 18px;
}
.the-truyen { display: block; }
.the-truyen .bia {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--bo-goc);
  overflow: hidden;
  background: var(--nen-3);
  border: 1px solid var(--vien);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.the-truyen:hover .bia {
  transform: translateY(-6px);
  border-color: var(--xanh);
  box-shadow: var(--hop-nhan);
}
.the-truyen .bia img { width: 100%; height: 100%; object-fit: cover; }
.the-truyen .khong-bia {
  display: grid; place-items: center; height: 100%;
  color: var(--chu-nhat); font-size: 34px;
}
.the-truyen .so-chuong {
  position: absolute; left: 8px; bottom: 8px;
  padding: 4px 9px; border-radius: 8px;
  background: rgba(8, 11, 20, .86);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 11.5px; font-weight: 700;
}
.the-truyen h3 {
  margin: 11px 0 3px;
  font-size: 14.5px; font-weight: 700; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color .16s;
}
.the-truyen:hover h3 { color: var(--xanh-sang); }
.the-truyen .phu { color: var(--chu-mo); font-size: 12.5px; }

/* ---------- Trang chi tiet truyen ---------- */
.chi-tiet {
  display: grid; grid-template-columns: 258px 1fr;
  gap: 32px; padding: 34px 0 8px;
}
.chi-tiet .bia-lon {
  border-radius: var(--bo-goc); overflow: hidden;
  border: 1px solid var(--vien); background: var(--nen-3);
  aspect-ratio: 2 / 3; box-shadow: var(--hop-bong);
}
.chi-tiet .bia-lon img { width: 100%; height: 100%; object-fit: cover; }
.chi-tiet h1 {
  margin: 0 0 10px;
  font-size: clamp(23px, 3.6vw, 32px);
  letter-spacing: -.7px; font-weight: 800; line-height: 1.2;
}
.thong-so { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.thong-so span {
  padding: 5px 12px; border-radius: 999px;
  background: var(--nen-2); border: 1px solid var(--vien);
  font-size: 12.5px; color: var(--chu-mo);
}
.thong-so span b { color: var(--chu); font-weight: 600; }
.the-loai { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.the-loai i {
  font-style: normal; padding: 5px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--xanh) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--xanh) 30%, transparent);
  color: var(--xanh-sang); font-size: 12.5px; font-weight: 600;
}
.mo-ta { color: var(--chu-mo); margin: 0 0 22px; white-space: pre-line; max-width: 720px; }

.nut {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--bo-goc-nho);
  font-weight: 700; font-size: 14.5px; font-family: inherit;
  border: 1px solid var(--vien); background: var(--nen-2); color: var(--chu);
  cursor: pointer;
  transition: transform .16s, border-color .16s, background .16s, opacity .16s, box-shadow .16s;
}
.nut:hover { transform: translateY(-2px); border-color: var(--xanh); background: var(--nen-3); }
.nut.chinh { background: var(--gradient); border-color: transparent; color: #fff; }
.nut.chinh:hover { opacity: .93; box-shadow: var(--hop-nhan); }
.nut:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.hang-nut { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Danh sach chuong ---------- */
.ds-chuong { display: grid; gap: 8px; margin: 8px 0 40px; }
.ds-chuong a {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 13px 16px;
  border-radius: var(--bo-goc-nho);
  background: var(--nen-2); border: 1px solid var(--vien);
  transition: border-color .16s, background .16s, transform .16s;
}
.ds-chuong a:hover {
  border-color: var(--xanh); background: var(--nen-3); transform: translateX(3px);
}
.ds-chuong .ten-chuong { font-weight: 600; font-size: 14.5px; }
.ds-chuong .so-trang { color: var(--chu-mo); font-size: 12.5px; white-space: nowrap; }

/* ---------- Trinh doc ---------- */
body.doc { background: var(--nen-doc); }
.thanh-doc {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--nen-doc) 92%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--vien);
}
.thanh-doc .boc {
  display: flex; align-items: center; gap: 10px;
  height: 58px; max-width: 1400px;
}
.thanh-doc .ten-bo {
  font-weight: 700; font-size: 14.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 240px;
}
.thanh-doc select {
  height: 36px; padding: 0 12px;
  border-radius: var(--bo-goc-nho);
  background: var(--nen-2); color: var(--chu);
  border: 1px solid var(--vien);
  font-family: inherit; font-size: 13.5px;
  outline: none; cursor: pointer; max-width: 250px;
}
.thanh-doc select:focus { border-color: var(--xanh); }
.nut-nho {
  height: 36px; padding: 0 13px;
  border-radius: var(--bo-goc-nho);
  background: var(--nen-2); color: var(--chu);
  border: 1px solid var(--vien);
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  transition: border-color .16s, background .16s;
}
.nut-nho:hover:not(:disabled) { border-color: var(--xanh); background: var(--nen-3); }
.nut-nho:disabled { opacity: .35; cursor: not-allowed; }
.day-phai { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.khung-doc { margin: 0 auto; padding: 0 0 40px; }
.khung-doc img {
  width: 100%; height: auto; margin: 0 auto; display: block;
  background: var(--nen-2);
  min-height: 60px;
}
.khung-doc.rong-vua  { max-width: 800px; }
.khung-doc.rong-lon  { max-width: 1100px; }
.khung-doc.rong-full { max-width: 100%; }

.khung-doc.lat-trang { display: grid; place-items: center; min-height: calc(100vh - 130px); }
.khung-doc.lat-trang img { display: none; }
.khung-doc.lat-trang img.hien {
  display: block; max-height: calc(100vh - 130px);
  width: auto; object-fit: contain;
}

.chan-doc {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; flex-wrap: wrap;
  padding: 26px 20px 60px;
  border-top: 1px solid var(--vien);
  margin-top: 20px;
}

/* ---------- Trang thai ---------- */
.trang-thai { text-align: center; padding: 70px 20px; color: var(--chu-mo); }
.trang-thai .to { font-size: 44px; margin-bottom: 14px; }
.trang-thai h3 { color: var(--chu); margin: 0 0 8px; font-size: 18px; }
.trang-thai p { margin: 0 0 18px; }
.trang-thai code {
  background: var(--nen-3); border: 1px solid var(--vien);
  padding: 2px 7px; border-radius: 6px;
  font-size: 13px; color: var(--xanh-sang);
}

/* ---------- Footer ---------- */
.chan-trang {
  border-top: 1px solid var(--vien);
  margin-top: 56px; padding: 34px 0 40px;
  background: var(--nen-2);
}
.chan-trang .boc {
  display: flex; flex-wrap: wrap; gap: 24px;
  align-items: center; justify-content: space-between;
}
.chan-trang .gioi-thieu { max-width: 460px; }
.chan-trang .gioi-thieu p { color: var(--chu-mo); font-size: 13.5px; margin: 10px 0 0; }
.chan-mxh { display: flex; gap: 10px; flex-wrap: wrap; }
.chan-mxh a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: var(--bo-goc-nho);
  background: var(--nen-3); border: 1px solid var(--vien);
  font-size: 13.5px; font-weight: 600;
  transition: transform .16s, border-color .16s;
}
.chan-mxh a:hover { transform: translateY(-2px); border-color: var(--xanh); }
.chan-mxh svg { width: 16px; height: 16px; fill: currentColor; }
.ban-quyen {
  width: 100%; text-align: center; color: var(--chu-nhat);
  font-size: 12.5px; margin-top: 6px;
}

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .chi-tiet { grid-template-columns: 1fr; gap: 20px; }
  .chi-tiet .bia-lon { max-width: 190px; }
}
@media (max-width: 680px) {
  .boc { padding: 0 14px; }
  .dau-trang .boc { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
  .o-tim { order: 3; flex: 1 1 100%; max-width: none; }
  .luoi { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 18px 12px; }
  /* Thanh doc tren dien thoai: bo bot nut cho khoi tran man hinh.
     Chuyen chuong da co san o cuoi trang doc. */
  .thanh-doc .ten-bo { display: none; }
  .thanh-doc .nhan-che { display: none; }
  .thanh-doc #ch-truoc,
  .thanh-doc #ch-sau,
  .thanh-doc #doi-rong { display: none; }
  .thanh-doc .boc { gap: 8px; }
  .thanh-doc select { flex: 1 1 auto; max-width: none; min-width: 0; }
  .khung-doc.rong-vua, .khung-doc.rong-lon { max-width: 100%; }
  .chan-trang .boc { flex-direction: column; align-items: flex-start; }
}
