/* ==========================================================================
   Truyện Đêm Pro — giao diện
   Bảng màu: trời đêm chàm (băng đầu trang), ngọc bích (hành động), vàng đèn lồng (sao, xếp hạng)
   Chữ: Be Vietnam Pro (giao diện) · Literata (tên truyện + nội dung chương)
   ========================================================================== */
:root {
  --night: #161936;
  --night-2: #232859;
  --night-ink: #eceefb;
  --night-muted: #a9aed3;
  --bg: #eef0f6;
  --surface: #ffffff;
  --surface-2: #f5f6fa;
  --ink: #191b2e;
  --ink-2: #3f4365;
  --muted: #676c8c;
  --line: #dfe2ec;
  --accent: #128072;
  --accent-ink: #0e6c60;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
  --gold: #d9952b;
  --gold-soft: color-mix(in srgb, var(--gold) 16%, transparent);
  --hot: #d9493a;
  --ui: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Literata', Georgia, 'Times New Roman', serif;
  --r: 10px;
  --r-sm: 6px;
  --wrap: 1200px;
  --shadow: 0 1px 2px rgba(22, 25, 54, .06), 0 8px 24px -12px rgba(22, 25, 54, .18);
  --head-h: 64px;
  color-scheme: light;
}
[data-mode="dark"] {
  --bg: #0f1124;
  --surface: #171a31;
  --surface-2: #1e2240;
  --ink: #e8e9f4;
  --ink-2: #c3c6dc;
  --muted: #9195b4;
  --line: #2a2e4e;
  --accent: #2db3a0;
  --accent-ink: #5fd2c1;
  --gold: #f0b44c;
  --hot: #f06a5a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- Nền tảng ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--head-h) + 12px); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.6 var(--ui); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-ink); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0 0 1em; }
ol, ul { margin: 0; padding: 0; list-style: none; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--gold); color: #1a1300; padding: 8px 14px; border-radius: 6px; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.site-main { min-height: 62vh; }
.ic { flex: none; vertical-align: -0.15em; }
[hidden] { display: none !important; }
[data-mode="dark"] .when-dark, [data-mode="light"] .when-light { display: inline-flex; }
.when-dark, .when-light { display: none; }
.only-m { display: none !important; }
@media (max-width: 900px) { .only-d { display: none !important; } .only-m { display: inline-flex !important; } }

/* ---------- Nút ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 999px; font-weight: 600; font-size: 14.5px; white-space: nowrap; transition: background .15s, color .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); color: #fff; }
[data-mode="dark"] .btn-primary { color: #04201c; }
[data-mode="dark"] .btn-primary:hover { color: #04201c; }
.btn-gold { background: var(--gold); color: #2a1a00; }
.btn-gold:hover { color: #2a1a00; filter: brightness(1.06); }
.btn-gold:disabled { opacity: .55; cursor: default; }
.btn-soft { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn-soft:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn-ghost-night { color: var(--night-ink); border: 1px solid rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .04); }
.btn-ghost-night:hover { color: #fff; border-color: rgba(255, 255, 255, .6); }
.btn-ghost-night[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #2a1a00; }
.btn-icon { width: 42px; padding: 0; }
.btn.is-off { opacity: .45; pointer-events: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; color: inherit; }
.icon-btn:hover { background: rgba(127, 135, 180, .14); color: inherit; }
.link-btn { color: var(--accent-ink); font-weight: 600; font-size: 14px; }

/* ---------- Thẻ / nhãn ---------- */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13.5px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.tag span { color: var(--muted); font-size: 12px; }
.tag:hover { border-color: var(--accent); color: var(--accent-ink); }
.tag.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-mode="dark"] .tag.is-on { color: #04201c; }
.tag-plain { height: auto; padding: 0; border: 0; background: none; color: var(--muted); font-size: 13px; }
.tag-plain + .tag-plain::before { content: ","; margin: 0 4px 0 -4px; color: var(--muted); }
.tag-night { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); color: var(--night-ink); }
.tag-night:hover { color: #fff; border-color: var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips-scroll::-webkit-scrollbar { display: none; }

/* ---------- Đầu trang ---------- */
.site-head { position: sticky; top: 0; z-index: 40; background: var(--night); color: var(--night-ink); border-bottom: 1px solid rgba(255, 255, 255, .06); }
.head-in { display: flex; align-items: center; gap: 10px; height: var(--head-h); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; color: inherit; flex: none; }
.logo:hover { color: inherit; }
.logo-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe7a8, var(--gold) 60%, #a86a12); color: var(--night); }
.logo-mark.sm { width: 28px; height: 28px; }
.logo-img { width: 36px; height: 36px; object-fit: contain; }
.nav { display: flex; align-items: center; gap: 2px; margin-left: 12px; }
.nav-link { display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0 12px; border-radius: 8px; color: var(--night-muted); font-weight: 500; font-size: 14.5px; }
.nav-link:hover, .dd.is-open > .nav-link { color: #fff; background: rgba(255, 255, 255, .07); }
.dd { position: relative; }
.dd-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px; display: none; }
.dd.is-open .dd-panel { display: grid; }
@media (hover: hover) { .dd:hover .dd-panel { display: grid; } .dd::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 8px; } }
.dd-panel a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 6px; font-size: 14px; }
.dd-panel a:hover { background: var(--accent-soft); }
.dd-panel a span { color: var(--muted); font-size: 12px; }
.dd-list { min-width: 200px; }
.dd-genres { grid-template-columns: repeat(3, minmax(150px, 1fr)); width: max-content; max-width: 560px; }
.search { position: relative; display: flex; align-items: center; gap: 8px; margin-left: auto; height: 40px; padding: 0 14px; border-radius: 999px; background: rgba(255, 255, 255, .08); color: var(--night-muted); width: min(340px, 34vw); border: 1px solid transparent; }
.search:focus-within { border-color: rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .12); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; color: var(--night-ink); font-size: 14px; }
.search input::placeholder { color: var(--night-muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search-pop { position: absolute; top: calc(100% + 8px); left: 0; right: 0; min-width: 300px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; z-index: 60; }
.search-pop a { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 8px; }
.search-pop a:hover, .search-pop a.is-active { background: var(--accent-soft); color: inherit; }
.search-pop img, .search-pop .sp-blank { width: 34px; height: 48px; object-fit: cover; border-radius: 4px; background: var(--surface-2); flex: none; }
.search-pop b { display: block; font-weight: 600; font-size: 14px; line-height: 1.3; }
.search-pop small { color: var(--muted); font-size: 12.5px; }
.search-pop .sp-all { justify-content: center; color: var(--accent-ink); font-weight: 600; font-size: 13.5px; }
.search-pop .sp-empty { padding: 10px; color: var(--muted); font-size: 14px; }
.site-head .icon-btn { color: var(--night-muted); }
.site-head .icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
@media (max-width: 900px) {
  .head-in { gap: 4px; }
  .logo-text { font-size: 16px; }
  .search { width: auto; flex: 1; margin-left: 8px; padding: 0 12px; }
}
@media (max-width: 520px) { .logo-text { display: none; } }

/* Ngăn kéo mobile */
.drawer { position: fixed; inset: 0; z-index: 80; }
.drawer-bg { position: absolute; inset: 0; background: rgba(8, 9, 22, .55); }
.drawer-panel { position: absolute; inset: 0 auto 0 0; width: min(320px, 86vw); background: var(--surface); padding: 12px 16px 24px; overflow-y: auto; animation: slide-in .2s ease-out; }
@keyframes slide-in { from { transform: translateX(-100%); } }
.drawer-top { display: flex; align-items: center; justify-content: space-between; font-weight: 800; font-size: 17px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.drawer-nav { display: grid; padding: 8px 0; }
.drawer-nav a { padding: 11px 4px; font-weight: 500; border-bottom: 1px solid var(--line); }
.drawer-h { margin: 16px 0 10px; font-weight: 700; }
.drawer-genres { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Băng đầu trang chủ ---------- */
.hero { position: relative; background: var(--night); color: var(--night-ink); overflow: hidden; isolation: isolate; }
.hero-sky { position: absolute; inset: 0; z-index: -1; background:
  radial-gradient(circle at 86% 20%, rgba(255, 232, 178, .32) 0 26px, rgba(255, 214, 130, .1) 27px 70px, rgba(255, 214, 130, .04) 120px, transparent 240px),
  radial-gradient(1px 1px at 12% 22%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 28% 68%, #fff 50%, transparent 51%),
  radial-gradient(1.5px 1.5px at 44% 14%, #ffe9b5 50%, transparent 51%), radial-gradient(1px 1px at 58% 82%, #fff 50%, transparent 51%),
  radial-gradient(1px 1px at 70% 40%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 92% 66%, #fff 50%, transparent 51%),
  radial-gradient(1px 1px at 6% 86%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 36% 40%, #c7cdfa 50%, transparent 51%),
  linear-gradient(180deg, var(--night) 0%, var(--night-2) 100%); opacity: .95; }
.hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 48px; background: linear-gradient(transparent, rgba(0, 0, 0, .18)); z-index: -1; }
.hero-in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 40px; align-items: center; min-height: 420px; padding-top: 40px; padding-bottom: 48px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.hero-title { font: 600 clamp(30px, 4.2vw, 48px)/1.1 var(--serif); letter-spacing: -.015em; text-wrap: balance; }
.hero-title a:hover { color: #fff; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 6px; text-decoration-thickness: 2px; }
.hero-author { margin: 12px 0 0; color: var(--night-muted); display: flex; gap: 6px; align-items: center; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 18px 0; color: var(--night-muted); font-size: 14px; }
.hero-stats b { color: var(--night-ink); font-weight: 700; font-size: 16px; margin-right: 3px; }
.hero-desc { color: #cdd0ea; max-width: 56ch; font-size: 15.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 24px; }
.hero-latest { color: var(--gold); font-weight: 600; font-size: 14px; }
.hero-latest:hover { color: #ffd88a; }
.hero-slide.is-on { animation: hero-in .45s ease-out; }
@keyframes hero-in { from { opacity: 0; transform: translateY(6px); } }
/* Kệ bìa xếp quạt */
.hero-shelf { position: relative; height: 330px; display: flex; align-items: flex-end; justify-content: center; }
.hero-book { position: relative; width: 150px; flex: none; margin-left: -42px; border-radius: 6px; transform: rotate(calc((var(--i) - 2) * 3deg)) translateY(calc(var(--i) * 0px)); transform-origin: 50% 120%; transition: transform .35s cubic-bezier(.2, .8, .2, 1), filter .3s; filter: brightness(.62) saturate(.8); box-shadow: 0 18px 40px -10px rgba(0, 0, 0, .7); }
.hero-book:first-child { margin-left: 0; }
.hero-book .cover { border-radius: 6px; }
.hero-book:hover { filter: brightness(.85); }
.hero-book.is-on { z-index: 5; filter: none; transform: translateY(-26px) scale(1.18); }
.hero-book.is-on::after { content: ""; position: absolute; left: 18%; right: 18%; bottom: -18px; height: 3px; border-radius: 3px; background: var(--gold); box-shadow: 0 0 18px var(--gold); }
@media (prefers-reduced-motion: reduce) { .hero-book, .hero-slide.is-on { transition: none; animation: none; } }
@media (max-width: 900px) {
  .hero-in { grid-template-columns: minmax(0, 1fr); gap: 24px; min-height: 0; padding-top: 28px; padding-bottom: 28px; }
  .hero-shelf { order: -1; height: auto; justify-content: flex-start; overflow-x: auto; gap: 12px; padding: 30px 4px 26px; margin: -10px -20px 0; padding-left: 20px; scrollbar-width: none; }
  .hero-shelf::-webkit-scrollbar { display: none; }
  .hero-book { width: 96px; margin-left: 0; transform: none; }
  .hero-book.is-on { transform: translateY(-10px) scale(1.08); }
}

/* ---------- Bìa truyện ---------- */
.cover { position: relative; display: block; aspect-ratio: 2 / 3; overflow: hidden; border-radius: var(--r-sm); background: var(--surface-2); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-blank { display: grid; place-items: center; padding: 12px; background: linear-gradient(160deg, hsl(var(--h) 45% 32%), hsl(calc(var(--h) + 40) 50% 16%)); }
.cover-blank::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 3px; }
.cover-title { position: relative; font: 600 15px/1.3 var(--serif); color: #fff; text-align: center; text-wrap: balance; }
.badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; z-index: 2; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; color: #fff; line-height: 1.5; }
.b-full { background: var(--accent); }
.b-hot { background: var(--hot); }
.b-new { background: #3f6fd8; }

/* ---------- Lưới thẻ ---------- */
.grid { display: grid; gap: 22px 18px; }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-6 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 900px) { .grid-5, .grid-6 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-5, .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; } }
.card { min-width: 0; }
.card-cover { position: relative; display: block; border-radius: var(--r-sm); box-shadow: var(--shadow); }
.card-cover .cover { transition: transform .25s; }
.card:hover .card-cover .cover { transform: translateY(-3px); }
.card-ch { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 8px 6px; font-size: 12px; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgba(8, 10, 26, .85)); border-radius: 0 0 var(--r-sm) var(--r-sm); }
.card-title { margin-top: 10px; font: 600 15px/1.35 var(--serif); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.card-meta > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rating-mini { display: inline-flex; align-items: center; gap: 3px; color: var(--gold); font-weight: 700; flex: none; }
.rating-mini .ic { fill: currentColor; }
@media (max-width: 640px) { .card-title { font-size: 14px; } }

/* ---------- Bố cục trang chủ ---------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 36px; padding-top: 32px; padding-bottom: 48px; }
@media (max-width: 1000px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
.sec { margin-bottom: 40px; }
.sec-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 16px; }
.sec-head h2 { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; letter-spacing: -.01em; margin-right: auto; }
.sec-head h2 .ic { color: var(--gold); }
.sec-head .tabs { order: 3; width: 100%; }
.sec-more { font-size: 14px; font-weight: 600; color: var(--accent-ink); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 20px; }
.panel .sec-head { margin-bottom: 12px; }
.panel .sec-head h2 { font-size: 17px; }
.continue { padding-top: 28px; }
.continue-row { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 6px; }
.cont { display: flex; gap: 12px; align-items: center; flex: none; width: 290px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.cont:hover { border-color: var(--accent); color: inherit; }
.cont img, .cont .sp-blank { width: 48px; height: 68px; border-radius: 4px; object-fit: cover; background: var(--surface-2); flex: none; }
.cont b { display: block; font: 600 14.5px/1.3 var(--serif); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.cont small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.cont .cont-go { color: var(--accent-ink); font-weight: 600; font-size: 13px; margin-top: 4px; display: block; }
.cont-bar { height: 3px; border-radius: 3px; background: var(--line); margin-top: 6px; overflow: hidden; }
.cont-bar i { display: block; height: 100%; background: var(--gold); }
.intro { padding-bottom: 48px; color: var(--muted); max-width: 820px; font-size: 14px; }

/* Tabs */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { height: 34px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; border: 1px solid transparent; }
.tab:hover { color: var(--ink); }
.tab.is-on { color: var(--ink); background: var(--surface); border-color: var(--line); box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.tabs-sm { margin-bottom: 10px; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.tabs-sm .tab { flex: 1; height: 30px; font-size: 13.5px; }

/* Mới cập nhật */
.upd-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.upd { display: grid; grid-template-columns: 40px minmax(0, 1.3fr) minmax(0, 1fr) 96px; gap: 14px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.upd:last-child { border-bottom: 0; }
.upd-cover .cover { width: 40px; border-radius: 4px; }
.upd-cover .cover-title { font-size: 0; }
.upd-title { font: 600 15px/1.35 var(--serif); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upd-genres { font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.upd-ch { font-size: 14px; color: var(--accent-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upd-ch-t { color: var(--ink-2); }
.upd-time { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
@media (max-width: 640px) {
  .upd { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "c t time" "c ch ch"; row-gap: 2px; padding: 10px 12px; }
  .upd-cover { grid-area: c; } .upd-main { grid-area: t; } .upd-ch { grid-area: ch; font-size: 13.5px; } .upd-time { grid-area: time; font-size: 12px; }
  .upd-genres { display: none; }
}

/* Xếp hạng (sidebar) */
.rank { display: grid; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.rank-row:last-child { border-bottom: 0; }
.rank-n { flex: none; width: 26px; text-align: center; font: 700 16px/1 var(--serif); color: var(--muted); }
.rank-row.r1 .rank-n, .rank-row.r2 .rank-n, .rank-row.r3 .rank-n { color: var(--gold); font-size: 22px; }
.rank-cover .cover { width: 44px; border-radius: 4px; }
.rank-cover .cover-title { font-size: 0; }
.rank-main { min-width: 0; }
.rank-title { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rank-sub { font-size: 12.5px; color: var(--muted); }
.mini-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list a { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list span { color: var(--muted); font-size: 12.5px; flex: none; }

/* ---------- Trang danh sách ---------- */
.page-pad { padding-top: 22px; padding-bottom: 56px; }
.narrow { max-width: 820px; }
.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); margin-bottom: 16px; }
.crumb a:hover { color: var(--accent-ink); }
.crumb-sep { opacity: .5; }
.page-title { font: 600 clamp(26px, 3.4vw, 34px)/1.2 var(--serif); letter-spacing: -.01em; margin-bottom: 6px; }
.browse-head { margin-bottom: 18px; }
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 18px; margin-bottom: 24px; }
.filter-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--line); min-width: 0; }
.filter-row:last-child { border-bottom: 0; }
.filter-row .chips { flex: 1; min-width: 0; }
.filter-l { flex: none; width: 84px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.view-toggle { display: flex; gap: 2px; }
.view-toggle .is-on { color: var(--accent-ink); background: var(--accent-soft); }
@media (max-width: 640px) {
  .filters { padding: 4px 12px; }
  .filter-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .filter-row .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .view-toggle { display: none; }
}
.browse .as-list { display: none; }
.browse[data-view-target="list"] .as-grid { display: none; }
.browse[data-view-target="list"] .as-list { display: block; }
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 28px; }
.page-numbers { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.page-numbers.current { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-mode="dark"] .page-numbers.current { color: #04201c; }
.page-numbers.dots { border: 0; background: none; }
.empty { color: var(--muted); }
.empty-box { text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 40px 20px; }
.empty-box p { color: var(--muted); margin-bottom: 16px; }
.search-big { width: 100%; max-width: 620px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); height: 52px; margin: 16px 0 24px; padding-right: 6px; }
.search-big input { color: var(--ink); font-size: 15px; }
.search-big input::placeholder { color: var(--muted); }
.search-big:focus-within { background: var(--surface); border-color: var(--accent); }

/* ---------- Trang truyện ---------- */
.story-hero { position: relative; isolation: isolate; background: var(--night); color: var(--night-ink); padding: 22px 0 36px; overflow: hidden; }
.story-hero::before { content: ""; position: absolute; inset: -40px; z-index: -2; background: var(--cover, none) center/cover no-repeat; filter: blur(38px) saturate(1.2); opacity: .5; transform: scale(1.1); }
.story-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(22, 25, 54, .72), rgba(22, 25, 54, .94)); }
.story-hero .crumb { color: var(--night-muted); }
.story-hero .crumb a:hover { color: #fff; }
.story-top { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 36px; align-items: start; }
.story-cover { position: relative; border-radius: 8px; box-shadow: 0 24px 50px -16px rgba(0, 0, 0, .75); }
.story-cover .cover { border-radius: 8px; }
.story-title { font: 600 clamp(28px, 3.8vw, 42px)/1.15 var(--serif); letter-spacing: -.015em; text-wrap: balance; }
.story-author { display: flex; align-items: center; gap: 6px; margin: 10px 0 14px; color: var(--night-muted); }
.story-author a { color: var(--gold); font-weight: 600; }
.story-tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.status-pill { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600; background: rgba(240, 180, 76, .16); color: #ffd28a; border: 1px solid rgba(240, 180, 76, .35); }
.status-pill.is-done { background: rgba(45, 179, 160, .18); color: #7ee0cf; border-color: rgba(45, 179, 160, .4); }
.story-stats { display: flex; flex-wrap: wrap; margin: 22px 0 0; border-top: 1px solid rgba(255, 255, 255, .1); border-bottom: 1px solid rgba(255, 255, 255, .1); }
.story-stats div { padding: 12px 24px 12px 0; margin-right: 24px; border-right: 1px solid rgba(255, 255, 255, .1); }
.story-stats div:last-child { border-right: 0; margin-right: 0; }
.story-stats dt { font-size: 12.5px; color: var(--night-muted); }
.story-stats dd { margin: 0; font: 600 22px/1.2 var(--serif); }
.story-facts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 14px 0 0; font-size: 14px; color: #d8dbf2; }
.story-facts span { color: var(--night-muted); margin-right: 6px; }
.story-facts .online { color: #7ee0cf; display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #2db3a0; box-shadow: 0 0 0 0 rgba(45, 179, 160, .6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(45, 179, 160, 0); } 100% { box-shadow: 0 0 0 0 rgba(45, 179, 160, 0); } }
.story-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
@media (max-width: 760px) {
  .story-top { grid-template-columns: 120px minmax(0, 1fr); gap: 18px; }
  .story-stats div { padding-right: 14px; margin-right: 14px; }
  .story-stats dd { font-size: 18px; }
  .story-info { display: contents; }
  .story-title { grid-column: 2; align-self: end; font-size: 24px; }
  .story-author, .story-tags, .story-stats, .story-facts, .story-cta { grid-column: 1 / -1; }
  .story-cover { grid-row: 1 / span 2; }
  .story-author { grid-column: 2; margin: 0; align-self: start; }
  .story-cta .btn { flex: 1; }
}
.story-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; padding-top: 32px; padding-bottom: 56px; }
@media (max-width: 1000px) { .story-grid { grid-template-columns: minmax(0, 1fr); } }
.intro-text { font: 400 16.5px/1.8 var(--serif); color: var(--ink-2); }
.intro-text.is-clamped { max-height: 12.6em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.vote { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .vote { grid-template-columns: 1fr; } }
.vote-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.vote-h { font-weight: 600; margin-bottom: 10px; }
.vote-sub { margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }
.rate-stars { display: flex; gap: 2px; }
.rate-star { color: var(--line); padding: 2px; border-radius: 6px; transition: color .1s, transform .1s; }
.rate-star .ic { fill: currentColor; stroke: none; }
.rate-star.on, .rate-stars:hover .rate-star { color: var(--gold); }
.rate-stars .rate-star:hover ~ .rate-star { color: var(--line); }
.rate-star:hover { transform: scale(1.12); }
.jump { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.jump input { width: 120px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.jump .btn { background: var(--accent); color: #fff; }
.ch-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 20px; }
.ch-list li { border-bottom: 1px dashed var(--line); min-width: 0; }
.ch-list a { display: flex; gap: 8px; padding: 10px 0; font-size: 14.5px; min-width: 0; }
.ch-list a.is-read .ch-n, .ch-list a.is-read .ch-t { color: var(--muted); }
.ch-list a.is-last::after { content: "Đang đọc"; margin-left: auto; flex: none; font-size: 11.5px; font-weight: 700; color: var(--gold); }
.ch-n { flex: none; font-weight: 600; }
.ch-t { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-t::before { content: ": "; margin-left: -6px; }
@media (max-width: 640px) { .ch-list { grid-template-columns: 1fr; padding: 4px 14px; } }
.side-books li + li { margin-top: 12px; }
.side-books a { display: flex; gap: 12px; align-items: center; }
.side-books .cover { width: 46px; flex: none; border-radius: 4px; }
.side-books .cover-title { font-size: 0; }
.side-books span { font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.side-books small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; margin-top: 2px; }

/* Box affiliate + quảng cáo */
.aff { display: flex; align-items: center; gap: 16px; justify-content: space-between; padding: 16px 18px; border-radius: var(--r); background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); margin: 24px 0; }
.aff p { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; }
@media (max-width: 640px) { .aff { flex-direction: column; align-items: stretch; } }
.ad-slot { margin: 24px 0; text-align: center; overflow: hidden; }
.ad-empty { padding: 18px; border: 1px dashed var(--line); border-radius: var(--r); color: var(--muted); font-size: 13px; }

/* ---------- Bảng xếp hạng ---------- */
.board { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.board-row { display: grid; grid-template-columns: 48px 56px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.board-row:last-child { border-bottom: 0; }
.board-n { font: 700 22px/1 var(--serif); color: var(--muted); text-align: center; }
.board-row.r1 .board-n, .board-row.r2 .board-n, .board-row.r3 .board-n { color: var(--gold); font-size: 30px; }
.board-cover .cover { width: 56px; border-radius: 4px; }
.board-cover .cover-title { font-size: 0; }
.board-title { font: 600 17px/1.3 var(--serif); }
.board-sub { margin: 2px 0 4px; color: var(--muted); font-size: 13.5px; }
.board-tags { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
.board-ch { color: var(--accent-ink); font-weight: 600; }
.board-val { text-align: right; }
.board-val b { display: block; font: 700 20px/1.1 var(--serif); }
.board-val span { font-size: 12.5px; color: var(--muted); }
@media (max-width: 640px) { .board-row { grid-template-columns: 30px 44px minmax(0, 1fr); padding: 12px; gap: 10px; } .board-cover .cover { width: 44px; } .board-val { grid-column: 3; text-align: left; } .board-val b { display: inline; font-size: 15px; margin-right: 4px; } }

/* ---------- Tủ truyện ---------- */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 18px; }
.shelf .cont { width: auto; position: relative; }
.shelf-x { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); display: grid; place-items: center; }
.shelf-x:hover { background: var(--surface-2); color: var(--hot); }
.shelf-empty { grid-column: 1 / -1; }
.shelf .tag-new { color: var(--hot); font-weight: 700; }

/* ---------- Trang đọc ---------- */
.is-reader { --rbg: var(--bg); --rfg: var(--ink); --rsize: 20px; --rlh: 1.85; --rwidth: 720px; --rfont: var(--serif); --ralign: left; background: var(--rbg); color: var(--rfg); }
.is-reader[data-rtheme]:not([data-rtheme="auto"]) { --surface: color-mix(in srgb, var(--rbg) 92%, var(--rfg)); --surface-2: color-mix(in srgb, var(--rbg) 86%, var(--rfg)); --line: color-mix(in srgb, var(--rbg) 78%, var(--rfg)); --ink: var(--rfg); --ink-2: color-mix(in srgb, var(--rfg) 85%, var(--rbg)); --muted: color-mix(in srgb, var(--rfg) 60%, var(--rbg)); }
.rbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 12px; background: color-mix(in srgb, var(--rbg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); transition: transform .25s; }
.rbar.is-hidden { transform: translateY(-100%); }
.rbar-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; padding: 0 6px; }
.rbar-story { font-weight: 600; font-size: 14.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rbar-ch { font-size: 12.5px; color: var(--muted); }
.rprogress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.rprogress span { display: block; height: 100%; width: 0; background: var(--gold); }
.chapter { max-width: var(--rwidth); margin: 0 auto; padding: 32px 20px 80px; }
.ch-head { text-align: center; margin-bottom: 24px; }
.ch-story { color: var(--accent-ink); font-weight: 600; font-size: 14px; }
.ch-title { margin-top: 10px; font-family: var(--serif); }
.ch-num { display: block; font-size: 15px; font-weight: 500; color: var(--muted); }
.ch-name { display: block; font-size: clamp(26px, 4vw, 34px); font-weight: 600; letter-spacing: -.01em; margin-top: 4px; text-wrap: balance; }
.ch-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.ch-meta span { display: inline-flex; align-items: center; gap: 5px; }
.ch-nav { display: flex; justify-content: center; gap: 8px; margin: 20px 0; }
.ch-nav .btn { flex: 0 1 200px; }
.ch-nav .btn-icon { flex: none; }
.ch-body { font-family: var(--rfont); font-size: var(--rsize); line-height: var(--rlh); text-align: var(--ralign); color: var(--rfg); overflow-wrap: break-word; hyphens: auto; }
.ch-body p { margin: 0 0 1.05em; }
.ch-body h2, .ch-body h3 { font-size: 1.1em; margin: 1.6em 0 .8em; }
.ch-body hr, .ch-body .scene-break { border: 0; height: auto; margin: 1.8em 0; text-align: center; }
.ch-body hr::before { content: "✦ ✦ ✦"; color: var(--muted); letter-spacing: .6em; font-size: .7em; }
.ch-body blockquote { margin: 1.2em 0; padding: .2em 0 .2em 1em; border-left: 3px solid var(--gold); color: var(--ink-2); font-style: italic; }
.ch-end { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }
.ch-end-note { text-align: center; color: var(--muted); font-size: 14.5px; }
.rdock { display: none; }
@media (max-width: 760px) {
  .chapter { padding: 22px 18px 96px; }
  .ch-nav-top { display: none; }
  .rdock { display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 45; justify-content: space-around; height: 54px; align-items: center; background: color-mix(in srgb, var(--rbg) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .35); transition: transform .25s; }
  .rdock.is-hidden { transform: translateY(calc(100% + 20px)); }
  .rdock > * { display: grid; place-items: center; width: 52px; height: 44px; border-radius: 10px; color: var(--rfg); }
  .rdock .is-off { opacity: .3; }
}
/* Bảng trượt: mục lục / tuỳ chỉnh */
.sheet { position: fixed; inset: 0; z-index: 90; }
.sheet-bg { position: absolute; inset: 0; background: rgba(8, 9, 22, .5); }
.sheet-box { position: absolute; right: 0; top: 0; bottom: 0; width: min(420px, 100%); background: var(--surface); color: var(--ink); display: flex; flex-direction: column; padding: 14px 18px 18px; box-shadow: -10px 0 40px rgba(0, 0, 0, .25); animation: sheet-in .22s ease-out; overflow-y: auto; }
@keyframes sheet-in { from { transform: translateX(30px); opacity: 0; } }
@media (max-width: 760px) { .sheet-box { top: auto; width: 100%; max-height: 82vh; border-radius: 18px 18px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); } @keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 16px; }
.toc-filter { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 12px; margin-bottom: 8px; }
.toc { overflow-y: auto; flex: 1; min-height: 200px; }
.toc a { display: block; padding: 9px 8px; border-radius: 8px; font-size: 14.5px; border-bottom: 1px dashed var(--line); }
.toc a:hover { background: var(--accent-soft); color: inherit; }
.toc a.is-cur { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.toc a.is-read { color: var(--muted); }
.toc li.muted { padding: 10px 8px; }
.set-row { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.set-l { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: var(--sw, linear-gradient(135deg, #fff 50%, #161936 50%)); color: var(--swf, #888); font: 600 13px var(--serif); }
.swatch[data-v="auto"] { color: transparent; }
.swatch.is-on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); font-size: 14px; }
.seg button.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 52px; height: 40px; font-weight: 600; }
.stepper button:hover { background: var(--surface-2); }
.stepper output { min-width: 56px; text-align: center; font-weight: 600; border-left: 1px solid var(--line); border-right: 1px solid var(--line); line-height: 40px; }
[data-set-reset] { margin-top: 14px; align-self: flex-start; }

/* ---------- Bình luận ---------- */
.comments-wrap { margin-top: 40px; }
.comment-form textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 12px 14px; resize: vertical; min-height: 90px; }
.comment-form textarea:focus, .comment-form input:focus { outline: none; border-color: var(--accent); }
.comment-form input[type="text"], .comment-form input[type="email"] { width: 100%; height: 40px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 0 12px; }
.comment-form p { margin: 0 0 10px; }
.comment-form-author, .comment-form-email { display: inline-block; width: calc(50% - 6px); }
.comment-form-email { margin-left: 8px !important; }
.comment-form label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }
.comment-form-cookies-consent { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.comment-form-cookies-consent label { margin: 0; }
.comment-list { margin-top: 20px; }
.comment-list .comment { padding: 14px 0; border-top: 1px solid var(--line); }
.comment-list .children { padding-left: 24px; }
.comment-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.comment-author { display: flex; align-items: center; gap: 10px; }
.comment-author img { border-radius: 50%; }
.comment-author .fn { font-weight: 600; color: var(--ink); font-style: normal; }
.comment-author .says { display: none; }
.comment-metadata a { color: var(--muted); }
.comment-content { margin: 6px 0 0 46px; }
.reply { margin-left: 46px; font-size: 13px; font-weight: 600; }
.reply a { color: var(--accent-ink); }

/* ---------- Văn bản tĩnh / 404 ---------- */
.prose { font-size: 16px; line-height: 1.75; }
.prose a { color: var(--accent-ink); text-decoration: underline; }
.post-item { padding: 18px 0; border-bottom: 1px solid var(--line); }
.post-title { font: 600 22px/1.3 var(--serif); }
.nf { text-align: center; padding-top: 60px; }
.nf .search-big { margin-left: auto; margin-right: auto; }
.nf-code { font: 700 120px/1 var(--serif); color: var(--gold); margin: 0; opacity: .85; }

/* ---------- Chân trang ---------- */
.site-foot { background: var(--night); color: var(--night-muted); padding: 44px 0 24px; font-size: 14px; }
.foot-in { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 28px; }
.foot-brand .logo { color: var(--night-ink); margin-bottom: 12px; }
.foot-brand p { max-width: 42ch; }
.foot-social { display: flex; flex-wrap: wrap; gap: 14px; }
.foot-social a { color: var(--night-ink); font-weight: 600; }
.foot-col { display: grid; align-content: start; gap: 8px; }
.foot-h { color: var(--night-ink); font-weight: 700; margin: 0 0 4px; }
.foot-col a:hover, .foot-social a:hover { color: var(--gold); }
.foot-bottom { margin-top: 32px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 13px; }
@media (max-width: 760px) { .foot-in { grid-template-columns: 1fr 1fr; } .foot-brand { grid-column: 1 / -1; } }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 100; background: var(--night); color: var(--night-ink); padding: 10px 18px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); animation: toast .25s ease-out; }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- Quảng cáo treo chìm ---------- */
.ad-mid { margin: 1.6em auto; font-size: 15px; line-height: 1.5; text-align: center; }
.upd-ad { padding: 8px 16px; border-bottom: 1px solid var(--line); }
.upd-ad .ad-slot { margin: 0; }
.home-side > .ad-slot, .story-side > .ad-slot { margin: 0 0 20px; }

/* ---------- Quảng cáo treo nổi ---------- */
.adf-box { position: relative; }
.adf-x { position: absolute; z-index: 2; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--night); color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.adf-x:hover { background: var(--hot); }
.adf-body { overflow: hidden; text-align: center; }
.adf-body img { margin: 0 auto; }
/* Neo đáy */
.adf-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 44; display: flex; justify-content: center; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px -10px rgba(0, 0, 0, .3); }
.adf-bottom .adf-box { max-width: 970px; width: 100%; }
.adf-bottom .adf-body { max-height: 110px; }
.adf-bottom .adf-x { top: -22px; right: 0; }
body.has-adf-bottom { padding-bottom: 110px; }
@media (max-width: 760px) {
  .adf-bottom .adf-body { max-height: 70px; }
  body.has-adf-bottom { padding-bottom: 80px; }
  /* Trang đọc: nằm trên thanh điều hướng */
  .is-reader .adf-bottom { bottom: calc(70px + env(safe-area-inset-bottom)); left: 10px; right: 10px; border: 1px solid var(--line); border-radius: 12px; padding-bottom: 6px; }
  body.is-reader.has-adf-bottom { padding-bottom: 150px; }
}
/* Treo 2 bên */
.adf-left, .adf-right { position: fixed; top: calc(var(--head-h) + 24px); z-index: 30; width: 160px; }
.adf-left { right: calc(50% + var(--wrap) / 2 + 16px); }
.adf-right { left: calc(50% + var(--wrap) / 2 + 16px); }
.is-reader .adf-left, .is-reader .adf-right { top: 80px; }
.adf-left .adf-body, .adf-right .adf-body { max-height: 600px; }
.adf-left .adf-x, .adf-right .adf-x { top: -10px; right: -10px; }
/* Popup */
.adf-popup { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 20px; }
.adf-popup[hidden] { display: none; }
.adf-bg { position: absolute; inset: 0; background: rgba(8, 9, 22, .6); }
.adf-popup .adf-box { background: var(--surface); border-radius: 14px; padding: 28px 14px 14px; width: min(92vw, 480px); max-height: 86vh; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6); animation: toast .25s ease-out; }
.adf-popup .adf-body { max-height: calc(86vh - 50px); overflow: auto; }
.adf-popup .adf-x { top: 8px; right: 8px; }
.adf-label { position: absolute; top: 10px; left: 14px; font-size: 11.5px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .adf-popup .adf-box { animation: none; } }
