/* Giao diện "long lanh": nền chuyển màu hồng tím, khung kính mờ, chữ ánh nhũ, cánh hoa rơi */
:root {
  --nen-1: #fff4f7;
  --nen-2: #f4edff;
  --nen-3: #fff1e4;
  --kinh: rgba(255, 255, 255, .62);
  --kinh-dam: rgba(255, 255, 255, .86);
  --vien-kinh: rgba(255, 255, 255, .9);
  --chu: #4a2c44;
  --chu-nhat: #8f7088;
  --hong: #f2668f;
  --hong-dam: #d9467a;
  --tim: #a184f5;
  --vang: #f6b85f;
  --nhu: linear-gradient(120deg, #f2668f 0%, #b07cf2 45%, #f6b85f 100%);
  --nut: linear-gradient(135deg, #ff86ab 0%, #e95b8e 55%, #b77cf0 100%);
  --bong: 0 10px 30px -12px rgba(201, 84, 136, .35), 0 2px 6px rgba(120, 60, 110, .06);
  --bong-sang: 0 0 0 1px rgba(255, 255, 255, .7) inset;
  --chu-doc: 19px;
}
body.toi {
  --nen-1: #170d21;
  --nen-2: #241236;
  --nen-3: #2a1226;
  --kinh: rgba(46, 26, 58, .55);
  --kinh-dam: rgba(34, 20, 44, .9);
  --vien-kinh: rgba(255, 255, 255, .1);
  --chu: #f7e8f2;
  --chu-nhat: #bba2b8;
  --hong: #ff8db3;
  --hong-dam: #ffa8c6;
  --tim: #b9a1ff;
  --bong: 0 10px 34px -12px rgba(0, 0, 0, .6);
  --bong-sang: 0 0 0 1px rgba(255, 255, 255, .06) inset;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  color: var(--chu);
  font-family: "Be Vietnam Pro", system-ui, sans-serif; font-size: 16px; line-height: 1.6;
  background-color: var(--nen-1);
  background-image:
    radial-gradient(60vw 50vw at 0% 0%, rgba(255, 170, 200, .45), transparent 60%),
    radial-gradient(55vw 45vw at 100% 10%, rgba(190, 160, 255, .38), transparent 60%),
    radial-gradient(70vw 50vw at 50% 100%, rgba(255, 205, 160, .35), transparent 60%),
    linear-gradient(180deg, var(--nen-1), var(--nen-2) 50%, var(--nen-3));
  background-attachment: fixed;
  overflow-x: hidden;
}
body.toi {
  background-image:
    radial-gradient(60vw 50vw at 0% 0%, rgba(214, 70, 140, .25), transparent 60%),
    radial-gradient(55vw 45vw at 100% 10%, rgba(120, 80, 230, .25), transparent 60%),
    radial-gradient(1px 1px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 20%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 85% 60%, #fff, transparent), radial-gradient(1px 1px at 40% 80%, #fff, transparent),
    linear-gradient(180deg, var(--nen-1), var(--nen-2) 55%, var(--nen-3));
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
.phu { color: var(--chu-nhat); font-size: 14px; }

.kinh {
  background: var(--kinh);
  -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--vien-kinh);
  box-shadow: var(--bong), var(--bong-sang);
}
.nhu {
  background: var(--nhu); background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: anh-nhu 6s linear infinite;
}
@keyframes anh-nhu { to { background-position: 200% center; } }

/* Cánh hoa rơi và ánh sao */
#hoa-roi { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
#hoa-roi i {
  position: absolute; top: -40px; width: 14px; height: 12px;
  background: radial-gradient(circle at 30% 30%, #fff 0 12%, #ffc1d4 40%, #f58fb1 100%);
  border-radius: 80% 0 80% 0; opacity: .75;
  animation: roi linear infinite;
}
body.toi #hoa-roi i { opacity: .45; }
@keyframes roi {
  0% { transform: translate(0, 0) rotate(0); }
  50% { transform: translate(40px, 55vh) rotate(200deg); }
  100% { transform: translate(-20px, 110vh) rotate(400deg); }
}
.sao { position: absolute; color: #fff; text-shadow: 0 0 8px #ffd1e2, 0 0 14px #f6b85f; animation: lap-lanh 2.6s ease-in-out infinite; pointer-events: none; }
@keyframes lap-lanh { 0%, 100% { opacity: .25; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) {
  #hoa-roi { display: none; }
  .nhu, .sao, .nut.to::after { animation: none !important; }
}

header, main, footer, #len-dau { position: relative; z-index: 1; }

/* Phần đầu trang */
#dau {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--nen-1) 70%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--vien-kinh);
}
.dau-trong { max-width: 1080px; margin: 0 auto; padding: 10px 16px 6px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; }
.logo svg { width: 34px; height: 34px; filter: drop-shadow(0 2px 6px rgba(242, 102, 143, .45)); }
.logo span { font-family: "Dancing Script", cursive; font-weight: 700; font-size: 27px; line-height: 1; }
.tim { order: 3; flex-basis: 100%; position: relative; }
.tim input {
  width: 100%; padding: 10px 16px 10px 40px; border-radius: 999px; font: inherit; font-size: 15px; color: var(--chu);
  background: var(--kinh-dam); border: 1px solid var(--vien-kinh); box-shadow: var(--bong-sang);
}
.tim::before { content: "⌕"; position: absolute; left: 15px; top: 50%; transform: translateY(-52%); font-size: 19px; color: var(--hong); }
.tim input:focus { outline: 2px solid var(--hong); outline-offset: 1px; }
.nut-toi {
  margin-left: auto; width: 40px; height: 40px; border-radius: 50%; font-size: 17px;
  background: var(--kinh-dam); border: 1px solid var(--vien-kinh); box-shadow: var(--bong);
}
.menu { display: flex; gap: 6px; overflow-x: auto; max-width: 1080px; margin: 0 auto; padding: 2px 12px 10px; scrollbar-width: none; }
.menu::-webkit-scrollbar { display: none; }
.menu a { padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; white-space: nowrap; color: var(--chu-nhat); transition: .2s; }
.menu a:hover { color: var(--hong-dam); background: var(--kinh); }
.menu a.chon { color: #fff; background: var(--nut); box-shadow: 0 4px 14px -4px rgba(233, 91, 142, .6); }
@media (min-width: 760px) {
  .tim { order: 0; flex-basis: auto; width: 340px; margin-left: auto; }
  .nut-toi { margin-left: 0; }
}

main { max-width: 1080px; margin: 0 auto; padding: 22px 16px 56px; }
section { margin-top: 38px; }
.tieu-de-muc { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-family: "Playfair Display", serif; font-size: 23px; font-weight: 700; }
.tieu-de-muc::before { content: "✦"; color: var(--vang); font-size: 16px; text-shadow: 0 0 10px rgba(246, 184, 95, .8); }
.tieu-de-muc::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(242, 102, 143, .45), transparent); }

/* Khung chào trang chủ */
.chao { position: relative; border-radius: 28px; padding: 34px 24px; overflow: hidden; display: grid; gap: 26px; align-items: center; }
.chao::before {
  content: ""; position: absolute; width: 380px; height: 380px; right: -120px; top: -160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 160, 195, .55), transparent 65%); pointer-events: none;
}
.chao .nho-tren { font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--hong-dam); }
.chao h1 { font-family: "Dancing Script", cursive; line-height: 1.05; margin-top: 6px; padding-bottom: 4px; }
.chao .khau-hieu { font-family: "Playfair Display", serif; font-style: italic; font-size: 19px; color: var(--chu-nhat); margin: 8px 0 0; }
.chao .hang-nut { margin-top: 22px; }
.chao-bia { position: relative; justify-self: center; width: 200px; order: -1; }
.chao h1 { font-size: 46px; }
.chao .hang-nut .nut { padding: 11px 18px; font-size: 14px; }
.chao-bia .bia { transform: rotate(4deg); box-shadow: 0 24px 50px -18px rgba(201, 84, 136, .65); }
.chao-bia .bia.sau { position: absolute; inset: 0; transform: rotate(-7deg) translate(-26px, 10px); opacity: .7; filter: blur(.3px); }
@media (min-width: 760px) {
  .chao { grid-template-columns: 1fr 260px; padding: 48px 48px; }
  .chao h1 { font-size: 76px; }
  .chao-bia { width: 230px; order: 0; }
  .chao .hang-nut .nut { padding: 12px 22px; font-size: 15px; }
}

.chip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.chip a {
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--kinh-dam); border: 1px solid var(--vien-kinh); transition: .2s;
}
.chip a:hover { color: var(--hong-dam); transform: translateY(-1px); }
.chip a.chon { color: #fff; background: var(--nut); border-color: transparent; }

/* Thẻ truyện và bìa */
.luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 18px; }
@media (min-width: 760px) { .luoi { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }
.the { display: block; }
.the h3 { font-size: 15px; font-weight: 600; margin-top: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.the .phu { margin: 3px 0 0; font-size: 13px; }
.the:hover .bia { transform: translateY(-6px) rotate(-1deg); box-shadow: 0 22px 40px -16px rgba(201, 84, 136, .7); }

.bia {
  position: relative; aspect-ratio: 2 / 3; border-radius: 16px; overflow: hidden; container-type: inline-size;
  box-shadow: var(--bong); transition: transform .35s, box-shadow .35s;
  background: linear-gradient(165deg, #ffd3e0, #d9c8ff);
}
.bia img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bia::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%);
  transform: translateX(-120%); transition: transform .9s;
}
.the:hover .bia::after, .chao-bia:hover .bia::after { transform: translateX(120%); }
/* Khung kiểu bìa sách: viền vàng mảnh, tên truyện ở trên, tác giả ở dưới */
.bia::before {
  content: ""; position: absolute; inset: 4.5cqw; z-index: 2; pointer-events: none;
  border: 1px solid rgba(255, 226, 160, .85); border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .25) inset, 0 0 12px rgba(255, 210, 140, .35);
}
.bia .ten-bia {
  position: absolute; inset: 0 0 auto 0; z-index: 1; padding: 13cqw 9cqw 22cqw; text-align: center;
  font-family: "Playfair Display", serif; font-weight: 700; font-size: 9.5cqw; line-height: 1.22; color: #fff;
  text-shadow: 0 2px 10px rgba(90, 20, 50, .75), 0 0 22px rgba(255, 190, 210, .55);
  background: linear-gradient(rgba(60, 15, 40, .62), rgba(60, 15, 40, .28) 60%, transparent);
}
.bia .ten-bia::after { content: "✦"; display: block; margin-top: 3cqw; font-size: 6cqw; color: #ffe2a0; text-shadow: 0 0 10px rgba(255, 210, 140, .9); }
.bia .tac-gia {
  position: absolute; inset: auto 0 0 0; z-index: 1; padding: 16cqw 0 9cqw; text-align: center;
  font-family: "Dancing Script", cursive; font-weight: 700; font-size: 8cqw; color: #ffe9c2;
  text-shadow: 0 1px 8px rgba(60, 15, 40, .8);
  background: linear-gradient(transparent, rgba(60, 15, 40, .55));
}
.bia .nhan-bia {
  position: absolute; top: 7cqw; right: 7cqw; z-index: 3; font-size: 11px; font-weight: 600; color: #fff;
  padding: 2px 8px; border-radius: 999px; background: rgba(242, 102, 143, .75);
  border: 1px solid rgba(255, 255, 255, .6);
}
.bia .nhan-bia { display: none; }

/* Đề cử */
.de-cu { display: grid; gap: 20px; padding: 20px; border-radius: 24px; }
.de-cu .bia { width: 150px; }
.de-cu h3 { font-family: "Playfair Display", serif; font-size: 22px; }
.de-cu .mo-ta { font-family: "Lora", serif; font-size: 16px; line-height: 1.75; margin: 10px 0 0; }
@media (min-width: 620px) { .de-cu { grid-template-columns: 170px 1fr; padding: 26px; } .de-cu .bia { width: 100%; } }

.sap-ra { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.sap-ra .o { padding: 16px; border-radius: 20px; position: relative; overflow: hidden; display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: start; }
.sap-ra .bia .ten-bia, .sap-ra .bia .nhan-bia, .sap-ra .bia .tac-gia, .sap-ra .bia::before { display: none; }
.sap-ra .o::after { content: "Sắp ra mắt"; position: absolute; top: 14px; right: -34px; transform: rotate(35deg); background: var(--nut); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 38px; }
.sap-ra h3 { font-family: "Playfair Display", serif; font-size: 17px; padding-right: 50px; }
.sap-ra p { margin: 8px 0 0; font-size: 14px; color: var(--chu-nhat); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

.doc-tiep { display: grid; gap: 10px; }
.doc-tiep a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 15px 18px; border-radius: 18px; transition: .2s; }
.doc-tiep a:hover { transform: translateX(3px); }
.doc-tiep span { color: var(--hong-dam); font-weight: 600; font-size: 14px; white-space: nowrap; }

.trong { text-align: center; color: var(--chu-nhat); padding: 40px 0; }

/* Nút */
.hang-nut { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.nut {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 22px; border-radius: 999px; font-weight: 600; font-size: 15px;
  background: var(--kinh-dam); border: 1px solid var(--vien-kinh); box-shadow: var(--bong-sang); transition: transform .2s, box-shadow .2s;
}
.nut:hover { transform: translateY(-2px); }
.nut.to { color: #fff; background: var(--nut); border-color: transparent; box-shadow: 0 10px 24px -10px rgba(233, 91, 142, .8); }
.nut.to::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: lua-sang 3.2s ease-in-out infinite;
}
@keyframes lua-sang { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.nut[aria-disabled="true"] { opacity: .4; pointer-events: none; }

/* Trang giới thiệu truyện */
.gioi-thieu { display: grid; gap: 24px; padding: 24px; border-radius: 28px; position: relative; overflow: hidden; }
.gioi-thieu .bia { width: 62%; max-width: 230px; margin: 0 auto; box-shadow: 0 24px 50px -18px rgba(201, 84, 136, .65); }
.gioi-thieu h1 { font-family: "Playfair Display", serif; font-size: 30px; }
.gioi-thieu .mo-ta { font-family: "Lora", serif; font-size: 17px; line-height: 1.8; }
.gioi-thieu .chip { margin-top: 14px; }
@media (min-width: 760px) { .gioi-thieu { grid-template-columns: 240px 1fr; padding: 34px; align-items: start; } .gioi-thieu .bia { width: 100%; } }

.ds-chuong { list-style: none; margin: 0; padding: 6px; border-radius: 22px; }
.ds-chuong a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 14px; transition: .2s; }
.ds-chuong a:hover { background: var(--kinh-dam); }
.ds-chuong .so { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 10px; border-radius: 50%; font-size: 13px; font-weight: 700; color: var(--hong-dam); background: rgba(242, 102, 143, .12); }
.ds-chuong .dang-doc { color: var(--hong-dam); font-weight: 600; }
.ds-chuong .khoa-nho { font-size: 12px; color: var(--chu-nhat); white-space: nowrap; }

/* Trang đọc */
#tien-do { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 30; background: var(--nhu); box-shadow: 0 0 10px rgba(242, 102, 143, .7); }
.giay { max-width: 740px; margin: 0 auto; padding: 28px 20px 34px; border-radius: 28px; background: var(--kinh-dam); }
@media (min-width: 760px) { .giay { padding: 46px 56px 50px; } }
.duong-dan { font-size: 14px; color: var(--chu-nhat); text-align: center; }
.duong-dan a { color: var(--hong-dam); font-weight: 500; }
.giay h1 { font-family: "Playfair Display", serif; font-size: 28px; text-align: center; margin-top: 8px; }
.hoa-van { text-align: center; color: var(--hong); letter-spacing: .5em; margin: 12px 0 0; font-size: 13px; }
.cong-cu { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; color: var(--chu-nhat); }
.cong-cu button { width: 38px; height: 32px; border-radius: 10px; background: var(--kinh); border: 1px solid var(--vien-kinh); }

.van { margin-top: 28px; font-family: "Lora", serif; font-size: var(--chu-doc); line-height: 1.9; }
.van p { margin: 0 0 1.05em; }
.van > p:first-child::first-letter { font-family: "Playfair Display", serif; float: left; font-size: 3.3em; line-height: .9; padding: 6px 8px 0 0; color: var(--hong-dam); }
.van .ngat { text-align: center; color: var(--hong); letter-spacing: .8em; margin: 1.8em 0; }
.van-mo { position: relative; max-height: 15em; overflow: hidden; }
.van-mo::after { content: ""; position: absolute; inset: auto 0 0 0; height: 9em; background: linear-gradient(transparent, var(--kinh-dam)); }
.het { text-align: center; color: var(--chu-nhat); font-style: italic; font-family: "Lora", serif; margin-top: 26px; }

.dieu-huong { max-width: 740px; margin: 26px auto 0; display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; }
.dieu-huong .nut { padding: 12px 10px; font-size: 14px; }

/* Hộp khóa chương */
.khoa {
  position: relative; text-align: center; margin: 26px auto 0; padding: 32px 22px; border-radius: 26px;
  background: linear-gradient(var(--kinh-dam), var(--kinh-dam)) padding-box, var(--nhu) border-box;
  border: 2px solid transparent; box-shadow: 0 20px 50px -20px rgba(233, 91, 142, .6);
}
.khoa .bieu-tuong { width: 74px; height: 74px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--nut); box-shadow: 0 0 0 8px rgba(242, 102, 143, .12), 0 10px 24px -8px rgba(233, 91, 142, .8); }
.khoa .bieu-tuong svg { width: 40px; height: 40px; }
.khoa h2 { font-family: "Playfair Display", serif; font-size: 22px; margin-top: 16px; }
.khoa p { margin: 10px auto 0; max-width: 420px; }
.khoa .nut { margin-top: 22px; padding: 14px 28px; font-size: 16px; }
.khoa .phu { font-size: 12.5px; margin-top: 16px; }
.khoa .sao { font-size: 16px; }

/* Cuối trang */
#cuoi { text-align: center; color: var(--chu-nhat); font-size: 14px; padding: 30px 16px 40px; border-top: 1px solid var(--vien-kinh); }
#cuoi .logo-cuoi { font-family: "Dancing Script", cursive; font-size: 26px; font-weight: 700; }
#cuoi p { margin: 4px auto; max-width: 640px; }

#len-dau {
  position: fixed; right: 16px; bottom: 20px; z-index: 25; width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: var(--nut); color: #fff; font-size: 20px; box-shadow: 0 10px 24px -8px rgba(233, 91, 142, .8);
}
#len-dau[hidden] { display: none; }
