/* NetTruyen Pro — Nâng cấp giao diện hiện đại, giữ trọn nhận diện NetTruyen, cuộn mượt & CLS = 0 */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

:root {
  --nt-primary: #f36621;
  --nt-primary-dark: #d94e0e;
  --nt-header: #2c1d5a;
  --nt-header-grad: linear-gradient(135deg, #24164c 0%, #372271 60%, #2c1d5a 100%);
  --nt-bg: #ebebeb;
  --nt-card: #ffffff;
  --nt-soft: #f8fafc;
  --nt-text: #1e293b;
  --nt-muted: #64748b;
  --nt-border: #e2e8f0;
  --nt-blue: #2980b9;
}

[data-theme="dark"] {
  --nt-bg: #0b1120;
  --nt-card: #151e31;
  --nt-soft: #1e293b;
  --nt-text: #f1f5f9;
  --nt-muted: #94a3b8;
  --nt-border: #2b384e;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--nt-primary); }
.text-orange { color: var(--nt-primary); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

html, body { max-width: 100%; overflow-x: clip; }
.nt-header, .nt-nav, .nt-main, .nt-footer { max-width: 100%; }
.container-main { max-width: min(1480px, 96vw); margin: 0 auto; padding: 0 12px; min-width: 0; }
.main-col, .nt-sidebar { min-width: 0; }

/* Header */
.nt-header { background: var(--nt-header-grad); color: #fff; padding: 10px 0; }
.header-inner { display: flex; align-items: center; gap: 14px; }
.mob-menu-btn { display: none; background: transparent; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 8px; padding: 5px 10px; font-size: 18px; cursor: pointer; }
.nt-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 900; font-size: 22px; letter-spacing: -.5px; color: #fff; flex-shrink: 0; text-decoration: none; }
.nt-brand .brand-logo { height: 32px; width: auto; max-width: 160px; object-fit: contain; display: block; }
.nt-brand .brand-mark { color: #fff; }
.nt-brand .brand-accent { color: var(--nt-primary); }
.brand-site-tag { font-size: 11px; font-weight: 600; color: rgba(255,255,255,.72); padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.12); }

.nt-search { flex: 1; max-width: 600px; position: relative; }
.nt-search form { display: flex; background: #fff; border-radius: 999px; overflow: hidden; border: 2px solid transparent; transition: border-color .15s; }
.nt-search form:focus-within { border-color: var(--nt-primary); }
.nt-search input { flex: 1; border: 0; padding: 8px 16px; outline: none; font-size: 13.5px; color: #0f172a; background: transparent; min-width: 0; }
.nt-search button { border: 0; background: var(--nt-primary); color: #fff; padding: 0 18px; font-weight: 700; cursor: pointer; font-size: 13px; }
.nt-search button:hover { background: var(--nt-primary-dark); }

.suggest-box { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--nt-card); color: var(--nt-text); border: 1px solid var(--nt-border); border-radius: 12px; box-shadow: 0 14px 35px rgba(0,0,0,.22); z-index: 90; overflow: hidden; }
.suggest-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--nt-border); }
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:hover { background: var(--nt-soft); }
.suggest-item img { width: 38px; height: 50px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.suggest-item strong { display: block; font-size: 13px; line-height: 1.3; }
.suggest-item small { color: var(--nt-primary); font-size: 11.5px; }

.nt-header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.mob-novel-pill { display: none; }
.bulb-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); background: rgba(255,150,1,.18); color: #ffd166; cursor: pointer; font-size: 16px; display: grid; place-items: center; flex-shrink: 0; }
.bulb-btn:hover { background: var(--nt-primary); color: #fff; }
.action-pill { color: #fff; padding: 6px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600; border: 1px solid rgba(255,255,255,.28); }
.action-pill:hover { background: rgba(255,255,255,.12); color: #fff; }
.action-primary { background: var(--nt-primary); border-color: var(--nt-primary); }
.action-primary:hover { background: var(--nt-primary-dark); }

/* Sticky Sub-Navbar */
.nt-nav { background: var(--nt-card); border-bottom: 1px solid var(--nt-border); box-shadow: 0 2px 6px rgba(0,0,0,.04); position: sticky; top: 0; z-index: 40; }
.nav-list { list-style: none; display: flex; margin: 0; padding: 0; align-items: stretch; flex-wrap: wrap; }
.nav-list > li { position: relative; }
.nav-list > li > a { display: flex; align-items: center; gap: 4px; padding: 11px 15px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .2px; border-right: 1px solid var(--nt-border); }
.nav-list > li.active > a, .nav-list > li > a[aria-current="page"], .nav-list > li > a:hover { color: var(--nt-primary); background: var(--nt-soft); }
.nav-list > li.active > a, .nav-list > li > a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--nt-primary); }
.nav-list > li > a:focus-visible, .mob-menu-btn:focus-visible, .drawer-close:focus-visible, .drawer-genres-btn:focus-visible, .sidebar-more-btn:focus-visible { outline: 2px solid var(--nt-primary); outline-offset: 2px; }
@media (forced-colors: active) {
  .nav-list > li > a[aria-current="page"], .drawer-links a[aria-current="page"] { border: 2px solid Highlight; }
}
.has-mega .megamenu { display: none; position: absolute; top: 100%; left: 0; min-width: 560px; background: var(--nt-card); border: 1px solid var(--nt-border); border-top: 3px solid var(--nt-primary); border-radius: 0 0 10px 10px; padding: 16px; box-shadow: 0 12px 32px rgba(0,0,0,.16); z-index: 60; }
.has-mega:hover .megamenu { display: block; }
.mega-title { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--nt-primary); margin-bottom: 10px; }
.mega-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 14px; }
.mega-grid a { font-size: 13px; padding: 3px 0; display: block; }

/* Notice Bar */
.nt-notice-bar { display: flex; align-items: center; gap: 10px; background: var(--nt-card); border: 1px solid #4080ff; border-radius: 8px; margin-top: 12px; overflow: hidden; font-size: 13px; }
.notice-badge { background: #4080ff; color: #fff; font-weight: 800; padding: 8px 13px; flex-shrink: 0; }
.notice-text { padding: 6px 10px 6px 0; }

/* Main Layout */
.nt-main { padding: 14px 0 28px; min-height: 60vh; }
.nt-box { background: var(--nt-card); border: 1px solid var(--nt-border); border-radius: 10px; padding: 14px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.03); }
.nt-box-flush { padding: 0; overflow: hidden; }
.box-title { display: flex; align-items: center; justify-content: space-between; font-size: 18px; font-weight: 800; color: var(--nt-blue); padding-bottom: 8px; margin-bottom: 14px; border-bottom: 2px solid var(--nt-primary); }
[data-theme="dark"] .box-title { color: #60a5fa; }
.filter-link, .count-tag { font-size: 12.5px; font-weight: 600; color: var(--nt-primary); }
.box-title-sm { display: flex; align-items: center; justify-content: space-between; font-size: 14.5px; font-weight: 800; padding-bottom: 8px; margin-bottom: 10px; border-bottom: 2px solid var(--nt-primary); text-transform: uppercase; }
.more-link { font-size: 11.5px; color: var(--nt-primary); text-transform: none; }

/* Native CSS Scroll Snap Carousel (thay OwlCarousel2 + jQuery) */
.featured-section { background: var(--nt-card); border: 1px solid var(--nt-border); border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-head h1, .section-head h2 { margin: 0; font-size: 18px; font-weight: 800; color: var(--nt-blue); }
[data-theme="dark"] .section-head h1, [data-theme="dark"] .section-head h2 { color: #60a5fa; }

/* SXO Hero & AEO FAQ & Topic-Cluster Internal Links */
.sxo-hero-bar { padding: 14px 16px; border-inline-start: 4px solid var(--nt-primary); }
.sxo-hero-title { margin: 0 0 6px; font-size: clamp(1.1rem, 0.95rem + 0.6vw, 1.38rem); font-weight: 800; color: var(--nt-blue); text-wrap: balance; }
[data-theme="dark"] .sxo-hero-title { color: #60a5fa; }
.sxo-hero-desc { margin: 0 0 10px; font-size: 0.9rem; color: var(--nt-muted); line-height: 1.55; }
.sxo-quick-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-hot { border-color: rgba(243, 102, 33, .45); color: var(--nt-primary); }
.chip-novel { border-color: rgba(15, 118, 110, .45); color: #0f766e; }
[data-theme="dark"] .chip-novel { color: #5eead4; }

.aeo-faq-list { display: grid; gap: 8px; }
.aeo-faq-item { border: 1px solid var(--nt-border); border-radius: 8px; background: var(--nt-soft); padding: 10px 12px; }
.aeo-faq-item summary { cursor: pointer; font-weight: 700; font-size: 0.92rem; line-height: 1.45; }
.aeo-faq-item p { margin: 8px 0 0; font-size: 0.88rem; color: var(--nt-muted); line-height: 1.6; }

.comic-ring-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.ring-link { font-size: 0.86rem; font-weight: 700; color: var(--nt-blue); max-width: 34ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-theme="dark"] .ring-link { color: #60a5fa; }
.ring-hub { color: #0f766e; }
[data-theme="dark"] .ring-hub { color: #5eead4; }
.chapter-related-box { margin-top: 16px; }
.carousel-controls { display: flex; gap: 6px; }
.carousel-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--nt-border); background: var(--nt-soft); color: var(--nt-text); font-size: 18px; line-height: 1; cursor: pointer; touch-action: manipulation; display: grid; place-items: center; }
.carousel-btn:hover { background: var(--nt-primary); color: #fff; border-color: var(--nt-primary); }
.carousel-btn:focus-visible { outline: 2px solid var(--nt-primary); outline-offset: 2px; }

.carousel-track {
  display: flex; gap: 12px; overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  touch-action: manipulation;
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .carousel-track { scroll-behavior: smooth; }
}
.slide-card { flex: 0 0 calc(20% - 10px); min-width: 165px; scroll-snap-align: start; }
.slide-thumb { display: block; position: relative; aspect-ratio: 3/4; border-radius: 8px; overflow: hidden; background: var(--nt-soft); }
.slide-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .28s ease; }
.slide-card:hover .slide-thumb img { transform: scale(1.05); }
.slide-overlay { position: absolute; inset: auto 0 0 0; background: linear-gradient(transparent, rgba(0,0,0,.88) 35%); color: #fff; padding: 18px 8px 8px; }
.slide-overlay h3 { margin: 0 0 4px; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slide-meta { display: flex; justify-content: space-between; font-size: 11px; color: #e2e8f0; }

/* Split Grid + Sticky Sidebar (xóa bỏ khoảng trắng trống 2800px bên phải) */
.layout-split { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 16px; align-items: start; }
.nt-sidebar { position: sticky; top: 56px; }

/* 4-Column Uniform CSS Grid */
.items-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.comic-card figure { margin: 0; display: flex; flex-direction: column; height: 100%; }
.card-thumb { position: relative; aspect-ratio: 3/4; border-radius: 7px; overflow: hidden; border: 1px solid var(--nt-border); background: var(--nt-soft); }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.comic-card:hover .card-thumb img { transform: scale(1.05); }
.card-stats { position: absolute; inset: auto 0 0 0; background: rgba(15,23,42,.72); color: #fff; padding: 4px 8px; font-size: 11.5px; display: flex; justify-content: space-between; }
.ribbon { position: absolute; top: 7px; left: 0; z-index: 2; background: var(--nt-primary); color: #fff; font-size: 10px; font-weight: 800; padding: 2px 7px; text-transform: uppercase; border-radius: 0 4px 4px 0; }
.ribbon.completed { background: #16a34a; }
.ribbon.coming { background: #64748b; }
.badge-novel { position: absolute; top: 7px; right: 6px; z-index: 2; background: rgba(15, 118, 110, .94); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; line-height: 1.3; box-shadow: 0 2px 6px rgba(0,0,0,.22); }
.novel-list-banner { background: var(--nt-soft); border: 1px solid var(--nt-border); border-inline-start: 4px solid #0f766e; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 0.9rem; line-height: 1.5; }

.comic-card figcaption { padding-top: 8px; flex: 1; display: flex; flex-direction: column; }
.comic-card figcaption h3 { margin: 0 0 6px; font-size: 14px; font-weight: 700; line-height: 1.35; height: 2.7em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-chapters { list-style: none; margin: 0; padding: 0; }
.card-chapters li { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 3px 0; border-top: 1px dashed var(--nt-border); font-size: 12px; }
.card-chapters li a { font-weight: 600; white-space: nowrap; }
.card-chapters li time { color: var(--nt-muted); font-size: 11px; white-space: nowrap; }

/* Sidebar Top Tabs */
.top-tabs { display: flex; border-bottom: 2px solid var(--nt-primary); }
.top-tabs .tab { flex: 1; padding: 10px 6px; border: 0; background: var(--nt-soft); color: var(--nt-muted); font-weight: 700; font-size: 12.5px; cursor: pointer; }
.top-tabs .tab.active { background: var(--nt-primary); color: #fff; }
.top-panels { padding: 4px 12px 10px; }
.top-list { list-style: none; margin: 0; padding: 0; }
.top-row { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px dashed var(--nt-border); }
.top-row:last-child { border-bottom: 0; }
.top-num { width: 28px; text-align: center; font-weight: 800; font-size: 18px; color: var(--nt-muted); flex-shrink: 0; }
.top-num.n1 { color: #3498db; }
.top-num.n2 { color: #27ae60; }
.top-num.n3 { color: #e67e22; }
.top-thumb { flex: 0 0 44px; }
.top-thumb img { width: 44px; height: 58px; object-fit: cover; border-radius: 4px; display: block; }
.top-info { flex: 1; min-width: 0; }
.top-info .name { display: block; font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-meta { display: flex; justify-content: space-between; font-size: 11.5px; margin-top: 3px; }
.top-meta .chap { color: var(--nt-primary); font-weight: 600; }
.top-meta .views { color: var(--nt-muted); }

.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--nt-soft); border: 1px solid var(--nt-border); }
.chip:hover { background: var(--nt-primary); color: #fff; border-color: var(--nt-primary); }

.mini-history-list { list-style: none; padding: 0; margin: 0; }
.mini-history-list li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--nt-border); font-size: 12.5px; }
.mini-history-list li:last-child { border-bottom: 0; }

/* Pagination */
.nt-pagination { display: flex; justify-content: center; gap: 6px; padding-top: 16px; flex-wrap: wrap; }
.pager-btn { min-width: 34px; height: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--nt-border); border-radius: 8px; background: var(--nt-card); font-weight: 700; font-size: 13px; }
.pager-btn.active, .pager-btn:hover:not(.ellipsis) { background: var(--nt-primary); color: #fff; border-color: var(--nt-primary); }

/* Detail Page */
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; color: var(--nt-muted); margin-bottom: 10px; }
.detail-title { margin: 0; font-size: 22px; font-weight: 800; }
.detail-updated { font-size: 12px; color: var(--nt-muted); font-style: italic; margin-top: 4px; }
.detail-hero { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; margin-top: 14px; }
.detail-cover img { width: 100%; height: auto; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; border: 1px solid var(--nt-border); display: block; }
.detail-meta dl { margin: 0; }
.meta-row { display: flex; padding: 7px 0; border-bottom: 1px solid var(--nt-border); font-size: 13.5px; }
.meta-row dt { width: 110px; color: var(--nt-muted); font-weight: 600; flex-shrink: 0; }
.meta-row dd { margin: 0; flex: 1; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn-nt { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 999px; font-weight: 700; font-size: 13px; border: 1px solid transparent; cursor: pointer; }
.btn-orange { background: var(--nt-primary); color: #fff; }
.btn-orange:hover { background: var(--nt-primary-dark); color: #fff; }
.btn-novel { background: #0f766e; color: #fff; }
@media (hover: hover) { .btn-novel:hover { background: #0d5e58; color: #fff; } }
.chap-text-pill { display: inline-flex; align-items: center; margin-inline-start: 8px; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; color: #0f766e; background: rgba(15, 118, 110, .11); border: 1px solid rgba(15, 118, 110, .3); vertical-align: middle; }
[data-theme="dark"] .chap-text-pill { color: #5eead4; background: rgba(20, 184, 166, .16); border-color: rgba(94, 234, 212, .35); }
@media (hover: hover) { .chap-text-pill:hover { background: #0f766e; color: #fff; border-color: #0f766e; } }
.btn-navy { background: var(--nt-header); color: #fff; }
.btn-navy:hover { color: #fff; filter: brightness(1.15); }
.btn-follow { background: #e11d48; color: #fff; }
.btn-follow.is-followed { background: #16a34a; }
.btn-outline { background: var(--nt-card); border-color: var(--nt-border); color: var(--nt-text); }
.btn-nt:disabled { opacity: .45; cursor: not-allowed; }
.detail-desc-block { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--nt-border); }
.section-subhead { margin: 0 0 10px; font-size: 14.5px; font-weight: 800; text-transform: uppercase; border-bottom: 2px solid var(--nt-primary); padding-bottom: 6px; }
.chapter-scroll { max-height: 460px; overflow-y: auto; }
.chapter-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.chapter-table th, .chapter-table td { padding: 9px 8px; border-bottom: 1px dashed var(--nt-border); text-align: left; }
.chapter-table td.t, .chapter-table th:nth-child(n+2) { text-align: right; color: var(--nt-muted); font-size: 12px; }

/* Reader */
.read-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0%; background: var(--nt-primary); z-index: 100; }
@media (prefers-reduced-motion: no-preference) { .read-progress { transition: width .08s linear; } }
.reader-header-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.reader-title { margin: 0; font-size: 1.15rem; font-weight: 800; text-wrap: balance; }
.reader-controls-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.reader-format-switch { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--nt-soft); border: 1px solid var(--nt-border); }
.format-tab { border: 1px solid transparent; background: transparent; color: var(--nt-text); border-radius: 999px; padding: 6px 14px; min-inline-size: 2rem; min-block-size: 2.25rem; cursor: pointer; font-size: 0.85rem; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.format-tab .format-meta { font-weight: 500; font-size: 0.78rem; opacity: .9; }
.format-tab[aria-pressed="true"] { background: #0f766e; color: #fff; border-color: #0f766e; }
.format-tab:focus-visible, .mode-pill:focus-visible, .tb-btn:focus-visible { outline: 2px solid var(--nt-primary); outline-offset: 2px; }
@media (pointer: coarse) {
  .format-tab, .mode-pill, .tb-btn { min-inline-size: 2.5rem; min-block-size: 2.5rem; }
}
.reader-mode-bar { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; flex-wrap: wrap; }
.reader-mode-bar[hidden] { display: none; }
.mode-pill { border: 1px solid var(--nt-border); background: var(--nt-soft); color: var(--nt-text); border-radius: 999px; padding: 5px 11px; min-inline-size: 2rem; min-block-size: 2rem; cursor: pointer; font-size: 0.78rem; font-weight: 600; }
.mode-pill[aria-pressed="true"], .mode-pill.active { background: var(--nt-primary); color: #fff; border-color: var(--nt-primary); }

/* Novel Toolbar & Reading Surface */
.novel-toolbar { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 12px; }
.novel-toolbar[hidden] { display: none !important; }
.tb-group { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tb-sep { display: inline-block; inline-size: 1px; block-size: 22px; border-inline-start: 1px solid var(--nt-border); margin: 0 2px; }
.tb-btn { border: 1px solid var(--nt-border); background: var(--nt-soft); color: var(--nt-text); border-radius: 8px; padding: 5px 10px; min-inline-size: 2rem; min-block-size: 2rem; cursor: pointer; font-size: 0.82rem; font-weight: 700; }
.tb-btn[aria-pressed="true"] { background: var(--nt-primary); color: #fff; border-color: var(--nt-primary); }
.novel-size-readout { font-size: 0.8rem; font-weight: 700; min-inline-size: 3.6rem; text-align: center; color: var(--nt-muted); }
@media (hover: hover) {
  .format-tab:not([aria-pressed="true"]):hover, .mode-pill:not([aria-pressed="true"]):hover, .tb-btn:not([aria-pressed="true"]):hover { background: var(--nt-border); }
}
@media (forced-colors: active) {
  .tb-btn[aria-pressed="true"], .format-tab[aria-pressed="true"], .mode-pill[aria-pressed="true"] { background: Highlight; color: HighlightText; border-color: ButtonText; }
  .tb-sep { border-inline-start-color: ButtonText; }
}

.reader-toolbar { background: var(--nt-card); border: 1px solid var(--nt-border); border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.sticky-reader-bar { position: sticky; top: 46px; z-index: 35; }
@media (prefers-reduced-motion: no-preference) { .sticky-reader-bar { transition: transform .2s ease; } }
.sticky-reader-bar.is-hidden { transform: translateY(-140%); }
.chap-word-short { display: none; }
.chap-select { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--nt-border); background: var(--nt-soft); color: var(--nt-text); font-weight: 600; }
.reader-pages { background: #111; border-radius: 8px; overflow: hidden; text-align: center; padding: 0; }
.reader-pages[data-read-bg="light"] { background: #f8fafc; }
.reader-pages[data-read-bg="sepia"] { background: #f4ecd8; }
.reader-pages img { display: block; width: 100%; max-width: 820px; height: auto; margin: 0 auto; }

.novel-view { border-radius: 10px; padding: clamp(20px, 3vw, 36px) clamp(16px, 3.5vw, 44px); border: 1px solid var(--nt-border); background: #111827; color: #e5e7eb; }
.novel-view[data-read-bg="light"] { background: #ffffff; color: #1e293b; }
.novel-view[data-read-bg="sepia"] { background: #f5ebd6; color: #3a2d1b; border-color: #dfd0b2; }
.novel-paper { width: 100%; max-width: none; margin: 0 auto; }
.novel-view[data-novel-width="compact"] .novel-paper { max-width: 920px; width: 100%; }
body.is-novel-wide .nt-main .container-main { max-width: min(1480px, 96vw); }
.novel-header { text-align: center; padding-bottom: 16px; margin-bottom: 22px; border-bottom: 1px dashed rgba(148, 163, 184, .35); }
.novel-heading { margin: 0 0 8px; font-size: clamp(1.25rem, 1rem + 1vw, 1.65rem); font-weight: 800; line-height: 1.3; text-wrap: balance; }
.novel-meta { margin: 0; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; font-size: 0.85rem; opacity: .82; }
.novel-body { width: 100%; font-size: var(--novel-size, 1.2rem); line-height: var(--novel-lh, 1.9); text-align: start; overflow-wrap: break-word; }
.novel-body[data-novel-font="sans"] { font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; }
.novel-body[data-novel-font="serif"] { font-family: "Times New Roman", Cambria, "Palatino Linotype", "Noto Serif", serif; }
.novel-body p { margin: 0 0 1.15em; text-wrap: pretty; }
.novel-subhead { margin: 0 0 1.1em; font-size: 1.18em; font-weight: 800; text-align: center; color: var(--nt-primary); text-wrap: balance; }
.novel-scene-break { border: 0; text-align: center; margin: 1.6em auto; height: auto; }
.novel-scene-break::before { content: "*  *  *"; letter-spacing: 0.5em; opacity: .55; font-weight: 700; }
.novel-empty-state { text-align: center; padding: 32px 12px; display: grid; gap: 16px; justify-items: center; }
.novel-empty-links { display: grid; gap: 10px; justify-items: center; max-width: 100%; }
.novel-empty-links-label { font-size: 0.9rem; opacity: .88; }
.novel-empty-pills { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.novel-empty-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* content-visibility: auto CHỈ dùng cho vùng dưới màn hình đầu tiên + bắt buộc đi kèm contain-intrinsic-size */
.reader-page-deferred { content-visibility: auto; contain-intrinsic-size: auto none auto 1100px; }
.chapter-list-deferred { content-visibility: auto; contain-intrinsic-size: auto none auto 420px; }

/* Search inline */
.search-inline-form { display: flex; gap: 8px; margin-bottom: 16px; }
.search-inline-form input { flex: 1; padding: 10px 14px; border-radius: 9px; border: 1px solid var(--nt-border); background: var(--nt-soft); color: var(--nt-text); font-size: 14px; }

/* Balanced 3-Column Footer (sửa triệt để lỗi bể layout cột trống) */
.nt-footer {
  background: #181826; color: #cbd5e1; padding: 30px 0 18px; margin-top: 24px;
  border-top: 3px solid var(--nt-primary);
  content-visibility: auto; contain-intrinsic-size: auto none auto 260px;
}
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1.4fr; gap: 28px; align-items: start; }
.nt-footer h5 { margin: 0 0 10px; font-size: 13.5px; text-transform: uppercase; color: #fff; letter-spacing: .4px; }
.footer-desc { font-size: 13px; color: #94a3b8; line-height: 1.65; margin: 10px 0; }
.footer-meta { font-size: 12.5px; color: #cbd5e1; }
.footer-meta a:hover { color: var(--nt-primary); }
.footer-col-links ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 13px; }
.footer-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.footer-tag { font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid #334155; color: #cbd5e1; background: rgba(255,255,255,.04); }
.footer-tag:hover { border-color: var(--nt-primary); color: #fff; background: var(--nt-primary); }
.footer-bottom { margin-top: 22px; padding-top: 14px; border-top: 1px solid #2b2d42; text-align: center; font-size: 12px; color: #94a3b8; }

/* Mobile Drawer */
.drawer-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 95; backdrop-filter: blur(2px); }
.drawer-overlay.open { display: block; }
.drawer {
  position: fixed; inset-block-start: 0; inset-inline-start: 0;
  inline-size: min(300px, 84dvw); block-size: 100dvh;
  background: var(--nt-card); z-index: 100;
  padding: 16px; padding-block-end: calc(20px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(-105%); transition: transform .24s ease;
  box-shadow: 4px 0 24px rgba(0,0,0,.28);
}
.drawer[hidden] { display: none !important; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding-block-end: 10px; border-block-end: 2px solid var(--nt-primary); margin-block-end: 12px; }
.drawer-close { background: none; border: 0; font-size: 24px; line-height: 1; min-inline-size: 38px; min-block-size: 38px; color: var(--nt-text); cursor: pointer; display: grid; place-items: center; }
.drawer-search { display: flex; gap: 6px; margin-block-end: 12px; }
.drawer-search input { flex: 1; min-inline-size: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--nt-border); background: var(--nt-soft); color: var(--nt-text); }
.drawer-search button { border: 0; border-radius: 8px; background: var(--nt-primary); color: #fff; padding: 0 12px; font-weight: 700; cursor: pointer; }
.drawer ul { list-style: none; margin: 0; padding: 0; }
.drawer-links > li > a { display: flex; align-items: center; gap: 8px; padding-block: 10px; padding-inline: 4px; border-block-end: 1px solid var(--nt-border); font-weight: 600; min-block-size: 42px; }
.drawer-links > li > a[aria-current="page"] { color: var(--nt-primary); border-inline-start: 3px solid var(--nt-primary); padding-inline-start: 10px; background: var(--nt-soft); font-weight: 800; }
.drawer-genres-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; padding-block: 11px; padding-inline: 4px; background: transparent; border: 0; border-block-end: 1px solid var(--nt-border); color: var(--nt-text); font: inherit; font-weight: 700; cursor: pointer; min-block-size: 44px; text-align: start; }
.drawer-genres-btn[aria-expanded="true"] { color: var(--nt-primary); }
.drawer-genres-btn[aria-expanded="true"] .drawer-caret { transform: rotate(180deg); }
.drawer-caret { transition: transform .2s ease; }
.drawer-genre-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding-block: 10px; }
.drawer-genre-grid[hidden], .chip-wrap-extra[hidden] { display: none !important; }
.drawer-genre-grid li a { display: block; padding: 6px 8px; border: 1px solid var(--nt-border); border-radius: 6px; background: var(--nt-soft); font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.footer-tag-all { background: var(--nt-primary) !important; color: #fff !important; border-color: var(--nt-primary) !important; font-weight: 700; }
.chip-wrap-extra { margin-top: 6px; }
.sidebar-more-btn { width: 100%; margin-top: 10px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--nt-border); background: var(--nt-soft); color: var(--nt-text); font-size: 12px; font-weight: 700; cursor: pointer; }
.sidebar-more-btn:hover { border-color: var(--nt-primary); color: var(--nt-primary); }

.back-top-btn { position: fixed; inset-inline-end: 16px; inset-block-end: 20px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--nt-primary); color: #fff; font-weight: 900; font-size: 18px; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 50; }

@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-caret { transition: none; }
}

@media (max-width: 1024px) {
  .layout-split { grid-template-columns: minmax(0, 1fr); }
  .nt-sidebar { position: static; }
  .items-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .tb-group-width, .tb-sep-width { display: none; }
}

@media (max-width: 720px) {
  .container-main { max-width: 100%; padding-inline: 10px; }
  .header-inner { flex-wrap: wrap; gap: 8px 10px; }
  .mob-menu-btn { display: inline-flex; align-items: center; justify-content: center; min-inline-size: 40px; min-block-size: 40px; flex-shrink: 0; }
  .nt-brand { flex-shrink: 1; min-inline-size: 0; }
  .nt-brand .brand-logo { max-inline-size: 132px; block-size: 28px; }
  .brand-site-tag, .nt-header-actions .action-pill { display: none; }
  .nt-header-actions { margin-inline-start: auto; gap: 6px; flex-shrink: 0; }
  .mob-novel-pill { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); color: #fff; font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; min-block-size: 36px; }
  .nt-search { order: 10; flex: 1 0 100%; inline-size: 100%; min-inline-size: 0; margin: 0; }
  .nt-search form { inline-size: 100%; }
  .nt-search input { min-inline-size: 0; }

  .nt-nav { display: block; overflow: visible; }
  .nt-nav .nav-inner { padding-inline: 0; }
  .nav-list { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 6px; padding: 8px 12px; align-items: center; }
  .nav-list::-webkit-scrollbar { display: none; }
  .nav-list > li { flex-shrink: 0; }
  .nav-list > li > a { padding: 7px 12px; font-size: 12px; border-right: 0; border: 1px solid var(--nt-border); border-radius: 999px; background: var(--nt-soft); white-space: nowrap; }
  .nav-list > li.active > a, .nav-list > li > a[aria-current="page"] { background: var(--nt-primary); color: #fff; border-color: var(--nt-primary); box-shadow: none; font-weight: 800; }
  .has-mega .megamenu { display: none !important; }

  .items-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .slide-card { flex: 0 0 46%; min-width: 140px; }
  .detail-hero { grid-template-columns: minmax(0, 1fr); }
  .detail-cover { max-width: 210px; margin: 0 auto; }

  .reader-header-box { padding: 10px 12px; gap: 8px; margin-bottom: 10px; }
  .novel-toolbar {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
    gap: 6px;
    padding: 6px 24px 6px 10px;
    margin-bottom: 10px;
    -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 22px), transparent 100%);
    mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 22px), transparent 100%);
  }
  .novel-toolbar.is-scrolled-end {
    -webkit-mask-image: none;
    mask-image: none;
    padding-inline-end: 10px;
  }
  .novel-toolbar::-webkit-scrollbar { display: none; }
  .novel-toolbar .tb-group { flex-wrap: nowrap; flex-shrink: 0; gap: 3px; scroll-snap-align: start; }
  .novel-toolbar .tb-sep { flex-shrink: 0; block-size: 18px; margin: 0 2px; }
  .novel-toolbar .tb-btn { padding: 4px 8px; min-inline-size: 2.15rem; min-block-size: 2.25rem; font-size: 0.78rem; white-space: nowrap; border-radius: 7px; }
  .novel-toolbar .novel-size-readout { min-inline-size: 2.9rem; font-size: 0.74rem; }

  .reader-toolbar { flex-wrap: nowrap; gap: 5px; padding: 7px 8px; margin-bottom: 10px; }
  .sticky-reader-bar { top: 52px; }
  body.is-novel-wide .nt-main .container-main { max-width: 100%; padding-inline: 8px; }
  .novel-view { padding: 16px 14px; border-radius: 8px; }
  .reader-toolbar .btn-nt { padding: 6px 8px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }
  .reader-toolbar .chap-select { flex: 1 1 auto; min-inline-size: 0; padding: 6px 6px; font-size: 12px; }

  .nt-footer { content-visibility: visible; contain-intrinsic-size: auto; inline-size: 100%; padding: 24px 0 calc(20px + env(safe-area-inset-bottom, 0px)); }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .footer-col-links ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
  .footer-tags { gap: 6px; }
  .footer-tag { padding: 4px 8px; font-size: 11px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 6px; padding-block-start: 12px; font-size: 12px; }
  .back-top-btn { inset-inline-end: 12px; inset-block-end: calc(14px + env(safe-area-inset-bottom, 0px)); width: 38px; height: 38px; }
}

@media (max-width: 480px) {
  .chap-word-full { display: none; }
  .chap-word-short { display: inline; }
}
