@font-face { font-family: "Noto Serif"; src: url("fonts/NotoSerif-Regular.ttf"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Serif"; src: url("fonts/NotoSerif-Bold.ttf"); font-weight: 700; font-display: swap; }

:root {
  --paper: #f0e5cd; --paper-2: #e6d6b4; --card: #f8f1e1; --line: #cdb994; --field: #fffaf0;
  --ink: #28241e; --muted: #6e6250; --jade: #1f4a3d; --jade-2: #46806a; --cinnabar: #8c2a1e; --gold: #b07c2e;
  --night: #15130f; --night-2: #1f1c17; --night-3: #2a261f; --night-line: #3a342a; --night-ink: #e9dfc9;
  --shadow: 0 10px 30px rgba(60, 40, 10, .18);
  --top-bg: rgba(240, 229, 205, .92);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
html[data-theme="dem"] {
  --paper: #17150f; --paper-2: #221f18; --card: #1f1c16; --line: #3d372b; --field: #15130f;
  --ink: #ece2cc; --muted: #a89a80; --jade: #6fb79a; --jade-2: #3f8a6d; --cinnabar: #e0705e; --gold: #e3b467;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --top-bg: rgba(23, 21, 15, .9);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: "Noto Serif", Georgia, serif; color: var(--ink); background: var(--paper);
  background-image: radial-gradient(ellipse at top, rgba(255,255,255,.45), transparent 60%),
                    radial-gradient(ellipse at bottom, rgba(150,110,50,.12), transparent 70%);
  min-height: 100vh; line-height: 1.6; transition: background-color .3s, color .3s;
}
html[data-theme="dem"] body { background-image: radial-gradient(ellipse at top, rgba(111,183,154,.06), transparent 60%); }
a { color: var(--jade); text-decoration: none; }
a:hover { color: var(--cinnabar); }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--cinnabar); color: var(--paper); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- hiệu ứng ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }
@keyframes slideInL { from { transform: translateX(-100%); } to { transform: none; } }
.rise { opacity: 0; animation: rise .55s var(--ease) forwards; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- đầu trang ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 10px clamp(16px, 4vw, 48px); background: var(--top-bg); backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--jade); transition: transform .3s var(--ease);
}
.top.hide { transform: translateY(-110%); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.seal {
  width: 42px; height: 42px; border-radius: 8px; background: #8c2a1e; color: #f0e5cd; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; line-height: 1; text-align: center;
  box-shadow: inset 0 0 0 3px rgba(240,229,205,.35); letter-spacing: -.5px; transition: transform .3s var(--ease);
}
.brand:hover .seal { transform: rotate(-8deg) scale(1.06); }
.brand b { display: block; font-size: 19px; letter-spacing: .5px; }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: -3px; }
.top nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.top nav a { padding: 6px 14px; border-radius: 99px; color: var(--muted); transition: .2s; }
.top nav a.on, .top nav a:hover { background: var(--jade); color: var(--paper); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card);
  display: inline-grid; place-items: center; cursor: pointer; font-size: 17px; transition: .2s var(--ease); padding: 0;
}
.icon-btn:hover { border-color: var(--jade); transform: translateY(-2px); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 64px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 40px; border-top: 1px solid var(--line); }

/* ---------- trang chủ ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: clamp(28px, 6vw, 64px);
  background: linear-gradient(135deg, #1f4a3d 0%, #12302a 100%); color: #f0e5cd; box-shadow: var(--shadow);
}
.hero::after {
  content: "紅塵"; position: absolute; right: -10px; bottom: -60px; font-size: 220px; font-weight: 700;
  color: rgba(240, 229, 205, .07); line-height: 1; pointer-events: none; animation: float 9s ease-in-out infinite;
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 20% 120%, rgba(232,184,107,.25), transparent 45%),
              radial-gradient(circle at 90% -20%, rgba(140,42,30,.35), transparent 40%);
}
.hero > * { position: relative; }
.hero .eyebrow { color: #e8b86b; letter-spacing: 3px; font-size: 13px; font-weight: 700; }
.hero h1 { font-size: clamp(30px, 5vw, 52px); margin: 6px 0 10px; line-height: 1.15; }
.hero p { max-width: 620px; opacity: .9; margin: 0; }
.hero .cta { margin-top: 22px; display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--jade); background: var(--jade);
  color: var(--paper); padding: 9px 20px; border-radius: 99px; cursor: pointer; font-weight: 700;
  transition: transform .2s var(--ease), background .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { background: var(--cinnabar); border-color: var(--cinnabar); color: var(--paper); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(140,42,30,.25); }
.btn:active { transform: translateY(0) scale(.97); }
.btn.ghost { background: transparent; color: var(--jade); }
.btn.ghost:hover { background: var(--jade); color: var(--paper); border-color: var(--jade); }
.btn.on { background: var(--cinnabar); border-color: var(--cinnabar); color: var(--paper); }
.hero .btn { background: #f0e5cd; color: #1f4a3d; border-color: #f0e5cd; }
.hero .btn.ghost { background: transparent; color: #f0e5cd; border-color: rgba(240,229,205,.6); }
.btn.small { padding: 4px 12px; font-size: 14px; }
.btn.red { background: var(--cinnabar); border-color: var(--cinnabar); }
.btn[disabled] { opacity: .4; pointer-events: none; }

.sec-title { display: flex; align-items: center; gap: 12px; margin: 40px 0 18px; color: var(--cinnabar); }
.sec-title::before { content: ""; width: 12px; height: 12px; background: var(--cinnabar); transform: rotate(45deg); flex: none; }
.sec-title h2 { margin: 0; font-size: 22px; letter-spacing: 1px; text-transform: uppercase; }
.sec-title::after { content: ""; flex: 1; height: 2px; background: var(--line); }
.sec-title .tools { order: 3; display: flex; gap: 8px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 22px 0 0; }
.search {
  flex: 1; min-width: 220px; display: flex; align-items: center; gap: 8px; background: var(--card);
  border: 1.5px solid var(--line); border-radius: 99px; padding: 6px 16px; transition: .2s;
}
.search:focus-within { border-color: var(--jade); box-shadow: 0 0 0 4px rgba(31,74,61,.12); }
.search input { flex: 1; border: 0; background: transparent; outline: none; padding: 4px 0; }
.search kbd { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-row button { cursor: pointer; }
.chip-row button.on { background: var(--jade); color: var(--paper); border-color: var(--jade); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 22px; }
.card { color: var(--ink); display: block; }
.card .cover {
  aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--paper-2);
  box-shadow: var(--shadow); position: relative; border: 2px solid var(--card); transition: transform .35s var(--ease), box-shadow .35s;
}
.card:hover .cover { transform: translateY(-6px) rotate(-.6deg); box-shadow: 0 18px 40px rgba(60,40,10,.28); }
.card .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.card:hover .cover img { transform: scale(1.06); }
.card .cover::after {
  content: "Đọc ngay"; position: absolute; inset: auto 0 0 0; padding: 30px 12px 12px; color: #f0e5cd; font-weight: 700;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); opacity: 0; transform: translateY(10px); transition: .3s var(--ease);
}
.card:hover .cover::after { opacity: 1; transform: none; }
.card .badge {
  position: absolute; left: 10px; top: 10px; background: #8c2a1e; color: #f0e5cd; font-size: 12px; z-index: 1;
  font-weight: 700; padding: 2px 10px; border-radius: 99px;
}
.badge.new, .tag-new {
  background: var(--gold); color: #1b160d; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px;
  letter-spacing: .5px; animation: pop .5s var(--ease);
}
.card .badge.new { left: auto; right: 10px; }
.card h3 { margin: 12px 0 2px; font-size: 18px; line-height: 1.3; }
.card .meta { color: var(--muted); font-size: 13px; }
.card .bar { height: 4px; border-radius: 4px; background: var(--paper-2); margin-top: 6px; overflow: hidden; }
.card .bar i { display: block; height: 100%; background: var(--cinnabar); }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.shelf a {
  display: flex; gap: 14px; align-items: center; padding: 10px; background: var(--card); border: 1.5px solid var(--line);
  border-radius: 14px; color: var(--ink); transition: .2s var(--ease);
}
.shelf a:hover { border-color: var(--jade); transform: translateY(-3px); }
.shelf img { width: 54px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; }
.shelf b { display: block; line-height: 1.3; }
.shelf small { color: var(--muted); }
.shelf .bar { height: 4px; border-radius: 4px; background: var(--paper-2); margin-top: 6px; overflow: hidden; }
.shelf .bar i { display: block; height: 100%; background: var(--cinnabar); }

/* khung chờ */
.skel { background: linear-gradient(90deg, var(--paper-2) 0, var(--card) 50%, var(--paper-2) 100%); background-size: 800px 100%; animation: shimmer 1.4s linear infinite; border-radius: 14px; }
.skel.cover { aspect-ratio: 3/4; }
.skel.line { height: 16px; margin-top: 10px; width: 70%; }

/* ---------- trang truyện ---------- */
.backdrop { position: absolute; inset: 0 0 auto 0; height: 380px; overflow: hidden; z-index: -1; pointer-events: none; }
.backdrop img { width: 100%; height: 100%; object-fit: cover; filter: blur(40px) saturate(1.3); opacity: .35; transform: scale(1.2); }
.backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 30%, var(--paper)); }
.story { display: grid; grid-template-columns: 280px 1fr; gap: clamp(20px, 4vw, 48px); align-items: start; }
.story .cover { aspect-ratio: 3/4; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); background: var(--paper-2); border: 3px solid var(--card); animation: rise .6s var(--ease); }
.story .cover img { width: 100%; height: 100%; object-fit: cover; }
.story h1 { font-size: clamp(30px, 4.5vw, 46px); line-height: 1.15; margin: 0; }
.story .alt { color: var(--muted); font-style: italic; margin: 4px 0 16px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.stats div { background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 6px 14px; text-align: center; min-width: 86px; }
.stats b { display: block; font-size: 20px; color: var(--jade); line-height: 1.2; }
.stats small { color: var(--muted); font-size: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 2px 12px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); font-size: 14px; font-weight: 400; color: var(--ink); }
.chip.jade { border-color: var(--jade); color: var(--jade); }
.desc { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 16px 20px; margin: 18px 0; position: relative; }
.desc.clamp p { max-height: 7.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.desc p { margin: 0; white-space: pre-line; }
.desc button { background: none; border: 0; color: var(--jade); cursor: pointer; padding: 6px 0 0; font-weight: 700; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.heart.on { background: var(--cinnabar); border-color: var(--cinnabar); color: #f0e5cd; }
.heart.on .ic { display: inline-block; animation: pop .45s var(--ease); }

.chapters { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.chapters li { animation: rise .45s var(--ease) both; }
.chapters a {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--card); border: 1.5px solid var(--line);
  border-radius: 14px; color: var(--ink); transition: .2s var(--ease); position: relative; overflow: hidden;
}
.chapters a:hover { border-color: var(--jade); transform: translateX(4px); }
.chapters a.is-read { opacity: .72; }
.chapters a .prog { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--cinnabar); }
.chapters .no { font-weight: 700; color: var(--jade); min-width: 46px; }
.chapters .name { flex: 1; font-weight: 700; }
.chapters .date { color: var(--muted); font-size: 14px; }
.chapters .read { font-size: 12px; color: #f0e5cd; background: var(--jade-2); border-radius: 99px; padding: 1px 9px; }
.chapters .wait { font-size: 12px; color: var(--muted); font-style: italic; }
.chapters .pages-n { color: var(--muted); font-size: 13px; }
.chapters a.dim { opacity: .55; pointer-events: none; }
.chapters a.here { border-color: var(--cinnabar); box-shadow: inset 4px 0 0 var(--cinnabar); }

/* ---------- nút nổi, thông báo ---------- */
.to-top {
  position: fixed; right: 20px; bottom: 22px; z-index: 30; width: 46px; height: 46px; border-radius: 99px; border: 0;
  background: var(--jade); color: var(--paper); font-size: 20px; cursor: pointer; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(20px) scale(.8); pointer-events: none; transition: .3s var(--ease);
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--jade); color: var(--paper);
  padding: 10px 22px; border-radius: 99px; box-shadow: var(--shadow); z-index: 90; animation: rise .35s var(--ease);
  display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 32px);
}
.toast button { background: rgba(255,255,255,.18); border: 0; color: inherit; border-radius: 99px; padding: 3px 12px; cursor: pointer; font-weight: 700; }
.hint { color: var(--muted); font-size: 13px; }
.empty { text-align: center; padding: 80px 20px; color: var(--muted); }

/* ---------- trang đọc ---------- */
body.reader { background: var(--rd-bg, #15130f); color: var(--night-ink); background-image: none; }
body.reader[data-bg="xam"] { --rd-bg: #2b2b2b; }
body.reader[data-bg="giay"] { --rd-bg: #efe4cb; color: #28241e; }
body.reader[data-bg="trang"] { --rd-bg: #ffffff; color: #28241e; }
.rbar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 40; display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: rgba(21,19,15,.94); border-bottom: 1px solid var(--night-line); backdrop-filter: blur(8px); transition: transform .3s var(--ease);
  color: var(--night-ink);
}
.rbar.hide { transform: translateY(-110%); }
.rbar a.title { color: var(--night-ink); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.rbar .sp { flex: 1; }
.rbar select { background: var(--night-2); color: var(--night-ink); border: 1px solid #4a4236; border-radius: 10px; padding: 6px 10px; max-width: 40vw; }
.rbtn {
  background: var(--night-2); color: var(--night-ink); border: 1px solid #4a4236; border-radius: 10px; padding: 6px 12px; cursor: pointer;
  transition: .15s; white-space: nowrap; line-height: 1.4;
}
.rbtn:hover:not([disabled]) { background: #1f4a3d; border-color: #1f4a3d; }
.rbtn.on { background: #8c2a1e; border-color: #8c2a1e; }
.rbtn[disabled] { opacity: .35; cursor: default; }
.progress { position: fixed; left: 0; top: 0; height: 3px; background: linear-gradient(90deg, #8c2a1e, #e3b467); z-index: 50; width: 0; transition: width .15s linear; }
.reader main { padding-top: 54px; }
.pages { --w: 900px; --gap: 0px; max-width: var(--w); margin: 0 auto; min-height: 60vh; display: flex; flex-direction: column; gap: var(--gap); transition: max-width .25s var(--ease); }
.pages img { display: block; width: 100%; height: auto; opacity: 0; transition: opacity .4s; user-select: none; -webkit-user-drag: none; }
.pages img.ok { opacity: 1; }
.pages .pg { position: relative; background: #000; min-height: 200px; }
.pages .pg.wait { min-height: 900px; background: linear-gradient(90deg, #1b1915 0, #24211b 50%, #1b1915 100%); background-size: 800px 100%; animation: shimmer 1.4s linear infinite; }
.pages .pg.err { min-height: 300px; display: grid; place-items: center; background: #1b1915; }
.pg .retry { position: absolute; inset: 0; display: grid; place-items: center; gap: 6px; color: #b5a88e; text-align: center; }
.dim-layer { position: fixed; inset: 0; background: #000; pointer-events: none; z-index: 35; opacity: 0; transition: opacity .2s; }

/* chế độ lật trang */
body.paged { overflow: hidden; }
body.paged .pages { position: fixed; inset: 0; max-width: none; margin: 0; display: block; background: transparent; }
body.paged .pages .pg { position: absolute; inset: 0; height: 100%; aspect-ratio: auto !important; min-height: 0 !important; display: none; background: transparent; overflow: auto; }
body.paged .pages .pg.cur { display: grid; place-items: center; animation: fade .25s var(--ease); }
body.paged .pages .pg img { width: auto; max-width: min(100%, var(--w)); height: auto; margin: auto; }
body.paged.fit-h .pages .pg img { max-height: 100vh; }
body.paged .pages .pg.zoomed img { max-width: none; max-height: none; width: calc(var(--w) * 2); cursor: zoom-out; }
body.paged .end { display: none; }
body.paged.at-end .end { display: block; position: fixed; inset: 0; z-index: 36; max-width: none; background: rgba(21,19,15,.96); color: #e9dfc9; padding-top: 18vh; animation: fade .3s; }
body.reader.paged.at-end .end .btn.ghost { color: #e9dfc9; border-color: #6b604c; }
.tapzone { position: fixed; top: 0; bottom: 0; width: 30%; z-index: 34; cursor: pointer; display: none; }
.tapzone.l { left: 0; } .tapzone.r { right: 0; }
body.paged .tapzone { display: block; }

.pageno {
  position: fixed; right: 14px; bottom: 14px; z-index: 41; background: rgba(21,19,15,.85); color: var(--night-ink);
  border: 1px solid var(--night-line); border-radius: 99px; padding: 4px 12px; font-size: 13px; transition: opacity .4s; pointer-events: none;
}
.pageno.fade { opacity: 0; }
.end { max-width: 900px; margin: 0 auto; padding: 40px 20px 70px; text-align: center; }
.end h2 { margin: 0 0 4px; }
.end p { color: #b5a88e; margin: 0 0 20px; }
.end .actions { justify-content: center; }
.end .btn.ghost { color: var(--night-ink); border-color: #6b604c; }
body.reader[data-bg="giay"] .end .btn.ghost, body.reader[data-bg="trang"] .end .btn.ghost { color: #28241e; }
.next-card {
  display: flex; gap: 16px; align-items: center; text-align: left; margin: 0 auto 22px; max-width: 520px; padding: 14px;
  border-radius: 16px; background: var(--night-2); border: 1px solid var(--night-line); color: var(--night-ink); transition: .2s var(--ease);
}
.next-card:hover { border-color: #e3b467; transform: translateY(-3px); color: var(--night-ink); }
.next-card img { width: 64px; height: 86px; object-fit: cover; border-radius: 8px; }
.next-card small { color: #b5a88e; display: block; }
.next-card b { font-size: 18px; }
.next-card .count { margin-left: auto; font-size: 13px; color: #e3b467; }

/* bảng cài đặt + danh sách chương (trượt) */
.sheet {
  position: fixed; top: 0; bottom: 0; right: 0; width: min(380px, 92vw); z-index: 60; background: #1b1915; color: var(--night-ink);
  border-left: 1px solid var(--night-line); padding: 18px 20px 40px; overflow: auto; transform: translateX(105%);
  transition: transform .35s var(--ease); box-shadow: -20px 0 50px rgba(0,0,0,.4);
}
.sheet.left { right: auto; left: 0; border-left: 0; border-right: 1px solid var(--night-line); transform: translateX(-105%); }
.sheet.open { transform: none; }
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .3s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet h3 { margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; }
.sheet h4 { margin: 18px 0 8px; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: #b5a88e; }
.seg { display: flex; background: var(--night-2); border: 1px solid #4a4236; border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--night-ink); padding: 7px 6px; border-radius: 9px; cursor: pointer; transition: .2s; font-size: 14px; }
.seg button.on { background: #1f4a3d; }
.range { display: flex; align-items: center; gap: 10px; }
.range input { flex: 1; accent-color: #8c2a1e; }
.range output { min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; color: #e3b467; }
.switch { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; cursor: pointer; }
.switch input { width: 42px; height: 24px; appearance: none; background: #4a4236; border-radius: 99px; position: relative; cursor: pointer; transition: .2s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 99px; background: #e9dfc9; transition: .2s var(--ease); }
.switch input:checked { background: #1f4a3d; }
.switch input:checked::after { left: 21px; }
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; font-size: 14px; }
.keys kbd, .sheet kbd { background: var(--night-2); border: 1px solid #4a4236; border-bottom-width: 3px; border-radius: 6px; padding: 0 7px; font-family: inherit; font-size: 13px; }
.ch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ch-list a { display: flex; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--night-2); color: var(--night-ink); border: 1px solid transparent; }
.ch-list a:hover { border-color: #46806a; }
.ch-list a.here { border-color: #8c2a1e; background: #2a1a16; }
.ch-list a .ok { margin-left: auto; color: #6fb79a; font-size: 12px; }
.ch-list a.dim { opacity: .45; pointer-events: none; }

/* tự cuộn */
.auto-pill {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 41; display: none; gap: 8px; align-items: center;
  background: rgba(21,19,15,.92); border: 1px solid var(--night-line); border-radius: 99px; padding: 5px 8px 5px 14px; color: var(--night-ink); font-size: 14px;
}
.auto-pill.show { display: flex; animation: rise .3s var(--ease); }

/* ---------- quản lý ---------- */
.panel { background: var(--card); border: 1.5px solid var(--line); border-radius: 18px; padding: 22px; margin-bottom: 22px; animation: rise .45s var(--ease) both; }
.panel h2 { margin: 0 0 14px; font-size: 20px; color: var(--jade); }
.form { display: grid; grid-template-columns: 170px 1fr; gap: 10px 16px; align-items: center; }
.form label { color: var(--muted); }
.form input, .form textarea, .form select {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--field); color: var(--ink);
}
.form textarea { min-height: 110px; resize: vertical; }
.form .full { grid-column: 1 / -1; }
.jobs { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: #1b1915; color: #e9dfc9; border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; max-height: 260px; overflow: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list td, table.list th { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }

/* trang khoá */
.lock { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.lock .box { max-width: 460px; animation: rise .6s var(--ease); }
.lock .seal { width: 84px; height: 84px; font-size: 28px; margin: 0 auto 18px; border-radius: 16px; animation: float 6s ease-in-out infinite; }

@media (max-width: 760px) {
  .story { grid-template-columns: 1fr; }
  .story .cover { max-width: 240px; margin: 0 auto; }
  .form { grid-template-columns: 1fr; }
  .brand small { display: none; }
  .rbar a.title { display: none; }
  .rbar .wide { display: none; }
  .top nav a { padding: 6px 10px; }
}
@media (max-width: 480px) {
  .rbar { gap: 5px; padding: 7px 8px; }
  .rbtn { padding: 6px 9px; }
  .rbar select { max-width: 36vw; padding: 6px 6px; }
  .brand b { font-size: 16px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .card h3 { font-size: 15px; }
}

/* =================================================== tài khoản Discord, cấp bậc, bình luận, tìm kiếm */
@keyframes ring { from { --p: 0; } }
@property --p { syntax: "<number>"; inherits: true; initial-value: 0; }
@keyframes lvl { 0% { transform: scale(.4) rotate(-12deg); opacity: 0; } 55% { transform: scale(1.08) rotate(2deg); opacity: 1; } 100% { transform: none; } }
@keyframes rays { to { transform: rotate(360deg); } }
@keyframes xpIn { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes bar { from { width: 0; } }
@keyframes stamp { 0% { transform: scale(1.5); opacity: 0; } 100% { transform: none; opacity: 1; } }

.ic { width: 22px; height: 22px; object-fit: contain; flex: none; vertical-align: -5px; display: inline-block; }
.ic.xs { width: 16px; height: 16px; vertical-align: -3px; }
.ic.sm { width: 26px; height: 26px; }
.ic.lg { width: 44px; height: 44px; }
.ic.xl { width: 84px; height: 84px; }
.ic-x { display: inline-grid; place-items: center; font-size: .8em; color: var(--cinnabar); font-weight: 700; }
html[data-theme="dem"] img.ic { filter: brightness(1.6) saturate(.95); }

.top nav a.nav-discord { display: inline-flex; align-items: center; gap: 6px; }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn.discord:hover { background: #4752c4; border-color: #4752c4; color: #fff; transform: translateY(-2px); }
.btn.discord img.ic { filter: brightness(0) invert(1); }

/* vòng level quanh avatar */
.ring { --p: 0; position: relative; width: 40px; height: 40px; border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  background: conic-gradient(var(--cinnabar) calc(var(--p) * 1%), var(--line) 0); animation: ring 1.2s var(--ease); }
.ring img { width: calc(100% - 6px); height: calc(100% - 6px); border-radius: 50%; object-fit: cover; border: 2px solid var(--paper); }
.ring.big { width: 104px; height: 104px; }
.ring.big img { width: calc(100% - 10px); height: calc(100% - 10px); border-width: 3px; }

.me-wrap { position: relative; }
.top nav a.me { display: flex; align-items: center; gap: 10px; padding: 3px 12px 3px 3px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); }
.top nav a.me:hover { background: var(--card); color: var(--ink); border-color: var(--jade); }
.me-t { display: flex; flex-direction: column; line-height: 1.15; max-width: 150px; }
.me-t b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-t small { font-size: 11.5px; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 6px; display: none; flex-direction: column; animation: rise .25s var(--ease); }
.me-wrap:hover .menu, .me-wrap:focus-within .menu { display: flex; }
.me-wrap::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 10px; }
.top nav .menu a { border-radius: 9px; display: flex; gap: 8px; align-items: center; color: var(--ink); }

.hero-me:empty { display: none; }
.hero-me { margin-top: 22px; }
.hello { display: inline-flex; align-items: center; gap: 12px; padding: 8px 18px 8px 8px; border-radius: 99px; background: rgba(240,229,205,.1);
  border: 1px solid rgba(240,229,205,.25); color: #f0e5cd; transition: .25s var(--ease); }
.hello:hover { background: rgba(240,229,205,.18); color: #fff; transform: translateY(-2px); }
.hello .ring { width: 48px; height: 48px; background: conic-gradient(#e8b86b calc(var(--p) * 1%), rgba(240,229,205,.2) 0); }
.hello .ring img { border-color: #1a3d33; }
.hello span { display: flex; flex-direction: column; line-height: 1.25; }
.hello small { color: #e8b86b; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; }
.hello em { font-style: normal; opacity: .75; font-size: 13px; }
.hello.guest { padding: 10px 20px; }
.hello.guest img.ic { filter: brightness(0) invert(.93); }

/* thẻ truyện có link phụ */
article.card h3 a { color: inherit; }
article.card h3 a:hover { color: var(--cinnabar); }
.card .cover { display: block; }
.card .meta a { color: var(--muted); }
.card .meta a:hover { color: var(--cinnabar); }
.card .tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.tag { font-size: 11.5px; padding: 0 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.tag:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
a.chip { transition: .2s var(--ease); }
a.chip:hover { background: var(--jade); color: var(--paper); border-color: var(--jade); transform: translateY(-2px); }
.chip.ghost { background: transparent; }
.tag-early { display: inline-flex; gap: 3px; align-items: center; font-size: 11px; color: var(--gold); border: 1px solid var(--gold); border-radius: 99px; padding: 0 7px; }

/* tiêu đề trang */
.page-h { padding: 18px 0 6px; animation: rise .5s var(--ease); }
.page-h h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); }
.page-h p { margin: 4px 0 0; color: var(--muted); max-width: 680px; }
.sec-title .more { order: 3; font-size: 14px; white-space: nowrap; }
.sec-title small { order: 3; }

/* tìm kiếm */
.sort { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; }
.sort select { background: var(--card); border: 1.5px solid var(--line); border-radius: 99px; padding: 6px 12px; color: var(--ink); }
.filters { margin: 18px 0 0; background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 6px 18px; }
.frow { display: grid; grid-template-columns: 100px 1fr; gap: 12px; align-items: baseline; padding: 10px 0; }
.frow + .frow { border-top: 1px dashed var(--line); }
.flabel { color: var(--muted); font-size: 14px; }
.filters .chip { cursor: pointer; transition: .15s; }
.filters .chip:hover { border-color: var(--jade); }
.filters .chip.on { background: var(--jade); color: var(--paper); border-color: var(--jade); }
.count { color: var(--muted); margin: 18px 0; }
.linkish { background: none; border: 0; color: var(--cinnabar); cursor: pointer; padding: 0 0 0 6px; }
.empty-box { grid-column: 1 / -1; text-align: center; padding: 50px 20px; color: var(--muted); border: 1.5px dashed var(--line); border-radius: 16px; }

/* cấp bậc */
.me-card { display: flex; gap: 22px; align-items: center; padding: 22px; border-radius: 20px; background: var(--card); border: 1.5px solid var(--line);
  box-shadow: var(--shadow); margin: 18px 0; animation: rise .5s var(--ease); }
.me-card.guest { align-items: flex-start; }
.me-card h2 { margin: 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.me-card p { margin: 4px 0 12px; color: var(--muted); }
.me-info { flex: 1; min-width: 0; }
.me-tier { display: flex; gap: 8px; align-items: center; margin: 2px 0 10px; color: var(--muted); }
.me-tier b { color: var(--cinnabar); font-size: 18px; }
.xpbar { height: 10px; border-radius: 99px; background: var(--paper-2); overflow: hidden; margin-bottom: 6px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--jade), var(--gold)); border-radius: 99px; animation: bar 1.2s var(--ease); }
.warn { color: var(--cinnabar) !important; font-size: 14px; margin: 8px 0 0 !important; }
.pill { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; padding: 1px 9px; border-radius: 99px; background: var(--paper-2); color: var(--muted); font-weight: 400; white-space: nowrap; }
.pill.staff { background: var(--cinnabar); color: #f0e5cd; }
.pill.staff img.ic { filter: brightness(0) invert(.93); }

.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.rule { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center; padding: 14px 18px;
  border-radius: 16px; border: 1.5px solid var(--line); background: var(--card); }
.rule .ic, .rule .ic-x { grid-row: span 2; }
.rule b { font-size: 20px; color: var(--jade); }
.rule span { color: var(--muted); font-size: 13px; line-height: 1.35; }

.ladder { list-style: none; padding: 0; margin: 0; position: relative; }
.ladder::before { content: ""; position: absolute; left: 35px; top: 20px; bottom: 20px; width: 2px; background: var(--line); }
.ladder > li { position: relative; display: flex; gap: 18px; padding: 12px 0; opacity: 0; animation: rise .5s var(--ease) forwards; }
.tier-ic { width: 72px; height: 72px; border-radius: 50%; background: var(--card); border: 2px solid var(--line); display: grid; place-items: center; flex: none; z-index: 1; transition: .3s; }
.ladder li.ok .tier-ic { border-color: var(--jade); }
.ladder li:not(.ok):not(.staff) .tier-ic img { opacity: .45; }
.ladder li.here .tier-ic { border-color: var(--cinnabar); box-shadow: 0 0 0 6px rgba(140,42,30,.14); }
.tier-b { flex: 1; background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 18px; }
.ladder li.here .tier-b { border-color: var(--cinnabar); }
.tier-h { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tier-h b { font-size: 19px; }
.tier-h span { color: var(--muted); font-size: 14px; }
.tier-h em { margin-left: auto; font-style: normal; font-size: 12px; color: #f0e5cd; background: var(--cinnabar); border-radius: 99px; padding: 1px 10px; animation: stamp .5s var(--ease) .6s both; }
.perm { list-style: none; padding: 0; margin: 6px 0 0; }
.perm li { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); padding: 2px 0; }
.perm li b { color: var(--ink); }
.tier-b .hint { margin: 4px 0 0; }

.table-wrap { overflow-x: auto; border: 1.5px solid var(--line); border-radius: 16px; background: var(--card); }
.board { width: 100%; border-collapse: collapse; font-size: 14px; }
.board th { text-align: left; color: var(--muted); font-weight: 400; padding: 10px 14px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.board td { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.board tr:last-child td { border-bottom: 0; }
.board tr.mine td { background: rgba(140,42,30,.08); }
.board .rk { font-size: 18px; color: var(--gold); width: 36px; }
.board .who, .cmt .who { display: flex; gap: 8px; align-items: center; }
.ava { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; background: var(--paper-2); }

/* hồ sơ */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tiles div { background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 16px; display: grid; gap: 2px; }
.tiles b { font-size: 24px; color: var(--jade); line-height: 1.1; }
.tiles small { color: var(--muted); }
.perm-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.perm-grid li { display: flex; gap: 12px; padding: 12px 16px; border-radius: 14px; border: 1.5px dashed var(--line); opacity: .7; }
.perm-grid li.ok { border-style: solid; border-color: var(--jade); opacity: 1; background: var(--card); }
.perm-grid b { display: block; }
.perm-grid small { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; }
.perm-grid em { font-style: normal; font-size: 12px; color: var(--cinnabar); }
.perm-grid li.ok em { color: var(--jade); }

/* cảm xúc + bình luận */
.reacts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; margin: 34px auto 0; max-width: 720px; }
.reacts .r-title { width: 100%; text-align: center; color: #b5a88e; font-size: 14px; margin-bottom: 2px; }
.react { display: inline-flex; gap: 6px; align-items: center; padding: 6px 14px; border-radius: 99px; border: 1.5px solid #4a4235; background: rgba(255,255,255,.04);
  color: #e9dfc9; cursor: pointer; transition: .2s var(--ease); }
.react .g { font-size: 16px; }
.react b { min-width: 6px; font-size: 13px; color: #e8b86b; }
.react:hover { transform: translateY(-3px); border-color: #e8b86b; }
.react.on { background: #8c2a1e; border-color: #8c2a1e; }
.react.on b { color: #f0e5cd; }
.react.pop .g { animation: pop .4s var(--ease); }
body.reader[data-bg="giay"] .react, body.reader[data-bg="trang"] .react { color: #28241e; border-color: #cdb994; }
body.reader[data-bg="giay"] .react.on, body.reader[data-bg="trang"] .react.on { color: #f0e5cd; }

.comments { margin: 40px auto 0; max-width: 820px; text-align: left; }
.end .comments { background: var(--card); color: var(--ink); border-radius: 20px; padding: 20px clamp(14px, 3vw, 26px); border: 1.5px solid var(--line); }
.end .comments p { color: var(--ink); margin: 0; }
.cmt-h { display: flex; gap: 10px; align-items: center; margin: 0 0 14px; font-size: 20px; }
.cmt-h small { font-size: 13px; color: var(--muted); background: var(--paper-2); border-radius: 99px; padding: 0 9px; }
.cmt-form { display: flex; gap: 12px; margin-bottom: 18px; }
.cmt-form > div { flex: 1; }
.cmt-form textarea { width: 100%; min-height: 76px; resize: vertical; border: 1.5px solid var(--line); border-radius: 14px; background: var(--field); padding: 10px 14px; outline: none; transition: .2s; }
.cmt-form textarea:focus { border-color: var(--jade); box-shadow: 0 0 0 4px rgba(31,74,61,.12); }
.cmt-form .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; }
.replying { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.replying button { background: none; border: 0; cursor: pointer; color: var(--cinnabar); }
.locked { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-radius: 14px; border: 1.5px dashed var(--line); color: var(--muted); margin-bottom: 18px; font-size: 14px; }
.locked .btn { margin-left: auto; }
.cmt { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); animation: rise .4s var(--ease); }
.cmt.child { border-top: 0; padding: 10px 0 0; }
.cmt .body { flex: 1; min-width: 0; }
.cmt .who { flex-wrap: wrap; gap: 6px; }
.cmt .who time { color: var(--muted); font-size: 12px; }
.cmt .body > p { margin: 3px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cmt.gold > .body { background: linear-gradient(135deg, rgba(232,184,107,.16), transparent); border: 1.5px solid rgba(176,124,46,.5); border-radius: 14px; padding: 8px 12px; }
.cmt .acts { display: flex; gap: 12px; }
.cmt .acts button { background: none; border: 0; padding: 0; color: var(--muted); font-size: 13px; cursor: pointer; }
.cmt .acts button:hover { color: var(--cinnabar); }
.comments > .comments, .comments:empty { display: none; }
.story-page .comments { margin-top: 10px; }

/* XP + thăng cấp + khoá chương sớm */
.xp-pop { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 70; display: flex; gap: 10px; align-items: center; overflow: hidden;
  padding: 10px 20px; border-radius: 99px; background: #1f4a3d; color: #f0e5cd; box-shadow: 0 14px 40px rgba(0,0,0,.35); animation: xpIn .5s var(--ease); }
.xp-pop b { font-size: 18px; color: #e8b86b; }
.xp-pop span { font-size: 13px; opacity: .85; }
.xp-pop i { position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p); background: #e8b86b; animation: bar 1.4s var(--ease); }
.xp-pop img.ic { filter: brightness(0) invert(.9) sepia(.5); }
.lvup { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(15,13,10,.78); animation: fade .3s; }
.lvup .box { position: relative; text-align: center; color: #f0e5cd; padding: 40px 50px; animation: lvl .8s var(--ease); }
.lvup .box::before { content: ""; position: absolute; inset: -60px; z-index: -1; border-radius: 50%;
  background: repeating-conic-gradient(rgba(232,184,107,.18) 0 8deg, transparent 8deg 20deg); animation: rays 14s linear infinite;
  -webkit-mask-image: radial-gradient(closest-side, #000 40%, transparent); mask-image: radial-gradient(closest-side, #000 40%, transparent); }
.lvup small { display: block; letter-spacing: 4px; text-transform: uppercase; color: #e8b86b; margin-top: 10px; }
.lvup h2 { font-size: 54px; margin: 0; line-height: 1.1; }
.lvup p { margin: 0 0 18px; font-size: 20px; }
.lvup img.ic { filter: brightness(0) invert(.9) sepia(.6); }
.early-lock { text-align: center; padding: 18vh 24px 60px; color: #e9dfc9; max-width: 560px; margin: 0 auto; animation: rise .6s var(--ease); }
.early-lock p { color: #b5a88e; }
.early-lock img.ic { filter: brightness(0) invert(.85) sepia(.6); }
body.reader[data-bg="giay"] .early-lock, body.reader[data-bg="trang"] .early-lock { color: #28241e; }
body.paged.at-end .end { overflow-y: auto; padding-top: 10vh; }

@media (max-width: 760px) {
  .me-t { display: none; }
  .top nav a.me { padding: 3px; }
  .top nav a.nav-discord span { display: none; }
  .frow { grid-template-columns: 1fr; gap: 4px; }
  .me-card { flex-direction: column; text-align: center; }
  .me-card h2, .me-tier { justify-content: center; }
  .ladder::before { left: 27px; }
  .tier-ic { width: 56px; height: 56px; }
  .tier-ic .ic.lg { width: 34px; height: 34px; }
  .lvup h2 { font-size: 42px; }
}
.ic-x { width: auto !important; min-width: 22px; font-size: 15px; line-height: 1; }
.ic-x.xs { min-width: 16px; font-size: 11px; }
.ic-x.sm { min-width: 26px; font-size: 18px; }
.ic-x.lg { min-width: 44px; font-size: 28px; }
.ic-x.xl { min-width: 84px; font-size: 56px; }
.wrap > .comments { max-width: none; }
.card .badge { max-width: calc(100% - 70px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.early-lock .btn.ghost { color: #e9dfc9; border-color: #6b604c; }
body.reader[data-bg="giay"] .early-lock .btn.ghost, body.reader[data-bg="trang"] .early-lock .btn.ghost { color: #28241e; }
.pill.staff .ic-x, .btn.discord .ic-x, .hello .ic-x, .xp-pop .ic-x { color: inherit; }
.locked > span { flex: 1; min-width: 200px; }
@media (max-width: 760px) {
  .top { gap: 8px; padding: 8px 12px; }
  .brand > span:not(.seal) { display: none; }
  .top nav { flex-wrap: nowrap; gap: 2px; }
  .top nav a { padding: 6px 9px; white-space: nowrap; font-size: 15px; }
  .top nav a[href="index.html"] { display: none; }
  .top nav a.nav-discord { padding: 6px; }
  .icon-btn { width: 34px; height: 34px; }
  .top nav a.me { padding: 2px; }
  .menu { right: -4px; }
  #latest a { flex-wrap: wrap; row-gap: 0; }
  #latest .no { width: 100%; font-size: 13px; color: var(--muted); }
  #latest .name { flex: 1; min-width: 0; }
}
@media (max-width: 760px) {
  .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .stats div { min-width: 0; padding: 6px 4px; }
  #chapters a { flex-wrap: wrap; row-gap: 2px; }
  #chapters .name { flex: 1 1 calc(100% - 60px); min-width: 0; }
  #chapters .pages-n { display: none; }
  #chapters .date { margin-left: auto; font-size: 13px; }
}

/* chấm sao */
.stars { display: inline-flex; gap: 2px; }
.stars button { background: none; border: 0; cursor: pointer; font-size: 30px; line-height: 1; padding: 2px 3px; color: #5a5040; transition: transform .15s var(--ease), color .15s; }
.stars button.on { color: #e8b86b; }
.stars button:hover { transform: scale(1.18) rotate(-6deg); }
.stars button.pop { animation: pop .45s var(--ease) both; }
.reacts .avg { width: 100%; text-align: center; font-size: 13px; color: #b5a88e; }
.reacts .avg b { color: #e8b86b; font-size: 15px; }
.reacts .r-title em { font-style: normal; color: #e8b86b; }
.stars-box { margin-top: 30px; }
.rate-box { justify-content: flex-start; margin: 0 0 16px; max-width: none; gap: 2px 10px; }
.rate-box .r-title, .rate-box .avg { width: auto; text-align: left; color: var(--muted); }
.rate-box .r-title em { color: var(--gold); }
.rate-box .avg b { color: var(--gold); }
.rate-box .stars button { font-size: 26px; color: var(--line); }
.rate-box .stars button.on { color: var(--gold); }
body.reader[data-bg="giay"] .stars button:not(.on), body.reader[data-bg="trang"] .stars button:not(.on) { color: #cdb994; }

/* lịch sử đọc */
.hist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.hist a { display: flex; gap: 14px; align-items: center; padding: 10px 14px 10px 10px; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; color: var(--ink); transition: .2s var(--ease); }
.hist a:hover { border-color: var(--jade); transform: translateX(4px); }
.hist img { width: 46px; height: 62px; object-fit: cover; border-radius: 8px; flex: none; }
.h-main { flex: 1; min-width: 0; }
.h-main b { display: block; }
.h-main small { color: var(--muted); }
.h-main .bar { display: block; height: 4px; border-radius: 4px; background: var(--paper-2); margin-top: 6px; overflow: hidden; max-width: 320px; }
.h-main .bar i { display: block; height: 100%; background: var(--cinnabar); }
.h-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.h-side time { font-size: 12px; color: var(--muted); }
.h-side em { font-style: normal; color: var(--jade); font-weight: 700; }

/* ---------- icon nét mảnh + số liệu ---------- */
.sv { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.14em; flex: none; }
.nums { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.nums span { display: inline-flex; align-items: center; gap: 4px; }
.nums .gold { color: var(--gold); }
.nums .gold .sv { fill: currentColor; }
.stats .gold b { color: var(--gold); }
.grid { position: relative; }
.grid > [hidden] { display: none !important; }
.grid > .leaving { position: absolute; margin: 0; pointer-events: none; z-index: 0; }
.grid-empty { grid-column: 1 / -1; animation: fade .4s var(--ease); }

/* viên nền trượt theo chip đang chọn */
.chip-row.slide { position: relative; isolation: isolate; }
.chip-row.slide > .glide { position: absolute; left: 0; top: 0; border-radius: 99px; background: var(--jade); z-index: -1; pointer-events: none;
  box-shadow: 0 6px 16px rgba(31,74,61,.25); }
.chip-row.slide.ready > .glide { transition: transform .5s var(--ease), width .5s var(--ease), height .5s var(--ease), opacity .3s; }
.chip-row.slide > button { position: relative; transition: color .35s var(--ease), border-color .35s, background-color .35s; }
.chip-row.slide > button.on, .filters .chip-row.slide > .chip.on { background: transparent; border-color: transparent; color: var(--paper); }
.chip-row.slide > button:active { transform: scale(.95); }

/* ---------- bảng truyện ---------- */
#top-tabs .chip { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; }
.topboard { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; }
.topboard.swap > * { animation: rise .55s var(--ease) both; }
.topboard.swap > .top-list li { animation: rise .5s var(--ease) both; }
.topboard.swap > .top-list li:nth-child(1) { animation-delay: 60ms; } .topboard.swap > .top-list li:nth-child(2) { animation-delay: 110ms; }
.topboard.swap > .top-list li:nth-child(3) { animation-delay: 160ms; } .topboard.swap > .top-list li:nth-child(4) { animation-delay: 210ms; }
.topboard.swap > .top-list li:nth-child(5) { animation-delay: 260ms; } .topboard.swap > .top-list li:nth-child(6) { animation-delay: 310ms; }
.top-hero { position: relative; display: flex; gap: 20px; align-items: flex-end; min-height: 280px; padding: 26px; border-radius: 22px; overflow: hidden;
  color: #f3ead6; background: #1b2a24; box-shadow: var(--shadow); isolation: isolate; }
.top-hero .bg { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(26px) saturate(1.2) brightness(.55); z-index: -2;
  transform: scale(1.1); transition: transform 1.2s var(--ease); }
.top-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(100deg, rgba(15,22,19,.88) 30%, rgba(15,22,19,.2)); }
.top-hero:hover { color: #fff; }
.top-hero:hover .bg { transform: scale(1.18); }
.top-hero .rank { position: absolute; right: 22px; top: 6px; font-size: 120px; font-weight: 700; line-height: 1; color: transparent;
  -webkit-text-stroke: 1.5px rgba(227,180,103,.55); letter-spacing: -4px; }
.top-hero .cv { width: 150px; aspect-ratio: 3/4; object-fit: cover; border-radius: 12px; flex: none; box-shadow: 0 16px 36px rgba(0,0,0,.45);
  transform: rotate(-3deg); transition: transform .5s var(--ease); }
.top-hero:hover .cv { transform: rotate(0) translateY(-6px) scale(1.03); }
.top-hero .info { display: grid; gap: 6px; min-width: 0; }
.top-hero em { font-style: normal; font-size: 12px; letter-spacing: 2.5px; text-transform: uppercase; color: #e3b467; }
.top-hero strong { font-size: clamp(22px, 2.6vw, 32px); line-height: 1.15; }
.top-hero .by { font-size: 14px; opacity: .85; display: inline-flex; gap: 6px; align-items: center; }
.top-hero .metric b { font-size: 34px; color: #e3b467; font-variant-numeric: tabular-nums; }
.top-hero .metric small { margin-left: 6px; opacity: .8; }
.top-hero .nums { color: rgba(243,234,214,.75); }
.top-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; align-content: start; }
.top-list a { display: grid; grid-template-columns: 44px 42px 1fr auto; gap: 12px; align-items: center; padding: 8px 14px 8px 10px; border-radius: 14px;
  background: var(--card); border: 1.5px solid var(--line); color: var(--ink); transition: transform .25s var(--ease), border-color .25s, box-shadow .25s; }
.top-list a:hover { transform: translateX(6px); border-color: var(--jade); box-shadow: -4px 0 0 var(--cinnabar); }
.top-list .rk { font-size: 26px; font-weight: 700; color: var(--line); text-align: center; font-variant-numeric: tabular-nums; transition: color .25s; }
.top-list li:first-child .rk { color: var(--gold); }
.top-list a:hover .rk { color: var(--cinnabar); }
.top-list img { width: 42px; height: 56px; object-fit: cover; border-radius: 7px; }
.top-list .t { min-width: 0; }
.top-list .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-list .t small { color: var(--muted); font-size: 12.5px; }
.top-list .metric { text-align: right; line-height: 1.15; }
.top-list .metric b { display: block; font-size: 18px; color: var(--jade); font-variant-numeric: tabular-nums; }
.top-list .metric small { color: var(--muted); font-size: 11.5px; }
.top-list .solo { padding: 22px; text-align: center; border: 1.5px dashed var(--line); border-radius: 14px; }

/* ---------- thích / lưu ---------- */
.btn.mark { display: inline-flex; gap: 8px; align-items: center; }
.btn.mark b { font-size: 13px; padding: 0 8px; border-radius: 99px; background: rgba(31,74,61,.12); font-variant-numeric: tabular-nums; }
.btn.mark.on { color: #f3ead6; }
.btn.mark.on b { background: rgba(255,255,255,.18); }
.btn.mark.like.on { background: var(--cinnabar); border-color: var(--cinnabar); }
.btn.mark.save.on { background: var(--jade); border-color: var(--jade); }
.btn.mark.on .sv { fill: currentColor; }
.btn.mark { position: relative; }
.btn.mark.burst .sv { animation: pop .5s var(--ease); }
.btn.mark.burst::after { content: ""; position: absolute; inset: -2px; border-radius: inherit; border: 2px solid currentColor; opacity: 0;
  animation: ripple .6s var(--ease); pointer-events: none; }
.btn.mark.like.burst::after { border-color: var(--cinnabar); }
.btn.mark.save.burst::after { border-color: var(--jade); }
@keyframes ripple { from { opacity: .8; transform: scale(1); } to { opacity: 0; transform: scale(1.25, 1.6); } }

/* ---------- chip người dịch ---------- */
.person { display: inline-flex; align-items: center; gap: 7px; padding: 3px 12px 3px 3px; border-radius: 99px; border: 1.5px solid var(--jade);
  color: var(--jade); font-weight: 700; font-size: 14px; background: var(--card); transition: .25s var(--ease); }
.person img, .person .ini { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: none; }
.person .ini { display: grid; place-items: center; background: var(--jade); color: var(--paper); font-size: 12px; }
.person small { display: inline-flex; gap: 3px; align-items: center; color: var(--muted); font-weight: 400; font-size: 12px; }
.person:hover { background: var(--jade); color: var(--paper); transform: translateY(-2px); box-shadow: 0 6px 14px rgba(31,74,61,.25); }
.person:hover small { color: inherit; }
.pill.tr { background: rgba(31,74,61,.12); color: var(--jade); }
.cmt .who .nm { color: inherit; }
.cmt .who .nm:hover { color: var(--cinnabar); }
a.who { color: var(--ink); }
a.who:hover b { color: var(--cinnabar); }

/* ---------- hồ sơ công khai ---------- */
.pp-head { display: flex; gap: 26px; align-items: center; padding: 34px 0 26px; animation: rise .6s var(--ease); }
.pp-head .ring.big { width: 132px; height: 132px; }
.pp-head .ring.big img { box-shadow: 0 14px 30px rgba(0,0,0,.25); }
.ini-ring { background: var(--paper-2); }
.ini-ring .ini { width: calc(100% - 10px); height: calc(100% - 10px); border-radius: 50%; display: grid; place-items: center; background: var(--jade);
  color: var(--paper); font-size: 48px; font-weight: 700; }
.pp-t { min-width: 0; flex: 1; }
.pp-t h1 { margin: 4px 0 4px; font-size: clamp(30px, 5vw, 46px); line-height: 1.1; }
.pp-t .xpbar { max-width: 420px; }
.pp-badges { display: flex; gap: 6px; min-height: 20px; }
.pp-tiles { margin-top: 6px; }
.pp-tiles div { animation: rise .55s var(--ease) both; }
.pp-tiles div:nth-child(2) { animation-delay: 60ms; } .pp-tiles div:nth-child(3) { animation-delay: 120ms; }
.pp-tiles div:nth-child(4) { animation-delay: 180ms; } .pp-tiles div:nth-child(5) { animation-delay: 240ms; } .pp-tiles div:nth-child(6) { animation-delay: 300ms; }
.pp-tiles .sv { font-size: 20px; color: var(--cinnabar); }
.pp-tiles b { font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .topboard { grid-template-columns: 1fr; }
  .top-hero { min-height: 220px; padding: 18px; gap: 14px; }
  .top-hero .cv { width: 104px; }
  .top-hero .rank { font-size: 84px; }
  .sec-title:has(#top-tabs) { flex-wrap: wrap; }
  .sec-title #top-tabs { order: 4; width: 100%; }
  .pp-head { flex-direction: column; text-align: center; }
  .pp-head .me-tier, .pp-badges { justify-content: center; }
  .pp-t .xpbar { margin: 0 auto 6px; }
}
.actions .btn.lite { padding: 6px 14px; font-size: 14px; border-color: var(--line); color: var(--muted); font-weight: 400; }
.actions .btn.lite:hover { color: var(--paper); border-color: var(--jade); }
@media (max-width: 760px) {
  .top-hero { padding-top: 70px; }
  .top-hero .rank { font-size: 64px; top: 12px; right: 18px; letter-spacing: -2px; }
}
.topboard.solo { grid-template-columns: 1fr; }
.topboard.solo .top-hero { min-height: 300px; }

/* ======================================================================
   BẢN GỌN (12/2026): chữ nhỏ lại, đầu trang gọn, cột bên, thanh tab điện thoại
   ====================================================================== */
html { -webkit-text-size-adjust: 100%; }
body { font-size: 15px; line-height: 1.55; overflow-x: hidden; }
.wrap { max-width: 1200px; padding: 18px clamp(12px, 3vw, 32px) 48px; }

/* đầu trang */
.top { gap: 14px; padding: 8px clamp(12px, 3vw, 32px); height: 58px; border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(140,42,30,.25); }
.top .brand { gap: 10px; flex: none; }
.top .seal { width: 34px; height: 34px; font-size: 12px; border-radius: 6px; }
.brand-t b { font-size: 16px; letter-spacing: .3px; line-height: 1.2; }
.brand-t small { font-size: 11px; margin-top: 0; letter-spacing: .5px; }
.top nav.nav-main { margin-left: 6px; display: flex; gap: 2px; flex-wrap: nowrap; }
.top nav.nav-main a { padding: 5px 12px; font-size: 14px; border-radius: 8px; color: var(--muted); }
.top nav.nav-main a.on { background: none; color: var(--cinnabar); box-shadow: inset 0 -2px 0 var(--cinnabar); border-radius: 0; }
.top nav.nav-main a:hover { background: var(--paper-2); color: var(--ink); }
.top-search { position: relative; margin-left: auto; display: flex; align-items: center; gap: 6px; width: min(320px, 30vw);
  background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; height: 36px; transition: border-color .2s, box-shadow .2s; }
.top-search:focus-within { border-color: var(--jade); box-shadow: 0 0 0 3px rgba(31,74,61,.12); }
.top-search > span { color: var(--muted); }
.top-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 14px; }
.top-search kbd { font: 11px/1 monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px; }
.top-search:focus-within kbd { display: none; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; z-index: 40; animation: rise .2s var(--ease); }
.suggest a { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; color: var(--ink); }
.suggest a:hover, .suggest a.on { background: var(--paper-2); color: var(--ink); }
.suggest img { width: 30px; height: 40px; object-fit: cover; border-radius: 4px; flex: none; }
.suggest b { display: block; font-size: 14px; line-height: 1.3; }
.suggest small { color: var(--muted); font-size: 12px; }
.suggest a.all { justify-content: center; font-size: 13px; color: var(--jade); border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 4px; }
.top-act { display: flex; align-items: center; gap: 6px; flex: none; }
.top .icon-btn { width: 34px; height: 34px; font-size: 15px; border-width: 1px; }
.top .me { display: flex; align-items: center; gap: 8px; padding: 2px 10px 2px 2px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); color: var(--ink); }
.top .me:hover { border-color: var(--jade); color: var(--ink); }
.top .ring { width: 32px; height: 32px; }
.me-t b { display: block; font-size: 13px; line-height: 1.2; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-t small { display: flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); line-height: 1.2; }
.top .menu a { border-radius: 8px; display: flex; gap: 8px; align-items: center; color: var(--ink); padding: 7px 10px; font-size: 14px; }
.top .menu a:hover { background: var(--paper-2); }
.top .login { white-space: nowrap; }
.only-m { display: none !important; }
.role-ic { object-fit: contain; }

/* tiêu đề mục kiểu ấn triện */
.sec-title { margin: 26px 0 12px; gap: 10px; color: var(--ink); }
.sec-title::before { display: none; }
.sec-title h2 { font-size: 17px; text-transform: none; letter-spacing: .3px; }
.sec-title::after { height: 1px; }
.han { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 5px; font-size: 13px; font-weight: 700;
  color: #f4ead3; background: var(--cinnabar); box-shadow: inset 0 0 0 2px rgba(244,234,211,.3); line-height: 1; }
.sec-title .more { font-size: 13px; }

/* bố cục trang chủ */
.home .layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.home .col-main > :first-child .sec-title, .home .col-main > .sec-title:first-child { margin-top: 18px; }
.col-side { position: sticky; top: 74px; display: grid; gap: 14px; margin-top: 18px; }
.side-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.side-card[hidden] { display: none; }
.side-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.side-h h3 { margin: 0; font-size: 15px; }
.side-card .hint { margin: 0 0 10px; font-size: 13px; }
.side-card .btn { width: 100%; justify-content: center; }
.sm-me { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.sm-me .ring { width: 44px; height: 44px; }
.sm-me b { display: block; font-size: 15px; }
.sm-me small { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.xpbar { height: 5px; border-radius: 9px; background: var(--paper-2); overflow: hidden; margin: 10px 0 6px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--cinnabar)); border-radius: 9px; }
.side-card small.hint { display: block; font-size: 12px; margin: 0; }
.seg-tabs { display: flex; gap: 2px; background: var(--paper-2); border-radius: 9px; padding: 3px; margin-bottom: 8px; }
.seg-tabs button { flex: 1; border: 0; background: none; padding: 4px 0; border-radius: 7px; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg-tabs.slide > .glide { position: absolute; left: 0; top: 0; border-radius: 7px; background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.12); z-index: -1; }
.seg-tabs.slide { position: relative; isolation: isolate; }
.seg-tabs.slide.ready > .glide { transition: transform .4s var(--ease), width .4s var(--ease); }
.seg-tabs button.on { color: var(--ink); font-weight: 700; }
.mini-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mini-rank li { animation: rise .35s var(--ease) both; }
.mini-rank a { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 9px; color: var(--ink); }
.mini-rank a:hover { background: var(--paper-2); color: var(--ink); }
.mini-rank .rk { width: 20px; text-align: center; font-weight: 700; color: var(--muted); font-size: 14px; flex: none; }
.mini-rank .rk.r1 { color: var(--cinnabar); font-size: 17px; } .mini-rank .rk.r2 { color: var(--gold); font-size: 16px; } .mini-rank .rk.r3 { color: var(--jade); font-size: 15px; }
.mini-rank img { width: 32px; height: 43px; object-fit: cover; border-radius: 4px; flex: none; }
.mini-rank .t { flex: 1; min-width: 0; }
.mini-rank .t b { display: block; font-size: 13.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-rank .t small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-rank em { font-style: normal; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-cloud a { font-size: 13px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 99px; color: var(--ink); background: var(--paper); }
.tag-cloud a:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.tag-cloud small { color: var(--muted); margin-left: 4px; font-size: 11px; }
.discord-card { display: block; color: #fff; background: linear-gradient(135deg, #5865f2, #3c45a5); border: 0; }
.discord-card:hover { color: #fff; transform: translateY(-2px); }
.discord-card b { display: block; font-size: 15px; }
.discord-card small { opacity: .85; font-size: 12.5px; display: block; margin: 2px 0 8px; }
.discord-card span { font-weight: 700; font-size: 13px; }

/* truyện nổi bật */
.feat { position: relative; height: 250px; border-radius: 16px; overflow: hidden; background: #1c1812; color: #f4ead3; isolation: isolate; }
.feat[hidden] { display: none; }
.feat .slide { position: absolute; inset: 0; display: flex; gap: 22px; align-items: center; padding: 22px 28px; opacity: 0; visibility: hidden;
  transition: opacity .6s var(--ease), visibility .6s; }
.feat .slide.on { opacity: 1; visibility: visible; }
.feat .bg { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(28px) saturate(1.2) brightness(.45); z-index: -1; transform: scale(1.1); transition: transform 7s linear; }
.feat .slide.on .bg { transform: scale(1.2); }
.feat .slide::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(20,16,10,.55), transparent 70%); }
.feat .cv { flex: none; height: 100%; aspect-ratio: 3/4; border-radius: 10px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.15); }
.feat .cv img { width: 100%; height: 100%; object-fit: cover; }
.feat .slide.on .cv, .feat .slide.on .info { animation: rise .6s var(--ease) both; }
.feat .slide.on .info { animation-delay: .08s; }
.feat .info { min-width: 0; }
.feat em { font-style: normal; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: #e8b86b; }
.feat h2 { margin: 2px 0 4px; font-size: 24px; line-height: 1.2; }
.feat h2 a { color: inherit; }
.feat .meta { font-size: 13px; opacity: .75; }
.feat p { margin: 8px 0 0; font-size: 13.5px; opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 560px; }
.feat .acts { display: flex; gap: 8px; margin-top: 14px; }
.feat .btn { background: #f0e5cd; color: #1f4a3d; border-color: #f0e5cd; }
.feat .btn.ghost { background: transparent; color: #f0e5cd; border-color: rgba(240,229,205,.5); }
.feat .dots { position: absolute; right: 18px; bottom: 14px; display: flex; gap: 6px; }
.feat .dots button { width: 7px; height: 7px; border-radius: 9px; border: 0; padding: 0; background: rgba(255,255,255,.35); cursor: pointer; transition: width .3s var(--ease), background .3s; }
.feat .dots button.on { width: 20px; background: #e8b86b; }

/* thẻ truyện nhỏ gọn */
.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 14px; }
.card .cover { border-radius: 10px; }
.card h3 { font-size: 14.5px; line-height: 1.3; margin: 8px 0 2px; }
.card .meta { font-size: 12px; }
.card .badge { font-size: 11px; padding: 1px 7px; }
.card .tags .tag { font-size: 11px; }
.toolbar { margin: 0 0 14px; }
.chip-row button, .chip { font-size: 13px; padding: 2px 11px; }
.shelf.strip { display: flex; overflow-x: auto; gap: 10px; scroll-snap-type: x mandatory; padding-bottom: 4px; scrollbar-width: thin; }
.shelf.strip a { flex: 0 0 250px; scroll-snap-align: start; padding: 8px; gap: 10px; border-width: 1px; }
.shelf.strip img { width: 40px; height: 54px; }
.shelf.strip b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shelf.strip small { font-size: 12px; }
.chapters.compact a { padding: 8px 12px; gap: 10px; font-size: 14px; border-width: 1px; border-radius: 10px; }

/* nút & ô gọn */
.btn { font-size: 14px; padding: 6px 14px; border-radius: 9px; }
.btn.small { font-size: 13px; padding: 4px 11px; }
.search input { font-size: 14px; }
.foot { font-size: 12px; padding: 18px 16px 28px; }

/* trang truyện gọn */
.backdrop { height: 300px; }
.story { grid-template-columns: 200px minmax(0, 1fr); gap: 26px; }
.story .cover { border-radius: 12px; border-width: 2px; }
.story h1 { font-size: 26px; line-height: 1.25; }
.story .alt { font-size: 14px; margin: 2px 0 10px; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.stats span { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; min-width: 0; }
.stats b { display: inline; font-size: 14px; color: var(--ink); }
.stats .gold b, .stats .gold { color: var(--gold); }
.stats svg { width: 15px; height: 15px; }
.facts { gap: 4px 14px; font-size: 14px; margin: 0 0 12px; }
.facts dd { font-weight: 400; }
.actions { gap: 6px; }
.actions .btn { padding: 6px 12px; font-size: 13.5px; }
.desc { padding: 12px 14px; margin: 12px 0; font-size: 14px; border-width: 1px; border-radius: 10px; }
.chapters { gap: 6px; }
.chapters a { padding: 9px 14px; gap: 10px; border-width: 1px; border-radius: 10px; font-size: 14px; }
.chapters .no { min-width: 38px; }
.chapters .date { font-size: 12px; }
.chapters .pages-n { font-size: 12px; }

/* thanh tab dưới (điện thoại) */
#tabbar { display: none; }

@media (max-width: 1000px) {
  .home .layout { grid-template-columns: minmax(0, 1fr); }
  .col-side { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .top nav.nav-main { display: none; }
}
@media (max-width: 760px) {
  body { font-size: 14px; }
  .top { height: 52px; gap: 8px; padding: 6px 12px; }
  .top .brand-t small { display: none; }
  .top .brand-t b { font-size: 15px; }
  .top-search { display: none; }
  .only-m { display: inline-grid !important; }
  .top .dc, .top .me-t, .top .login { display: none !important; }
  .top .me { padding: 2px; border: 0; background: none; }
  .top .me-wrap:hover .menu { display: none; }
  .brand > span:not(.seal) { display: block; }
  #tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--top-bg); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  #tabbar a { display: grid; justify-items: center; gap: 1px; padding: 4px 0; color: var(--muted); font-size: 10.5px; }
  #tabbar a.on { color: var(--cinnabar); }
  #tabbar svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  #tabbar img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
  body.has-tabbar { padding-bottom: 58px; }
  body.has-tabbar .to-top { bottom: 72px; right: 14px; width: 40px; height: 40px; }
  body.has-tabbar .toast { bottom: 72px; }
  .wrap { padding: 12px 12px 32px; }
  .feat { height: 180px; border-radius: 12px; }
  .feat .slide { padding: 14px; gap: 14px; }
  .feat h2 { font-size: 17px; }
  .feat p { font-size: 12.5px; margin-top: 4px; }
  .feat .meta { font-size: 12px; }
  .feat .acts { margin-top: 10px; }
  .feat .dots { right: 12px; bottom: 10px; }
  .sec-title { margin: 20px 0 10px; }
  .sec-title h2 { font-size: 16px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; }
  .card h3 { font-size: 13px; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .card .meta { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card .tags, .card .nums { display: none; }
  .card .badge { font-size: 10px; padding: 0 5px; top: 6px; left: 6px; }
  .card .badge.new { right: 6px; }
  .shelf.strip a { flex-basis: 220px; }
  .chip-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px; }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip-row button { flex: none; }
  .col-side { grid-template-columns: 1fr; }
  #side-me, #tags-wrap { display: none; }
  /* trang truyện */
  .backdrop { height: 220px; }
  .story { grid-template-columns: 108px minmax(0, 1fr); gap: 14px; }
  .story .cover { max-width: none; margin: 0; border-radius: 8px; grid-row: 1 / span 3; align-self: start; }
  .story h1 { font-size: 19px; }
  .story .alt { font-size: 12.5px; margin-bottom: 6px; }
  .stats { font-size: 12px; gap: 2px 10px; }
  .stats b { font-size: 12.5px; }
  .story .facts, .story .actions, .story .rate-box, .story .desc { grid-column: 1 / -1; }
  .story > .rise { display: contents; }
  .story > .rise > h1, .story > .rise > .alt, .story > .rise > .stats { grid-column: 2; }
  .story > .rise > h1 { align-self: end; }
  .facts { font-size: 13px; grid-template-columns: max-content 1fr; }
  .actions .btn { padding: 6px 10px; font-size: 13px; }
  .actions .btn:first-child { flex: 1; justify-content: center; }
  .chapters a { padding: 8px 10px; font-size: 13.5px; flex-wrap: wrap; row-gap: 0; }
  .chapters .pages-n, .chapters .read { display: none; }
}
@media (max-width: 380px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.chapters.compact { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.chapters.compact img { width: 28px; height: 38px; object-fit: cover; border-radius: 4px; flex: none; }
.chapters.compact .lt { flex: 1; min-width: 0; line-height: 1.3; }
.chapters.compact .lt b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapters.compact .lt small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapters.compact .tag-new { font-size: 10px; }
@media (max-width: 760px) {
  .chapters.compact { grid-template-columns: 1fr; }
  .chapters.compact a { flex-wrap: nowrap; padding: 6px 10px; }
  .feat .dots { top: 12px; bottom: auto; }
  .card .badge:not(.new) { max-width: calc(100% - 50px); }
}
.actions .btn { white-space: nowrap; }
.ext-links { display: flex; gap: 14px; font-size: 13px; margin-top: 8px; }
.ext-links a { color: var(--muted); }
.ext-links a:hover { color: var(--cinnabar); }
.story .rate-box { margin-top: 10px; font-size: 13px; }
@media (max-width: 760px) {
  .story .ext-links { grid-column: 1 / -1; margin-top: -4px; }
  .story > .rise > * { min-width: 0; }
  .facts dd .chips { gap: 5px; }
  .facts .chip, .facts dd .chips > * { font-size: 12.5px; }
  .actions .btn:first-child { flex: none; }
  .actions .btn.red { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; justify-content: center; }
  .actions .mark, .actions .discord, .actions .lite { padding: 5px 10px; font-size: 12.5px; }
  .story .rate-box { font-size: 12.5px; }
  .story .rate-box .star, .story .rate-box button { font-size: 22px; }
}
/* trang phụ gọn */
.page-h { padding: 8px 0 4px; }
.page-h h1 { font-size: 24px; }
.page-h p { font-size: 14px; }
.me-card { padding: 16px; gap: 16px; border-radius: 14px; border-width: 1px; }
.rules { gap: 10px; }
.rule { padding: 10px 14px; border-width: 1px; border-radius: 12px; }
.rule b { font-size: 16px; }
.rule .ic { width: 36px; height: 36px; }
@media (max-width: 760px) {
  .page-h h1 { font-size: 20px; }
  .page-h p { font-size: 13px; }
  .me-card { flex-direction: row; text-align: left; padding: 12px; gap: 12px; }
  .me-card h2, .me-tier { justify-content: flex-start; }
  .me-card h2 { font-size: 17px; }
  .rules { grid-template-columns: 1fr 1fr; gap: 8px; }
  .rule { padding: 8px 10px; column-gap: 8px; }
  .rule .ic { width: 28px; height: 28px; }
  .rule b { font-size: 14px; }
  .rule span { font-size: 11.5px; }
}
.me-card .ring.big { width: 84px; height: 84px; }
@media (max-width: 760px) { .me-card .ring.big { width: 60px; height: 60px; } }
.vai { --vm: var(--cinnabar); display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--vm);
  border: 1px solid color-mix(in srgb, var(--vm) 45%, transparent); background: color-mix(in srgb, var(--vm) 10%, transparent); border-radius: 99px; padding: 0 8px 0 4px; line-height: 20px; white-space: nowrap; }
.vai img { width: 16px; height: 16px; object-fit: contain; }
.vai i { font-style: normal; }

/* chuyển trang mượt: trình duyệt giữ trang cũ tới khi trang mới vẽ xong rồi hoà dần, không nháy nền */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
header.top { view-transition-name: top; }
#tabbar { view-transition-name: tabbar; }
::view-transition-group(top), ::view-transition-group(tabbar) { animation-duration: 0s; }
html { background: var(--paper); }

/* ô chọn tự vẽ */
.dd { position: relative; display: inline-block; }
.dd-btn { display: inline-flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 10px 6px 14px; color: var(--ink); cursor: pointer; font-size: 14px; transition: border-color .2s, box-shadow .2s; }
.dd-btn:hover { border-color: var(--jade); }
.dd.open .dd-btn { border-color: var(--jade); box-shadow: 0 0 0 3px rgba(31,74,61,.12); }
.dd-btn .sv { color: var(--muted); transition: transform .25s var(--ease); }
.dd.open .dd-btn .sv { transform: rotate(180deg); }
.dd-list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 100%; width: max-content; z-index: 45; list-style: none; margin: 0; padding: 5px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); animation: ddIn .18s var(--ease); }
@keyframes ddIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.dd-list li { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--ink); }
.dd-list li.hi { background: var(--paper-2); }
.dd-list li .ok { opacity: 0; color: var(--cinnabar); }
.dd-list li.on { color: var(--cinnabar); font-weight: 700; }
.dd-list li.on .ok { opacity: 1; }
/* icon tìm kiếm thẳng hàng */
.top-search > .sv, .search > .sv { color: var(--muted); width: 16px; height: 16px; vertical-align: 0; }
.search { align-items: center; }
.icon-btn .sv { width: 17px; height: 17px; vertical-align: 0; }
.top .icon-btn { display: inline-grid; place-items: center; }
.top .menu .sv { width: 17px; height: 17px; color: var(--muted); }
.top .menu a:hover .sv { color: var(--cinnabar); }
/* thẻ truyện: số chương cùng hàng số liệu */
.card .nums { gap: 4px 10px; }
.card .nums .ch { color: var(--ink); }
@media (max-width: 760px) {
  .card .nums { display: flex; font-size: 11px; gap: 8px; }
  .card .nums span:nth-child(n+3) { display: none; }
}

/* ======================= trang xếp hạng ======================= */
.wrap.narrow { max-width: 980px; }
.league { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px 22px 22px; margin-top: 14px; overflow: hidden; isolation: isolate; }
.league::before { content: ""; position: absolute; left: 50%; top: -40px; width: 340px; height: 220px; transform: translateX(-50%); z-index: -1;
  background: radial-gradient(closest-side, rgba(140,42,30,.16), transparent); }
.lg-dir { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.lg-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 18px; padding: 14px 0 6px; }
.lg-side { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lg-side.up { justify-content: flex-start; }
.lg-side.down { justify-content: flex-end; }
.lg-top { font-size: 12.5px; color: var(--muted); }
.lg-b { position: relative; flex: none; display: grid; place-items: center; border-radius: 16px; cursor: pointer; padding: 0;
  background: var(--paper); border: 1px solid var(--line); transition: transform .25s var(--ease), border-color .2s, opacity .2s; }
.lg-b.d1 { width: 58px; height: 58px; } .lg-b.d2 { width: 50px; height: 50px; } .lg-b.d3 { width: 42px; height: 42px; }
.lg-b .lg-ic .ic { width: 64%; height: 64%; }
.lg-b .lg-ic { width: 100%; height: 100%; display: grid; place-items: center; }
.lg-b.lgk { border-style: dashed; }
.lg-b.lgk.d1 { opacity: .8; } .lg-b.lgk.d2 { opacity: .55; } .lg-b.lgk.d3 { opacity: .35; }
.lg-b.lgk .lg-ic { filter: grayscale(1) blur(2px); opacity: .25; }
.lg-b .lk { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.lg-b .lk .sv { width: 18px; height: 18px; }
.lg-b.lgk:hover { opacity: 1; border-color: var(--muted); }
.lg-b.done:hover { transform: translateY(-2px); border-color: var(--jade); }
.lg-b.done.sel { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176,124,46,.25); transform: scale(1.05); }
.lg-b .ck { position: absolute; right: -4px; bottom: -4px; width: 17px; height: 17px; border-radius: 50%; background: var(--jade-2); color: #fff; display: grid; place-items: center; }
.lg-b .ck .sv { width: 11px; height: 11px; stroke-width: 3; }
.lg-mid { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lg-cur { width: 108px; height: 108px; border-radius: 28px; padding: 0; cursor: pointer; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--paper), var(--paper-2)); border: 2px solid var(--cinnabar);
  box-shadow: 0 0 0 4px rgba(140,42,30,.15), 0 10px 32px rgba(140,42,30,.25); transition: transform .3s var(--ease); animation: pop .5s var(--ease); }
.lg-cur:hover { transform: scale(1.04); }
.lg-cur .lg-ic { width: 72%; height: 72%; display: grid; place-items: center; }
.lg-cur .lg-ic .ic { width: 100%; height: 100%; }
.lg-here { font-size: 11.5px; font-weight: 700; color: #f4ead3; background: var(--cinnabar); border-radius: 99px; padding: 2px 12px; }
.lg-note { text-align: center; font-size: 13px; color: var(--muted); background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 12px; max-width: 420px; margin: 4px auto 0; animation: rise .25s var(--ease); }
.lg-info { max-width: 640px; margin: 10px auto 0; text-align: center; animation: fade .3s var(--ease); }
.lg-name { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.lg-name h2 { margin: 0; font-size: 24px; }
.lg-name .chip { font-size: 12px; color: var(--muted); }
.lg-back { border: 0; background: none; color: var(--cinnabar); cursor: pointer; font-size: 13px; }
.lg-desc { margin: 4px auto 0; color: var(--muted); font-size: 14px; max-width: 520px; }
.lg-prog { margin-top: 14px; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.lg-prog-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.lg-prog-h span { color: var(--cinnabar); font-weight: 700; }
.lg-prog-h small { margin-left: auto; color: var(--muted); font-size: 12px; }
.lg-prog .xpbar { height: 8px; margin: 8px 0 6px; }
.lg-next { color: var(--jade); font-size: 12px; }
.lg-passed { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; color: var(--jade); background: rgba(70,128,106,.12); border-radius: 99px; padding: 3px 12px; }
.lg-info > .btn { margin-top: 12px; width: auto; }
.lg-perks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-top: 12px; text-align: left; }
.lg-perks > div { display: flex; gap: 10px; align-items: flex-start; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; }
.lg-perks i { font-style: normal; color: var(--jade); width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 7px; background: rgba(70,128,106,.14); font-size: 12px; }
.lg-perks b { display: block; font-size: 13.5px; }
.lg-perks small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; }
.shake { animation: shake .35s ease-in-out; }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }

.xp-ways { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; margin: 14px 0 4px; font-size: 13px; color: var(--muted); }
.xp-ways span { display: inline-flex; align-items: center; gap: 5px; }
.xp-ways b { color: var(--ink); }

.lb { background: var(--card); border: 1px solid var(--line); border-radius: 20px; margin-top: 18px; overflow: visible; }
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.lb-tabs { margin: 0; width: 200px; }
.lb-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lb-tools .seg-tabs { margin: 0; }
.lb-tools .seg-tabs[hidden] { display: none; }
.lb-tools .seg-tabs button { padding: 4px 12px; flex: none; }
.lb-cols, .lb-list a { display: grid; grid-template-columns: 40px minmax(0, 1fr) 150px 70px 80px 80px; align-items: center; gap: 10px; }
.lb-cols { padding: 8px 18px; font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--paper); }
.lb-cols span:nth-child(n+4) { text-align: right; }
.lb-cols span:first-child { text-align: center; }
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-list li { animation: rise .35s var(--ease) both; border-bottom: 1px solid var(--line); }
.lb-list li:last-child { border-bottom: 0; }
.lb-list a { padding: 9px 18px; color: var(--ink); transition: background .15s; }
.lb-list a:hover { background: var(--paper); color: var(--ink); }
.lb-list li.mine a { background: rgba(140,42,30,.08); box-shadow: inset 3px 0 0 var(--cinnabar); }
.lb .rk { justify-self: center; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-size: 13px; color: var(--muted); font-weight: 700; }
.lb .rk.m1 { color: #b8860b; background: rgba(229,185,92,.18); box-shadow: inset 0 0 0 1px rgba(229,185,92,.7); }
.lb .rk.m2 { color: #7d8a96; background: rgba(185,196,207,.2); box-shadow: inset 0 0 0 1px rgba(185,196,207,.8); }
.lb .rk.m3 { color: #b0683a; background: rgba(205,140,92,.16); box-shadow: inset 0 0 0 1px rgba(205,140,92,.7); }
html[data-theme="dem"] .lb .rk.m1 { color: #e5b95c; } html[data-theme="dem"] .lb .rk.m2 { color: #b9c4cf; } html[data-theme="dem"] .lb .rk.m3 { color: #cd8c5c; }
.lb .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lb .ava { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 2px var(--line); }
.lb li.mine .ava { box-shadow: 0 0 0 2px var(--cinnabar); }
.lb .cv { width: 30px; height: 40px; border-radius: 5px; object-fit: cover; flex: none; }
.lb .nm { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.lb .nm b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.lb .nm small { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.lb .tg { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700; border-radius: 6px; padding: 0 6px; line-height: 18px; }
.lb .tg.tr { color: var(--jade); background: rgba(70,128,106,.14); }
.lb .tg.me { color: var(--cinnabar); background: rgba(140,42,30,.14); }
.lb .c-bac { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lb .c-num { text-align: right; font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
.lb .c-num b { color: var(--ink); }
.lb .c-num.hl { color: var(--ink); font-weight: 700; }
.lb .c-num.dim { opacity: .5; }
.lb .m-only { display: none; }
.lb-div { padding: 6px 18px; text-align: center; font-size: 12px; font-weight: 700; color: var(--jade); background: rgba(70,128,106,.08); animation: none !important; }
.lb-empty { padding: 26px; text-align: center; color: var(--muted); font-size: 14px; }
@media (max-width: 760px) {
  .league { padding: 14px 12px 16px; border-radius: 16px; }
  .lg-row { gap: 10px; }
  .lg-side { gap: 6px; }
  .lg-b.d1 { width: 44px; height: 44px; } .lg-b.d2 { width: 36px; height: 36px; } .lg-b.d3 { width: 30px; height: 30px; }
  .lg-b { border-radius: 12px; }
  .lg-b .lk .sv { width: 14px; height: 14px; }
  .lg-cur { width: 84px; height: 84px; border-radius: 22px; }
  .lg-name h2 { font-size: 20px; }
  .lg-desc { font-size: 13px; }
  .lg-perks { grid-template-columns: 1fr; }
  .xp-ways { justify-content: flex-start; gap: 6px 12px; font-size: 12px; }
  .lb { border-radius: 16px; }
  .lb-head { padding: 10px 12px; }
  .lb-tabs { width: 100%; }
  .lb-tools { width: 100%; justify-content: space-between; }
  .lb-cols { display: none; }
  .lb-list a { grid-template-columns: 30px minmax(0, 1fr) auto; padding: 9px 12px; gap: 8px; }
  .lb .c-bac, .lb .d-only { display: none; }
  .lb .m-only { display: inline; }
  .lb .nm small.m-only { display: block; }
}
.lg-b.d4 { width: 42px; height: 42px; } .lg-b.lgk.d4 { opacity: .25; }
.lg-b .lg-ic { overflow: hidden; border-radius: inherit; }
.lg-b .lg-ic .ic { width: 64%; height: 64%; object-fit: contain; }
@media (max-width: 760px) {
  .lg-b.d1 { width: 40px; height: 40px; } .lg-b.d2 { width: 33px; height: 33px; } .lg-b.d3 { width: 28px; height: 28px; }
  .lg-b.d4 { display: none; }
  .lg-side { gap: 5px; }
  .lg-b .ck { width: 14px; height: 14px; right: -3px; bottom: -3px; }
  .lg-b .ck .sv { width: 9px; height: 9px; }
}
.card .nums { flex-wrap: nowrap; overflow: hidden; gap: 8px; font-size: 12px; white-space: nowrap; }
.card .nums .gold { display: none; }

/* đối tác Semantica */
.partner { position: relative; display: block; border-radius: 14px; padding: 1px; color: var(--ink); isolation: isolate; overflow: hidden;
  background: conic-gradient(from var(--pa, 0deg), var(--cinnabar), var(--gold), var(--jade), #6a7fd6, var(--cinnabar)); animation: ptSpin 6s linear infinite; }
@property --pa { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes ptSpin { to { --pa: 360deg; } }
.partner:hover { color: var(--ink); }
.pt-in { position: relative; display: block; border-radius: 13px; padding: 14px; background: var(--card); overflow: hidden; }
.pt-in::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.35) 50%, transparent 65%);
  transform: translateX(-120%); transition: transform .9s var(--ease); pointer-events: none; }
html[data-theme="dem"] .pt-in::after { background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.08) 50%, transparent 65%); }
.partner:hover .pt-in::after { transform: translateX(120%); }
.pt-glow { position: absolute; z-index: 2; width: 180px; height: 180px; left: var(--mx, 50%); top: var(--my, 50%); transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(176,124,46,.22), transparent); pointer-events: none; opacity: 0; transition: opacity .3s; }
.partner:hover .pt-glow { opacity: 1; }
.pt-tag { display: inline-block; font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.pt-head { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.pt-head b { font-size: 17px; letter-spacing: .3px; }
.pt-han { font-size: 13px; color: var(--cinnabar); font-weight: 700; }
.pt-desc { display: block; font-size: 12.5px; color: var(--muted); margin: 4px 0 10px; line-height: 1.45; }
.pt-cta { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--jade); transition: gap .2s var(--ease); }
.partner:hover .pt-cta { gap: 8px; color: var(--cinnabar); }
.partner:active { transform: scale(.985); }
.foot-pt { display: block; margin-top: 4px; }
.foot-pt a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.foot-pt a:hover { color: var(--cinnabar); }
@media (prefers-reduced-motion: reduce) { .partner { animation: none; } }
/* cột bên không được nở ra vì tên dài (giữ thẳng mép với dải truyện nổi bật) */
.col-side { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.side-card, .partner { min-width: 0; }
.mini-rank a { min-width: 0; }
/* ảnh bìa nền trong suốt: để lộ nền thẻ */
.card .cover, .story .cover, .feat .cv, .mini-rank img, .shelf img, .suggest img, .lb .cv, .chapters.compact img { background: var(--paper-2); }
.feat .cv { background: rgba(255,255,255,.06); }
.feat .cv img, .story .cover img { object-fit: contain; }
.mini-rank, .tag-cloud { grid-template-columns: minmax(0, 1fr); min-width: 0; }
/* ảnh bìa: luôn hiện trọn ảnh (bìa dạng chữ nền trong suốt không bị cắt) */
.card .cover img, .mini-rank img, .shelf img, .suggest img, .lb .cv, .chapters.compact img, .feat .cv img, .story .cover img { object-fit: contain; }

/* tên + danh phận theo Discord */
.cname { color: color-mix(in srgb, var(--cn) 82%, #000); }
html[data-theme="dem"] .cname { color: var(--cn); }
.gname { background: var(--gn); -webkit-background-clip: text; background-clip: text; color: transparent; filter: brightness(.86) saturate(1.1); }
html[data-theme="dem"] .gname { filter: none; }
.danh { --d1: var(--muted); display: inline-flex; align-items: center; gap: 4px; max-width: 100%; font-size: 11.5px; font-weight: 700; line-height: 18px;
  padding: 0 7px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--d1) 45%, transparent);
  background: color-mix(in srgb, var(--d1) 10%, transparent); color: color-mix(in srgb, var(--d1) 80%, #000); white-space: nowrap; vertical-align: middle; }
html[data-theme="dem"] .danh { color: var(--d1); }
.danh > span { overflow: hidden; text-overflow: ellipsis; }
.danh > span.g { background: var(--dg); -webkit-background-clip: text; background-clip: text; color: transparent; filter: brightness(.86) saturate(1.1); }
html[data-theme="dem"] .danh > span.g { filter: none; }
.danh img { width: 14px; height: 14px; object-fit: contain; }
.danh i { font-style: normal; }
.vai.seal { width: 20px; height: 20px; padding: 0; justify-content: center; border-radius: 6px; background: color-mix(in srgb, var(--vm) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--vm) 50%, transparent); vertical-align: middle; flex: none; }
.vai.seal img { width: 15px; height: 15px; }
.me-info h2, .pp-t h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.me-info > .danh { margin: 2px 0 4px; }
.cmt .who .danh, .cmt .who .vai { margin-left: 2px; }
.vai.seal .ic { width: 14px; height: 14px; }
.vai.seal .ic-x { color: var(--vm); }

/* khung bình luận theo gradient role + hoạ tiết chưởng quầy (trái) / dịch giả (phải) */
.cmt.framed { --f1: #c99a4a; --f2: #8a5a1c; --fr: linear-gradient(135deg, #e3b86b, #a86f2a); }
.cmt.framed > .body { position: relative; border: 1.5px solid transparent; border-radius: 14px; padding: 9px 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--f1) 13%, transparent), color-mix(in srgb, var(--f2) 5%, transparent) 60%, transparent) padding-box,
    linear-gradient(var(--card), var(--card)) padding-box;
  box-shadow: 0 2px 14px -6px color-mix(in srgb, var(--f1) 45%, transparent); }
/* viền gradient vẽ bằng lớp riêng, chừa khe chỗ hoạ tiết (không cần nền che viền) */
.cmt.framed > .body::before { content: ""; position: absolute; inset: -1.5px; border-radius: 14px; padding: 1.5px; background: var(--fr); pointer-events: none;
  --gl: 0px; --gr: 0px;
  -webkit-mask: linear-gradient(#000 0 0) left 16px top 0 / var(--gl) 1.5px no-repeat, linear-gradient(#000 0 0) right 16px top 0 / var(--gr) 1.5px no-repeat,
    linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor, xor, xor;
  mask: linear-gradient(#000 0 0) left 16px top 0 / var(--gl) 1.5px no-repeat, linear-gradient(#000 0 0) right 16px top 0 / var(--gr) 1.5px no-repeat,
    linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude, exclude, exclude; }
.cmt.framed.cq > .body::before { --gl: 86px; }
.cmt.framed.dg > .body::before { --gr: 86px; }
.cmt.framed.cq > .body, .cmt.framed.dg > .body { padding-top: 17px; }
.cmt .orn { position: absolute; top: -15px; width: 84px; height: 29px; padding: 0 3px; cursor: help; outline: none; z-index: 2; }
.cmt .orn.l { left: 15px; }
.cmt .orn.r { right: 15px; }
.cmt .orn svg { width: 100%; height: 100%; overflow: visible; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.cmt .orn .cl { stroke-width: 1.4; }
.cmt .orn.l .cl { stroke: var(--f1); }
.cmt .orn.r .cl { stroke: var(--f2); }
/* đèn lồng chưởng quầy: đung đưa nhẹ, toả sáng */
.cmt .orn .lan { transform-origin: 32px 0; animation: lanSway 3.2s ease-in-out infinite; }
.cmt .orn .str { stroke: #b48a3c; stroke-width: 1; }
.cmt .orn .cap { fill: #d4a24a; }
.cmt .orn .body { fill: #c2362b; }
.cmt .orn .glow { fill: url(#lanGlowG); animation: lanGlow 3.2s ease-in-out infinite; }
.cmt .orn .rib { stroke: #8e2219; stroke-width: .8; }
.cmt .orn .tas { stroke: #d4a24a; stroke-width: .9; }
@keyframes lanSway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes lanGlow { 0%, 100% { opacity: .6; } 50% { opacity: 1; } }
/* bút lông dịch giả: chấm mực, bút khẽ chấm xuống */
.cmt .orn .hdl { stroke: #9a6a32; stroke-width: 2.2; }
.cmt .orn .band { stroke: #d4a24a; stroke-width: 2.6; }
.cmt .orn .tip { fill: var(--ink); }
.cmt .orn .ink { fill: var(--ink); opacity: .85; }
.cmt .orn .brush { transform-origin: 38px 3px; animation: brushDip 4s ease-in-out infinite; }
@keyframes brushDip { 0%, 70%, 100% { transform: rotate(0); } 80% { transform: rotate(-7deg) translate(-1px, 1px); } }
@media (prefers-reduced-motion: reduce) { .cmt .orn .lan, .cmt .orn .glow, .cmt .orn .brush { animation: none; } }
.cmt.child.framed > .body { padding-top: 8px; }

.cmt .orn-tip { position: absolute; top: calc(100% + 6px); width: 230px; padding: 9px 12px; border-radius: 12px; z-index: 30;
  background: var(--card); border: 1px solid transparent; background: linear-gradient(var(--card), var(--card)) padding-box, var(--fr) border-box;
  box-shadow: var(--shadow); font-size: 12.5px; line-height: 1.45; color: var(--muted); text-align: left; white-space: normal;
  opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity .18s, transform .18s var(--ease); }
.cmt .orn-tip b { display: block; font-size: 13.5px; color: var(--ink); margin-bottom: 2px; }
.cmt .orn.l .orn-tip { left: 0; }
.cmt .orn.r .orn-tip { right: 0; }
.cmt .orn:hover .orn-tip, .cmt .orn:focus .orn-tip { opacity: 1; transform: none; }
.cmt:has(.orn:hover), .cmt:has(.orn:focus) { position: relative; z-index: 6; }
/* bình luận ghim */
.pin-mark { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--cinnabar); margin-bottom: 2px; }
.pin-mark .sv { width: 13px; height: 13px; }
.cmt.pinned:not(.framed) > .body { border-left: 2px solid var(--cinnabar); padding-left: 10px; }
/* thẻ dịch giả theo màu role Discord */
.person.tinted { border-color: transparent; background: linear-gradient(135deg, color-mix(in srgb, var(--p1) 12%, var(--card)), color-mix(in srgb, var(--p2) 6%, var(--card))) padding-box, var(--pg) border-box; }
.person.tinted:hover { color: var(--ink); background: linear-gradient(135deg, color-mix(in srgb, var(--p1) 26%, var(--card)), color-mix(in srgb, var(--p2) 16%, var(--card))) padding-box, var(--pg) border-box;
  box-shadow: 0 6px 14px -4px color-mix(in srgb, var(--p1) 55%, transparent); }
.person.tinted:hover small { color: var(--muted); }
