:root {
  color-scheme: dark;
  --ink: #08090b;
  --ink-soft: #111318;
  --paper: #f1eadb;
  --paper-2: #d9cfbb;
  --gold: #d8ae63;
  --gold-bright: #f3cf86;
  --jade: #91b7a8;
  --line: rgba(216, 174, 99, .22);
  --reader-size: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
.noise {
  position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}
.site-shell { overflow: hidden; }
.topbar {
  position: absolute; z-index: 20; top: 0; left: 0; width: 100%; height: 86px;
  display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(22px, 5vw, 78px);
  border-bottom: 1px solid rgba(255,255,255,.08); backdrop-filter: blur(10px);
}
.mark { display: inline-flex; gap: 12px; align-items: center; letter-spacing: .16em; font-size: 12px; }
.mark span { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--gold); color: var(--gold-bright); font: 20px Georgia, serif; transform: rotate(45deg); }
.mark span::first-letter { transform: rotate(-45deg); }
.mark b { font-weight: 600; }
.topbar nav { display: flex; gap: 34px; color: rgba(255,255,255,.67); font-size: 13px; }
.topbar nav a { transition: color .2s; }
.topbar nav a:hover { color: var(--gold-bright); }
.live-pill { display: flex; gap: 9px; align-items: center; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: 9px 13px; font-size: 11px; letter-spacing: .08em; color: rgba(255,255,255,.72); }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: #8bd6ad; box-shadow: 0 0 0 6px rgba(139,214,173,.1); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(139,214,173,0); } }

.hero { position: relative; min-height: min(900px, 100svh); display: flex; align-items: center; overflow: hidden; }
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; filter: saturate(.8) contrast(1.04); transform: scale(1.015); animation: breathe 15s ease-in-out infinite alternate; }
@keyframes breathe { to { transform: scale(1.05); } }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(5,6,8,.98) 0%, rgba(5,6,8,.82) 32%, rgba(5,6,8,.15) 65%, rgba(5,6,8,.42) 100%), linear-gradient(0deg, #08090b 0%, transparent 28%); }
.hero-grid { position: absolute; inset: 0; opacity: .13; background-image: linear-gradient(to right, rgba(216,174,99,.32) 1px, transparent 1px), linear-gradient(to bottom, rgba(216,174,99,.16) 1px, transparent 1px); background-size: 84px 84px; mask-image: linear-gradient(90deg, #000, transparent 70%); }
.hero-copy { position: relative; z-index: 2; width: min(650px, 86vw); margin-left: clamp(24px, 9vw, 145px); padding-top: 55px; }
.eyebrow, .section-label { color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: .24em; }
.hero h1 { margin: 22px 0; color: var(--paper); font: 500 clamp(70px, 10vw, 148px)/.78 Georgia, "Times New Roman", serif; letter-spacing: -.06em; }
.hero h1 span { color: transparent; -webkit-text-stroke: 1px rgba(241,234,219,.82); }
.hero-copy > p { width: min(510px, 90%); margin: 34px 0; color: rgba(241,234,219,.68); font: 18px/1.7 Georgia, serif; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-actions a, .hero-actions button { display: inline-flex; min-height: 50px; align-items: center; justify-content: center; padding: 0 23px; border-radius: 2px; font-size: 13px; font-weight: 700; letter-spacing: .04em; transition: transform .2s, background .2s, color .2s, border-color .2s; }
.hero-actions a:hover, .hero-actions button:hover:not(:disabled) { transform: translateY(-2px); }
.primary { background: var(--gold); color: #171208; }
.secondary { border: 1px solid rgba(255,255,255,.22); background: rgba(0,0,0,.18); backdrop-filter: blur(8px); }
.check-now { gap: 9px; border: 1px solid rgba(145,183,168,.5); background: rgba(13,35,30,.48); color: #c6e7da; cursor: pointer; backdrop-filter: blur(8px); }
.check-now:hover:not(:disabled) { border-color: var(--jade); background: rgba(31,70,59,.62); }
.check-now:disabled { cursor: wait; opacity: .74; }
.check-icon { display: inline-block; color: #9ad7bf; font-size: 18px; line-height: 1; }
.check-now.is-running .check-icon { animation: check-spin .85s linear infinite; }
@keyframes check-spin { to { transform: rotate(360deg); } }
.check-feedback { width: fit-content; max-width: min(620px, 100%); margin-top: 13px; padding: 10px 13px; border: 1px solid rgba(145,183,168,.25); background: rgba(4,10,9,.64); color: #bcd9ce; font-size: 12px; line-height: 1.5; backdrop-filter: blur(10px); }
.check-feedback.is-success { border-color: rgba(216,174,99,.38); color: var(--gold-bright); }
.check-feedback.is-error { border-color: rgba(207,96,105,.42); color: #efb7bc; }
.check-feedback[hidden] { display: none; }
.hero-stat { position: absolute; right: clamp(24px, 6vw, 96px); bottom: 70px; z-index: 2; width: 230px; border-left: 1px solid var(--gold); padding-left: 24px; }
.hero-stat small { color: rgba(255,255,255,.5); font-size: 9px; letter-spacing: .2em; }
.hero-stat strong { display: block; color: var(--gold-bright); font: 64px/1 Georgia, serif; margin: 7px 0; }
.hero-stat span { color: rgba(255,255,255,.7); font-size: 13px; line-height: 1.5; }

.status-strip { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0 clamp(24px, 6vw, 96px); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #0c0e11; }
.status-strip > div { min-height: 112px; display: flex; flex-direction: column; justify-content: center; padding: 20px 28px; border-left: 1px solid rgba(255,255,255,.07); }
.status-strip > div:last-child { border-right: 1px solid rgba(255,255,255,.07); }
.status-strip span { color: rgba(255,255,255,.38); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.status-strip b { margin-top: 9px; color: var(--paper-2); font-size: 14px; font-weight: 600; }
.section { width: min(1220px, calc(100% - 48px)); margin: 0 auto; padding: 120px 0; }
.intro { display: grid; grid-template-columns: 1.2fr .8fr; gap: 12vw; align-items: end; }
.section h2 { margin: 15px 0 0; color: var(--paper); font: 500 clamp(45px, 6vw, 78px)/.98 Georgia, serif; letter-spacing: -.045em; }
.section h2 em { color: var(--gold); font-weight: 400; }
.intro > p, .section-head > p { color: rgba(241,234,219,.55); line-height: 1.9; max-width: 520px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 42px; }
.search { width: min(420px, 100%); display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.2); padding: 0 4px 12px; color: var(--gold); }
.search input { width: 100%; color: var(--paper); border: 0; outline: 0; background: transparent; }
.search input::placeholder { color: rgba(255,255,255,.35); }
.chapter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.chapter-card { display: grid; grid-template-columns: 54px 1fr 24px; gap: 17px; align-items: center; min-height: 108px; padding: 18px; background: #101216; border: 1px solid rgba(255,255,255,.07); transition: border-color .25s, background .25s, transform .25s; }
.chapter-card:hover { border-color: rgba(216,174,99,.42); background: #151719; }
.chapter-card > span { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid var(--line); color: var(--gold-bright); font: 17px Georgia, serif; }
.chapter-card div { min-width: 0; }
.chapter-card b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--paper-2); font: 500 15px Georgia, serif; }
.chapter-card small { display: block; margin-top: 8px; color: rgba(255,255,255,.32); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.chapter-card i, .pdf-card i { color: var(--gold); font-style: normal; }
.chapter-card[hidden] { display: none; }
.pdf-zone { width: 100%; padding-inline: max(24px, calc((100% - 1220px)/2)); background: radial-gradient(circle at 85% 5%, rgba(145,183,168,.08), transparent 34%), #0d0f12; border-top: 1px solid rgba(255,255,255,.06); }
.pdf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pdf-card { display: grid; grid-template-columns: 60px 1fr 20px; gap: 18px; align-items: center; min-height: 100px; padding: 18px; border: 1px solid var(--line); background: rgba(255,255,255,.025); transition: border-color .25s, background .25s, transform .25s; }
.pdf-card:hover { border-color: var(--gold); }
.pdf-icon { display: grid; place-items: center; height: 60px; border: 1px solid rgba(216,174,99,.45); color: var(--gold-bright); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.pdf-card b { display: block; font: 500 17px Georgia, serif; }
.pdf-card small { display: block; margin-top: 7px; color: rgba(255,255,255,.35); }
.footer { min-height: 190px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 45px clamp(24px, 6vw, 96px); border-top: 1px solid var(--line); color: rgba(255,255,255,.38); font-size: 12px; }
.footer a { color: var(--gold); }

.reader-page { min-height: 100vh; background: #0d0e10; }
[data-theme="sepia"] { color-scheme: light; }
[data-theme="sepia"] .reader-page { background: #ece3cf; color: #332d25; }
.reader-bar { position: sticky; top: 0; z-index: 20; height: 66px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(20px, calc((100% - 920px)/2)); background: rgba(13,14,16,.88); border-bottom: 1px solid rgba(255,255,255,.08); backdrop-filter: blur(18px); }
[data-theme="sepia"] .reader-bar { background: rgba(236,227,207,.9); border-color: rgba(80,57,25,.15); }
.brand-mini { color: var(--gold-bright); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
[data-theme="sepia"] .brand-mini { color: #76521d; }
.reader-tools { display: flex; gap: 6px; }
.reader-tools button { width: 38px; height: 34px; border: 1px solid rgba(255,255,255,.12); background: transparent; color: var(--paper); cursor: pointer; }
[data-theme="sepia"] .reader-tools button { border-color: rgba(80,57,25,.18); color: #4d3a22; }
.reader-wrap { width: min(820px, calc(100% - 38px)); margin: 0 auto; padding: 90px 0 40px; }
.chapter-kicker { color: var(--gold); text-align: center; font-size: 11px; font-weight: 800; letter-spacing: .26em; }
.reader-wrap h1 { margin: 18px auto 25px; color: var(--paper); text-align: center; font: 500 clamp(35px, 6vw, 58px)/1.2 Georgia, serif; letter-spacing: -.035em; }
[data-theme="sepia"] .reader-wrap h1 { color: #45351f; }
.chapter-rule { display: flex; align-items: center; justify-content: center; gap: 15px; margin-bottom: 56px; color: var(--gold); }
.chapter-rule span { width: 75px; height: 1px; background: var(--line); }
.chapter-rule b { font-size: 9px; }
.prose { font: var(--reader-size)/1.9 Georgia, "Noto Serif", "DejaVu Serif", serif; color: #d8d1c4; }
[data-theme="sepia"] .prose { color: #332e27; }
.prose p { margin: 0 0 1.1em; text-indent: 2em; text-align: justify; }
.chapter-nav { display: grid; grid-template-columns: 1fr 1fr; justify-content: space-between; gap: 20px; margin-top: 70px; padding-top: 28px; border-top: 1px solid rgba(255,255,255,.1); }
.chapter-nav > :last-child { text-align: right; }
.nav-link { color: var(--gold-bright); font-size: 13px; }
.reader-footer { width: min(820px, calc(100% - 38px)); margin: 0 auto; padding: 35px 0 55px; display: flex; justify-content: space-between; gap: 20px; color: rgba(255,255,255,.35); font-size: 11px; }
[data-theme="sepia"] .reader-footer { color: rgba(51,46,39,.55); }
.reader-footer a { color: var(--gold); }

@media (max-width: 900px) {
  .topbar nav { display: none; }
  .status-strip { grid-template-columns: 1fr 1fr; }
  .intro { grid-template-columns: 1fr; gap: 35px; }
  .chapter-grid, .pdf-grid { grid-template-columns: 1fr 1fr; }
  .hero-stat { right: 24px; bottom: 35px; }
}
@media (max-width: 620px) {
  .topbar { height: 72px; padding: 0 18px; }
  .mark b, .live-pill { display: none; }
  .hero { min-height: 760px; align-items: flex-start; }
  .hero-art { object-position: 62% center; }
  .hero-shade { background: linear-gradient(180deg, rgba(5,6,8,.58), rgba(5,6,8,.45) 35%, #08090b 84%); }
  .hero-copy { margin: 0 20px; padding-top: 145px; }
  .hero h1 { font-size: clamp(65px, 23vw, 98px); }
  .hero-copy > p { font-size: 16px; }
  .hero-actions { gap: 9px; }
  .hero-actions a, .hero-actions button { min-height: 46px; padding: 0 16px; font-size: 12px; }
  .check-now { width: 100%; }
  .hero-stat { left: 21px; right: auto; bottom: 28px; width: calc(100% - 42px); }
  .hero-stat strong { font-size: 46px; }
  .status-strip { grid-template-columns: 1fr; padding: 0 20px; }
  .status-strip > div { min-height: 82px; padding: 16px 4px; border-left: 0; border-bottom: 1px solid rgba(255,255,255,.06); }
  .section { width: min(100% - 38px, 1220px); padding: 82px 0; }
  .section-head { align-items: stretch; flex-direction: column; }
  .chapter-grid, .pdf-grid { grid-template-columns: 1fr; }
  .chapter-card { min-height: 94px; }
  .pdf-zone { padding-inline: 19px; }
  .footer { flex-direction: column; align-items: flex-start; }
  .reader-wrap { padding-top: 64px; }
  .prose { line-height: 1.85; }
  .reader-footer { flex-direction: column; }
}
/* ===== Phan trang + bo loc thu vien chuong ===== */
.toolbar { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 16px 24px; margin: -14px 0 18px; }
.toolbar label, .tool-group label { display: flex; align-items: center; gap: 10px; color: rgba(241,234,219,.6); font-size: 12px; letter-spacing: .04em; }
.toolbar input, .toolbar select { height: 38px; padding: 0 10px; color: var(--paper); background: #101216; border: 1px solid rgba(255,255,255,.14); border-radius: 2px; font: inherit; font-size: 13px; }
.toolbar input[type="number"] { width: 118px; }
.toolbar button { height: 38px; padding: 0 15px; color: var(--paper); background: transparent; border: 1px solid rgba(255,255,255,.18); border-radius: 2px; font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .04em; cursor: pointer; transition: border-color .2s, background .2s, color .2s; }
.toolbar button:hover { border-color: var(--gold); color: var(--gold-bright); }
.toolbar button.is-on, .toolbar button[aria-pressed="true"].is-on { background: var(--gold); color: #171208; border-color: var(--gold); }
.tool-group { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.list-meta { margin: 0 0 14px; color: rgba(255,255,255,.42); font-size: 12px; letter-spacing: .04em; }
.empty-note { padding: 40px 0; color: rgba(255,255,255,.45); text-align: center; }
.pager { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; margin: 18px 0; }
.pager button { min-width: 40px; height: 40px; padding: 0 10px; color: var(--paper); background: #101216; border: 1px solid rgba(255,255,255,.12); border-radius: 2px; font: 600 13px Georgia, serif; cursor: pointer; transition: border-color .2s, color .2s; }
.pager button:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-bright); }
.pager button.is-current { background: var(--gold); color: #171208; border-color: var(--gold); }
.pager button:disabled { opacity: .3; cursor: default; }
.pager span { color: rgba(255,255,255,.4); padding: 0 4px; }
.chapter-card.is-read { opacity: .55; }
.chapter-card.is-read > span { color: rgba(255,255,255,.4); border-color: rgba(255,255,255,.12); }
.chapter-card.is-read small::after { content: " · đã đọc"; color: var(--gold); }
.chapter-card[hidden], .pdf-card[hidden] { display: none; }
.hero-actions .resume { border-color: var(--gold); color: var(--gold-bright); }
@media (max-width: 620px) {
  .toolbar { flex-direction: column; align-items: stretch; margin-top: 0; }
  .toolbar .jump { justify-content: space-between; }
  .toolbar input[type="number"] { flex: 1; }
  .tool-group { justify-content: space-between; }
  .pager button { min-width: 36px; height: 38px; }
}

/* ===== Banner lan cuoi doc ===== */
.last-read { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px 24px; margin: 0 0 22px; padding: 18px 22px; border: 1px solid rgba(216,174,99,.45); border-left: 3px solid var(--gold); background: linear-gradient(90deg, rgba(216,174,99,.10), rgba(216,174,99,.02)); }
.last-read-info { min-width: 0; flex: 1 1 320px; }
.last-read-info small { display: block; color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: .24em; }
.last-read-info strong { display: block; margin: 6px 0 4px; color: var(--paper); font: 500 20px/1.35 Georgia, serif; }
.last-read-info span { color: rgba(241,234,219,.6); font-size: 13px; line-height: 1.6; }
.last-read-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.last-read-actions a, .last-read-actions button { display: inline-flex; align-items: center; min-height: 42px; padding: 0 18px; border-radius: 2px; font: 700 12px inherit; letter-spacing: .04em; cursor: pointer; }
.last-read-actions button { color: var(--paper); background: transparent; border: 1px solid rgba(255,255,255,.2); }
.last-read-actions button:hover { border-color: var(--gold); color: var(--gold-bright); }
.chapter-card.is-current { border-color: var(--gold); background: rgba(216,174,99,.08); opacity: 1; }
.chapter-card.is-current small::after { content: " · ĐANG ĐỌC"; color: var(--gold-bright); font-weight: 700; }
.chapter-card.flash { animation: tbb-flash 2.2s ease-out; }
@keyframes tbb-flash { 0%, 55% { box-shadow: 0 0 0 2px var(--gold-bright); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (max-width: 620px) { .last-read { padding: 16px; } .last-read-actions a, .last-read-actions button { flex: 1 1 auto; justify-content: center; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition-duration: .01ms !important; }
}

.range-box { border: 1px solid var(--line); background: rgba(16,18,22,.7); padding: 22px; margin-bottom: 26px; }
.range-title { color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: .24em; margin-bottom: 14px; }
.range-row { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; }
.range-row label { display: grid; gap: 6px; color: rgba(241,234,219,.55); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.range-row input { width: 130px; padding: 11px 12px; background: #0b0c0f; border: 1px solid rgba(255,255,255,.18); color: var(--paper); font: 16px Georgia, serif; outline: 0; }
.range-row input:focus { border-color: var(--gold); }
.range-dash { color: var(--gold); padding-bottom: 12px; }
.range-row button, .range-actions button, .range-actions a { border: 1px solid var(--gold); background: var(--gold); color: #171208; padding: 12px 18px; font: 700 13px sans-serif; cursor: pointer; text-decoration: none; display: inline-block; }
.range-row button:disabled, .range-actions button:disabled { opacity: .55; cursor: wait; }
.range-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.range-actions .alt { background: transparent; color: var(--gold-bright); }
.range-msg { margin-top: 14px; color: var(--paper-2); font-size: 14px; line-height: 1.7; }
.range-msg.is-error { color: #ff9c8a; } .range-msg.is-success { color: var(--jade); }
.range-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; margin-top: 16px; }
.range-list a, .range-list span { display: block; text-align: center; padding: 10px 4px; border: 1px solid var(--line); font: 15px Georgia, serif; color: var(--gold-bright); text-decoration: none; }
.range-list span { color: rgba(255,255,255,.28); border-style: dashed; }
.range-list [hidden], .range-msg[hidden], .range-actions[hidden] { display: none; }
#range-reader { position: fixed; inset: 0; z-index: 50; background: var(--ink); overflow: auto; display: none; }
#range-reader.on { display: block; }
#range-reader .rr-bar { position: sticky; top: 0; display: flex; gap: 10px; align-items: center; padding: 10px 14px; background: rgba(8,9,11,.92); border-bottom: 1px solid var(--line); }
#range-reader .rr-bar b { flex: 1; color: var(--gold-bright); font-size: 13px; }
#range-reader .rr-bar button { border: 1px solid var(--line); background: transparent; color: var(--paper); padding: 8px 12px; cursor: pointer; }
#range-reader .reader-wrap { padding-top: 40px; }
#range-reader section + section { margin-top: 70px; padding-top: 50px; border-top: 1px solid var(--line); }
@media (max-width: 620px) { .range-row input { width: 100%; } .range-row label { flex: 1; min-width: 120px; } .range-row button { width: 100%; } .range-dash { display: none; } }
