/* =========================================================
   iBook — Hệ thống thiết kế
   Chủ đề: giấy ấm + mực đậm, dành cho sách & sách điện tử
   ========================================================= */

/* ---------- 1. Design tokens ---------- */
:root {
  /* Màu nền & bề mặt */
  --paper:        #FBF8F2;
  --paper-2:      #F4EEE3;
  --surface:      #FFFFFF;
  --surface-2:    #FDFBF7;
  --line:         #E7DFD1;
  --line-strong:  #D6CAB6;

  /* Chữ */
  --ink:          #17150F;
  --ink-2:        #4A4438;
  --ink-3:        #7C7466;

  /* Nhấn */
  --accent:       #B0522C;   /* terracotta – nút chính */
  --accent-ink:   #FFFFFF;
  --accent-soft:  #F6E7DE;
  --pine:         #1E4B44;   /* xanh rêu – nhấn phụ */
  --pine-soft:    #E2EDE9;
  --gold:         #B08420;
  --gold-soft:    #F6EDD6;

  /* Trạng thái */
  --sale:         #A3282C;
  --sale-soft:    #FBE6E5;

  /* Hình khối */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(23,21,15,.06), 0 2px 6px rgba(23,21,15,.05);
  --shadow-md: 0 2px 6px rgba(23,21,15,.06), 0 12px 28px -10px rgba(23,21,15,.18);
  --shadow-lg: 0 6px 14px rgba(23,21,15,.07), 0 30px 60px -24px rgba(23,21,15,.32);
  --shadow-book: 0 1px 1px rgba(23,21,15,.10), 0 10px 22px -8px rgba(23,21,15,.35);

  /* Nhịp */
  --gap: 24px;
  --pad-section: clamp(56px, 7vw, 104px);
  --container: 1200px;

  /* Chữ */
  --font-ui: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Lora", Georgia, "Times New Roman", serif;
  --font-read: "Literata", Georgia, serif;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper:        #131210;
  --paper-2:      #1A1815;
  --surface:      #1C1A16;
  --surface-2:    #221F1A;
  --line:         #322D25;
  --line-strong:  #46402F;

  --ink:          #F3EDE1;
  --ink-2:        #C6BCA9;
  --ink-3:        #978D7B;

  --accent:       #D9744A;
  --accent-ink:   #17150F;
  --accent-soft:  #35231A;
  --pine:         #7FC0B2;
  --pine-soft:    #16302C;
  --gold:         #D8B45E;
  --gold-soft:    #322914;

  --sale:         #E9756F;
  --sale-soft:    #37201F;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow-md: 0 2px 6px rgba(0,0,0,.45), 0 14px 30px -12px rgba(0,0,0,.7);
  --shadow-lg: 0 8px 18px rgba(0,0,0,.45), 0 34px 70px -26px rgba(0,0,0,.85);
  --shadow-book: 0 1px 1px rgba(0,0,0,.5), 0 12px 26px -8px rgba(0,0,0,.8);

  color-scheme: dark;
}

/* ---------- 2. Reset & nền tảng ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5 { margin: 0; font-family: var(--font-display); font-weight: 600; line-height: 1.18; letter-spacing: -.015em; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

::selection { background: var(--accent); color: var(--accent-ink); }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--ink); color: var(--paper);
  padding: 10px 18px; border-radius: var(--r-sm);
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 3. Bố cục ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 20px; }
.container--wide { max-width: 1360px; }
.container--narrow { max-width: 820px; }

.section { padding-block: var(--pad-section); }
.section--tight { padding-block: clamp(40px, 5vw, 68px); }
.section--paper { background: var(--paper-2); }

.stack > * + * { margin-top: var(--gap); }
.cluster { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.grid { display: grid; gap: var(--gap); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--books { grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 34px 24px; }

/* ---------- 4. Kiểu chữ ---------- */
.display-1 { font-size: clamp(2.6rem, 5.4vw, 4.15rem); letter-spacing: -.03em; }
.display-2 { font-size: clamp(2rem, 3.6vw, 2.9rem); letter-spacing: -.025em; }
.h3 { font-size: clamp(1.35rem, 2vw, 1.7rem); }
.h4 { font-size: 1.15rem; }

.eyebrow {
  font-family: var(--font-ui);
  font-size: .74rem; font-weight: 700;
  letter-spacing: .17em; text-transform: uppercase;
  color: var(--accent);
  display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before {
  content: ""; width: 26px; height: 1.5px; background: currentColor; opacity: .55;
}
.eyebrow--center::after {
  content: ""; width: 26px; height: 1.5px; background: currentColor; opacity: .55;
}

.lede { font-size: 1.075rem; color: var(--ink-2); max-width: 62ch; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 36px; flex-wrap: wrap;
}
.section-head__text { max-width: 60ch; }
.section-head__text .display-2 { margin-top: 12px; }
.section-head__text > p { margin-top: 12px; color: var(--ink-2); }
.section-head--center { flex-direction: column; align-items: center; text-align: center; }

/* ---------- 5. Nút ---------- */
.btn {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-ink);
  --btn-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 24px;
  font-size: .94rem; font-weight: 600; letter-spacing: .005em;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1.5px solid var(--btn-bd);
  border-radius: var(--r-pill);
  transition: transform .18s cubic-bezier(.2,.8,.3,1), box-shadow .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn--ghost { --btn-bg: transparent; --btn-fg: var(--ink); --btn-bd: var(--line-strong); }
.btn--ghost:hover { --btn-bd: var(--ink); }
.btn--ink { --btn-bg: var(--ink); --btn-fg: var(--paper); }
.btn--pine { --btn-bg: var(--pine); --btn-fg: #fff; }
:root[data-theme="dark"] .btn--pine { --btn-fg: #10201D; }
.btn--light { --btn-bg: rgba(255,255,255,.1); --btn-fg: #F3EDE1; --btn-bd: rgba(243,237,225,.35); }
.btn--gold { --btn-bg: var(--gold); --btn-fg: #17150F; }
.btn--sm { padding: 9px 17px; font-size: .84rem; }
.btn--lg { padding: 16px 32px; font-size: 1rem; }
.btn--block { width: 100%; }

.link-arrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: .92rem; color: var(--accent);
  border-bottom: 1.5px solid transparent; padding-bottom: 2px;
  transition: border-color .2s ease, gap .2s ease;
}
.link-arrow:hover { border-color: currentColor; gap: 12px; }

/* ---------- 6. Nhãn / chip ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--line);
}
.badge--sale   { background: var(--sale-soft); color: var(--sale); border-color: transparent; }
.badge--new    { background: var(--pine-soft); color: var(--pine); border-color: transparent; }
.badge--gold   { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.badge--accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.fmt {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: var(--r-xs);
  font-size: .655rem; font-weight: 700; letter-spacing: .08em;
  border: 1px solid var(--line-strong); color: var(--ink-3);
  background: var(--surface);
}
.fmt--epub { color: var(--pine); border-color: color-mix(in srgb, var(--pine) 45%, transparent); }
.fmt--pdf  { color: var(--sale); border-color: color-mix(in srgb, var(--sale) 45%, transparent); }
.fmt--mobi,
.fmt--azw3 { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 50%, transparent); }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface);
  font-size: .88rem; font-weight: 500; color: var(--ink-2);
  transition: all .18s ease;
}
.chip:hover { border-color: var(--ink); color: var(--ink); transform: translateY(-1px); }
.chip[aria-pressed="true"], .chip.is-active {
  background: var(--ink); border-color: var(--ink); color: var(--paper);
}
.chip__count { font-size: .75rem; opacity: .6; }

/* ---------- 7. Header ---------- */
.topbar {
  background: #17150F; color: #F3EDE1;
  font-size: .8rem; letter-spacing: .01em;
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 38px; }
.topbar__marquee { display: flex; align-items: center; gap: 10px; }
.topbar__dot { width: 6px; height: 6px; border-radius: 50%; background: #D8B45E; flex: none; }
.topbar__links { display: flex; gap: 20px; opacity: .78; }
.topbar__links a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }

.header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, box-shadow .25s ease;
}
.header.is-stuck { border-bottom-color: var(--line); box-shadow: 0 8px 24px -18px rgba(23,21,15,.5); }
.header__inner { display: flex; align-items: center; gap: 22px; min-height: 74px; }

.logo { display: inline-flex; align-items: center; gap: 11px; font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; }
.logo__mark {
  width: 36px; height: 36px; border-radius: 9px; flex: none;
  background: linear-gradient(150deg, var(--accent), #8C3C1E);
  display: grid; place-items: center; color: #fff;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.2), var(--shadow-sm);
  position: relative;
}
.logo__mark::after {
  content: ""; position: absolute; left: 9px; top: 7px; bottom: 7px; width: 1.5px;
  background: rgba(255,255,255,.5); border-radius: 2px;
}
.logo__mark svg { width: 18px; height: 18px; margin-left: 6px; }
.logo em { font-style: normal; color: var(--accent); }

.nav { display: flex; align-items: center; gap: 4px; margin-inline: auto; }
.nav__item { position: relative; }
.nav__link {
  position: relative; padding: 9px 14px; border-radius: var(--r-sm); white-space: nowrap;
  font-size: .93rem; font-weight: 500; color: var(--ink-2);
  transition: color .18s ease, background .18s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.nav__link:hover { color: var(--ink); background: var(--paper-2); }
.nav__link[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav__link[aria-current="page"]::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px;
  height: 2px; border-radius: 2px; background: var(--accent);
}
.nav__caret { width: 14px; height: 14px; opacity: .5; }

.mega {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translate(-50%, 8px);
  width: min(660px, 78vw); padding: 22px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.nav__item:hover .mega, .nav__item:focus-within .mega {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0);
}
.mega__title {
  grid-column: 1 / -1; font-family: var(--font-ui);
  font-size: .7rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px;
}
.mega__link { display: flex; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); transition: background .16s ease; }
.mega__link:hover { background: var(--paper-2); }
.mega__ico {
  width: 34px; height: 34px; flex: none; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 1rem;
}
.mega__name { font-weight: 600; font-size: .92rem; }
.mega__desc { font-size: .78rem; color: var(--ink-3); line-height: 1.45; }

.header__tools { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--ink-2);
  transition: background .18s ease, color .18s ease; position: relative;
}
.icon-btn:hover { background: var(--paper-2); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn__count {
  position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--r-pill); background: var(--accent); color: #fff;
  font-size: .64rem; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--paper);
}
.header__burger { display: none; }

/* Ô tìm kiếm */
.search { position: relative; flex: 1; max-width: 330px; }
.searchbar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 44px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-pill);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.searchbar:focus-within { border-color: var(--ink); box-shadow: 0 0 0 4px var(--accent-soft); }
.searchbar svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.searchbar input { flex: 1; border: 0; background: none; outline: none; font-size: .9rem; min-width: 0; }
.searchbar input::placeholder { color: var(--ink-3); }
.searchbar kbd {
  font-family: var(--font-ui); font-size: .68rem; font-weight: 600;
  padding: 3px 6px; border-radius: 5px; border: 1px solid var(--line);
  background: var(--paper-2); color: var(--ink-3);
}

.search-pop {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 70;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: 8px; max-height: 62vh; overflow: auto;
}
.search-pop[hidden] { display: none; }
.search-res { display: flex; gap: 12px; padding: 9px 10px; border-radius: var(--r-sm); align-items: center; }
.search-res:hover { background: var(--paper-2); }
.search-res .cover { width: 34px; flex: none; }
.search-res__t { font-weight: 600; font-size: .89rem; line-height: 1.3; }
.search-res__a { font-size: .77rem; color: var(--ink-3); }
.search-res__p { margin-left: auto; font-weight: 700; font-size: .84rem; white-space: nowrap; }
.search-empty { padding: 20px; text-align: center; color: var(--ink-3); font-size: .88rem; }
.search-hint { padding: 8px 10px 4px; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }

/* Menu di động */
.mobile-panel {
  position: fixed; inset: 0; z-index: 90;
  background: var(--paper); padding: 20px;
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
.mobile-panel.is-open { transform: translateX(0); }
.mobile-panel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.mobile-panel a.nav__link { font-size: 1.1rem; padding: 15px 8px; border-bottom: 1px solid var(--line); border-radius: 0; display: flex; }
.mobile-panel .btn { margin-top: 22px; }

/* ---------- 8. Bìa sách dựng bằng CSS ---------- */
.cover {
  --c1: #2E4A6B; --c2: #16263A;
  position: relative; aspect-ratio: 2 / 3; width: 100%;
  border-radius: 3px 7px 7px 3px; overflow: hidden;
  background: linear-gradient(148deg, var(--c1), var(--c2));
  box-shadow: var(--shadow-book);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 12% 10% 10% 16%;
  color: #fff; isolation: isolate;
  transition: transform .35s cubic-bezier(.2,.8,.3,1), box-shadow .35s ease;
}
.cover::before { /* gáy sách */
  content: ""; position: absolute; inset-block: 0; left: 0; width: 9%;
  background: linear-gradient(90deg, rgba(0,0,0,.45), rgba(0,0,0,.12) 55%, rgba(255,255,255,.16));
  z-index: 2;
}
.cover::after { /* vân giấy + ánh sáng */
  content: ""; position: absolute; inset: 0; z-index: 1; opacity: .55;
  background:
    radial-gradient(120% 80% at 85% 0%, rgba(255,255,255,.22), transparent 60%),
    repeating-linear-gradient(115deg, rgba(255,255,255,.05) 0 2px, transparent 2px 9px);
}
.cover > * { position: relative; z-index: 3; }
.cover__label {
  font-size: .52rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  opacity: .82; line-height: 1.4;
}
.cover__body { margin-top: auto; }
.cover__title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(.7rem, 1.35vw, 1rem); line-height: 1.22;
  letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.cover__rule { width: 26px; height: 2px; background: rgba(255,255,255,.7); margin: 8px 0 7px; border-radius: 2px; }
.cover__author { font-size: .6rem; letter-spacing: .05em; opacity: .84; line-height: 1.35; }
.cover--lg { border-radius: 4px 10px 10px 4px; }

/* ---------- 9. Thẻ sách ---------- */
.book { position: relative; display: flex; flex-direction: column; }
.book__media { position: relative; margin-bottom: 15px; }
.book__media::after { /* bóng đổ dưới sách */
  content: ""; position: absolute; left: 8%; right: 8%; bottom: -9px; height: 14px;
  background: radial-gradient(50% 60% at 50% 0%, rgba(23,21,15,.30), transparent 72%);
  filter: blur(3px); opacity: .8; transition: opacity .3s ease, transform .3s ease;
}
.book:hover .cover { transform: translateY(-8px) rotate(-.6deg); box-shadow: var(--shadow-lg); }
.book:hover .book__media::after { opacity: .5; transform: scaleX(1.06); }

.book__flags { position: absolute; top: 9px; left: 13%; right: 8px; display: flex; gap: 5px; flex-wrap: wrap; z-index: 4; }
.book__quick {
  position: absolute; inset-inline: 8px; bottom: 8px; z-index: 4;
  display: flex; gap: 6px;
  opacity: 0; transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
}
.book:hover .book__quick, .book:focus-within .book__quick { opacity: 1; transform: translateY(0); }
.book__quick .btn { flex: 1; padding: 9px 8px; font-size: .76rem; }
.book__quick .btn--ghost { background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(6px); }

.book__fmts { display: flex; gap: 4px; margin-bottom: 7px; flex-wrap: wrap; }
.book__title {
  font-family: var(--font-display); font-size: 1rem; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  transition: color .18s ease;
}
.book:hover .book__title { color: var(--accent); }
.book__author { font-size: .82rem; color: var(--ink-3); margin-top: 4px; }
.book__meta { margin-top: 9px; display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.book__price { font-weight: 700; font-size: 1rem; }
.book__price-old { font-size: .82rem; color: var(--ink-3); text-decoration: line-through; }
.book__rating { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; color: var(--ink-2); margin-top: 7px; }
.stars { display: inline-flex; gap: 1.5px; color: var(--gold); }
.stars svg { width: 13px; height: 13px; }
.stars .is-off { color: var(--line-strong); }

/* dải ngang cuộn */
.rail { display: flex; gap: 24px; overflow-x: auto; padding-bottom: 20px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.rail > * { flex: 0 0 clamp(158px, 21vw, 196px); scroll-snap-align: start; }
.rail::-webkit-scrollbar { height: 7px; }
.rail::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
.rail::-webkit-scrollbar-track { background: var(--line); border-radius: 4px; }

/* thẻ sách dạng hàng (bảng xếp hạng) */
.book-row { display: flex; gap: 15px; align-items: center; padding: 11px; border-radius: var(--r-md); transition: background .18s ease, box-shadow .18s ease; }
.book-row:hover { background: var(--surface); box-shadow: var(--shadow-sm); }
.book-row__rank { font-family: var(--font-display); font-size: 1.85rem; font-weight: 700; color: var(--line-strong); width: 32px; text-align: center; flex: none; }
.book-row:hover .book-row__rank { color: var(--accent); }
.book-row .cover { width: 56px; flex: none; }
.book-row__body { min-width: 0; flex: 1; }
.book-row__t { font-family: var(--font-display); font-weight: 600; font-size: .95rem; line-height: 1.3; }
.book-row__a { font-size: .78rem; color: var(--ink-3); }
.book-row__p { font-weight: 700; font-size: .9rem; white-space: nowrap; }

/* ---------- 10. Hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(44px, 6vw, 84px) clamp(56px, 7vw, 96px); }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(70% 60% at 78% 16%, var(--accent-soft), transparent 62%),
    radial-gradient(58% 55% at 8% 84%, var(--pine-soft), transparent 60%);
  opacity: .9;
}
.hero::after { /* dòng kẻ giấy */
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px);
  background-size: 100% 34px; opacity: .4;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 25%, #000 70%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 25%, #000 70%, transparent);
}
.hero > .container { position: relative; z-index: 1; }
.hero__grid { display: grid; grid-template-columns: 1.02fr .98fr; gap: clamp(30px, 5vw, 60px); align-items: center; }
.hero__title { margin-top: 18px; }
.hero__title .ital { font-style: italic; color: var(--accent); }
.hero__lede { margin-top: 20px; font-size: 1.1rem; color: var(--ink-2); max-width: 50ch; }
.hero__cta { margin-top: 30px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero__stats { margin-top: 42px; display: flex; gap: clamp(20px, 4vw, 44px); flex-wrap: wrap; }
.hero__stat strong { display: block; font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; }
.hero__stat span { font-size: .82rem; color: var(--ink-3); }

.hero__art { position: relative; min-height: 500px; display: grid; place-items: center; }
.hero__books { position: absolute; inset: 0; }
.hero__books .cover { position: absolute; }
.hero__books .cover:nth-child(1) { left: 0;    top: 10%;   rotate: -8deg; width: 35%; animation: float 7s ease-in-out infinite; }
.hero__books .cover:nth-child(2) { left: 5%;   bottom: 2%; rotate: 5deg;  width: 30%; animation: float 8.5s ease-in-out infinite .8s; }
.hero__books .cover:nth-child(3) { right: 0;   top: 3%;    rotate: 7deg;  width: 29%; animation: float 9s ease-in-out infinite .4s; }
.hero__books .cover:nth-child(4) { right: 3%;  bottom: 7%; rotate: -5deg; width: 26%; animation: float 7.8s ease-in-out infinite 1.2s; }
@keyframes float { 0%,100% { translate: 0 0; } 50% { translate: 0 -14px; } }
@media (prefers-reduced-motion: reduce) { .hero__books .cover, .float-card { animation: none !important; } }

/* ---------- 11. Máy đọc sách (mockup) ---------- */
.ereader {
  position: relative; width: min(300px, 74%); aspect-ratio: 3 / 4.35;
  background: linear-gradient(160deg, #3A3630, #2A2723 45%, #201E1A);
  border-radius: 20px; padding: 18px 14px 38px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.16);
  z-index: 2;
}
.ereader::after { /* phím nguồn */
  content: ""; position: absolute; right: -3px; top: 22%; width: 3px; height: 44px;
  background: #4A453D; border-radius: 0 3px 3px 0;
}
.ereader__screen {
  height: 100%; border-radius: 5px; overflow: hidden;
  background: #EFEAE0; color: #23211C;
  padding: 14px 14px 11px; font-family: var(--font-read);
  font-size: .58rem; line-height: 1.72; text-align: justify;
  display: flex; flex-direction: column;
  box-shadow: inset 0 0 22px rgba(23,21,15,.13);
}
.ereader__brand { position: absolute; bottom: 12px; left: 50%; translate: -50%; font-family: var(--font-ui); font-size: .56rem; letter-spacing: .22em; color: #79726A; text-transform: uppercase; }
.ereader__st { display: flex; justify-content: space-between; font-family: var(--font-ui); font-size: .5rem; letter-spacing: .06em; color: #6E675D; border-bottom: 1px solid #D8D0C2; padding-bottom: 6px; margin-bottom: 10px; }
.ereader__h { font-family: var(--font-display); font-size: .8rem; font-weight: 600; margin-bottom: 8px; line-height: 1.25; }
.ereader__screen p + p { margin-top: 7px; text-indent: 1.1em; }
.ereader__foot { margin-top: auto; padding-top: 8px; border-top: 1px solid #D8D0C2; display: flex; justify-content: space-between; font-family: var(--font-ui); font-size: .5rem; color: #6E675D; }
.ereader__bar { height: 2px; background: #D8D0C2; border-radius: 2px; margin-top: 7px; overflow: hidden; }
.ereader__bar i { display: block; height: 100%; width: 38%; background: #4B443A; border-radius: 2px; }

.float-card {
  position: absolute; z-index: 3;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-md);
  padding: 11px 15px; display: flex; align-items: center; gap: 11px;
  font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.float-card small { display: block; font-weight: 400; color: var(--ink-3); font-size: .72rem; }
.float-card__ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--pine-soft); color: var(--pine); }
.float-card__ico svg { width: 17px; height: 17px; }
.float-card { max-width: 262px; }
.float-card--a { left: -3%; top: -1%; animation: float 6.5s ease-in-out infinite; }
.float-card--b { right: -3%; bottom: -1%; animation: float 7.5s ease-in-out infinite .9s; }

/* ---------- 12. Thẻ chung ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 26px;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.card--hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.card__ico {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 18px;
}
.card__ico svg { width: 22px; height: 22px; }
.card__ico--pine { background: var(--pine-soft); color: var(--pine); }
.card__ico--gold { background: var(--gold-soft); color: var(--gold); }
.card h3 { font-size: 1.12rem; margin-bottom: 8px; }
.card > p { color: var(--ink-2); font-size: .92rem; }

/* danh mục */
.cat-card {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg); padding: 22px; min-height: 168px;
  display: flex; flex-direction: column; justify-content: flex-end;
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .25s ease, box-shadow .25s ease;
}
.cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.cat-card__glow { position: absolute; inset: 0; opacity: .15; transition: opacity .25s ease; }
.cat-card:hover .cat-card__glow { opacity: .28; }
.cat-card__n { font-family: var(--font-display); font-size: 1.14rem; font-weight: 600; position: relative; }
.cat-card__c { font-size: .8rem; color: var(--ink-3); position: relative; }
.cat-card__emoji { position: absolute; top: 14px; right: 16px; font-size: 1.85rem; }

/* ---------- 13. Thiết bị & bảng so sánh ---------- */
.device-card { text-align: center; display: flex; flex-direction: column; align-items: center; }
.device-card .ereader { width: 58%; margin-bottom: 22px; }
.device-card__name { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; }
.device-card__spec { font-size: .84rem; color: var(--ink-3); margin-top: 5px; }
.device-card__price { margin-top: 14px; font-weight: 700; font-size: 1.05rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
table.cmp { width: 100%; border-collapse: collapse; min-width: 760px; font-size: .9rem; }
table.cmp th, table.cmp td { padding: 15px 18px; text-align: left; border-bottom: 1px solid var(--line); }
table.cmp thead th { background: var(--paper-2); font-family: var(--font-ui); font-weight: 700; font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
table.cmp tbody th { font-family: var(--font-ui); font-weight: 600; color: var(--ink-2); white-space: nowrap; }
table.cmp tbody tr:last-child td, table.cmp tbody tr:last-child th { border-bottom: 0; }
table.cmp tbody tr:hover { background: var(--surface-2); }
.yes { color: var(--pine); font-weight: 700; }
.no  { color: var(--ink-3); }

/* ---------- 14. Trang thư viện ---------- */
/* Cột lọc rộng thêm để bù phần đệm bên trong khung, tên thể loại khỏi xuống dòng */
.catalog { display: grid; grid-template-columns: 300px 1fr; gap: 36px; align-items: start; }
/* Bộ lọc là một vùng riêng, tách khỏi lưới sách bằng nền và viền */
.filters {
  position: sticky; top: 96px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px 20px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
/* Trang sách nói dùng bảng màu tím riêng của nó */
.audio-page .filters { background: var(--a-card); border-color: var(--a-line); }
.filter-group + .filter-group { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.filter-group__t { font-family: var(--font-ui); font-size: .74rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 13px; }
/* Tên thể loại dài ("Tâm lý – Kỹ năng sống") phải nằm gọn một dòng: bớt khoảng
   cách, cho phần tên co lại và cắt bằng dấu ba chấm thay vì rớt xuống dòng. */
.check {
  display: flex; align-items: center; gap: 8px; padding: 6px 0;
  font-size: .87rem; cursor: pointer; color: var(--ink-2); min-width: 0;
}
.check__t {
  min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.check:hover { color: var(--ink); }
.check input { width: 17px; height: 17px; accent-color: var(--accent); flex: none; cursor: pointer; }
.check__n { margin-left: auto; font-size: .76rem; color: var(--ink-3); flex: none; padding-left: 6px; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line);
}
.select {
  appearance: none; padding: 10px 38px 10px 15px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background-color: var(--surface); color: var(--ink);
  font-size: .87rem; font-weight: 500;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237C7466' stroke-width='2' stroke-linecap='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 15px;
  cursor: pointer;
}
.active-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.active-filters:empty { display: none; }
.tag-x { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font-size: .8rem; font-weight: 600; }
.tag-x button { color: inherit; display: grid; place-items: center; opacity: .7; line-height: 1; }
.tag-x button:hover { opacity: 1; }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 50px; }
.pagination a, .pagination span {
  min-width: 42px; height: 42px; padding: 0 12px; border-radius: var(--r-sm);
  display: grid; place-items: center; font-size: .9rem; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  transition: all .16s ease;
}
.pagination a:hover { border-color: var(--ink); color: var(--ink); }
.pagination .is-current { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.empty-state { text-align: center; padding: 70px 20px; color: var(--ink-3); }
.empty-state svg { width: 46px; height: 46px; margin: 0 auto 16px; opacity: .5; }

/* ---------- 15. Trang chi tiết ---------- */
.crumbs { display: flex; gap: 8px; align-items: center; font-size: .82rem; color: var(--ink-3); flex-wrap: wrap; padding-block: 20px; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.crumbs svg { width: 13px; height: 13px; opacity: .55; }

.detail { display: grid; grid-template-columns: 310px 1fr 300px; gap: 44px; align-items: start; }
.detail__cover .cover { box-shadow: var(--shadow-lg); }
.detail__thumbs { display: flex; gap: 10px; margin-top: 18px; }
.detail__thumbs .cover { width: 52px; cursor: pointer; opacity: .5; transition: opacity .2s, transform .2s; }
.detail__thumbs .cover.is-active, .detail__thumbs .cover:hover { opacity: 1; transform: translateY(-2px); }

.buybox { position: sticky; top: 96px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.fmt-pick { display: grid; gap: 9px; margin-bottom: 20px; }
.fmt-opt {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-md); cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}
.fmt-opt:hover { border-color: var(--line-strong); }
.fmt-opt input { accent-color: var(--accent); width: 17px; height: 17px; flex: none; }
.fmt-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.fmt-opt__n { font-weight: 600; font-size: .9rem; }
.fmt-opt__d { font-size: .75rem; color: var(--ink-3); }
.fmt-opt__p { margin-left: auto; font-weight: 700; font-size: .93rem; white-space: nowrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 26px; overflow-x: auto; }
.tab {
  padding: 13px 18px; font-size: .92rem; font-weight: 600; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: color .18s ease, border-color .18s ease;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.tabpanel[hidden] { display: none; }

.prose { font-family: var(--font-read); font-size: 1.01rem; line-height: 1.85; color: var(--ink-2); max-width: 68ch; }
.prose p + p { margin-top: 1.05em; }
.prose h3 { font-family: var(--font-display); color: var(--ink); margin: 1.6em 0 .5em; font-size: 1.26rem; }
.prose blockquote {
  margin: 1.6em 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--accent);
  font-style: italic; color: var(--ink); font-size: 1.05rem;
}
.prose ul { list-style: none; margin: 1em 0; }
.prose li { position: relative; padding-left: 22px; margin: .4em 0; }
.prose li::before { content: "—"; position: absolute; left: 0; color: var(--accent); }

.specs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; margin: 0; }
.specs > div { background: var(--surface); padding: 15px 18px; }
.specs dt { font-family: var(--font-ui); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.specs dd { margin: 5px 0 0; font-weight: 600; font-size: .92rem; }

.review { padding: 22px 0; border-bottom: 1px solid var(--line); }
.review__head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .88rem; background: var(--pine-soft); color: var(--pine); flex: none; }
.rating-summary { display: flex; gap: 34px; align-items: center; flex-wrap: wrap; padding: 24px; background: var(--paper-2); border-radius: var(--r-lg); margin-bottom: 10px; }
.rating-big { font-family: var(--font-display); font-size: 3rem; font-weight: 700; line-height: 1; }
.rating-bars { flex: 1; min-width: 220px; display: grid; gap: 7px; }
.rating-bar { display: flex; align-items: center; gap: 10px; font-size: .8rem; color: var(--ink-3); }
.rating-bar i { flex: 1; height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; }
.rating-bar i b { display: block; height: 100%; background: var(--gold); border-radius: 4px; }

/* ---------- 16. Trình đọc thử ---------- */
.reader-shell { background: var(--paper-2); min-height: 100vh; display: flex; flex-direction: column; }
.reader-bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px; padding: 10px 18px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.reader-bar__t { font-family: var(--font-display); font-weight: 600; font-size: .95rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-bar__sp { margin-left: auto; }

.reader-main { flex: 1; display: flex; justify-content: center; padding: clamp(16px, 3.5vw, 42px) 20px 0; }
.reader-page {
  position: relative; width: min(1060px, 100%);
  background: var(--rd-bg, #FFFDF8); color: var(--rd-fg, #24211B);
  border-radius: var(--r-lg); border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  padding: clamp(26px, 4vw, 54px) clamp(22px, 4.4vw, 58px);
  transition: background .25s ease, color .25s ease;
}
.reader-content {
  font-family: var(--rd-font, var(--font-read));
  font-size: var(--rd-size, 19px);
  line-height: var(--rd-lh, 1.85);
  text-align: justify; hyphens: auto;
  height: 58vh; min-height: 340px; overflow: hidden;
}
.reader-content h2 { font-family: inherit; font-size: 1.45em; margin: 0 0 .7em; break-after: avoid; letter-spacing: -.01em; color: inherit; }
.reader-content p { margin: 0 0 1em; }
.reader-content p.drop::first-letter {
  float: left; font-size: 3em; line-height: .84; padding: .06em .09em 0 0; font-weight: 600; font-family: var(--font-display);
}
.reader-content .sep { text-align: center; letter-spacing: .8em; margin: 1.6em 0; opacity: .5; }

.reader-nav { display: flex; align-items: center; gap: 16px; justify-content: center; padding: 20px; }
.reader-progress { flex: 1; max-width: 400px; }
.reader-progress input { width: 100%; accent-color: var(--accent); }
.reader-progress span { display: block; text-align: center; font-size: .76rem; color: var(--ink-3); margin-top: 3px; }
.round-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--ink-2); transition: all .18s ease; }
.round-btn:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); transform: scale(1.06); }
.round-btn:disabled { opacity: .35; cursor: not-allowed; }
.round-btn svg { width: 20px; height: 20px; }

.reader-panel {
  position: fixed; right: 16px; top: 64px; z-index: 45; width: 300px; max-height: 78vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 20px;
}
.reader-panel[hidden] { display: none; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.opt-row__l { font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.seg { display: flex; gap: 3px; padding: 3px; background: var(--paper-2); border-radius: var(--r-pill); }
.seg button { padding: 6px 11px; border-radius: var(--r-pill); font-size: .79rem; font-weight: 600; color: var(--ink-3); transition: all .15s ease; }
.seg button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); transition: transform .15s ease, border-color .15s; }
.swatch.is-active { border-color: var(--accent); transform: scale(1.12); }

.toc-list a { display: block; padding: 9px 12px; border-radius: var(--r-sm); font-size: .86rem; color: var(--ink-2); transition: background .15s; }
.toc-list a:hover { background: var(--paper-2); color: var(--ink); }
.toc-list a.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.toc-list small { float: right; color: var(--ink-3); font-weight: 400; }

/* ---------- 17. Dải tính năng / CTA / bản tin ---------- */
.strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
.strip__i { background: var(--paper); padding: 25px 22px; display: flex; gap: 14px; align-items: flex-start; }
.strip__i svg { width: 24px; height: 24px; color: var(--accent); flex: none; margin-top: 2px; }
.strip__i strong { display: block; font-size: .93rem; }
.strip__i span { font-size: .81rem; color: var(--ink-3); line-height: 1.5; }

.cta-band { position: relative; overflow: hidden; border-radius: var(--r-xl); padding: clamp(34px, 5vw, 62px); background: linear-gradient(135deg, #23201A, #14120F); color: #F3EDE1; }
.cta-band::before { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 90% at 88% 12%, rgba(176,82,44,.45), transparent 62%), radial-gradient(50% 70% at 6% 96%, rgba(30,75,68,.45), transparent 60%); }
.cta-band > * { position: relative; }
.cta-band .muted { color: rgba(243,237,225,.66); }
.cta-band .eyebrow { color: #D8B45E; }

.newsletter-form { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.newsletter-form input {
  flex: 1; min-width: 220px; padding: 14px 20px; border-radius: var(--r-pill);
  border: 1.5px solid rgba(243,237,225,.26); background: rgba(255,255,255,.07); color: inherit; outline: none;
}
.newsletter-form input::placeholder { color: rgba(243,237,225,.5); }
.newsletter-form input:focus { border-color: #D8B45E; }

.quote-card { position: relative; padding-top: 26px; }
.quote-card::before { content: "\201C"; position: absolute; top: -12px; left: -4px; font-family: var(--font-display); font-size: 4.6rem; color: var(--accent); opacity: .22; line-height: 1; }
.quote-card p { font-family: var(--font-display); font-size: 1.06rem; line-height: 1.62; color: var(--ink); }
.quote-card footer { margin-top: 18px; display: flex; align-items: center; gap: 12px; }

.post { display: flex; flex-direction: column; gap: 13px; }
.post__thumb { aspect-ratio: 16/10; border-radius: var(--r-md); overflow: hidden; position: relative; background: linear-gradient(140deg, var(--c1, #2E4A6B), var(--c2, #16263A)); }
.post__thumb::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(255,255,255,.06) 0 12px, transparent 12px 24px); }
.post__thumb .badge { position: absolute; left: 14px; bottom: 14px; z-index: 2; }
.post h3 { font-size: 1.06rem; line-height: 1.35; transition: color .18s ease; }
.post:hover h3 { color: var(--accent); }
.post__meta { font-size: .78rem; color: var(--ink-3); }

/* ---------- 18. Footer ---------- */
.footer { background: #17150F; color: #C6BCA9; padding-block: clamp(46px, 6vw, 74px) 32px; }
.footer__grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr 1.3fr; gap: 40px 28px; }
.footer .logo { color: #F3EDE1; }
.footer h4 { color: #F3EDE1; font-family: var(--font-ui); font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; margin-bottom: 16px; }
.footer li + li { margin-top: 9px; }
.footer a { font-size: .88rem; transition: color .16s ease; }
.footer a:hover { color: #F3EDE1; }
.footer__bottom { margin-top: 44px; padding-top: 24px; border-top: 1px solid rgba(243,237,225,.12); display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; font-size: .81rem; color: #8B8172; }
.socials { display: flex; gap: 8px; margin-top: 18px; }
.socials a { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(243,237,225,.18); display: grid; place-items: center; transition: all .18s ease; }
.socials a:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateY(-2px); }
.socials svg { width: 17px; height: 17px; }
.pay { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.pay span { padding: 5px 9px; border-radius: 5px; border: 1px solid rgba(243,237,225,.18); font-size: .67rem; letter-spacing: .06em; }

/* ---------- 19. Hiệu ứng & tiện ích ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.8,.3,1); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

.toast {
  position: fixed; left: 50%; bottom: 26px; translate: -50% 100px; z-index: 120;
  background: var(--ink); color: var(--paper); padding: 13px 22px; border-radius: var(--r-pill);
  box-shadow: var(--shadow-lg); font-size: .88rem; font-weight: 500;
  opacity: 0; transition: opacity .28s ease, translate .28s cubic-bezier(.2,.8,.3,1);
  display: flex; align-items: center; gap: 10px; pointer-events: none;
}
.toast.is-on { opacity: 1; translate: -50% 0; }

/* ---------- 20. Responsive ---------- */
@media (max-width: 1100px) {
  .detail { grid-template-columns: 270px 1fr; }
  .buybox { grid-column: 1 / -1; position: static; }
  .footer__grid { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 980px) {
  .nav, .search { display: none; }
  .header__burger { display: grid; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__art { min-height: 400px; margin-top: 14px; }
  .catalog { grid-template-columns: 1fr; }
  .filters { position: static; }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .grid--books { grid-template-columns: repeat(auto-fill, minmax(144px, 1fr)); gap: 28px 16px; }
  .detail { grid-template-columns: 1fr; }
  .topbar__links { display: none; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .reader-panel { left: 16px; right: 16px; width: auto; }
  .float-card { display: none; }
  .section-head { align-items: flex-start; }
}
@media (max-width: 480px) {
  .grid--4 { grid-template-columns: 1fr 1fr; }
  .strip { grid-template-columns: 1fr; }
  .hero__stats { gap: 22px; }
  .book__quick { display: none; }
}

@media print {
  .header, .topbar, .footer, .reader-bar, .reader-nav, .btn { display: none !important; }
  body { background: #fff; }
}

/* ---------- 21. Tinh chỉnh bổ sung ---------- */
.link-arrow svg { width: 16px; height: 16px; }
.strip__i > span:first-child { display: flex; flex: none; }
.cat-card__glow { pointer-events: none; }
.book__quick .btn svg { width: 16px; height: 16px; }
.float-card > span:last-child { line-height: 1.35; }
.hero__art > .ereader { position: relative; }
.section-head__text .eyebrow { margin-bottom: 2px; }
.detail__meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.detail__title { font-size: clamp(1.7rem, 3vw, 2.4rem); letter-spacing: -.025em; }
.gift-note { display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px; border-radius: var(--r-md); background: var(--pine-soft); color: var(--pine); font-size: .82rem; line-height: 1.5; margin-top: 16px; }
.gift-note svg { width: 17px; height: 17px; flex: none; margin-top: 2px; }
.trust-list { display: grid; gap: 11px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.trust-list li { display: flex; gap: 10px; font-size: .84rem; color: var(--ink-2); align-items: flex-start; }
.trust-list svg { width: 17px; height: 17px; color: var(--pine); flex: none; margin-top: 2px; }

/* ---------- 22. Trang thiết bị ---------- */
.page-hero { position: relative; overflow: hidden; padding-block: clamp(44px, 5.5vw, 78px); background: var(--paper-2); border-bottom: 1px solid var(--line); }
.page-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 70% at 82% 20%, var(--accent-soft), transparent 62%); }
.page-hero > .container { position: relative; }

.steps { counter-reset: st; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; grid-template-columns: repeat(4, 1fr); }
.step { background: var(--surface); padding: 26px 22px; position: relative; }
.step::before {
  counter-increment: st; content: counter(st, decimal-leading-zero);
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--accent); opacity: .35;
  display: block; margin-bottom: 12px;
}
.step h3 { font-size: 1.04rem; margin-bottom: 7px; }
.step p { font-size: .87rem; color: var(--ink-2); }

.faq details {
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  padding: 0 20px; margin-bottom: 10px; transition: border-color .18s ease;
}
.faq details[open] { border-color: var(--line-strong); }
.faq summary {
  cursor: pointer; list-style: none; padding: 17px 0; font-weight: 600; font-size: .96rem;
  display: flex; align-items: center; gap: 14px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; margin-left: auto; font-size: 1.3rem; color: var(--accent); line-height: 1; transition: transform .2s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding: 0 0 18px; font-size: .9rem; color: var(--ink-2); line-height: 1.72; max-width: 74ch; }

.spec-list { display: grid; gap: 9px; margin-top: 16px; text-align: left; }
.spec-list li { display: flex; gap: 9px; font-size: .84rem; color: var(--ink-2); }
.spec-list svg { width: 16px; height: 16px; color: var(--pine); flex: none; margin-top: 3px; }

.accessory { display: flex; gap: 16px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); transition: border-color .18s ease, transform .18s ease; }
.accessory:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.accessory__ico { width: 52px; height: 52px; border-radius: var(--r-sm); display: grid; place-items: center; font-size: 1.5rem; background: var(--paper-2); flex: none; }
.accessory__p { margin-left: auto; font-weight: 700; font-size: .9rem; white-space: nowrap; }

@media (max-width: 980px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }

/* ---------- 23. Trình đọc: chi tiết thêm ---------- */
.reader-flow { height: 100%; column-fill: auto; }
.reader-flow > :first-child { margin-top: 0; }
.reader-content { position: relative; }
.reader-tap { position: absolute; inset: 0; display: flex; justify-content: space-between; z-index: 2; pointer-events: none; }
.reader-tap button { width: 15%; background: none; pointer-events: auto; }
.reader-tap button:first-child { cursor: w-resize; }
.reader-tap button:last-child { cursor: e-resize; }
.reader-page__edge {
  position: absolute; inset-block: 26px; width: 1px; left: 50%;
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.reader-page[data-cols="1"] .reader-page__edge { display: none; }

.reader-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--r-pill); background: var(--paper-2); font-size: .74rem; font-weight: 600; color: var(--ink-2); }

.reader-buy {
  margin: 34px auto 0; max-width: 1060px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
  padding: 22px 26px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.reader-buy .cover { width: 62px; flex: none; }
.reader-buy__t { flex: 1; min-width: 220px; }
.reader-buy__t strong { font-family: var(--font-display); font-size: 1.06rem; }
.reader-buy__t p { font-size: .84rem; color: var(--ink-3); margin-top: 3px; }

.range { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 3px; background: var(--line); outline: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--surface); box-shadow: var(--shadow-sm); }
.range::-moz-range-thumb { width: 16px; height: 16px; border: 2px solid var(--surface); border-radius: 50%; background: var(--accent); cursor: pointer; }

.panel-title { font-family: var(--font-ui); font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 14px; }
.panel-sep { border-top: 1px solid var(--line); margin: 18px 0; }
.kbd-hint { display: flex; gap: 8px; align-items: center; font-size: .74rem; color: var(--ink-3); margin-top: 4px; flex-wrap: wrap; }
.kbd-hint kbd { font-family: var(--font-ui); font-size: .68rem; font-weight: 600; padding: 3px 7px; border-radius: 5px; border: 1px solid var(--line); background: var(--paper-2); }

@media (max-width: 720px) {
  .reader-bar__t { font-size: .85rem; }
  .reader-buy { flex-direction: column; align-items: flex-start; }
}

/* ---------- 24. Sửa lỗi sau khi kiểm tra trên trình duyệt ---------- */
.book .cover__label { display: none; }          /* nhường chỗ cho nhãn giảm giá */
.book__title { min-height: 2.6em; }             /* các thẻ trong lưới thẳng hàng */
.logo__text { display: inline-flex; }
@media (max-width: 1180px) { .nav__link { padding: 9px 10px; font-size: .89rem; } }

/* Chữ trên bìa co giãn theo bề rộng của chính bìa sách (container query) */
.cover { container-type: inline-size; }
.cover__label  { font-size: max(6px, 4cqw); letter-spacing: .14em; }
.cover__title  { font-size: max(9px, 8.6cqw); }
.cover__author { font-size: max(7px, 4.7cqw); }
.cover__rule   { width: 14cqw; height: max(1px, .9cqw); margin: 5cqw 0 4cqw; }
@supports not (width: 1cqw) {
  .cover__label { font-size: .52rem; }
  .cover__title { font-size: clamp(.7rem, 1.2vw, 1rem); }
  .cover__author { font-size: .6rem; }
}
.hero__books .cover:nth-child(1) { width: 38%; }
.hero__books .cover:nth-child(2) { width: 33%; }
.hero__books .cover:nth-child(3) { width: 32%; }
.hero__books .cover:nth-child(4) { width: 29%; }

/* Cụm bìa sách trong hero: xoè rộng hơn để tựa sách đọc được */
.hero__books .cover:nth-child(1) { width: 42%; left: -6%; top: 8%; }
.hero__books .cover:nth-child(2) { width: 36%; left: 0;    bottom: 0; }
.hero__books .cover:nth-child(3) { width: 35%; right: -6%; top: 2%; }
.hero__books .cover:nth-child(4) { width: 31%; right: 0;   bottom: 4%; }
.hero__art > .ereader { width: min(252px, 58%); }

/* Mục lục: số trang canh phải gọn gàng */
.toc-list a { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.toc-list small { float: none; white-space: nowrap; }

.reader-panel { width: 318px; }
.opt-row__l { white-space: nowrap; }
.kbd-hint { line-height: 2.1; }

/* Hộp chọn định dạng: tên và mô tả xuống dòng riêng */
.fmt-opt > span:nth-child(2) { flex: 1; min-width: 0; }
.fmt-opt__n, .fmt-opt__d { display: block; line-height: 1.4; }

/* Thanh tab: ẩn thanh cuộn thừa */
.tabs { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }

/* Ba mẫu máy đặt cạnh nhau: canh đáy để thấy chênh lệch kích thước */
.device-card { justify-content: flex-end; }
.device-card .ereader { margin-top: auto; }

/* Kết quả tìm kiếm: tên và tác giả xuống dòng riêng */
.search-res > span:nth-child(2) { flex: 1; min-width: 0; }
.search-res__t, .search-res__a { display: block; }
.search-res__t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-res__a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =========================================================
   25. Bản sửa lỗi & mảng Sách nói
   ========================================================= */

/* Bìa sách là flex item: chặn kích thước tối thiểu tự động khiến bìa phình to */
.cover { min-width: 0; }

/* --- Mega menu: tên và số lượng xuống dòng riêng --- */
.mega__link > span:last-child { min-width: 0; }
.mega__name, .mega__desc { display: block; }
.mega { width: min(700px, 82vw); }

/* --- Hàng xếp hạng: tên / tác giả / giá xếp dọc --- */
.book-row { gap: 14px; align-items: center; }
.book-row__cover { width: 58px; flex: none; display: block; }
.book-row__body { display: block; }
.book-row__t, .book-row__a, .book-row__p { display: block; }
.book-row__t { margin-bottom: 2px; }
.book-row__a { margin-bottom: 6px; }
.book-row__p { font-weight: 700; font-size: .92rem; }
.book-row__old { color: var(--ink-3); font-weight: 400; font-size: .8rem; margin-left: 7px; }
.book-row__go { flex: none; color: var(--ink-3); opacity: 0; transform: translateX(-4px); transition: all .18s ease; }
.book-row__go svg { width: 18px; height: 18px; }
.book-row:hover .book-row__go { opacity: 1; transform: none; }

/* --- Thẻ sách: mô tả ngắn + dấu hiệu sách nói --- */
.book__desc {
  margin-top: 8px; font-size: .82rem; line-height: 1.55; color: var(--ink-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.55em;
}
.book__audio {
  margin-top: 8px; display: inline-flex; align-items: center; gap: 6px;
  font-size: .75rem; font-weight: 600; color: var(--pine);
  background: var(--pine-soft); padding: 4px 9px; border-radius: var(--r-pill);
}
.book__audio svg { width: 13px; height: 13px; flex: none; }
.book__rating { margin-top: 9px; }

/* --- Nhãn định dạng âm thanh --- */
.fmt--m4b, .fmt--mp3 {
  color: var(--pine); border-color: color-mix(in srgb, var(--pine) 45%, transparent);
  background: var(--pine-soft);
}

/* --- Trình phát sách nói (mô phỏng) --- */
.player {
  width: min(430px, 100%); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 26px; box-shadow: var(--shadow-lg);
}
.player__top { display: flex; gap: 16px; align-items: flex-start; }
.player__top .cover { width: 96px; flex: none; }
.player__t { font-family: var(--font-display); font-size: 1.08rem; font-weight: 600; line-height: 1.28; }
.player__a { font-size: .82rem; color: var(--ink-3); margin-top: 4px; }
.player__nar { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: .78rem; color: var(--pine); font-weight: 600; }
.player__nar svg { width: 14px; height: 14px; flex: none; }

.wave { display: flex; align-items: center; gap: 2.5px; height: 46px; margin: 22px 0 8px; }
.wave i { flex: 1; background: var(--line-strong); border-radius: 2px; min-height: 3px; transition: background .2s ease; }
.wave i.is-on { background: var(--accent); }
.player__times { display: flex; justify-content: space-between; font-size: .74rem; color: var(--ink-3); }
.player__ctrl { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 16px; }
.player__play {
  width: 58px; height: 58px; border-radius: 50%; flex: none;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  box-shadow: var(--shadow-md); transition: transform .18s ease;
}
.player__play:hover { transform: scale(1.06); }
.player__play svg { width: 24px; height: 24px; }
.player__skip { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); border: 1px solid var(--line); position: relative; }
.player__skip:hover { border-color: var(--ink); color: var(--ink); }
.player__skip svg { width: 20px; height: 20px; }
.player__skip b { position: absolute; font-size: .52rem; font-weight: 700; letter-spacing: .02em; }
.player__foot {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: .76rem; color: var(--ink-3);
}
.player__foot span { display: inline-flex; align-items: center; gap: 6px; }
.player__foot svg { width: 14px; height: 14px; }

/* Dải giới thiệu sách nói */
.audio-hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(30px, 5vw, 58px); align-items: center; }
.audio-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 30px; }
.audio-facts strong { display: block; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }
.audio-facts span { font-size: .8rem; color: var(--ink-3); }
.audio-art { position: relative; display: grid; place-items: center; }
@media (max-width: 980px) { .audio-hero { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .audio-facts { grid-template-columns: 1fr 1fr; } }

/* =========================================================
   26. Tinh chỉnh cho màn hình nhỏ
   ========================================================= */

/* Nhóm nút bên phải luôn dạt về mép phải, kể cả khi menu chính bị ẩn */
.header__tools { margin-left: auto; }

/* Thông báo trên cùng: thoáng hơn, không bị bó khi xuống 2 dòng */
.topbar { line-height: 1.55; }
.topbar__inner { min-height: 42px; padding-block: 9px; }
.topbar__marquee { align-items: flex-start; }
.topbar__dot { margin-top: 8px; }

@media (max-width: 980px) {
  .topbar__inner { justify-content: center; text-align: center; }
  .topbar__marquee { justify-content: center; }
}

@media (max-width: 720px) {
  /* Hero: canh giữa toàn khối cho cân đối trên điện thoại */
  .hero__grid > div:first-child { text-align: center; }
  .hero__lede { margin-inline: auto; }
  .hero__cta { justify-content: center; }
  .hero__cta .btn { flex: 1 1 260px; max-width: 340px; }
  .hero__stats { justify-content: center; gap: 26px 30px; }
  .hero__title br { display: none; }

  /* Thông báo trên cùng rộng rãi hơn nữa */
  .topbar { font-size: .78rem; }
  .topbar__inner { padding-block: 11px; min-height: 48px; }

  /* Trình phát sách nói */
  .player { padding: 20px; }
  .player__top .cover { width: 78px; }
}
.book__audio { white-space: nowrap; max-width: 100%; overflow: hidden; }

/* =========================================================
   27. Sách miễn phí
   ========================================================= */
.badge--free { background: var(--pine); color: #fff; border-color: transparent; }
:root[data-theme="dark"] .badge--free { color: #10201D; }
.book__price--free { color: var(--pine); }

.freebox {
  position: sticky; top: 96px;
  background: linear-gradient(165deg, var(--pine-soft), var(--surface) 60%);
  border: 1.5px solid color-mix(in srgb, var(--pine) 35%, transparent);
  border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-sm);
}
.freebox__price { font-family: var(--font-display); font-size: 2.3rem; font-weight: 700; color: var(--pine); line-height: 1; }
.freebox__sub { font-size: .82rem; color: var(--ink-2); margin-top: 6px; }

.dl-list { display: grid; gap: 8px; margin: 20px 0 4px; }
.dl-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-md);
  border: 1.5px solid var(--line); background: var(--surface);
  transition: border-color .18s ease, transform .18s ease;
}
.dl-row:hover { border-color: var(--pine); transform: translateY(-1px); }
.dl-row__ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--paper-2); color: var(--ink-2); }
.dl-row__ico svg { width: 17px; height: 17px; }
.dl-row__n { font-weight: 600; font-size: .9rem; }
.dl-row__d { font-size: .75rem; color: var(--ink-3); }
.dl-row__s { margin-left: auto; font-size: .78rem; color: var(--ink-3); white-space: nowrap; }

.free-note {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--paper-2); font-size: .82rem; line-height: 1.6; color: var(--ink-2);
  margin-top: 18px;
}
.free-note svg { width: 17px; height: 17px; flex: none; margin-top: 3px; color: var(--pine); }

.chapter-list { display: grid; gap: 2px; margin-top: 18px; }
.chapter {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 13px; border-radius: var(--r-sm); text-align: left;
  transition: background .16s ease;
}
.chapter:hover { background: var(--paper-2); }
.chapter.is-playing { background: var(--pine-soft); }
.chapter__i {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line-strong); color: var(--ink-3); font-size: .7rem; font-weight: 700;
}
.chapter.is-playing .chapter__i { background: var(--pine); border-color: var(--pine); color: #fff; }
.chapter__t { font-size: .89rem; font-weight: 500; flex: 1; min-width: 0; }
.chapter.is-playing .chapter__t { color: var(--pine); font-weight: 600; }
.chapter__d { font-size: .78rem; color: var(--ink-3); white-space: nowrap; }

/* =========================================================
   28. Thư viện sách nói — bảng màu riêng biệt
   ========================================================= */
.audio-page {
  /* Sáng */
  --a-bg:     #F5F4FB;
  --a-bg-2:   #ECEAF7;
  --a-card:   #FFFFFF;
  --a-line:   #DEDBEF;
  --a-ink:    #1A192C;
  --a-ink-2:  #4B4869;
  --a-ink-3:  #7C799B;
  --a-hi:     #DD5A2C;
  --a-hi-2:   #0F8A72;
  --a-soft:   rgba(26,25,44,.04);
  --a-bar:    rgba(255,255,255,.94);
  --a-shadow: 0 18px 40px -22px rgba(26,25,44,.38);
  --a-glow-1: rgba(221,90,44,.16);
  --a-glow-2: rgba(15,138,114,.14);
  background: var(--a-bg); color: var(--a-ink);
}
:root[data-theme="dark"] .audio-page {
  /* Tối */
  --a-bg:     #12142A;
  --a-bg-2:   #191C38;
  --a-card:   #1E2143;
  --a-line:   #2C3059;
  --a-ink:    #EDEBFF;
  --a-ink-2:  #A8A5CE;
  --a-ink-3:  #7A78A0;
  --a-hi:     #FF8A5B;
  --a-hi-2:   #6FE3C4;
  --a-soft:   rgba(255,255,255,.045);
  --a-bar:    rgba(20,22,46,.94);
  --a-shadow: 0 18px 40px -20px rgba(0,0,0,.9);
  --a-glow-1: rgba(255,138,91,.28);
  --a-glow-2: rgba(111,227,196,.20);
}

.ahero {
  position: relative; overflow: hidden;
  padding-block: clamp(46px, 6vw, 82px) clamp(34px, 4vw, 54px);
  background:
    radial-gradient(60% 80% at 82% 10%, var(--a-glow-1), transparent 62%),
    radial-gradient(52% 70% at 8% 96%, var(--a-glow-2), transparent 60%),
    linear-gradient(180deg, var(--a-bg-2), var(--a-bg));
  border-bottom: 1px solid var(--a-line);
}
.ahero__eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: .74rem; font-weight: 700; letter-spacing: .17em; text-transform: uppercase;
  color: var(--a-hi-2);
}
.ahero__eyebrow svg { width: 16px; height: 16px; }
.ahero h1 { color: var(--a-ink); margin-top: 16px; }
.ahero__lede { color: var(--a-ink-2); margin-top: 16px; max-width: 56ch; font-size: 1.05rem; }
.ahero__stats { display: flex; gap: clamp(20px, 4vw, 46px); margin-top: 32px; flex-wrap: wrap; }
.ahero__stats strong { display: block; font-family: var(--font-display); font-size: 1.6rem; color: var(--a-ink); }
.ahero__stats span { font-size: .8rem; color: var(--a-ink-3); }

.achip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r-pill);
  border: 1px solid var(--a-line); background: var(--a-soft);
  color: var(--a-ink-2); font-size: .87rem; font-weight: 500;
  transition: all .18s ease;
}
.achip:hover { border-color: var(--a-ink-3); color: var(--a-ink); }
.achip.is-active { background: var(--a-hi); border-color: var(--a-hi); color: #FFF7F2; font-weight: 600; }

.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 18px; }
.acard {
  display: flex; gap: 16px; padding: 16px;
  background: var(--a-card); border: 1px solid var(--a-line);
  border-radius: var(--r-lg);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.acard:hover { transform: translateY(-3px); border-color: var(--a-ink-3); box-shadow: var(--a-shadow); }
.acard__media { position: relative; width: 96px; flex: none; }
.acard__media .cover { border-radius: 10px; }
.acard__play {
  position: absolute; right: -10px; bottom: -8px;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--a-hi); color: #FFF7F2; display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(26,25,44,.32); transition: transform .18s ease;
}
.acard__play:hover { transform: scale(1.1); }
.acard__play svg { width: 18px; height: 18px; }
.acard__body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.acard__t {
  font-family: var(--font-display); font-size: 1.02rem; font-weight: 600; line-height: 1.3; color: var(--a-ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.acard__a { font-size: .8rem; color: var(--a-ink-3); margin-top: 4px; }
.acard__nar { display: flex; align-items: center; gap: 6px; font-size: .77rem; color: var(--a-hi-2); margin-top: 8px; }
.acard__nar svg { width: 13px; height: 13px; flex: none; }
.acard__foot { margin-top: auto; padding-top: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.acard__dur { font-size: .77rem; color: var(--a-ink-2); display: inline-flex; align-items: center; gap: 5px; }
.acard__dur svg { width: 13px; height: 13px; }
.acard__price { margin-left: auto; font-weight: 700; font-size: .92rem; color: var(--a-ink); }
.acard__price.is-free { color: var(--a-hi-2); }

.miniwave { display: flex; align-items: center; gap: 2px; height: 20px; margin-top: 10px; }
.miniwave i { flex: 1; background: var(--a-line); border-radius: 1px; min-height: 2px; }
.acard:hover .miniwave i { background: var(--a-ink-3); }

.narrators { display: flex; gap: 12px; flex-wrap: wrap; }
.nchip {
  display: flex; align-items: center; gap: 11px; padding: 9px 16px 9px 9px;
  border-radius: var(--r-pill); border: 1px solid var(--a-line); background: var(--a-soft);
  transition: all .18s ease;
}
.nchip:hover { border-color: var(--a-hi); }
.nchip__av {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(150deg, var(--a-hi), #B4472A); color: #fff; font-weight: 700; font-size: .8rem;
}
.nchip__n { font-size: .88rem; font-weight: 600; color: var(--a-ink); }
.nchip__c { font-size: .74rem; color: var(--a-ink-3); }

.asection-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.asection-head h2 { color: var(--a-ink); }
.asection-head p { color: var(--a-ink-3); font-size: .9rem; margin-top: 8px; }
.audio-page .link-arrow { color: var(--a-hi); }
.audio-page .empty-state { color: var(--a-ink-3); }

/* Thanh phát cố định dưới màn hình */
.nowplaying {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  background: var(--a-bar); backdrop-filter: blur(16px);
  border-top: 1px solid var(--a-line);
  padding: 12px 20px; transform: translateY(115%);
  transition: transform .3s cubic-bezier(.2,.8,.3,1);
}
.nowplaying.is-on { transform: none; }
.nowplaying__in { max-width: 1200px; margin-inline: auto; display: flex; align-items: center; gap: 16px; }
.nowplaying .cover { width: 46px; flex: none; }
.nowplaying__t { font-weight: 600; font-size: .9rem; color: var(--a-ink); }
.nowplaying__a { font-size: .76rem; color: var(--a-ink-3); }
.nowplaying__ctrl { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.nowplaying__btn {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--a-hi); color: #FFF7F2; flex: none;
}
.nowplaying__btn svg { width: 18px; height: 18px; }
.nowplaying__bar { width: 260px; height: 4px; border-radius: 3px; background: var(--a-line); overflow: hidden; }
.nowplaying__bar i { display: block; height: 100%; width: 34%; background: var(--a-hi-2); }
.nowplaying__x { color: var(--a-ink-3); width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; }
.nowplaying__x:hover { color: var(--a-ink); background: var(--a-soft); }
.nowplaying__x svg { width: 18px; height: 18px; }

.audio-page .table-wrap { background: var(--a-card); border-color: var(--a-line); }
.audio-page table.cmp th, .audio-page table.cmp td { border-color: var(--a-line); }
.audio-page table.cmp thead th { background: var(--a-soft); color: var(--a-ink-2); }
.audio-page table.cmp tbody th { color: var(--a-ink-2); }
.audio-page table.cmp tbody tr:hover { background: var(--a-soft); }
.audio-page table.cmp td { color: var(--a-ink-2); }

@media (max-width: 720px) {
  .agrid { grid-template-columns: 1fr; }
  .nowplaying__bar { display: none; }
  .acard__media { width: 78px; }
}

/* =========================================================
   29. Bìa sách khi nằm trực tiếp trong flex container
   Chrome suy kích thước từ aspect-ratio nếu chỉ khai báo width,
   nên phải khoá cả chiều cao (width x 1.5).
   ========================================================= */
.nowplaying .cover     { flex: 0 0 46px; width: 46px; height: 69px; }
.search-res .cover     { flex: 0 0 38px; width: 38px; height: 57px; }
.reader-buy .cover     { flex: 0 0 62px; width: 62px; height: 93px; }
.detail__thumbs .cover { flex: 0 0 52px; width: 52px; height: 78px; }
.player__top .cover    { flex: 0 0 96px; width: 96px; height: 144px; }
.acard__media a        { display: block; }

/* Biểu tượng trong thông báo nổi */
.toast svg { width: 18px; height: 18px; flex: none; }
.toast span { line-height: 1.4; }

/* Trang sách nói: nút phát và nhãn */
.audio-page .select option { background: var(--a-card); color: var(--a-ink); }
.acard__nar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Lớp bọc giữ bìa đúng kích thước khi nằm trong flex container */
.coverfit { display: block; flex: none; }
.coverfit .cover { width: 100%; }
.detail__thumbs .coverfit { cursor: pointer; opacity: .5; transition: opacity .2s, transform .2s; }
.detail__thumbs .coverfit.is-active, .detail__thumbs .coverfit:hover { opacity: 1; transform: translateY(-2px); }
.book-row .coverfit { align-self: center; }

/* Hàng tải file: tên và mô tả xuống dòng riêng */
.dl-row > span:nth-child(2) { flex: 1; min-width: 0; text-align: left; }
.dl-row__n, .dl-row__d { display: block; line-height: 1.4; }

/* Hàng tải file — dùng class rõ ràng, không phụ thuộc thứ tự phần tử */
.dl-row { text-align: left; }
.dl-row__body { flex: 1; min-width: 0; }
.dl-row__body .dl-row__n,
.dl-row__body .dl-row__d { display: block; line-height: 1.4; }

/* Thẻ người đọc: tên và số lượng xuống dòng riêng */
.nchip > span:last-child { min-width: 0; }
.nchip__n, .nchip__c { display: block; line-height: 1.35; }

/* Thể loại trên trang sách nói: dùng lại .cat-card với bảng màu riêng */
.audio-page .cat-card { background: var(--a-card); border-color: var(--a-line); }
.audio-page .cat-card:hover { border-color: var(--a-hi); box-shadow: var(--a-shadow); }
.audio-page .cat-card__n { color: var(--a-ink); }
.audio-page .cat-card__c { color: var(--a-ink-3); }
.audio-page .card { background: var(--a-card); border-color: var(--a-line); }
.audio-page .empty-state svg { color: var(--a-ink-3); }
.acat-count { color: var(--a-hi-2); font-weight: 600; }

/* =========================================================
   30. Bộ lọc / danh mục trên nền sách nói
   ========================================================= */
.audio-page .crumbs { color: var(--a-ink-3); }
.audio-page .crumbs a:hover { color: var(--a-ink); }
.audio-page .eyebrow { color: var(--a-hi-2); }
.audio-page .lede { color: var(--a-ink-2); }
.audio-page .muted { color: var(--a-ink-3); }
.audio-page h1, .audio-page h2, .audio-page h3, .audio-page h4 { color: var(--a-ink); }
.audio-page .section--paper { background: var(--a-bg-2); }
.audio-page hr { border-top-color: var(--a-line); }

.audio-page .filter-group + .filter-group { border-top-color: var(--a-line); }
.audio-page .filter-group__t { color: var(--a-ink-3); }
.audio-page .check { color: var(--a-ink-2); }
.audio-page .check:hover { color: var(--a-ink); }
.audio-page .check input { accent-color: var(--a-hi); }
.audio-page .check__n { color: var(--a-ink-3); }

.audio-page .toolbar { border-bottom-color: var(--a-line); }
.audio-page .select {
  background-color: var(--a-card); border-color: var(--a-line); color: var(--a-ink);
}
.audio-page .tag-x { background: var(--a-soft); color: var(--a-hi); border: 1px solid var(--a-line); }

.audio-page .pagination a, .audio-page .pagination span {
  background: var(--a-card); border-color: var(--a-line); color: var(--a-ink-2);
}
.audio-page .pagination a:hover { border-color: var(--a-hi); color: var(--a-ink); }
.audio-page .pagination .is-current { background: var(--a-hi); border-color: var(--a-hi); color: #FFF7F2; }

.audio-page .btn--ghost { --btn-fg: var(--a-ink); --btn-bd: var(--a-line); }
.audio-page .btn--ghost:hover { --btn-bd: var(--a-hi); }
.audio-page .btn--audio { --btn-bg: var(--a-hi); --btn-fg: #FFF7F2; }

.audio-page .section-head__text > p { color: var(--a-ink-3); }
.audio-page .badge { background: var(--a-soft); color: var(--a-ink-2); border-color: var(--a-line); }
.audio-page .fmt { background: var(--a-soft); }

/* Lưới thẻ trong trang danh mục */
.agrid--cat { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.audio-page .catalog { gap: 40px; }

/* Bảng tóm tắt thể loại ở đầu trang */
.acat-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.acat-strip a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--r-pill);
  border: 1px solid var(--a-line); background: var(--a-soft);
  font-size: .84rem; color: var(--a-ink-2); transition: all .18s ease;
}
.acat-strip a:hover { border-color: var(--a-hi); color: var(--a-ink); }
.acat-strip a.is-on { background: var(--a-hi); border-color: var(--a-hi); color: #FFF7F2; font-weight: 600; }

/* =========================================================
   31. Menu trên cùng dính khi cuộn
   Thẻ bọc [data-site-header] từng giới hạn phạm vi của position:sticky,
   khiến header trôi mất ngay khi cuộn. display:contents gỡ ràng buộc đó.
   ========================================================= */
[data-site-header] { display: contents; }
.header { position: sticky; top: 0; z-index: 60; }
:root[data-theme="dark"] .header.is-stuck { box-shadow: 0 10px 26px -20px rgba(0,0,0,.9); }

/* Biểu tượng đứng cạnh nhãn eyebrow */
.eyebrow svg { width: 16px; height: 16px; flex: none; }

/* =========================================================
   32. Giá trị mặc định cho biến sách nói
   Nhờ vậy thanh phát cố định (.nowplaying) dùng được ở mọi trang,
   lấy bảng màu chính; trong .audio-page thì đã có bộ biến riêng ghi đè.
   ========================================================= */
:root {
  --a-bg:     var(--paper);
  --a-bg-2:   var(--paper-2);
  --a-card:   var(--surface);
  --a-line:   var(--line);
  --a-ink:    var(--ink);
  --a-ink-2:  var(--ink-2);
  --a-ink-3:  var(--ink-3);
  --a-hi:     var(--accent);
  --a-hi-2:   var(--pine);
  --a-soft:   var(--paper-2);
  --a-bar:    color-mix(in srgb, var(--paper) 94%, transparent);
  --a-shadow: var(--shadow-md);
}
.nowplaying__ch { font-size: .76rem; color: var(--a-hi-2); font-weight: 600; }

/* Khi thanh phát đang bật: nhường chỗ ở đáy trang và đẩy thông báo lên trên */
body:has(.nowplaying.is-on) { padding-bottom: 96px; }
body:has(.nowplaying.is-on) .toast { bottom: 116px; }

/* Menu con gọn một cột (mục "Miễn phí") */
.mega--sm { width: 340px; grid-template-columns: 1fr; }
.nav__link--sub { font-size: 1rem !important; padding-left: 26px !important; color: var(--ink-3); }
.nav__link--sub span { margin-right: 8px; }

/* =========================================================
   33. Trang ebook miễn phí
   ========================================================= */
.page-hero--free::before {
  background: radial-gradient(58% 70% at 80% 18%, var(--pine-soft), transparent 62%),
              radial-gradient(46% 60% at 6% 92%, var(--gold-soft), transparent 58%);
}

.free-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
  margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--line);
}
.free-stats strong {
  display: block; font-family: var(--font-display);
  font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; color: var(--pine);
}
.free-stats span { font-size: .82rem; color: var(--ink-3); }

/* Khối chéo sang bản sách nói */
.audio-cross {
  display: flex; align-items: center; gap: 14px;
  margin-top: 22px; padding: 15px 18px;
  border: 1.5px solid color-mix(in srgb, var(--pine) 32%, transparent);
  border-radius: var(--r-md); background: var(--pine-soft);
  transition: transform .18s ease, border-color .18s ease;
}
.audio-cross:hover { transform: translateY(-2px); border-color: var(--pine); }
.audio-cross__ico {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  display: grid; place-items: center; background: var(--pine); color: #fff;
}
:root[data-theme="dark"] .audio-cross__ico { color: #10201D; }
.audio-cross__ico svg { width: 20px; height: 20px; }
.audio-cross strong { display: block; font-size: .93rem; color: var(--pine); }
.audio-cross span span { font-size: .8rem; color: var(--ink-2); line-height: 1.5; display: block; }
.audio-cross__go { margin-left: auto; color: var(--pine); flex: none; }
.audio-cross__go svg { width: 18px; height: 18px; }

/* Khối đọc thử ngay trên trang chi tiết */
.ebook-preview {
  margin: 18px 24px 0; border-radius: var(--r-md);
  background: var(--paper-2); border: 1px solid var(--line);
  max-height: 340px; overflow: hidden; position: relative;
}
.ebook-preview::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 90px;
  background: linear-gradient(180deg, transparent, var(--paper-2));
  pointer-events: none;
}
.ebook-preview__page {
  padding: 26px 28px; font-family: var(--font-read);
  line-height: 1.85; color: var(--ink-2); text-align: justify;
}
.ebook-preview__page h3 {
  font-family: var(--font-display); font-size: 1.1em; color: var(--ink);
  margin-bottom: .8em; text-align: left;
}
.ebook-preview__page p { margin-bottom: .9em; }
.ebook-preview__page p.drop::first-letter {
  float: left; font-size: 2.8em; line-height: .86; padding: .06em .1em 0 0;
  font-weight: 600; font-family: var(--font-display); color: var(--ink);
}
.ebook-preview__fade { text-align: center; letter-spacing: .5em; opacity: .45; }
.ebook-preview__foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; padding: 16px 24px 22px;
}

.dl-row--main { border-color: var(--pine); background: var(--pine-soft); }
.dl-row--main .dl-row__ico { background: var(--pine); color: #fff; }
:root[data-theme="dark"] .dl-row--main .dl-row__ico { color: #10201D; }

@media (max-width: 720px) {
  .free-stats { grid-template-columns: 1fr 1fr; }
  .ebook-preview { margin-inline: 18px; }
  .ebook-preview__foot { padding-inline: 18px; }
}

/* =========================================================
   34. Menu thả xuống: đi chuột từ mục cha sang panel không bị mất
   - Cầu nối vô hình lấp khoảng hở giữa mục menu và panel.
   - Panel giữ pointer-events và chỉ ẩn hẳn khi mờ xong, nên rê vào
     giữa chừng là nó hiện lại thay vì biến mất.
   ========================================================= */
.mega {
  top: calc(100% + 8px);
  pointer-events: auto;
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}
.nav__item:hover .mega,
.nav__item:focus-within .mega {
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear 0s;
}
.nav__item:has(.mega)::after {
  content: ""; position: absolute; top: 100%; left: 50%;
  width: 360px; max-width: 78vw; height: 16px;
  transform: translateX(-50%);
}

/* Cụm nút trên thanh phát: nút phát là chính, lùi/tiến là phụ */
.nowplaying__ctrl { gap: 10px; }
.nowplaying__btn--ghost {
  background: transparent; color: var(--a-ink-2);
  border: 1.5px solid var(--a-line); width: 38px; height: 38px;
  transition: border-color .18s ease, color .18s ease;
}
.nowplaying__btn--ghost:hover { border-color: var(--a-hi); color: var(--a-ink); }
.nowplaying__btn--ghost svg { width: 17px; height: 17px; }
.nowplaying__btn--main { width: 48px; height: 48px; box-shadow: 0 6px 16px -6px var(--a-hi); }
.nowplaying__btn--main svg { width: 20px; height: 20px; }

/* =========================================================
   35. Mockup điện thoại đang nghe sách nói (hero trang chủ)
   ========================================================= */
.phone {
  position: relative; width: min(256px, 60%); aspect-ratio: 9 / 18.4;
  background: linear-gradient(165deg, #3B3730, #211F1A 55%, #17150F);
  border-radius: 36px; padding: 9px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.18);
  z-index: 2;
}
.phone::after {
  content: ""; position: absolute; right: -2px; top: 27%;
  width: 2.5px; height: 54px; background: #4A453D; border-radius: 0 3px 3px 0;
}
.phone__notch {
  position: absolute; top: 20px; left: 50%; translate: -50%;
  width: 60px; height: 5px; border-radius: 3px;
  background: rgba(23,21,15,.16); z-index: 3;
}
.phone__screen {
  height: 100%; border-radius: 29px; overflow: hidden;
  background: var(--surface); color: var(--ink);
  display: flex; flex-direction: column; padding: 28px 16px 16px;
}
.phone__st {
  display: flex; justify-content: space-between;
  font-size: .52rem; font-weight: 600; letter-spacing: .05em;
  color: var(--ink-3); margin-bottom: 12px;
}
.phone__label {
  font-size: .5rem; font-weight: 700; letter-spacing: .2em;
  text-transform: uppercase; color: var(--accent); text-align: center;
}
.phone__cover { width: 56%; margin: 12px auto 14px; }
.phone__t {
  font-family: var(--font-display); font-size: .8rem; font-weight: 600;
  line-height: 1.25; text-align: center;
}
.phone__nar {
  font-size: .56rem; color: var(--pine); margin-top: 6px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.phone__nar svg { width: 11px; height: 11px; flex: none; }
.wave--sm { height: 28px; margin: 15px 0 6px; gap: 1.5px; }
.phone__times {
  display: flex; justify-content: space-between;
  font-size: .5rem; color: var(--ink-3);
}
.phone__ctrl {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin-top: auto; padding-top: 12px;
}
.phone__btn { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-3); }
.phone__btn svg { width: 15px; height: 15px; }
.phone__play {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.phone__play svg { width: 17px; height: 17px; }
.phone__chips {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 14px; padding-top: 11px; border-top: 1px solid var(--line);
  font-size: .48rem; letter-spacing: .04em; color: var(--ink-3);
}

/* =========================================================
   36. Mega menu dạng cây — danh mục hai cấp
   ========================================================= */
.mega--tree {
  width: min(920px, 92vw);
  grid-template-columns: repeat(4, 1fr);
  gap: 4px 22px;
  padding: 24px 26px 20px;
}
.mega--tree .mega__title { grid-column: 1 / -1; margin-bottom: 10px; }

.mega__group { padding-bottom: 14px; }
.mega__root {
  display: flex; gap: 10px; align-items: center;
  padding: 7px 8px; margin-left: -8px; border-radius: var(--r-sm);
  transition: background .16s ease;
}
.mega__root:hover { background: var(--paper-2); }
.mega__root .mega__ico { width: 30px; height: 30px; font-size: .95rem; }
.mega__root .mega__name { font-size: .89rem; }
.mega__root .mega__desc { font-size: .72rem; }

.mega__kids { margin: 4px 0 0 40px; display: grid; gap: 1px; }
.mega__kids a {
  display: block; padding: 3px 8px; margin-left: -8px; border-radius: 6px;
  font-size: .8rem; color: var(--ink-3); transition: color .14s ease, background .14s ease;
}
.mega__kids a:hover { color: var(--accent); background: var(--paper-2); }

.mega__all {
  grid-column: 1 / -1; margin-top: 6px; padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: .84rem; font-weight: 600; color: var(--accent);
}
.mega__all:hover { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 1120px) {
  .mega--tree { grid-template-columns: repeat(3, 1fr); width: min(760px, 92vw); }
}

/* =========================================================
   37. Bộ lọc danh mục hai cấp trong sidebar
   ========================================================= */
.cat-tree { display: grid; gap: 1px; }
.cat-tree__group + .cat-tree__group { margin-top: 6px; }
.cat-tree__root { display: flex; align-items: center; gap: 8px; }
.cat-tree__root .check { flex: 1; font-weight: 600; color: var(--ink); }
.cat-tree__toggle {
  width: 24px; height: 24px; border-radius: 6px; flex: none;
  display: grid; place-items: center; color: var(--ink-3);
  transition: background .15s ease, transform .18s ease;
}
.cat-tree__toggle:hover { background: var(--paper-2); color: var(--ink); }
.cat-tree__toggle svg { width: 14px; height: 14px; }
.cat-tree__group.is-open .cat-tree__toggle { transform: rotate(90deg); }
.cat-tree__kids { display: none; margin: 2px 0 6px 22px; padding-left: 10px; border-left: 1px solid var(--line); }
.cat-tree__group.is-open .cat-tree__kids { display: block; }
.cat-tree__kids .check { font-size: .85rem; padding: 4px 0; }

.audio-page .cat-tree__kids { border-left-color: var(--a-line); }
.audio-page .cat-tree__root .check { color: var(--a-ink); }
.audio-page .cat-tree__toggle { color: var(--a-ink-3); }
.audio-page .cat-tree__toggle:hover { background: var(--a-soft); color: var(--a-ink); }

/* Thẻ danh mục con gọn dưới tiêu đề trang danh mục */
.subcat-strip { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 16px; }
.subcat-strip a {
  padding: 5px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface);
  font-size: .8rem; color: var(--ink-2); transition: all .16s ease;
}
.subcat-strip a:hover { border-color: var(--ink); color: var(--ink); }
.subcat-strip a.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 600; }

/* Danh mục chưa có đầu sách nào: làm mờ, không bấm được */
.cat-tree__group.is-empty > .cat-tree__root { opacity: .42; }
.cat-tree__group.is-empty .check { cursor: default; }

/* Mega menu cao quá thì cho cuộn bên trong */
.mega--tree { max-height: min(74vh, 640px); overflow-y: auto; }


/* =========================================================
   Trình đọc — /doc/<slug>.html
   Trang đọc chiếm trọn màn hình: bỏ header/footer chung, chỉ còn thanh
   điều khiển dính trên đỉnh và cột chữ ở giữa.
   ========================================================= */

.reader {
  --reader-fs: 19px;
  --reader-lh: 1.85;
  --reader-w: 34rem;
  background: var(--paper);
  min-height: 100vh;
}

/* Ba nền đọc. Đặt trên <html> để cả phần trang ngoài cột chữ cũng đổi màu theo;
   "auto" là mặc định, không đè gì cả nên vẫn theo data-theme sáng/tối của site. */
:root[data-paper="light"] { --paper: #FBF8F2; --paper-2: #F4EEE3; --surface: #FFFFFF;
  --ink: #17150F; --ink-2: #4A4438; --ink-3: #7C7466; --line: #E7DFD1; --line-strong: #D6CAB6; }
:root[data-paper="sepia"] { --paper: #F6EEDC; --paper-2: #EFE4CC; --surface: #FFFBF1;
  --ink: #2C2415; --ink-2: #4E4230; --ink-3: #85765A; --line: #E0D2B4; --line-strong: #D2C1A0; }
:root[data-paper="night"] { --paper: #14141A; --paper-2: #1C1C24; --surface: #272730;
  --ink: #E8E6E1; --ink-2: #BDB9B1; --ink-3: #8B867D; --line: #2C2C36; --line-strong: #3D3D4A;
  --accent: #D9744A; }

.reader__bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px clamp(16px, 4vw, 34px);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.reader__back {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .84rem; font-weight: 600; color: var(--ink-2);
}
.reader__back:hover { color: var(--ink); }
.reader__back svg { width: 15px; height: 15px; }

.reader__who { min-width: 0; flex: 1; text-align: center; }
.reader__t {
  font-family: var(--font-display); font-size: .95rem; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reader__a { font-size: .76rem; color: var(--ink-3); }

.reader__tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reader__tools .seg button { padding: 5px 10px; }

/* Vạch tiến độ chạy sát mép dưới thanh điều khiển */
.reader__progress {
  position: absolute; left: 0; bottom: -1px; height: 2px;
  background: var(--accent); width: 0; transition: width .12s linear;
}

.reader__page {
  max-width: var(--reader-w);
  margin: clamp(28px, 6vw, 64px) auto clamp(60px, 12vw, 120px);
  padding-inline: clamp(18px, 5vw, 26px);
  font-family: var(--font-read);
  font-size: var(--reader-fs);
  line-height: var(--reader-lh);
  color: var(--ink-2);
  text-align: justify;
  hyphens: auto;
}
.reader__page h1 {
  font-size: 1.5em; line-height: 1.25; color: var(--ink);
  text-align: left; margin-bottom: .3em;
}
.reader__meta {
  font-family: var(--font-ui); font-size: .78rem; color: var(--ink-3);
  text-align: left; margin-bottom: 2.4em;
  padding-bottom: 1.4em; border-bottom: 1px solid var(--line);
}
.reader__page h2 {
  font-size: 1.15em; color: var(--ink); text-align: left;
  margin: 2em 0 .8em;
}
.reader__page p + p { margin-top: 1em; }
.reader__page p.drop::first-letter {
  float: left; font-size: 3em; line-height: .84; padding: .06em .11em 0 0;
  font-weight: 600; font-family: var(--font-display); color: var(--ink);
}

/* Hết phần có sẵn: nói thẳng là hết, kèm lối đi tiếp */
.reader__end {
  max-width: var(--reader-w); margin: 0 auto clamp(50px, 10vw, 90px);
  padding: clamp(22px, 4vw, 30px);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--paper-2); text-align: center;
  font-family: var(--font-ui);
}
.reader__end h3 { font-size: 1.06rem; color: var(--ink); margin-bottom: 8px; }
.reader__end p { font-size: .87rem; color: var(--ink-3); margin-bottom: 18px; }
.reader__end .cluster { justify-content: center; }

@media (max-width: 640px) {
  .reader__who { order: 3; flex-basis: 100%; text-align: left; }
  .reader__page { text-align: left; }
}

@media print {
  .reader__bar, .reader__end { display: none; }
}
