/* =========================================================
   TruyenX — giao diện dark theo phong cách truyen3x
   1 file duy nhất, không framework. Biến --r-* cho trang đọc.
   ========================================================= */
:root {
  --bg: #131415;
  --surface: #1a1b1d;
  --surface-2: #222326;
  --text: #dcdcdc;
  --muted: #8d9095;
  --border: rgba(255,255,255,.055);
  --primary: #d27a70;
  --primary-2: #e0958c;
  --primary-soft: rgba(210,122,112,.13);
  --accent: #cfa25a;
  --danger: #dc2626;
  --hot: #ef4444;
  --full: #16a34a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.18);
  --header-h: 58px;
  --font: "Quicksand", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 var(--font);
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-2); text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; font-family: var(--font); }
p { margin: 0 0 1em; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.empty { padding: 30px 0; text-align: center; }
.ic { width: 15px; height: 15px; vertical-align: -2px; flex-shrink: 0; }
.ic-star { fill: #cfa25a; stroke: #cfa25a; opacity: .95; }
.ic-heart { stroke: #e0958c; opacity: .95; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 8px; }
.container-narrow { max-width: 900px; }
.container-md { max-width: 960px; }
.container-xs { max-width: 440px; }
.site-main { flex: 1; padding: 16px 0 32px; }
.layout-2col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.col-side { position: sticky; top: calc(var(--header-h) + 12px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(26,27,29,.9);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.site-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(210,122,112,.22), transparent);
}
.header-inner { display: flex; align-items: center; gap: 12px; height: var(--header-h); position: relative; }
.logo {
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  font-family: var(--font); font-weight: 800; font-size: 22px;
  letter-spacing: -.2px; line-height: 1; text-transform: uppercase; color: var(--primary);
}
.logo:hover { text-decoration: none; }
.logo-text { display: inline-flex; align-items: center; }
.lg-main { color: #ffffff; font-weight: 600; }
.lg-hi { color: #df8378; font-weight: 600; }
.logo-img { height: 34px; width: auto; display: block; }
.site-footer .logo-img { height: 30px; }
.drawer-head .logo-img { height: 28px; }
.lg-tld { align-self: flex-start; color: #7d8086; font-weight: 800; font-size: .46em; letter-spacing: .5px; margin: -.15em 0 0 2px; }
.logo:hover .lg-main { color: #f3d9d5; }
.logo:hover .lg-hi { color: #e9978d; }
.site-header .lg-tld { display: none; }
.nav-toggle { display: none; }
.main-nav { display: flex; align-items: center; gap: 2px; }
.has-drop { position: relative; }
.nav-link {
  display: block; padding: 8px 12px; border-radius: 8px; background: none; border: 0;
  cursor: pointer; color: var(--text); font-weight: 500; white-space: nowrap; font-size: 15px;
}
.nav-link:hover { background: var(--surface-2); text-decoration: none; color: var(--primary); }
.nav-link.is-active { color: var(--primary-2); }
.dropdown {
  position: absolute; top: 100%; left: 0; min-width: 210px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 6px; display: none; z-index: 60;
}
.dropdown a, .dropdown button {
  display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px;
  color: var(--text); background: none; border: 0; cursor: pointer;
}
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); color: var(--primary); text-decoration: none; }
.dropdown-genres { display: none; grid-template-columns: repeat(3, 150px); }
.has-drop:hover > .dropdown, .has-drop.open > .dropdown { display: block; }
.has-drop:hover > .dropdown-genres, .has-drop.open > .dropdown-genres { display: grid; }
.search-box { position: relative; flex: 1; max-width: 340px; margin-left: auto; display: flex; }
.search-box input {
  width: 100%; padding: 8px 38px 8px 14px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface-2); outline: none; color: var(--text);
}
.search-box input:focus { border-color: var(--primary); background: var(--surface); }
.search-box button {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; cursor: pointer; padding: 6px 8px; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.search-box button:hover { color: var(--primary-2); }
.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.15); overflow: hidden; z-index: 70;
}
.suggest a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; color: var(--text); }
.suggest a:hover, .suggest a.active { background: var(--surface-2); text-decoration: none; }
.suggest a strong { display: block; font-size: 14px; }
.suggest a small { color: var(--muted); }
.suggest .suggest-all { justify-content: center; color: var(--primary); font-size: 13px; border-top: 1px solid var(--border); }
.search-toggle { display: none; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 18px; padding: 6px 8px; border-radius: 8px; line-height: 1; color: var(--text); }
.icon-btn:hover { background: var(--surface-2); }
.header-user { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; }
.header-user:hover { text-decoration: none; }

/* ---------- Buttons / labels / chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--primary);
  background: var(--primary); color: #fff; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: .15s; font-size: 15px;
}
.btn:hover { background: var(--primary-2); border-color: var(--primary-2); color: #fff; text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary-2); }
.btn-ghost.is-active { background: var(--primary-soft); }
.btn-accent { background: var(--accent); border-color: var(--accent); }
.btn-accent:hover { background: #c2410c; border-color: #c2410c; }
.btn.disabled { opacity: .45; pointer-events: none; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--primary); font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.label {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px;
  vertical-align: middle; text-transform: uppercase; letter-spacing: .3px;
}
.label + .label { margin-left: 5px; }
.label-full { background: rgba(34,197,94,.14); color: #8cc5a0; }
.label-hot { background: rgba(210,122,112,.16); color: #e0958c; }
.label-new { background: rgba(251,191,36,.14); color: #cfa25a; }
.label-audio { background: rgba(207,162,90,.15); color: #dcbc84; }
.label-admin { background: rgba(185,179,214,.12); color: #b9b3d6; }
.chip {
  font-size: 12px; padding: 2px 10px; border-radius: 999px; background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1); color: #d0d0d0;
}
.genre-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.genre-chips .chip {
  font-size: 13px; padding: 5px 13px; border-radius: 999px; color: #d6d6d6;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
}
.genre-chips button.chip { cursor: pointer; }
.genre-chips .chip:hover { color: #fff; background: var(--primary-soft); border-color: rgba(210,122,112,.35); text-decoration: none; }
.genre-chips .chip.is-active { color: #fff; background: var(--primary); border-color: var(--primary); }

/* ---------- Boxes & sections ---------- */
.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.box-flush { padding: 0; overflow: hidden; }
.box-head { padding: 16px 18px 12px; margin: 0; border-bottom: 1px solid var(--border); }
.box-foot { padding: 12px; text-align: center; border-top: 1px solid var(--border); }
.box-title { font-size: 17px; margin-bottom: 12px; }
.box-title .ic { width: 18px; height: 18px; margin-right: 6px; vertical-align: -3px; color: var(--primary-2); }
.box-title-ic { display: flex; align-items: center; gap: 9px; }
.box-title-ic svg { color: var(--primary-2); flex-shrink: 0; padding: 6px; width: 30px; height: 30px; border-radius: 9px; background: var(--primary-soft); box-sizing: border-box; }
.page-title { font-size: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head .box-title, .section-head .page-title { margin: 0; }
.section-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; }
.section-head .section-title { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.st-bar { width: 4px; height: 20px; border-radius: 4px; background: linear-gradient(180deg, #e0958c, #bd6a61); flex-shrink: 0; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary-2); }
.breadcrumb .sep { margin: 0 6px; opacity: .6; }
.ad { margin: 0 0 16px; text-align: center; }
.ad:empty { display: none; }

/* ---------- Spotlight ---------- */
.spotlight { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; margin: 4px 0 16px; }
.spot-main {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 26px 26px 22px; border-radius: 16px; color: var(--text); overflow: hidden;
  border: 1px solid rgba(255,255,255,.07);
  background: radial-gradient(120% 140% at 0% 0%, rgba(210,122,112,.12), transparent 55%),
              radial-gradient(90% 120% at 100% 100%, rgba(207,162,90,.06), transparent 60%),
              linear-gradient(160deg, #1d1d1f, #17181a);
}
.spot-main:hover { text-decoration: none; color: var(--text); border-color: rgba(210,122,112,.6); }
.spot-kicker { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--primary-2); }
.spot-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.spot-genres { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.spot-title { font-size: 30px; line-height: 1.2; font-weight: 800; }
.spot-desc { color: #a9abaf; font-size: 14.5px; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.spot-meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--muted); margin-top: auto; }
.spot-meta span { display: inline-flex; align-items: center; gap: 4px; }
.spot-cta {
  align-self: flex-start; margin-top: 4px; padding: 9px 20px; border-radius: 999px;
  background: linear-gradient(90deg, #d27a70, #bd6a61); color: #fff; font-weight: 700;
  font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); transition: transform .15s;
}
.spot-main:hover .spot-cta { transform: translateX(3px); }
.spot-side { display: grid; grid-template-rows: repeat(4, 1fr); gap: 10px; }
.spot-item {
  display: flex; gap: 14px; align-items: center; padding: 12px 16px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  transition: border-color .15s, background .15s;
}
.spot-item:hover { text-decoration: none; color: var(--text); border-color: rgba(210,122,112,.5); background: var(--surface-2); }
.spot-no { font-size: 26px; font-weight: 900; width: 30px; text-align: center; color: transparent; -webkit-text-stroke: 1.5px #e0958c; flex-shrink: 0; }
.spot-item-body { display: flex; flex-direction: column; min-width: 0; }
.spot-item-body strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot-item:hover strong { color: var(--primary-2); }
.spot-item-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Audio home ---------- */
.audio-home { margin: 0 0 16px; }
.ac-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.audio-card {
  position: relative; display: flex; align-items: center; gap: 14px; min-height: 84px;
  padding: 14px 16px; border-radius: 14px; overflow: hidden; color: var(--text);
  border: 1px solid rgba(255,255,255,.06);
  background: radial-gradient(120% 140% at 0% 0%, rgba(207,162,90,.10), transparent 55%), linear-gradient(160deg, #1d1e20, #17181a);
  transition: border-color .2s, transform .2s, background .2s;
}
.audio-card:hover { text-decoration: none; color: var(--text); border-color: rgba(210,122,112,.45); transform: translateY(-2px); }
.ac-play {
  position: relative; z-index: 1; width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.35);
  transition: transform .2s, background .2s;
}
.ac-play svg { margin-left: 2px; }
.audio-card:hover .ac-play { transform: scale(1.08); background: var(--primary-2); }
.ac-body { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ac-body strong { font-size: 14.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.audio-card:hover .ac-body strong { color: #fff; }
.ac-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-wave { position: absolute; right: 12px; bottom: 10px; display: flex; align-items: flex-end; gap: 3px; height: 26px; opacity: .22; }
.ac-wave i { width: 3px; border-radius: 2px; background: #cfa25a; height: 30%; }
.ac-wave i:nth-child(2) { height: 70%; }
.ac-wave i:nth-child(3) { height: 45%; }
.ac-wave i:nth-child(4) { height: 95%; }
.ac-wave i:nth-child(5) { height: 55%; }
.ac-wave i:nth-child(6) { height: 80%; }
.ac-wave i:nth-child(7) { height: 35%; }
.audio-card:hover .ac-wave { opacity: .5; }
.audio-card:hover .ac-wave i { animation: acWave .9s ease-in-out infinite alternate; }
.audio-card:hover .ac-wave i:nth-child(2n) { animation-delay: .2s; }
.audio-card:hover .ac-wave i:nth-child(3n) { animation-delay: .4s; }
@keyframes acWave { from { transform: scaleY(.55); } to { transform: scaleY(1.15); } }

/* ---------- Update list (trang chủ) ---------- */
.home-cols > .col-main, .home-cols > .col-side { display: flex; flex-direction: column; }
.home-cols > .col-main > .box { flex: 1; display: flex; flex-direction: column; margin-bottom: 0; }
.home-cols .update-list { flex: 1; }
.home-cols .box-foot { margin-top: auto; }
.home-cols > .col-side > .box:last-child { flex: 1; margin-bottom: 0; }
.box-flush .update-list { padding: 0 6px; }
.update-list { display: flex; flex-direction: column; }
.update-item {
  display: grid; grid-template-columns: minmax(0, 1fr) 140px 110px 100px; gap: 10px;
  align-items: center; padding: 10px 16px; margin: 0 -6px; border-radius: 10px; -webkit-tap-highlight-color: transparent; border-bottom: 1px dashed var(--border); font-size: 14px;
}
.update-item:last-child { border-bottom: 0; }
.update-item:hover, .update-item:active { background: var(--surface-2); }
.u-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-title a { color: var(--text); font-weight: 500; }
.u-title a:hover { color: var(--primary); text-decoration: none; }
.u-title .label { margin-left: 6px; }
.u-title .label:first-child { margin-left: 0; }
.u-genre { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-chap { white-space: nowrap; }
.u-time { color: var(--muted); font-size: 13px; white-space: nowrap; text-align: right; }
.chap-link { color: var(--accent); font-weight: 600; font-size: 14px; white-space: nowrap; }
.chap-link:hover { color: var(--primary-2); }

/* ---------- Rank list & cat list (sidebar) ---------- */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.rank-list li:last-child { border-bottom: 0; }
.rank-no {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 800; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.rank-1 { background: #cfa25a; color: #fff; border-color: #cfa25a; }
.rank-2 { background: #94a3b8; color: #fff; border-color: #94a3b8; }
.rank-3 { background: #b45309; color: #fff; border-color: #b45309; }
.rank-body { min-width: 0; }
.rank-list a { color: var(--text); font-weight: 500; }
.rank-list a:hover { color: var(--primary); text-decoration: none; }
.rank-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; margin-top: 2px; color: var(--muted); font-size: 12.5px; }
.rank-meta span { display: inline-flex; align-items: center; gap: 3px; }
.rank-meta em { font-style: normal; opacity: .7; margin-left: 3px; }
.rank-norate { opacity: .75; }
.rank-norate .ic-star { fill: none; stroke: currentColor; opacity: .5; }
.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cat-list li + li { border-top: 1px solid rgba(255,255,255,.04); }
.cat-list a {
  display: flex; align-items: center; gap: 12px; padding: 11px 10px; margin: 0 -10px;
  border-radius: 10px; color: #d9d9d9; font-size: 14.5px; font-weight: 500;
  transition: background .15s, color .15s;
}
.cat-list a i { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); opacity: .55; flex-shrink: 0; transition: .15s; }
.cat-list a span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-list a b { color: var(--muted); font-weight: 400; font-size: 18px; line-height: 1; opacity: .5; transition: .15s; }
.cat-list a:hover { background: rgba(255,255,255,.035); color: #fff; text-decoration: none; }
.cat-list a:hover i { opacity: 1; box-shadow: 0 0 0 4px rgba(210,122,112,.15); }
.cat-list a:hover b { opacity: 1; color: var(--primary-2); transform: translateX(3px); }

/* ---------- Story rows (listing) ---------- */
.story-rows { display: flex; flex-direction: column; }
.story-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); align-items: start; }
.story-row:last-child { border-bottom: 0; }
.story-row-main, .story-row-body { min-width: 0; }
.story-row-title { font-size: 16px; margin: 0 0 4px; font-family: var(--font); font-weight: 600; }
.story-row-title a { color: var(--text); }
.story-row-title a:hover { color: var(--primary); text-decoration: none; }
.story-row-title .label { margin-left: 6px; }
.story-row-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 13px; }
.story-row-meta span { display: inline-flex; align-items: center; gap: 4px; }
.story-row-genres { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.story-row-genres a {
  font-size: 12px; padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted);
}
.story-row-genres a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.story-row-desc { margin: 6px 0 0; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.story-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.story-row-side time { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.ranked-item { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.ranked-item:last-child { border-bottom: 0; }
.ranked-item .story-row { border: 0; }
.ranked-body { min-width: 0; }
.ranked-no { font-size: 20px; font-weight: 900; text-align: center; color: transparent; -webkit-text-stroke: 1.3px #e0958c; }
.ranked-item:nth-child(1) .ranked-no { -webkit-text-stroke-color: #cfa25a; }

/* ---------- Filter bar / pagination / tabs ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 8px; padding: 12px; background: var(--surface-2); border-radius: 8px; }
.filter-bar .input { flex: 1 1 240px; }
.input, .select-sm, .input-sm, textarea, select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); outline: none; max-width: 100%; color: var(--text);
}
.select-sm, .input-sm { padding: 6px 10px; font-size: 14px; }
.input:focus, textarea:focus, select:focus, .input-sm:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { width: 100%; resize: vertical; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 16px; }
.pagination a, .pagination span {
  min-width: 36px; height: 36px; padding: 0 10px; display: inline-flex; align-items: center;
  justify-content: center; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14px;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.pagination .dots { border: 0; background: none; }
.rank-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.rank-tabs a {
  padding: 6px 14px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--muted); font-size: 14px; font-weight: 500;
}
.rank-tabs a:hover { color: #fff; text-decoration: none; }
.rank-tabs a.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Forms / auth / profile ---------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 14px; }
.form label.check, .radio { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; margin: 4px 0; }
.form .input { width: 100%; }
.form input[type="text"], .form input[type="password"] {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); outline: none; width: 100%;
}
.form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-error {
  background: rgba(220,38,38,.12); border: 1px solid rgba(220,38,38,.35); color: #f3a49d;
  padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 12px;
}
.auth-box { margin-top: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-sm { width: 30px; height: 30px; font-size: 13px; }
.avatar-lg { width: 84px; height: 84px; font-size: 34px; }
.avatar-letter { display: inline-flex; align-items: center; justify-content: center; background: hsl(var(--h, 20), 55%, 45%); color: #fff; font-weight: 700; }
.profile-head { display: flex; gap: 18px; align-items: center; margin-bottom: 20px; }
.profile-head .page-title { margin: 0; }
.profile-head .btn { margin-left: auto; }
.error-page { text-align: center; padding: 60px 20px; }
.error-code { font-size: 72px; font-weight: 800; color: var(--primary); line-height: 1; margin-bottom: 10px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 28px 0 16px; margin-top: auto; }
.site-footer .footer-inner, .site-footer .copyright { text-align: center; }
.site-footer .footer-inner > div { display: flex; flex-direction: column; align-items: center; }
.site-footer .footer-inner p { max-width: 820px; margin-left: auto; margin-right: auto; }
.site-footer .logo { font-size: 21px; justify-content: center; }
.site-footer .logo-text { display: inline-flex; }
.footer-inner p { margin: 8px 0 0; }
.copyright { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.online-counter {
  display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px;
  margin-top: 14px; padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.07); color: #b8b8b8; font-size: 13px;
}
.online-counter b { color: #f0f0f0; font-weight: 700; }
.online-counter svg { color: var(--muted); }
.online-counter:hover { text-decoration: none; color: #e6e6e6; border-color: rgba(210,122,112,.4); }
.online-counter:hover svg { color: var(--primary-2); }
.oc-dot { width: 8px; height: 8px; border-radius: 50%; background: #5bd08a; box-shadow: 0 0 0 0 rgba(91,208,138,.6); animation: ocPulse 2s infinite; flex-shrink: 0; display: inline-block; }
.oc-sep { width: 1px; height: 12px; background: rgba(255,255,255,.12); }
@keyframes ocPulse { 0% { box-shadow: 0 0 0 0 rgba(91,208,138,.5); } 70% { box-shadow: 0 0 0 7px rgba(91,208,138,0); } 100% { box-shadow: 0 0 0 0 rgba(91,208,138,0); } }
.to-top {
  position: fixed; right: 16px; bottom: 20px; width: 48px; height: 48px; border-radius: 50%;
  border: 0; background: var(--primary); color: #fff; font-size: 20px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.2); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #111827; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 300; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }

/* ---------- Reader ---------- */
body.reading { --r-bg: #17181a; --r-text: #cfcfcf; }
body.reading .site-main { padding-top: 0; }
.reader { background: var(--r-bg, #17181a); color: var(--r-text, #cfcfcf); padding: 26px 0 10px; }
.reader-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100; pointer-events: none; }
.reader-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #d27a70, #cfa25a); transition: width .1s; }
.reader-container { max-width: calc(var(--r-width, 1100px) + 40px); margin: 0 auto; padding: 0 18px; }
.chapter-head { text-align: center; margin-bottom: 30px; }
.ch-genres { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ch-genres a {
  font-size: 11.5px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
  color: #e6a79f; padding: 2px 10px; border-radius: 999px; background: rgba(210,122,112,.12);
}
.ch-genres a:hover { text-decoration: none; background: rgba(210,122,112,.22); }
.ch-story { font-size: 30px; font-weight: 800; line-height: 1.25; margin: 0 0 6px; color: #ececec; letter-spacing: -.2px; }
.chapter-title { font-size: 17px; font-weight: 500; margin: 0 0 8px; color: inherit; opacity: .8; font-family: var(--font); }
.chapter-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 0; font-size: 13px; color: inherit; opacity: .55; margin: 8px 0 18px; }
.chapter-meta span + span::before { content: "·"; margin: 0 10px; }
.ch-bar {
  display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px;
  padding: 6px; border-radius: 999px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
}
.ch-arrow, .ch-tool {
  height: 34px; min-width: 34px; padding: 0 12px; border-radius: 999px; border: 0; background: transparent;
  color: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; gap: 5px; opacity: .8; transition: .15s; white-space: nowrap;
}
.ch-arrow { font-size: 22px; padding: 0; width: 34px; line-height: 1; }
.ch-arrow:hover, .ch-tool:hover { background: rgba(255,255,255,.08); opacity: 1; text-decoration: none; color: inherit; }
.ch-tool.is-active, .ch-tool.on { color: #e6a79f; opacity: 1; }
.ch-arrow.disabled { opacity: .2; pointer-events: none; }
.ch-sep { width: 1px; height: 20px; background: rgba(255,255,255,.12); margin: 0 2px; }
.ch-pick {
  display: inline-flex; align-items: center; gap: 8px; max-width: 260px; height: 34px; padding: 0 14px;
  border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
  color: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: .15s;
}
.ch-pick span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-pick i { font-style: normal; font-size: 10px; opacity: .55; }
.ch-pick .ic { width: 15px; height: 15px; opacity: .65; flex-shrink: 0; }
.ch-tool .ic { width: 16px; height: 16px; flex-shrink: 0; }
.ch-tool.is-active .ic-heart { fill: #e6a79f; stroke: #e6a79f; }
.ch-pick:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.16); }
.chapter-content {
  max-width: var(--r-width, 1100px); margin: 0 auto;
  font-family: var(--r-font, var(--font));
  font-size: var(--r-size, 18px); line-height: var(--r-lh, 1.8); text-align: var(--r-align, left);
  overflow-wrap: break-word; padding: 0 0 10px;
  -webkit-user-select: text; user-select: text; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
.chapter-content p { margin: 0 0 1.15em; }
.chapter-content:empty { display: none; }
.ch-end { display: flex; align-items: center; gap: 14px; max-width: var(--r-width, 1100px); margin: 26px auto; color: inherit; opacity: .35; }
.ch-end::before, .ch-end::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .5; }
.ch-foot-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: var(--r-width, 1100px); margin: 0 auto 12px; }
.ch-big {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,.09); background: rgba(255,255,255,.03); color: inherit;
  font-weight: 600; font-size: 15px; min-width: 0; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; transition: .15s;
}
.ch-big small { font-size: 11.5px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; opacity: .5; }
.ch-big:hover { text-decoration: none; color: inherit; border-color: rgba(210,122,112,.5); background: rgba(210,122,112,.08); }
.ch-big-next { text-align: right; background: linear-gradient(135deg, rgba(210,122,112,.22), rgba(210,122,112,.08)); border-color: rgba(210,122,112,.35); }
.ch-big.disabled { opacity: .3; pointer-events: none; background: transparent; border-style: dashed; }
.ch-foot-select { text-align: center; margin-bottom: 22px; }
.rate-box { display: flex; align-items: center; gap: 2px; }
.chapter-rate { flex-direction: column; gap: 6px; margin: 4px auto 0; max-width: var(--r-width, 1100px); text-align: center; }
.chapter-rate .small { opacity: .75; }
.stars-row { display: inline-flex; }
.star-btn { background: none; border: 0; cursor: pointer; font-size: 24px; color: #3a3c40; padding: 0 2px; line-height: 1; transition: transform .1s; }
.star-btn.on, .star-btn.hover { color: #cfa25a; }
.star-btn:hover { transform: scale(1.15); }
.hint-keys { opacity: .35; margin: 12px 0 0; text-align: center; font-size: 13px; }
.reader-ad { max-width: var(--r-width, 1100px); margin: 18px auto; }

/* ---------- Modals ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--surface); color: var(--text); border-radius: 12px; width: 100%; max-width: 440px; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.3); max-height: 90vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-of-type { border-bottom: 0; }
.setting-row label { font-weight: 500; font-size: 14px; }
.theme-swatches { display: flex; gap: 8px; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0; }
.sw.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.sw-dark { background: #17181a; }
.sw-black { background: #000; }
.sw-sepia { background: #1c1712; }
.sw-green { background: #0f1a13; }
.sw-gray { background: #1f2329; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 36px; height: 32px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); cursor: pointer; color: var(--text); }
.stepper span { min-width: 48px; text-align: center; font-weight: 600; }
#report-modal textarea { margin: 10px 0; }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.modal-actions .btn { flex: 1; }
.chap-modal { background: rgba(0,0,0,.6); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.chap-box {
  max-width: 560px; padding: 0; display: flex; flex-direction: column;
  max-height: min(82vh, 700px); overflow: hidden; border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.5); animation: chapIn .18s ease-out;
  background: var(--surface); color: var(--text); width: 100%;
}
@keyframes chapIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.chap-head { position: relative; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 18px 12px 20px; }
.chap-head::before { content: ""; position: absolute; left: 50%; top: 7px; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: rgba(255,255,255,.18); }
.chap-head-text { min-width: 0; }
.chap-head h3 { font-size: 17px; margin: 0 0 2px; }
.chap-head .small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.chap-search { padding: 0 20px 14px; border-bottom: 1px solid var(--border); }
.chap-search input { width: 100%; height: 40px; padding: 0 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); outline: none; font-size: 14px; color: var(--text); }
.chap-search input:focus { border-color: var(--primary); }
.chap-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.chap-list a { display: flex; gap: 12px; align-items: center; padding: 9px 12px; border-radius: 10px; color: var(--text); }
.chap-list a b {
  min-width: 36px; height: 28px; padding: 0 6px; border-radius: 8px; background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; color: var(--muted); flex-shrink: 0;
}
.chap-list a span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; }
.chap-list a em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--primary-2); flex-shrink: 0; }
.chap-list a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.chap-list a.is-current { background: var(--primary-soft); }
.chap-list a.is-current b { background: var(--primary); color: #fff; }
.chap-list a.is-read span { color: var(--muted); }
.chap-list a.is-read b::after { content: "✓"; margin-left: 3px; color: #8cc5a0; font-size: 10px; }
.chap-note { padding: 24px 12px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Comments ---------- */
.comments { margin-top: 4px; }
.comment-form { margin-bottom: 16px; }
.comment-form textarea { margin-bottom: 8px; }
.right { text-align: right; }
.modal-box .right { margin-top: 14px; }
.form > p.center { margin: 4px 0 0; }
.hp { display: none !important; }
.cmt-act { background: none; border: 0; padding: 0; cursor: pointer; color: var(--primary); font-size: 13px; }
.cmt-act:hover { text-decoration: underline; }
.empty-cmt { padding: 10px 0; }
.reply-box { margin-top: 8px; }
.comment { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.comment .avatar { width: 38px; height: 38px; font-size: 15px; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.comment-head time { color: var(--muted); font-size: 12.5px; }
.comment-head .cmt-where { color: var(--muted); font-size: 12.5px; }
.comment-text { margin: 4px 0; overflow-wrap: anywhere; font-size: 14.5px; }
.comment-text p { margin: 0; }
.comment-actions { display: flex; gap: 14px; }
.replies { margin-top: 4px; }
.replies .comment { padding: 10px 0 4px; border-top: 1px dashed var(--border); }
.replies .avatar { width: 30px; height: 30px; font-size: 12px; }
.reply-form { margin-top: 8px; }
.reply-form textarea { margin-bottom: 6px; }
.cmt-login-note { padding: 14px; border: 1px dashed var(--border); border-radius: 8px; text-align: center; color: var(--muted); margin-bottom: 8px; }

/* ---------- Audio player ---------- */
.audio-box {
  max-width: var(--r-width, 1100px); margin: 0 auto 26px; padding: 18px 20px; border-radius: 16px;
  background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.07); color: var(--r-text, #cfcfcf);
}
.ap-top { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.ap-disc {
  position: relative; width: 64px; height: 64px; flex-shrink: 0; border-radius: 18px;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, #d27a70, #a95a52); box-shadow: 0 8px 24px rgba(210,122,112,.25);
}
.ap-eq { position: absolute; right: 7px; bottom: 7px; display: flex; align-items: flex-end; gap: 2px; height: 14px; opacity: 0; transition: opacity .2s; }
.ap-eq i { width: 3px; height: 100%; border-radius: 2px; background: rgba(255,255,255,.9); transform-origin: bottom; transform: scaleY(.3); }
.ap.is-playing .ap-eq { opacity: 1; }
.ap.is-playing .ap-eq i { animation: apEq .8s ease-in-out infinite alternate; }
.ap.is-playing .ap-eq i:nth-child(2) { animation-delay: .25s; }
.ap.is-playing .ap-eq i:nth-child(3) { animation-delay: .5s; }
.ap.is-playing .ap-eq i:nth-child(4) { animation-delay: .1s; }
.ap.is-playing .ap-disc svg { opacity: .55; }
@keyframes apEq { from { transform: scaleY(.25); } to { transform: scaleY(1); } }
.ap-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ap-info strong { font-size: 18px; color: #f2f2f2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-info span { font-size: 13.5px; color: #a9abaf; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-state { font-style: normal; font-size: 12px; color: var(--primary-2); margin-top: 2px; }
.ap-seek { padding: 10px 0; cursor: pointer; touch-action: none; outline: none; }
.ap-track { position: relative; height: 6px; border-radius: 6px; background: rgba(255,255,255,.09); }
.ap-buf { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 6px; background: rgba(255,255,255,.12); }
.ap-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 6px; background: linear-gradient(90deg, #d27a70, #e0958c); }
.ap-knob {
  position: absolute; top: 50%; left: 0; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4);
  transform: scale(0); transition: transform .15s;
}
.ap-seek:hover .ap-knob, .ap.is-drag .ap-knob, .ap-seek:focus-visible .ap-knob { transform: scale(1); }
.ap-seek:hover .ap-track, .ap.is-drag .ap-track { height: 8px; margin-top: -1px; }
.ap-times { display: flex; justify-content: space-between; font-size: 12px; color: #8d9095; font-variant-numeric: tabular-nums; margin-top: -2px; }
.ap-controls { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 14px 0 18px; }
.ap-btn {
  position: relative; width: 46px; height: 46px; border-radius: 50%; border: 0; background: transparent;
  color: #d6d6d6; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .15s, color .15s;
}
.ap-btn:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.ap-btn b { position: absolute; font-size: 8.5px; font-weight: 800; top: 50%; left: 50%; transform: translate(-50%, -38%); }
.ap-side.is-off { opacity: .25; pointer-events: none; }
.ap-play {
  position: relative; width: 68px; height: 68px; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e0958c, #c9675d); box-shadow: 0 10px 28px rgba(210,122,112,.35);
  transition: transform .15s, box-shadow .15s;
}
.ap-play:hover { transform: scale(1.05); box-shadow: 0 12px 34px rgba(210,122,112,.45); }
.ap-play:active { transform: scale(.97); }
.ap-i-play { margin-left: 4px; }
.ap-i-pause, .ap.is-playing .ap-i-play { display: none; }
.ap.is-playing .ap-i-pause { display: block; }
.ap-spin { position: absolute; inset: -4px; border-radius: 50%; border: 2px solid transparent; border-top-color: rgba(255,255,255,.8); opacity: 0; }
.ap.is-loading .ap-spin { opacity: 1; animation: apSpin .8s linear infinite; }
@keyframes apSpin { to { transform: rotate(360deg); } }
.ap-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.06); }
.ap-speed { display: inline-flex; gap: 3px; padding: 3px; border-radius: 10px; background: rgba(255,255,255,.04); }
.ap-speed button { border: 0; background: none; color: #a9abaf; font-size: 12.5px; font-weight: 700; padding: 5px 10px; border-radius: 7px; cursor: pointer; }
.ap-speed button:hover { color: #fff; }
.ap-speed button.on { background: var(--primary-soft); color: var(--primary-2); }
.ap-vol { display: inline-flex; align-items: center; gap: 8px; color: #a9abaf; }
.ap-vol input { width: 96px; accent-color: #d27a70; }
.ap-auto { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: #b5b5b5; cursor: pointer; position: relative; }
.ap-switch { position: relative; display: inline-block; width: 34px; height: 20px; border-radius: 20px; background: rgba(255,255,255,.12); transition: background .2s; flex-shrink: 0; }
.ap-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.ap-switch i { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.ap-switch:has(input:checked) { background: var(--primary); }
.ap-switch:has(input:checked) i { transform: translateX(14px); }
audio[data-ap-audio] { display: none; }

/* ---------- Stats ---------- */
.stats-page .page-title { margin-bottom: 4px; }
.st-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.st-card { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.st-card-live { background: radial-gradient(120% 140% at 0% 0%, rgba(91,208,138,.09), transparent 60%), var(--surface); }
.st-label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.st-card strong { font-size: 30px; font-weight: 700; color: #f2f2f2; line-height: 1.25; }
.st-card em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.st-chart { display: flex; align-items: flex-end; gap: 4px; height: 190px; padding-bottom: 22px; }
.st-col { position: relative; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.st-col span { display: block; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #d27a70, rgba(210,122,112,.4)); min-height: 2px; transition: background .15s; }
.st-col:hover span { background: #e0958c; }
.st-col em { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-style: normal; color: var(--muted); white-space: nowrap; }

/* ---------- Age gate ---------- */
body.gated { overflow: hidden; }
.age-gate {
  position: fixed; inset: 0; z-index: 1000; background: rgba(8,8,9,.9);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.age-gate-box { background: var(--surface); color: var(--text); border-radius: 16px; max-width: 420px; width: 100%; padding: 28px 24px; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.age-gate-box h2 { font-size: 20px; }
.age-gate-box p { color: var(--muted); font-size: 14px; }
.age-badge {
  display: inline-flex; align-items: center; justify-content: center; width: 54px; height: 54px;
  border-radius: 50%; border: 3px solid var(--danger); color: var(--danger);
  font-weight: 900; font-size: 17px; margin-bottom: 12px;
}
.age-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.age-leave { color: var(--muted); font-size: 14px; padding: 8px; }
.age-leave:hover { color: var(--text); }

/* ---------- Mobile drawer ---------- */
html.drawer-lock, html.drawer-lock body { overflow: hidden; }
.drawer { position: fixed; inset: 0; z-index: 400; visibility: hidden; transition: visibility 0s linear .3s; }
.drawer.open { visibility: visible; transition-delay: 0s; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; transition: opacity .25s ease; }
.drawer-panel {
  position: absolute; top: 0; bottom: 0; left: 0; width: min(84vw, 330px); display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid rgba(255,255,255,.06);
  box-shadow: 20px 0 50px rgba(0,0,0,.45); transform: translateX(-102%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
}
.drawer.open .drawer-backdrop { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 14px 18px; border-bottom: 1px solid rgba(255,255,255,.05); }
.drawer-head .logo { font-size: 20px; }
.drawer-head .logo-text { display: inline-flex; }
.drawer-x {
  width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03); color: var(--text); cursor: pointer;
}
.drawer-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 10px 10px 16px; }
.drawer-nav { display: flex; flex-direction: column; gap: 2px; }
.drawer-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px; color: var(--text); font-size: 15px; font-weight: 500; }
.drawer-nav a svg { color: var(--muted); flex-shrink: 0; }
.drawer-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.drawer-nav a.is-active { background: var(--primary-soft); color: var(--primary-2); }
.drawer-nav a.is-active svg { color: var(--primary-2); }
.drawer-label { margin: 18px 12px 10px; font-size: 11.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
.drawer-label-top { margin-top: 6px; }
.drawer-nav + .drawer-label { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.05); }
.drawer-genres { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 8px; }
.drawer-genres a { padding: 7px 13px; border-radius: 999px; font-size: 13.5px; color: #d6d6d6; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); }
.drawer-genres a:hover, .drawer-genres a.is-active { color: #fff; background: var(--primary-soft); border-color: rgba(210,122,112,.35); text-decoration: none; }
.drawer-foot { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.05); }
.drawer-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.drawer-btns .btn { height: 42px; }
.drawer-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.drawer-acc { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.drawer-acc a { padding: 8px 10px; border-radius: 9px; background: rgba(255,255,255,.04); color: var(--text); font-size: 13.5px; text-align: center; }
.drawer-acc a:hover { background: var(--surface-2); text-decoration: none; }

/* ---------- Cover placeholder (dự phòng khi dùng bìa) ---------- */
.cover { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.cover-ph {
  display: flex; align-items: flex-end; padding: 10px; position: relative; overflow: hidden;
  background: linear-gradient(160deg, hsl(var(--h, 20), 60%, 45%), hsl(calc(var(--h, 20) + 40), 65%, 25%));
  color: #fff; font-weight: 700; font-size: 14px; line-height: 1.3; text-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.cover-ph::before { content: "📖"; position: absolute; top: 10px; right: 10px; font-size: 22px; opacity: .5; }
.cover-ph span { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .reader-container { padding: 0 14px; }
  .spot-title { font-size: 26px; }
}
@media (max-width: 960px) {
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; padding: 0; border-radius: 10px; color: var(--text);
    border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03); cursor: pointer;
  }
  .main-nav, .main-nav.open { display: none; }
  .layout-2col { grid-template-columns: minmax(0, 1fr); }
  .col-main { min-width: 0; }
  .col-side { position: static; }
  .spotlight { grid-template-columns: 1fr; }
  .spot-side { grid-template-rows: none; grid-template-columns: 1fr 1fr; }
  .home-cols .update-item:nth-child(n+17) { display: none; }
  .ac-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-card-live { grid-column: span 2; }
  .site-header .search-box {
    display: none; position: absolute; left: 0; right: 0; top: var(--header-h);
    max-width: none; margin: 0; padding: 10px 12px; background: var(--surface);
    border-bottom: 1px solid var(--border); box-shadow: 0 12px 24px rgba(0,0,0,.35);
  }
  .site-header.search-open .search-box { display: flex; animation: searchDown .18s ease-out; }
  @keyframes searchDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
  .site-header .search-box input { height: 42px; font-size: 16px; }
  .site-header .search-box button { right: 16px; }
  .site-header .search-box .suggest { left: 12px; right: 12px; top: calc(100% - 4px); }
  .search-toggle {
    display: inline-flex; align-items: center; justify-content: center; margin-left: auto;
    width: 38px; height: 38px; padding: 0; border-radius: 10px; color: var(--text); cursor: pointer;
    border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03);
  }
  .search-toggle .i-close { display: none; }
  .search-open .search-toggle { background: var(--surface-2); color: var(--primary-2); }
  .search-open .search-toggle .i-search { display: none; }
  .search-open .search-toggle .i-close { display: block; }
  .hide-sm { display: none !important; }
  .header-actions .login-btn {
    width: 38px; height: 38px; padding: 0; border-radius: 10px; justify-content: center;
    border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03); color: var(--text);
  }
  .header-actions .login-btn span { display: none; }
  .header-actions { gap: 6px; margin-left: 0; }
  .search-box { margin-left: 0; }
}
@media (max-width: 760px) {
  .st-chart { height: 150px; }
  .comment { gap: 10px; }
}
@media (max-width: 680px) {
  body { font-size: 14px; }
  .header-inner { gap: 6px; }
  .header-inner > .logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
  .logo { font-size: 19px; gap: 0; }
  .spot-side { grid-template-columns: 1fr; gap: 8px; }
  .spot-main { padding: 20px 18px 18px; }
  .spot-title { font-size: 23px; }
  .spot-desc { -webkit-line-clamp: 3; font-size: 14px; }
  .spot-item { padding: 10px 12px; }
  .update-item { grid-template-columns: minmax(0, 1fr) 96px; padding: 10px 12px; }
  .u-genre, .u-time { display: none; }
  .story-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .story-row-side { flex-direction: row; align-items: center; text-align: left; }
  .ch-story { font-size: 23px; }
  .chapter-head { margin-bottom: 22px; }
  .ch-big { padding: 12px 14px; font-size: 14px; }
  .ranked-no { font-size: 17px; }
  .ranked-item { grid-template-columns: 26px minmax(0, 1fr); }
  .profile-head { flex-wrap: wrap; }
  .ap-controls { gap: 10px; }
  .ap-vol { display: none; }
  .box { padding: 16px 14px; }
  .box-flush { padding: 0; }
}
@media (max-width: 640px) {
  .page-title { font-size: 21px; }
  .auth-box { padding: 18px 16px; }
  .pagination a, .pagination span { min-width: 32px; height: 32px; font-size: 13px; }
  .filter-bar .select-sm { flex: 1 1 40%; }
}
@media (max-width: 400px) {
  .ch-pick { max-width: 168px; }
  .ch-bar { gap: 4px; padding: 5px; }
  .st-cards { grid-template-columns: 1fr; }
  .st-card-live { grid-column: auto; }
  .error-code { font-size: 54px; }
}

/* ===== ROUND 2: CSS port nguyên xi từ truyen3x (user/writer/stats/auth) ===== */
.container-md { max-width: 960px; }
.container-xs { max-width: 440px; }
.danger { color: var(--danger) !important; }
.dropdown { position: absolute; top: 100%; left: 0; min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 6px; display: none; z-index: 60; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); color: var(--primary); text-decoration: none; }
.dropdown-genres { display: none; grid-template-columns: repeat(3, 150px); }
.dropdown-right { left: auto; right: 0; }
.has-drop:hover > .dropdown, .has-drop.open > .dropdown { display: block; }
.has-drop:hover > .dropdown-genres, .has-drop.open > .dropdown-genres { display: grid; }
.suggest .suggest-all { justify-content: center; color: var(--primary); font-size: 13px; border-top: 1px solid var(--border); }
.user-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; padding: 4px 6px; border-radius: 999px; }
.user-btn:hover { background: var(--surface-2); }
/* Avatar */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-sm { width: 30px; height: 30px; font-size: 13px; }
.avatar-lg { width: 84px; height: 84px; font-size: 34px; }
.avatar-letter { display: inline-flex; align-items: center; justify-content: center; background: hsl(var(--h), 55%, 45%); color: #fff; font-weight: 700; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--primary); font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.input, .select-sm, .input-sm, textarea, select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); outline: none; max-width: 100%; }
.select-sm, .input-sm { padding: 6px 10px; font-size: 14px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 14px; }
.form label.check, .radio { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; display: flex; margin: 4px 0; }
.form .input { width: 100%; }
/* Alerts, labels */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid; }
.alert-success { background: #052e16; color: #bbf7d0; border-color: #166534; }
.alert-error { background: #450a0a; color: #fecaca; border-color: #991b1b; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head .box-title, .section-head .page-title { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.update-item:last-child { border-bottom: 0; }
.story-row:last-child { border-bottom: 0; }
.side-list li:last-child { border-bottom: 0; }
.rank-list li:last-child { border-bottom: 0; }
.chapter-newest li:last-child { border: 0; }
/* Tabs, filter */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tab:hover { color: var(--primary); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.genre-picker { flex-basis: 100%; }
.genre-picker summary { cursor: pointer; font-size: 14px; color: var(--muted); }
.genre-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px 12px; margin-top: 10px; font-size: 14px; }
.genre-checks label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
/* Table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; background: var(--surface-2); }
.table td.right, .table th.right { text-align: right; }
.comment .avatar { width: 38px; height: 38px; font-size: 15px; }
.replies .avatar { width: 30px; height: 30px; font-size: 12px; }
@media (max-width: 680px) {
  .reader { padding: 22px 0 24px; }
  .reader-container { padding: 0 18px; }
  .ch-story { font-size: 23px; }
  .chapter-head { margin-bottom: 22px; }
  .ch-bar { border-radius: 16px; }
  .chapter-select { max-width: 150px; }
  .ch-big { padding: 12px 14px; font-size: 14px; }
  .hint-keys { display: none; }
}
/* Profile */
.profile-head { display: flex; gap: 18px; align-items: center; margin-bottom: 20px; }
.profile-head .page-title { margin: 0; }
.stat-inline { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--muted); margin-top: 6px; }
.stat-inline strong { color: var(--text); }
.auth-box { margin-top: 20px; }
@media (max-width: 680px) {
  body { font-size: 14px; }
  .hide-sm { display: none !important; }
  .search-box { max-width: none; }
  .card-grid, .card-grid-hot { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .update-item { grid-template-columns: minmax(0, 1fr) auto; }
  .story-info { text-align: center; }
  .info-list { text-align: left; }
  .story-actions, .rate-box { justify-content: center; }
  .story-row { grid-template-columns: 1fr; gap: 6px; }
  .story-row-side { flex-direction: row; align-items: center; justify-content: space-between; }
  .chapter-list { grid-template-columns: 1fr; }
  .grid-2, .footer-inner { grid-template-columns: 1fr; }
  .box { padding: 14px; }
  .page-title { font-size: 20px; }
  .header-inner { gap: 6px; }
}
.mini-item:last-child { border-bottom: 0; }
.st-bar { width: 4px; height: 20px; border-radius: 4px; background: linear-gradient(180deg, #e0958c, #bd6a61); flex-shrink: 0; }
.drawer-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.drawer-acc { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.drawer-acc a { padding: 8px 10px; border-radius: 9px; background: rgba(255,255,255,.04); color: var(--text); font-size: 13.5px; text-align: center; }
.drawer-acc a:hover { background: var(--surface-2); text-decoration: none; }
.tile-top .label:first-child { margin-left: 0; }
.st-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.st-head .page-title { margin-bottom: 2px; }
.st-range { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.st-range a { padding: 6px 12px; border-radius: 8px; color: #b8b8b8; font-size: 13.5px; font-weight: 600; }
.st-range a:hover { color: #fff; text-decoration: none; }
.st-range a.on { background: var(--primary-soft); color: var(--primary-2); }
.st-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.st-card { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.st-card-live { background: radial-gradient(120% 140% at 0% 0%, rgba(91,208,138,.09), transparent 60%), var(--surface); }
.st-label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.st-card strong { font-size: 30px; font-weight: 700; color: #f2f2f2; line-height: 1.25; }
.st-card em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.st-chart { display: flex; align-items: flex-end; gap: 4px; height: 190px; padding-bottom: 22px; }
.st-col { position: relative; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.st-col span { display: block; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #d27a70, rgba(210,122,112,.4)); min-height: 2px; transition: background .15s; }
.st-col:hover span { background: #e0958c; }
.st-col em { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-style: normal; color: var(--muted); white-space: nowrap; }
.st-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.st-grid .box { margin: 0; min-width: 0; }
.st-map-box { margin-bottom: 16px; }
.st-map-wrap { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 24px; align-items: center; }
.st-map-cell { position: relative; height: 320px; overflow: hidden; border-radius: 12px; background: #161719; }
.st-map { position: absolute; inset: 0; }
.st-sub { margin-top: 18px; }
.st-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.st-bars li { position: relative; }
.st-bar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; margin-bottom: 5px; }
.st-bar-top span { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #dadada; }
.st-bar-top b { white-space: nowrap; color: #f0f0f0; font-weight: 600; }
.st-bar-top em { font-style: normal; color: var(--muted); font-weight: 400; margin-left: 4px; }
.st-bars i { display: block; height: 6px; border-radius: 6px; background: linear-gradient(90deg, #d27a70, #cfa25a); opacity: .85; }
.st-empty { padding: 8px 0; }
@media (max-width: 1100px) { .st-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .st-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-card-live { grid-column: span 2; }
  .st-grid { grid-template-columns: minmax(0, 1fr); }
  .st-map-wrap { grid-template-columns: minmax(0, 1fr); }
  .st-map-cell { height: 220px; }
  .st-card strong { font-size: 24px; }
  .online-counter { justify-content: center; }
}
.dropdown .ic, .tab .ic { width: 16px; height: 16px; margin-right: 8px; vertical-align: -3px; }
.wr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.wr-head .page-title { margin: 0 0 4px; }
.wr-head p { margin: 0; max-width: 560px; }
.wr-head .btn svg, .wr-actions .btn svg { width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; }
.wr-empty { text-align: center; padding: 32px 12px; color: var(--muted); }
.wr-empty .btn { margin-top: 8px; }
.wr-list { display: flex; flex-direction: column; gap: 10px; }
.wr-item { display: flex; gap: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; color: inherit; min-width: 0; }
.wr-item:hover { border-color: var(--primary); }
.wr-item-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wr-item-title { font-size: 16px; overflow-wrap: anywhere; }
.wr-item-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 13px; color: var(--muted); }
.wr-item-meta svg { width: 14px; height: 14px; margin-right: 3px; vertical-align: -2px; }
.wr-cover { width: 64px; height: 90px; flex: none; border-radius: 8px; object-fit: cover; }
.wr-cover-lg { width: 120px; height: 170px; flex: none; border-radius: 10px; object-fit: cover; }
.wr-st { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.wr-st-draft { background: rgba(255,255,255,.08); color: #b8bcc2; }
.wr-st-pending { background: rgba(251,191,36,.14); color: #e2b65a; }
.wr-st-approved { background: rgba(34,197,94,.14); color: #8cc5a0; }
.wr-st-rejected { background: rgba(239,68,68,.15); color: #f19a9a; }
.wr-note { font-size: 13px; color: #f19a9a; background: rgba(239,68,68,.08); border-left: 3px solid #b91c1c; padding: 6px 10px; border-radius: 6px; }
.wr-help { font-size: 14px; color: var(--muted); background: var(--surface-2, rgba(255,255,255,.04)); padding: 10px 12px; border-radius: 8px; margin: 10px 0; }
.wr-crumb { font-size: 13px; color: var(--muted); margin: 0 0 8px; overflow-wrap: anywhere; }
.wr-story { display: flex; gap: 18px; margin-bottom: 20px; min-width: 0; }
.wr-story-body { min-width: 0; flex: 1; }
.wr-story-body .page-title { margin: 0 0 8px; overflow-wrap: anywhere; }
.wr-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.wr-inline { display: inline-flex; margin: 0; }
.wr-danger { color: var(--danger) !important; }
.wr-chapters { display: flex; flex-direction: column; margin-bottom: 20px; }
.wr-ch { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.wr-ch-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.wr-ch-main a { color: inherit; }
.wr-ch-act { display: flex; gap: 4px; flex: none; }
.wr-ch-act form { margin: 0; }
.wr-ch-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; }
.wr-content { min-height: 420px; font-size: 15px; line-height: 1.7; }
.wr-count.wr-low { color: #e2b65a; }
.wr-cover-now { display: flex; align-items: center; gap: 12px; }
.wr-form .genre-checks label { font-weight: 400; }
.wr-steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.wr-step { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px; }
.wr-step.on { color: var(--primary-2); background: var(--primary-soft); border-color: rgba(210,122,112,.35); }
.wr-sec { font-size: 17px; margin: 22px 0 10px; padding-top: 16px; border-top: 1px solid var(--border); }
.wr-form .wr-sec:first-of-type { margin-top: 4px; padding-top: 0; border-top: 0; }
/* R23: form tao truyen gon lai */
.wr-steps-sm { flex-wrap: nowrap; overflow-x: auto; margin-bottom: 10px; scrollbar-width: none; }
.wr-steps-sm::-webkit-scrollbar { display: none; }
.wr-steps-sm { gap: 6px; }
.wr-steps-sm .wr-step { white-space: nowrap; font-size: 12px; padding: 5px 9px; }
.wr-form.wr-create { gap: 10px; }
.wr-create .wr-sec { margin: 12px 0 0; padding-top: 12px; font-size: 16px; }
.wr-form .wr-keep2 { grid-template-columns: 1fr 1fr; gap: 12px; }
.wr-create .genre-checks { gap: 2px 10px; margin-top: 6px; font-size: 13.5px; }
.wr-create .wr-content-sm { min-height: 200px; }
.wr-actions-sticky { position: sticky; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--border); padding: 10px 0 4px; margin-top: 4px; }
@media (max-width: 680px) { .wr-create .wr-content-sm { min-height: 200px; } }
@media (max-width: 640px) {
  .wr-story { flex-direction: column; }
  .wr-cover-lg { width: 96px; height: 136px; }
  .wr-ch { flex-wrap: wrap; }
  .wr-ch-main { flex-basis: 100%; }
  .wr-ch-row { grid-template-columns: 1fr; }
  .wr-content { min-height: 320px; }
}
/* ===== ROUND 2: icon .ic + emoticon + drawer hidden (bổ sung theo demo) ===== */
.ic { width: 14px; height: 14px; flex-shrink: 0; display: inline-block; vertical-align: -2px; margin-right: 4px; opacity: .75; }
.ic-star { fill: #cfa25a; stroke: #cfa25a; opacity: .95; }
.ic-heart { stroke: #e0958c; opacity: .95; }
.story-row-meta span, .tile-meta span, .spot-meta span { display: inline-flex; align-items: center; gap: 1px; }
.box-title .ic { width: 18px; height: 18px; margin-right: 6px; vertical-align: -3px; color: var(--primary-2); opacity: 1; }
.u-pin .ic { width: 14px; height: 14px; opacity: 1; }
.emoji-img { width: 20px; height: 20px; vertical-align: -4px; display: inline-block; object-fit: contain; aspect-ratio: 1 / 1; } /* cssfix1: chong meo emoji (chat + comment) */
.drawer[hidden] { display: none !important; }
.section-head .select-sm { margin-left: auto; }
/* Trang chủ: tiêu đề + ô lọc thể loại luôn CÙNG 1 hàng (trái/phải thẳng hàng, không so le) */
#moi-cap-nhat .section-head { flex-wrap: nowrap; }
#moi-cap-nhat .section-title { white-space: nowrap; }
#moi-cap-nhat .section-head .select-sm { min-width: 0; max-width: 54%; flex: 0 1 auto; }
.label { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; vertical-align: middle; text-transform: uppercase; letter-spacing: .3px; }
.label-full { background: rgba(34,197,94,.14); color: #8cc5a0; }
.label-hot { background: rgba(210,122,112,.16); color: #e0958c; }
.label-new { background: rgba(251,191,36,.14); color: #cfa25a; }
.label-audio { background: rgba(207,162,90,.15); color: #dcbc84; }
.label + .label { margin-left: 5px; }

/* ===== ROUND 4: toast thông báo, huy hiệu chức vụ, emoji picker, phòng chat ===== */
.tx-toasts { position: fixed; top: calc(var(--header-h, 57px) + 10px); left: 50%; transform: translateX(-50%); width: min(450px, calc(100vw - 24px)); z-index: 400; display: flex; flex-direction: column; gap: 8px; }
.tx-toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; background: #1d1e22; border: 1px solid var(--border); border-left: 4px solid var(--muted); box-shadow: 0 12px 32px rgba(0, 0, 0, .5); font-size: 14.5px; font-weight: 500; animation: txToastIn .28s ease both; }
.tx-toast-ic { flex: none; margin-top: 1px; display: inline-flex; }
.tx-toast.is-success { border-left-color: #4ade80; }
.tx-toast.is-success .tx-toast-ic { color: #4ade80; }
.tx-toast.is-error { border-left-color: #f87171; }
.tx-toast.is-error .tx-toast-ic { color: #f87171; }
.tx-toast.is-warning { border-left-color: #fbbf24; }
.tx-toast.is-warning .tx-toast-ic { color: #fbbf24; }
.tx-toast.is-info { border-left-color: var(--primary); }
.tx-toast.is-info .tx-toast-ic { color: var(--primary); }
.tx-toast-msg { flex: 1; min-width: 0; }
.tx-toast-x { flex: none; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 3px; border-radius: 6px; display: inline-flex; }
.tx-toast-x:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.tx-toast.hide { opacity: 0; transform: translateY(-6px); transition: opacity .3s ease, transform .3s ease; }
@keyframes txToastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.alert { border-left-width: 4px; font-weight: 500; }
.alert-success { border-left-color: #4ade80; }
.alert-error { border-left-color: #f87171; }
.alert-info { background: #17202b; color: #bfdbfe; border-color: #1d4ed8; border-left-color: #60a5fa; }

.role-badge { display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid; margin-left: 7px; vertical-align: 2px; white-space: nowrap; }
.role-admin { color: #f0a196; border-color: rgba(210, 122, 112, .55); background: rgba(210, 122, 112, .16); }
.role-smod { color: #e3c07f; border-color: rgba(207, 162, 90, .5); background: rgba(207, 162, 90, .14); }
.role-mod { color: #93c5fd; border-color: rgba(96, 165, 250, .45); background: rgba(96, 165, 250, .13); }

.emoji-picker { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; margin: 8px 0 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.emoji-picker-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; border-radius: 8px; cursor: pointer; padding: 0; }
.emoji-picker-btn:hover { background: rgba(255, 255, 255, .08); }
.emoji-picker-btn img { width: 22px; height: 22px; }

.perm-note { display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px; margin: 14px 0; border: 1px solid rgba(207, 162, 90, .4); background: rgba(207, 162, 90, .09); border-radius: 10px; font-size: 14.5px; line-height: 1.55; }
.perm-note svg { flex: none; color: #e3c07f; margin-top: 2px; }

.avatar-chat { width: 34px; height: 34px; font-size: 15px; flex: none; }
.chat-messages { display: flex; flex-direction: column; gap: 12px; max-height: 480px; overflow-y: auto; padding: 10px 4px; margin: 10px 0 4px; }
.chat-empty { color: var(--muted); text-align: center; padding: 22px 0; }
.chat-msg { display: flex; gap: 9px; max-width: 94%; }
.chat-msg.is-mine { align-self: flex-end; flex-direction: row-reverse; }
.chat-bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; border-top-left-radius: 4px; padding: 8px 12px 9px; min-width: 0; }
.chat-msg.is-mine .chat-bubble { background: rgba(210, 122, 112, .13); border-top-left-radius: 14px; border-top-right-radius: 4px; }
.chat-meta { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; margin-bottom: 2px; }
.chat-name { font-size: 13px; }
.chat-meta time { font-size: 11px; color: var(--muted); } /* ROUND 19: bỏ margin-left:auto — time về cụm trái cạnh tên/huy hiệu như comment truyện, không kéo xa nữa */
.chat-meta time::before { content: '· '; }
.chat-meta .role-badge { margin-left: 0; }
.chat-text { font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.chat-form { margin-top: 8px; }
.chat-as { font-size: 13.5px; color: var(--muted); margin: 6px 0 0; }
.chat-guest-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.chat-guest-row .input[name="name"] { flex: 1 1 180px; }
.chat-captcha { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); flex: 1 1 220px; }
.chat-captcha .input { width: 84px; flex: none; }
.chat-send-row { display: flex; gap: 8px; margin-top: 8px; }
.chat-send-row .input { flex: 1; min-width: 0; }
.chat-form-error { color: #f87171; font-size: 13.5px; margin: 8px 0 0; }
@media (max-width: 680px) {
  .chat-messages { max-height: 52vh; }
  .chat-msg { max-width: 97%; }
}

/* ===== ROUND 4B: nút đóng modal tròn rõ ràng + đệm safe-area cho modal chương ===== */
.icon-btn.modal-x {
  flex: none; width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 50%;
}
.icon-btn.modal-x:hover { background: var(--border); }
.chap-head { align-items: center; padding: 16px 16px 12px 20px; }
.chap-head::before { display: none; }
.chap-modal {
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
  padding-top: max(14px, env(safe-area-inset-top));
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

/* ===== ROUND 5: modal chương nổi hẳn khỏi mép (dvh) + tab thống kê active rõ + chat gọn kiểu messaging ===== */
.chap-modal {
  height: 100dvh; bottom: auto;
  padding-top: max(30px, env(safe-area-inset-top));
  padding-bottom: max(30px, env(safe-area-inset-bottom));
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
}
.chap-box { max-height: min(700px, 100%); }
.st-range a.on { background: var(--primary); color: #fff; }
.st-range a.on:hover { color: #fff; }

.chat-box { padding: 16px 16px 14px; }
.chat-head { display: flex; gap: 11px; align-items: center; }
.chat-ic { flex: none; width: 38px; height: 38px; border-radius: 11px; background: var(--primary-soft); color: var(--primary-2); display: inline-flex; align-items: center; justify-content: center; }
.chat-head-text h1 { font-size: 18px; margin: 0; line-height: 1.25; }
.chat-head-text p { margin: 2px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.chat-messages { gap: 9px; max-height: 460px; padding: 12px 2px 4px; margin: 8px 0 2px; }
.chat-msg { gap: 7px; max-width: 92%; }
.chat-msg .avatar-chat { width: 30px; height: 30px; font-size: 12.5px; }
.chat-bubble { padding: 6px 11px 7px; border-radius: 15px; border-top-left-radius: 5px; }
.chat-msg.is-mine .chat-bubble { border-top-right-radius: 5px; }
.chat-name { font-size: 12.5px; }
.chat-meta { margin-bottom: 1px; }
.chat-meta time { font-size: 10.5px; }
.chat-text { font-size: 14px; line-height: 1.45; }
/* ROUND 15: reply (quote) trong phòng chat */
.chat-quote { background: rgba(255,255,255,.05); border-left: 3px solid var(--primary); border-radius: 8px; padding: 5px 9px 6px; margin-bottom: 5px; font-size: 12.5px; line-height: 1.4; cursor: pointer; }
.chat-quote b { display: block; color: var(--primary-2); font-size: 12px; }
.chat-quote span { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chat-quote-gone { color: var(--muted); font-style: italic; cursor: default; }
.chat-reply-btn { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; background: var(--primary-soft); color: var(--primary-2); border: 1px solid rgba(210, 122, 112, .35); border-radius: 999px; font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; padding: 2px 9px; flex: none; } /* ROUND 19: pill hồng + icon cho dễ nhận diện, hết lẫn với time */
.chat-reply-btn:hover { background: rgba(210, 122, 112, .28); color: #fff; }
.chat-msg.flash .chat-bubble { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.chat-replybar { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 10px; padding: 7px 8px 7px 11px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.chat-replybar[hidden] { display: none; }
.chat-replybar-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-replybar-text b { color: var(--primary-2); }
.chat-replybar-x { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; padding: 0; }
.chat-text .emoji-img { width: 19px; height: 19px; }
.chat-form { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.chat-guest-row { margin-top: 0; gap: 8px; }
.chat-guest-row .input, .chat-captcha .input { height: 40px; }
.chat-as { margin: 0; }
.chat-composer { position: relative; display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.chat-composer .input { flex: 1; min-width: 0; height: 42px; border-radius: 999px; padding: 0 16px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); outline: none; }
.chat-composer .input:focus { border-color: var(--primary); }
.chat-emoji-btn { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.chat-emoji-btn:hover, .chat-emoji-btn.is-open { color: var(--primary-2); border-color: var(--primary); }
.chat-send { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.chat-send svg { transform: translate(-2px, 2px); } /* ROUND 16: icon máy bay giấy lệch quang học +3px phải/-2px lên (đo centroid pixel trên rig) — dịch ngược lại cho cân tâm nút */
.chat-send:hover { background: var(--primary-2); }
.chat-send:disabled { opacity: .55; cursor: default; }
.chat-emoji-pop { position: absolute; left: 0; bottom: 52px; z-index: 6; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 8px; box-shadow: 0 16px 44px rgba(0,0,0,.5); }
.chat-emoji-pop .emoji-picker { margin: 0; border: 0; background: transparent; padding: 0; max-width: 264px; }
@media (max-width: 680px) {
  .chat-box { padding: 13px 12px 12px; }
  .chat-messages { max-height: 50vh; }
}

/* ===== ROUND 6: thẻ đánh giá sao (điểm to + sao tô theo điểm TB + lượt rõ ràng) ===== */
.rate-box { display: block; }
.rate-card {
  display: flex; align-items: center; gap: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 18px; max-width: 560px; margin: 0 auto;
}
.rate-sum { display: flex; align-items: center; gap: 12px; flex: none; }
.rate-score { font-size: 34px; font-weight: 800; line-height: 1; color: #fff; white-space: nowrap; }
.rate-score small { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.rate-sum-side { display: flex; flex-direction: column; gap: 3px; }
.rate-stars-view { position: relative; display: inline-block; font-size: 16px; letter-spacing: 2px; line-height: 1.2; }
.rate-stars-bg { color: #3a3c40; }
.rate-stars-fill { position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap; color: #cfa25a; }
.rate-count { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.rate-act { margin-left: auto; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 0; }
.rate-ask { font-size: 13.5px; color: var(--muted); }
.chapter-rate .stars-row { display: inline-flex; }
.chapter-rate .star-btn { font-size: 27px; padding: 0 3px; }
.rate-note { font-size: 13px; color: var(--primary-2); min-height: 18px; }
.rate-note:empty { display: none; }
@media (max-width: 680px) {
  .rate-card { flex-direction: column; gap: 10px; text-align: center; padding: 14px; }
  .rate-act { margin-left: 0; align-items: center; text-align: center; }
}

/* ===== ROUND 7: bình luận kiểu messaging (bong bóng + composer như phòng chat) ===== */
.cmt-composer { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 18px; }
.cmt-composer .avatar { width: 36px; height: 36px; font-size: 14px; flex: none; margin-top: 2px; }
.cmt-inputwrap { position: relative; flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px 8px; }
.cmt-inputwrap textarea { width: 100%; background: transparent; border: 0; padding: 2px 2px 6px; margin: 0; resize: vertical; min-height: 42px; color: var(--text); font: inherit; }
.cmt-inputwrap textarea:focus { outline: none; }
.cmt-bar { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.cmt-bar .btn { margin-left: auto; flex: none; }
.cmt-as { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmt-emoji-anchor { position: static; display: inline-flex; flex: none; }
.cmt-emoji-pop { left: 0; bottom: 52px; width: 264px; max-width: 100%; } /* ROUND 13: neo pop vào .cmt-inputwrap (full bề ngang form) thay vì span neo nhỏ — form trả lời lồng sâu bị đẩy sang phải làm pop 264px tràn mép màn hình 360px; max-width:100% theo bề ngang form nên không bao giờ lòi ra ngoài */ /* ROUND 8: neo .cmt-emoji-anchor rất hẹp → pop position:absolute bị shrink-to-fit co về 52px, icon xếp 1 cột dọc; phải cho width cố định như pop phòng chat */
.chat-emoji-btn.is-open { color: var(--primary-2); background: var(--primary-soft); }
.comment { border-top: 0; padding: 9px 0 3px; gap: 10px; }
.comment .avatar { width: 36px; height: 36px; font-size: 14px; flex: none; }
.comment-body { display: flex; flex-direction: column; align-items: flex-start; }
.cmt-bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; padding: 7px 11px 8px; max-width: 100%; }
.comment-head { font-size: 13px; }
.comment-head b { color: #fff; font-size: 13.5px; }
.comment-head { flex-wrap: nowrap; gap: 3px; } /* ROUND 15: time bị wrap xuống hàng 2 trên mobile — ép head 1 hàng: tên dài thì cắt …, time/huy hiệu/chip không co */
.comment-head b { flex: 0 0 auto; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* ROUND 17.2: tên KHÔNG co (flex-shrink 0, trần 46% cho tên dài) — phần thiếu dồn hết sang chip */
.comment-head .role-badge, .comment-head .label-admin, .comment-head .cmt-where { flex: none; }
.comment-head time { font-size: 11.5px; } /* ROUND 15b: meta gọn lại để cả hàng vừa bề ngang mobile */
.comment-head .cmt-where { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; } /* ROUND 17: chip là van co cuối cùng khi head chật, tên không bao giờ bị bóp về 0 */
/* ROUND 17.1: time KHÔNG có dấu · phía trước (chip đã có) — dành 8px cho tên, ca chật nhất tên phải hiện đủ */
.comment-head .label-admin { text-transform: none; letter-spacing: 0; }
.comment-head b { font-size: 13px; }
.comment-head .label, .comment-head .role-badge { font-size: 8.5px; padding: 1px 5px; letter-spacing: .1px; margin-left: 0; } /* ROUND 18: bỏ margin-left 7px của rule gốc — tên <-> huy hiệu chỉ còn gap 3px cho sát */
.comment-head time { margin-left: auto; padding-left: 12px; white-space: nowrap; flex: none; }
.cmt-where { font-size: 12.5px; color: var(--muted); white-space: nowrap; } /* ROUND 17: bỏ pill — demo để chương là chữ muted thường sau dấu · cho gọn head */
.comment-text { margin: 2px 0 0; font-size: 14.5px; line-height: 1.5; }
.comment-actions { margin: 3px 0 0 13px; gap: 16px; }
.cmt-act { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.cmt-act:hover { color: var(--primary-2); text-decoration: none; }
.comment-body > .replies, .comment-body > .reply-box { align-self: stretch; width: 100%; }
.replies { margin: 8px 0 0 6px; border-left: 2px solid var(--border); padding-left: 12px; }
.replies .comment { border-top: 0; padding: 6px 0 2px; }
.replies .comment .avatar { width: 30px; height: 30px; font-size: 12px; }
.reply-box { margin-top: 8px; }
.cmt-login-note { background: var(--surface); }

/* ===== ROUND 11: hoàn khung box Truyện sex mới như cũ (hủy R9) + head sát mép như thẻ top ===== */
/* Bẫy: block @media 680px đặt .box{padding:14px} SAU rule .box-flush{padding:0} nên trên mobile
   box-flush bị ăn padding 14px, head bị đẩy vào giữa (14 + 18 = 32px). Ép flush về 0. */
@media (max-width: 680px) {
  .box-flush { padding: 0; }
}
/* Khoảng cách mép của head = đúng thẻ spotlight (.spot-item: 16px desktop / 12px mobile) */
#moi-cap-nhat .box-head { padding-left: 16px; padding-right: 16px; }
@media (max-width: 680px) {
  #moi-cap-nhat .box-head { padding-left: 12px; padding-right: 12px; }
}

/* ROUND 19: thiết bị cảm ứng không có hover-out — tắt mở-dropdown-bằng-hover
   để menu user đóng/mở thuần bằng class .open do JS toggle (trước đây bấm
   avatar lần 2 menu không đóng vì :hover dính). */
@media (hover: none) {
  .has-drop:hover > .dropdown { display: none; }
  .has-drop:hover > .dropdown-genres { display: none; }
  .has-drop.open > .dropdown { display: block; }
  .has-drop.open > .dropdown-genres { display: grid; }
}

/* ===== R20: Select tự thiết kế (thay dropdown native) ===== */
.cs-native { display: none !important; }
.cs-wrap { position: relative; display: inline-block; max-width: 100%; }
.cs-btn { display: inline-flex; align-items: center; gap: 8px; width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 13.5px; line-height: 1.35; cursor: pointer; text-align: left; }
.cs-btn:hover { border-color: rgba(255,255,255,.16); }
.cs-btn.open { border-color: var(--primary); }
.cs-btn .cs-label { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-btn .cs-chev { flex: 0 0 auto; color: var(--muted); transition: transform .18s; }
.cs-btn.open .cs-chev { transform: rotate(180deg); }
.section-head .cs-wrap { margin-left: auto; }
#moi-cap-nhat .section-head .cs-wrap { min-width: 0; max-width: 54%; flex: 0 1 auto; }
.filter-bar .cs-wrap { min-width: 0; }
.setting-row .cs-wrap { flex: 0 0 auto; min-width: 176px; max-width: 62%; }
.grid-2 .cs-wrap { display: block; }
.cs-list { position: fixed; z-index: 260; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 16px 44px rgba(0,0,0,.5); padding: 5px; overflow-y: auto; max-height: 45vh; }
.cs-list[hidden] { display: none; }
.cs-opt { padding: 9px 10px; border-radius: 7px; font-size: 14px; color: var(--text); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-opt:hover { background: var(--surface-2); }
.cs-opt.on { background: var(--primary-soft); color: var(--primary-2); font-weight: 700; }
@media (max-width: 680px) {
  .filter-bar .cs-wrap { flex: 1 1 40%; min-width: 0; }
  .setting-row .cs-wrap { min-width: 158px; }
}

/* ===== R20: Hộp xác nhận tự thiết kế (thay confirm() native) ===== */
.btn-danger-solid { background: var(--danger); border: 1px solid var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; text-decoration: none; }
.txcf-box { max-width: 350px; }
.txcf-msg { margin: 2px 0 18px; font-size: 15px; line-height: 1.5; }
.txcf-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* R20b: list chọn font — mỗi mục hiện bằng chính font của nó, chữ to cho dễ phân biệt */
.cs-list.cs-fonts .cs-opt { font-size: 17px; padding-top: 10px; padding-bottom: 10px; }

/* Chuyên mục (phân loại): Truyện Sex Ngắn / Dài Tập — nổi bật hơn chip thể loại */
.drawer-genres a.is-type, .story-row-genres a.is-type, .ch-genres a.is-type {
  color: var(--primary-2); background: var(--primary-soft); border-color: rgba(210,122,112,.4); font-weight: 600;
}
.dropdown a.is-type { color: var(--primary-2); font-weight: 600; }
.dropdown .dd-sep { height: 1px; margin: 6px 8px; background: rgba(255,255,255,.08); grid-column: 1 / -1; }
.cat-list a.is-type span { color: var(--primary-2); font-weight: 600; }

/* =========================================================
   HEADER DESKTOP (>= 961px) — logo | nav | ô tìm kiếm rộng | tài khoản.
   Không đụng tới mobile (<= 960px dùng drawer + search-toggle như cũ).
   ========================================================= */
@media (min-width: 961px) {
  .site-header .container { max-width: 1340px; padding: 0 20px; }
  .site-header { background: rgba(22,23,25,.94); box-shadow: 0 6px 22px rgba(0,0,0,.25); }
  .site-header .header-inner { gap: 22px; }
  .site-header .logo { font-size: 23px; margin-right: 2px; flex: 0 0 auto; }
  .site-header .main-nav { gap: 4px; flex: 0 1 auto; }
  .site-header .nav-link {
    position: relative; padding: 9px 13px; font-size: 14.5px; font-weight: 600; letter-spacing: .1px;
    color: #cfd0d3; border-radius: 9px; transition: background .15s, color .15s;
  }
  .site-header .nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
  .site-header .nav-link.is-active { color: var(--primary-2); background: var(--primary-soft); }
  .site-header .has-drop:hover > .nav-link, .site-header .has-drop.open > .nav-link { background: rgba(255,255,255,.05); color: #fff; }
  .site-header .dropdown-genres { top: calc(100% + 4px); grid-template-columns: repeat(3, 170px); gap: 2px; padding: 8px; }
  .site-header .dropdown-genres::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }

  /* Ô tìm kiếm rộng, nổi bật */
  .site-header .search-box { flex: 1 1 320px; max-width: 420px; min-width: 240px; margin-left: auto; }
  .site-header .search-box input {
    height: 42px; padding: 0 48px 0 20px; font-size: 14.5px; font-family: inherit;
    background: #26272b; border: 1px solid rgba(255,255,255,.09); border-radius: 999px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.25); transition: border-color .15s, background .15s, box-shadow .15s;
  }
  .site-header .search-box input::placeholder { color: #8d9095; }
  .site-header .search-box input:hover { border-color: rgba(255,255,255,.16); }
  .site-header .search-box input:focus { background: #1d1e21; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(210,122,112,.18); }
  .site-header .search-box button {
    right: 5px; width: 32px; height: 32px; padding: 0; border-radius: 50%;
    color: var(--primary-2); background: var(--primary-soft);
  }
  .site-header .search-box button:hover { background: var(--primary); color: #fff; }
  .site-header .search-box button svg { width: 16px; height: 16px; }
  .site-header .search-box .suggest { top: calc(100% + 8px); border-radius: 14px; box-shadow: 0 14px 38px rgba(0,0,0,.45); }

  .site-header .header-actions { gap: 10px; flex: 0 0 auto; }
  .site-header .header-actions .btn-sm { height: 38px; padding: 0 16px; border-radius: 999px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
  .site-header .user-btn { padding: 4px 10px 4px 4px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03); }
  .site-header .user-btn:hover { background: rgba(255,255,255,.07); }
  .site-header .user-menu .dropdown-right { top: calc(100% + 6px); min-width: 200px; }
}

/* v6.2: mọi màn desktop ≥961px (trước đây <1500px): 2 hàng — hàng 1: logo + tìm kiếm + tài khoản, hàng 2: menu điều hướng */
@media (min-width: 961px) {
  :root { --header-h: 104px; }
  .site-header .header-inner { flex-wrap: wrap; height: auto; padding: 8px 0 0; row-gap: 4px; }
  .site-header .logo { order: 1; }
  .site-header .search-box { order: 2; flex: 1 1 300px; max-width: 460px; min-width: 280px; margin: 0 auto; }
  .site-header .header-actions { order: 3; margin-left: 0; }
  .site-header .main-nav { order: 4; flex: 0 0 100%; justify-content: center; border-top: 1px solid rgba(255,255,255,.05); padding: 4px 0 6px; }
}
@media (min-width: 1500px) {
  .site-header .container { max-width: 1480px; }
  .site-header .main-nav { margin-left: 4px; }
  .site-header .search-box { flex: 1 1 420px; }
}

/* =====================================================================
   TRANG NGHE AUDIO (.xp) — hero, trình phát tuỳ biến, danh sách phần, mini-player
   Hiệu ứng chờ: vòng xoay trên nút Phát, shimmer thanh tua + bìa, equalizer khi phát,
   chuyển trạng thái mượt. prefers-reduced-motion: tắt chuyển động, giữ chỉ báo tĩnh.
   ===================================================================== */
.xp { max-width: 980px; margin: 0 auto; padding: 14px 10px 28px; }
.xp-ic { flex: none; }
.xp-hero { position: relative; overflow: hidden; border-radius: 18px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 14px; isolation: isolate; }
.xp-hero-bg { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(34px) saturate(1.3) brightness(.45); transform: scale(1.1); z-index: -1; opacity: .85; }
.xp-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(19,20,21,.25), rgba(19,20,21,.82)); }
.xp-hero-in { display: flex; gap: 22px; align-items: flex-end; padding: 26px 24px; }
.xp-cover { position: relative; flex: none; width: 210px; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: linear-gradient(145deg, #3a2a2c, #1d1c22 60%, #2b2a1f); box-shadow: 0 18px 40px rgba(0,0,0,.5); transition: transform .4s, box-shadow .4s; }
.xp-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.xp-cover-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.28); z-index: 0; }
.xp-cover img + .xp-cover-ph { display: none; }
.xp-cover.is-active { transform: scale(1.02); box-shadow: 0 22px 50px rgba(210,122,112,.28), 0 18px 40px rgba(0,0,0,.5); }
.xp-meta { flex: 1; min-width: 0; }
.xp-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.xp-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #eee; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(6px); }
a.xp-badge:hover { background: rgba(255,255,255,.18); text-decoration: none; color: #fff; }
.xp-badge.is-audio { background: var(--primary-soft); border-color: rgba(210,122,112,.45); color: var(--primary-2); }
.xp-title { margin: 0 0 8px; font-size: clamp(22px, 3.4vw, 34px); line-height: 1.22; font-weight: 800; color: #fff; text-shadow: 0 2px 14px rgba(0,0,0,.5); }
.xp-author { margin: 0 0 8px; font-size: 14.5px; color: #d6d6d6; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.xp-author a { color: var(--accent); font-weight: 700; }
.xp-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; margin: 0 0 12px; padding: 0; font-size: 13.5px; color: #cfcfcf; }
.xp-stats li { display: inline-flex; align-items: center; gap: 5px; }
.xp-stats .ic { width: 15px; height: 15px; }
.xp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.xp-hero-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.xp-cta { padding: 11px 24px; font-size: 15.5px; border-radius: 999px; box-shadow: 0 8px 22px rgba(210,122,112,.35); }
.xp-cta svg { width: 18px; height: 18px; }

/* ----- trình phát ----- */
.xp-player { position: relative; padding: 18px 18px 16px; margin-bottom: 14px; border-radius: 18px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--border); box-shadow: var(--shadow); }
.xp-now { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.xp-now-t { min-width: 0; }
.xp-now-t b { display: block; font-size: 18px; font-weight: 800; color: #fff; overflow-wrap: anywhere; }
.xp-now-t span { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xp-status { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--muted); background: rgba(255,255,255,.05); border: 1px solid var(--border); transition: color .25s, background .25s, border-color .25s; max-width: 55%; }
.xp-status span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xp-status.is-in span { animation: xp-fade .35s ease; }
.xp-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.xp-status[data-st=playing] { color: #7ee2a0; background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.3); }
.xp-status[data-st=playing] .xp-dot { animation: xp-pulse 1.4s ease-out infinite; }
.xp-status[data-st=loading], .xp-status[data-st=buffering], .xp-status[data-st=switching] { color: var(--primary-2); background: var(--primary-soft); border-color: rgba(210,122,112,.35); }
.xp-status[data-st=loading] .xp-dot, .xp-status[data-st=buffering] .xp-dot, .xp-status[data-st=switching] .xp-dot { animation: xp-blink .9s ease-in-out infinite; }
.xp-status[data-st=switching] { color: var(--accent); background: rgba(207,162,90,.12); border-color: rgba(207,162,90,.4); }
.xp-status[data-st=error] { color: #fca5a5; background: rgba(220,38,38,.12); border-color: rgba(220,38,38,.4); }
.xp-yt { position: relative; margin: 0 auto 14px; max-width: 560px; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #000; border: 1px solid var(--border); }
.xp-yt iframe, .xp-yt #xp-yt-host { position: absolute; inset: 0; width: 100%; height: 100%; }
.xp-frame { margin-bottom: 14px; }

/* thanh tua */
.xp-seek { position: relative; height: 26px; margin: 4px 0 0; cursor: pointer; touch-action: none; outline: none; }
.xp-track { position: absolute; left: 0; right: 0; top: 9px; height: 8px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; transition: height .15s, top .15s; }
.xp-seek:hover .xp-track, .xp-seek.is-drag .xp-track, .xp-seek:focus-visible .xp-track { height: 10px; top: 8px; }
.xp-buf { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255,255,255,.18); transition: width .3s; }
.xp-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.xp-knob { position: absolute; top: 50%; left: 0; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5); transform: scale(0); transition: transform .15s; pointer-events: none; }
.xp-seek:hover .xp-knob, .xp-seek.is-drag .xp-knob, .xp-seek:focus-visible .xp-knob { transform: scale(1); }
.xp-seek:focus-visible { box-shadow: 0 0 0 2px var(--primary-soft); border-radius: 10px; }
.xp-tip { position: absolute; bottom: 26px; left: 0; transform: translateX(-50%); padding: 3px 8px; border-radius: 6px; background: #000; color: #fff; font-size: 11.5px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .15s; font-variant-numeric: tabular-nums; }
.xp-seek:hover .xp-tip, .xp-seek.is-drag .xp-tip { opacity: 1; }
/* shimmer trên thanh tua khi đang tải / đệm */
.xp-track::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.28) 50%, transparent 80%); background-size: 200% 100%; opacity: 0; transition: opacity .25s; }
.xp.is-loading .xp-track::after { opacity: 1; animation: xp-shimmer 1.3s linear infinite; }
.xp.is-loading .xp-fill { opacity: .7; }
.xp-times { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 2px; }
.xp-resume { flex: 1; text-align: center; color: var(--accent); font-weight: 700; }

/* nút điều khiển */
.xp-ctrl { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 10px 0 12px; }
.xp-b { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 50%; border: 0; background: transparent; color: var(--text); cursor: pointer; transition: background .15s, transform .12s, color .15s; }
.xp-b:hover { background: rgba(255,255,255,.08); color: #fff; }
.xp-b:active { transform: scale(.9); }
.xp-b b { position: absolute; font-size: 9.5px; font-weight: 800; top: 50%; left: 50%; transform: translate(-50%, -38%); pointer-events: none; }
.xp-b:focus-visible, .xp-o:focus-visible, .xp-play:focus-visible, .xp-item:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.xp-play { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 70px; height: 70px; margin: 0 8px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; background: linear-gradient(145deg, var(--primary-2), var(--primary)); box-shadow: 0 10px 26px rgba(210,122,112,.4); transition: transform .15s, box-shadow .2s; flex: none; }
.xp-play:hover { transform: scale(1.05); box-shadow: 0 12px 32px rgba(210,122,112,.55); }
.xp-play:active { transform: scale(.95); }
.xp-play .xp-i-pause { display: none; }
.xp-play.is-on .xp-i-play { display: none; }
.xp-play.is-on .xp-i-pause { display: inline-flex; }
.xp-play > span { display: inline-flex; transition: opacity .2s; }
.xp-play.is-on:not(.is-loading) .xp-i-pause { animation: xp-pop .25s ease; }
.xp-ring { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); pointer-events: none; opacity: 0; transition: opacity .2s; transform: rotate(-90deg); }
.xp-ring circle { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 40 92; }
.xp-play.is-loading .xp-ring { opacity: 1; animation: xp-spin 1s linear infinite; }
.xp-play.is-loading > span { opacity: .75; }
.xp-play-sm { width: 44px; height: 44px; margin: 0 2px; box-shadow: 0 6px 16px rgba(210,122,112,.35); }
.xp-play-sm .xp-ring { inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); }

/* tuỳ chọn */
.xp-opts { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.xp-o { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,.05); color: var(--text); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s, border-color .15s, color .15s; text-decoration: none; white-space: nowrap; }
.xp-o:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.xp-o.is-archive { color: var(--accent); border-color: rgba(207,162,90,.45); background: rgba(207,162,90,.1); }
.xp.has-sleep [data-xp-pop=sleep] { color: var(--accent); border-color: rgba(207,162,90,.45); }
.xp-pop { position: relative; }
.xp-menu { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); min-width: 130px; padding: 6px; border-radius: 12px; background: var(--surface-2); border: 1px solid rgba(255,255,255,.1); box-shadow: 0 14px 34px rgba(0,0,0,.55); z-index: 20; display: flex; flex-direction: column; animation: xp-fade .15s ease; }
.xp-menu[hidden] { display: none; }
.xp-menu button { padding: 8px 12px; border: 0; background: none; color: var(--text); text-align: left; border-radius: 8px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.xp-menu button:hover, .xp-menu button.on { background: var(--primary-soft); color: var(--primary-2); }
.xp-vol { display: inline-flex; align-items: center; gap: 4px; padding: 0 12px 0 0; border-radius: 999px; background: rgba(255,255,255,.05); border: 1px solid var(--border); }
.xp-vol .xp-o { border: 0; background: none; padding: 0 6px 0 10px; }
.xp-vol input[type=range] { width: 88px; height: 4px; accent-color: var(--primary); cursor: pointer; }
.xp-mute .xp-i-mute { display: none; }
.xp.is-muted .xp-mute .xp-i-mute { display: inline-flex; }
.xp.is-muted .xp-mute .xp-i-vol { display: none; }
.xp-auto { cursor: pointer; }
.xp-auto input { position: absolute; opacity: 0; pointer-events: none; }
.xp-auto i { position: relative; width: 30px; height: 18px; border-radius: 999px; background: rgba(255,255,255,.18); transition: background .2s; flex: none; }
.xp-auto i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.xp-auto input:checked + i { background: var(--primary); }
.xp-auto input:checked + i::after { transform: translateX(12px); }
.xp-auto input:focus-visible + i { outline: 2px solid var(--primary); outline-offset: 2px; }
.xp-error { margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: rgba(220,38,38,.1); border: 1px solid rgba(220,38,38,.35); color: #fecaca; font-size: 14px; animation: xp-fade .3s ease; }
.xp-error[hidden] { display: none; }
.xp-error-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.xp-error .btn-ghost { border: 1px solid rgba(255,255,255,.2); color: #eee; padding: 9px 16px; border-radius: 8px; font-weight: 600; }

/* bìa: shimmer khi tải, equalizer khi phát */
.xp-shim { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 25%, rgba(255,255,255,.2) 50%, transparent 75%); background-size: 220% 100%; opacity: 0; pointer-events: none; transition: opacity .3s; }
.xp.is-loading .xp-shim { opacity: 1; animation: xp-shimmer 1.4s linear infinite; }
.xp.is-loading .xp-cover { animation: xp-breathe 1.8s ease-in-out infinite; }
.xp-eq { position: absolute; left: 12px; bottom: 12px; display: inline-flex; align-items: flex-end; gap: 3px; height: 26px; padding: 5px 7px; border-radius: 9px; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; }
.xp-eq i { display: block; width: 3.5px; height: 100%; border-radius: 2px; background: var(--primary-2); transform-origin: bottom; transform: scaleY(.3); }
.xp.is-playing .xp-cover .xp-eq { opacity: 1; transform: none; }
.xp.is-playing .xp-eq i { animation: xp-eq 1s ease-in-out infinite; }
.xp-eq i:nth-child(2) { animation-delay: -.3s !important; } .xp-eq i:nth-child(3) { animation-delay: -.6s !important; }
.xp-eq i:nth-child(4) { animation-delay: -.15s !important; } .xp-eq i:nth-child(5) { animation-delay: -.45s !important; }

/* danh sách phần */
.xp-list { list-style: none; margin: 0; padding: 0; max-height: 440px; overflow: auto; border-radius: 12px; scrollbar-width: thin; }
.xp-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--text); transition: background .15s; }
.xp-item:hover { background: var(--surface-2); text-decoration: none; }
.xp-n { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); font-size: 14px; color: var(--muted); }
.xp-n .xp-eq { position: static; opacity: 0; transform: none; background: none; padding: 0; height: 16px; display: none; backdrop-filter: none; }
.xp-it { flex: 1; min-width: 0; }
.xp-it b { display: block; font-size: 14.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xp-it small { color: var(--muted); font-size: 12px; }
.xp-ck { color: #4ade80; opacity: 0; font-weight: 800; }
.xp-item.is-done .xp-ck { opacity: 1; }
.xp-item.is-current { background: var(--primary-soft); }
.xp-item.is-current .xp-n { background: var(--primary); color: #fff; }
.xp.is-playing .xp-item.is-current .xp-n b { display: none; }
.xp.is-playing .xp-item.is-current .xp-n .xp-eq { display: inline-flex; opacity: 1; }
.xp.is-playing .xp-item.is-current .xp-n .xp-eq i { background: #fff; }
.xp-intro { position: relative; max-height: 118px; overflow: hidden; line-height: 1.7; color: #cfcfcf; font-size: 15px; transition: max-height .35s; }
.xp-intro:not(.is-open)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 44px; background: linear-gradient(transparent, var(--surface)); }
.xp-intro.is-open { max-height: 1200px; }
.xp-more { margin-top: 8px; background: none; border: 0; color: var(--primary-2); font-weight: 700; cursor: pointer; font: inherit; font-weight: 700; }
.xp-rate-wrap { margin-top: 4px; }
.xp-toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 16px); opacity: 0; z-index: 400; padding: 10px 18px; border-radius: 12px; background: #26282b; border: 1px solid rgba(255,255,255,.12); color: #fff; font-size: 13.5px; font-weight: 700; box-shadow: 0 10px 30px rgba(0,0,0,.5); transition: opacity .25s, transform .25s; max-width: 90vw; text-align: center; }
.xp-toast.is-in { opacity: 1; transform: translate(-50%, 0); }

/* mini-player */
.xp-mini { position: fixed; left: 0; right: 0; bottom: 0; z-index: 120; padding: 0 8px calc(8px + env(safe-area-inset-bottom)); transform: translateY(110%); transition: transform .3s cubic-bezier(.2,.8,.2,1); pointer-events: none; }
.xp-mini[hidden] { display: none; }
.xp-mini.is-in { transform: none; }
.xp-mini-bar { position: relative; max-width: 640px; margin: 0 auto; height: 3px; border-radius: 3px 3px 0 0; background: rgba(255,255,255,.12); overflow: hidden; pointer-events: auto; }
.xp-mini-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.xp-mini-in { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-radius: 0 0 16px 16px; background: rgba(32,33,36,.94); backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,.1); border-top: 0; box-shadow: 0 -8px 30px rgba(0,0,0,.5); pointer-events: auto; }
.xp-mini-cv { flex: none; width: 42px; height: 42px; margin-right: 6px; border-radius: 10px; overflow: hidden; background: linear-gradient(145deg, #3a2a2c, #1d1c22); }
.xp-mini-cv img { width: 100%; height: 100%; object-fit: cover; display: block; }
.xp-mini-t { flex: 1; min-width: 0; text-align: left; background: none; border: 0; color: var(--text); cursor: pointer; padding: 0; font: inherit; }
.xp-mini-t b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xp-mini-t span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xp-mini .xp-b { width: 40px; height: 40px; }
body.has-xp-mini { padding-bottom: 76px; }

@keyframes xp-spin { to { transform: rotate(270deg); } }
@keyframes xp-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes xp-pulse { 0% { box-shadow: 0 0 0 0 rgba(126,226,160,.55); } 100% { box-shadow: 0 0 0 8px rgba(126,226,160,0); } }
@keyframes xp-blink { 50% { opacity: .25; } }
@keyframes xp-fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@keyframes xp-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes xp-breathe { 50% { transform: scale(1.015); } }
@keyframes xp-eq { 0%, 100% { transform: scaleY(.25); } 25% { transform: scaleY(1); } 50% { transform: scaleY(.45); } 75% { transform: scaleY(.85); } }

@media (max-width: 720px) {
  .xp { padding: 8px 6px 20px; }
  .xp-hero-in { flex-direction: column; align-items: center; text-align: center; padding: 22px 16px; gap: 16px; }
  .xp-cover { width: min(62vw, 240px); }
  .xp-badges, .xp-stats, .xp-tags, .xp-hero-acts, .xp-author { justify-content: center; }
  .xp-player { padding: 14px 12px; border-radius: 16px; }
  .xp-now { flex-direction: column; gap: 8px; }
  .xp-status { max-width: 100%; align-self: flex-start; }
  .xp-ctrl { gap: 0; }
  .xp-b { width: 40px; height: 40px; }
  .xp-play { width: 64px; height: 64px; margin: 0 4px; }
  .xp-vol input[type=range] { width: 70px; }
  .xp-o { min-height: 38px; }
  .xp-auto span { display: none; }
  .xp-orig span { display: none; }
  .xp-list { max-height: 360px; }
}
@media (max-width: 380px) { .xp-b { width: 36px; height: 36px; } .xp-ctrl .xp-b[data-xp-skip="-30"], .xp-ctrl .xp-b[data-xp-skip="30"] { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .xp *, .xp-mini *, .xp-toast { animation: none !important; transition: none !important; }
  .xp.is-loading .xp-ring { opacity: 1; }
  .xp-ring circle { stroke-dasharray: 90 42; }
  .xp.is-playing .xp-eq i { transform: scaleY(.7); }
  .xp.is-loading .xp-track { background: repeating-linear-gradient(45deg, rgba(255,255,255,.12) 0 6px, rgba(255,255,255,.05) 6px 12px); }
}

/* =========================================================
   BROWSE (v6): /the-loai, /tac-gia, /tac-gia/<slug>, chip thể loại, tác giả nổi bật, thẻ truyện mở rộng
   ========================================================= */
.box-more { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); text-align: right; font-size: 13.5px; font-weight: 600; }
.box-more a { color: var(--primary-2); }
.dropdown .dd-all { grid-column: 1 / -1; color: var(--accent); font-weight: 700; text-align: center; }
.drawer-genres a.is-all { color: var(--accent); border-color: rgba(207,162,90,.35); background: rgba(207,162,90,.08); font-weight: 700; }

/* chip thể loại (sidebar) */
.gchips { display: flex; flex-wrap: wrap; gap: 7px; }
.gchip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: #d6d6d6; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .15s; }
.gchip em { font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--muted); background: rgba(255,255,255,.06); padding: 1px 7px; border-radius: 999px; }
.gchip:hover { color: #fff; background: var(--primary-soft); border-color: rgba(210,122,112,.4); text-decoration: none; transform: translateY(-1px); }
.gchip:hover em { color: var(--primary-2); }
.gchip-all { color: var(--accent); border-color: rgba(207,162,90,.38); background: rgba(207,162,90,.08); }
.gchip-all b { font-weight: 700; font-size: 16px; line-height: 1; }
.gchip-all:hover { color: #f0cf94; background: rgba(207,162,90,.16); border-color: rgba(207,162,90,.6); }

/* dải thể loại trang chủ */
.genre-strip { margin: 0 0 16px; }
.gstrip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.14) transparent; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.gstrip-row .gchip { flex: 0 0 auto; scroll-snap-align: start; padding: 8px 14px; }
.gstrip-row::-webkit-scrollbar { height: 6px; }
.gstrip-row::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 6px; }
@media (min-width: 900px) { .gstrip-row { flex-wrap: wrap; overflow: visible; } }

/* avatar chữ cái tác giả */
.au-av { --h: 12; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff; background: linear-gradient(145deg, hsl(var(--h) 46% 42%), hsl(calc(var(--h) + 38) 42% 28%)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 4px 12px rgba(0,0,0,.28); }
.au-av-xl { width: 92px; height: 92px; font-size: 40px; }
.au-av-img { object-fit: cover; display: block; }
.au-list { list-style: none; margin: 0; padding: 0; }
.au-list li + li { border-top: 1px solid rgba(255,255,255,.04); }
.au-list a, .au-card { display: flex; align-items: center; gap: 11px; min-width: 0; color: var(--text); }
.au-list a { padding: 8px 4px; border-radius: 8px; transition: background .15s; }
.au-list a:hover, .au-card:hover { background: rgba(255,255,255,.035); text-decoration: none; }
.au-list a:hover strong, .au-card:hover strong { color: var(--primary-2); }
.au-b { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.au-b strong { font-size: 14.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .15s; }
.au-b small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* trang chỉ mục */
.br-hero { margin: 4px 0 14px; }
.br-hero .page-title { margin-bottom: 4px; font-size: 26px; }
.br-hero p { margin: 0; }
.br-box { padding: 16px; }
.br-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.br-search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); transition: border-color .15s, box-shadow .15s; }
.br-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.br-search .ic { color: var(--muted); flex: 0 0 auto; }
.br-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; padding: 10px 0; font-size: 15px; }
.br-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); }
.br-seg button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font-weight: 700; font-size: 13.5px; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.br-seg button.is-on { background: var(--primary-soft); color: #fff; box-shadow: inset 0 0 0 1px rgba(210,122,112,.35); }
.br-found { margin: 0 0 12px; font-size: 14px; }
.br-empty { padding: 26px 0; }

.br-types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.br-type { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: linear-gradient(135deg, rgba(210,122,112,.12), rgba(207,162,90,.05)); border: 1px solid rgba(210,122,112,.2); color: var(--text); transition: transform .15s, border-color .15s, background .15s; }
.br-type:hover { transform: translateY(-2px); border-color: rgba(210,122,112,.5); text-decoration: none; background: linear-gradient(135deg, rgba(210,122,112,.18), rgba(207,162,90,.08)); }
.br-type-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-2); flex: 0 0 auto; }
.br-type-b { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.br-type-b strong { font-size: 15.5px; }
.br-type-b small { color: var(--muted); font-size: 13px; }
.br-type > b { color: var(--muted); font-size: 22px; font-weight: 400; transition: transform .15s, color .15s; }
.br-type:hover > b { transform: translateX(3px); color: var(--primary-2); }

.gn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.gn-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; padding: 12px 14px 15px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); overflow: hidden; transition: transform .15s, border-color .15s, background .15s; }
.gn-card:hover { transform: translateY(-2px); border-color: rgba(210,122,112,.45); background: #272629; text-decoration: none; }
.gn-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gn-n { font-size: 12.5px; font-weight: 800; color: var(--primary-2); background: var(--primary-soft); padding: 2px 9px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.gn-desc { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gn-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p, 10%); background: linear-gradient(90deg, var(--primary), var(--accent)); opacity: .75; border-radius: 0 3px 0 0; }
.gn-card.is-hide, .az-group.is-hide { display: none; }

.az-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.az-bar a { min-width: 34px; padding: 5px 9px; text-align: center; border-radius: 8px; font-weight: 700; font-size: 13.5px; color: #cfcfcf; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); }
.az-bar a:hover { color: #fff; background: var(--primary-soft); border-color: rgba(210,122,112,.4); text-decoration: none; }
.az-bar a.is-on { color: #fff; background: var(--primary); border-color: var(--primary); }
.az-group { margin-bottom: 18px; scroll-margin-top: calc(var(--header-h) + 14px); }
.az-letter { display: flex; align-items: baseline; gap: 10px; font-size: 22px; font-weight: 800; color: var(--accent); margin: 4px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.az-letter small { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.az-letter-wide { grid-column: 1 / -1; margin-top: 10px; }

.au-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px 14px; margin-bottom: 14px; }
.au-card { padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.au-card:hover { border-color: rgba(210,122,112,.4); }

/* trang tác giả */
.au-hero { display: flex; gap: 20px; align-items: center; padding: 6px 0 18px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.au-hero .au-av-xl { box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), 0 8px 24px rgba(0,0,0,.35); }
.au-hero-b { min-width: 0; flex: 1; }
.au-kicker { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
.au-hero .page-title { font-size: 28px; margin: 0 0 8px; word-break: break-word; }
.au-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 14px; }
.au-stats span { display: inline-flex; align-items: center; gap: 5px; }
.au-stats b { color: var(--text); font-weight: 800; }
.au-bio { margin: 10px 0 0; color: #bdbdbd; font-size: 14.5px; }
.au-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.au-tags a { padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: #cfcfcf; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); }
.au-tags a em { font-style: normal; color: var(--muted); margin-left: 3px; }
.au-tags a:hover { color: #fff; border-color: rgba(210,122,112,.4); background: var(--primary-soft); text-decoration: none; }
.au-tags a.is-type { color: var(--primary-2); border-color: rgba(210,122,112,.3); }
.au-list-title { font-size: 17px; margin: 0 0 6px; display: flex; align-items: center; gap: 10px; }

/* thẻ truyện mở rộng: ảnh bìa, tác giả (link), trạng thái */
.story-row.has-cover { grid-template-columns: 62px minmax(0, 1fr) auto; }
.story-row-cover { display: block; width: 62px; height: 86px; border-radius: 8px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.story-row-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-row-meta a { color: inherit; }
.story-row-meta a:hover { color: var(--primary-2); }
.srm-status { padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; line-height: 20px; border: 1px solid rgba(255,255,255,.1); }
.srm-status.is-full { color: #4ade80; border-color: rgba(74,222,128,.35); background: rgba(22,163,74,.1); }
.srm-status.is-going { color: var(--accent); border-color: rgba(207,162,90,.35); background: rgba(207,162,90,.08); }
.story-info { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 14px; margin: 2px 0 14px; color: var(--muted); font-size: 13.5px; }
.story-info span { display: inline-flex; align-items: center; gap: 4px; }
.story-info a { color: var(--primary-2); font-weight: 600; }

/* gợi ý cuối trang đọc */
.rel-box { margin-top: 28px; }
.rel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.rel-card { display: flex; gap: 11px; align-items: center; padding: 9px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); min-width: 0; transition: border-color .15s, transform .15s; }
.rel-card:hover { border-color: rgba(210,122,112,.4); transform: translateY(-1px); text-decoration: none; }
.rel-cover { --h: 12; flex: 0 0 auto; width: 46px; height: 64px; border-radius: 7px; background: center / cover no-repeat var(--surface); display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff; }
.rel-cover-ph { background: linear-gradient(150deg, hsl(var(--h) 40% 36%), hsl(calc(var(--h) + 40) 38% 24%)); }
.rel-b { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.rel-b strong { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rel-b small { color: var(--muted); font-size: 12px; }
.xp-rate-wrap .rel-box { margin-top: 20px; }

@media (max-width: 900px) { .rel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .br-types { grid-template-columns: 1fr; } }
@media (max-width: 680px) {
  .gn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gn-card { padding: 10px 11px 14px; }
  .gn-name { font-size: 14px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
  .au-grid { grid-template-columns: 1fr; }
  .au-hero { flex-direction: column; text-align: center; gap: 12px; }
  .au-stats, .au-tags { justify-content: center; }
  .au-hero .page-title { font-size: 24px; }
  .au-av-xl { width: 76px; height: 76px; font-size: 32px; }
  .rel-grid { grid-template-columns: 1fr; }
  .br-search { flex-basis: 100%; }
  .br-seg { flex: 1; } .br-seg button { flex: 1; }
  .story-row.has-cover { grid-template-columns: 54px minmax(0, 1fr); }
  .story-row.has-cover .story-row-side { grid-column: 2; flex-direction: row; align-items: center; justify-content: space-between; text-align: left; }
  .story-row-cover { width: 54px; height: 76px; }
}
@media (prefers-reduced-motion: reduce) { .gchip, .gn-card, .br-type, .rel-card { transition: none !important; } .gchip:hover, .gn-card:hover, .br-type:hover, .rel-card:hover { transform: none; } }
.br-box [hidden], .genre-strip [hidden] { display: none !important; }

/* Tiêu đề khối có icon (v6.2): đúng kích thước/kiểu của icon "Top truyện sex" — ô 30px bo 9px, glyph 18px nét 2, màu --primary-2.
   Đặt sau cùng để rule cũ `.box-title .ic` / `.ic` (ép 18px kể cả padding) không làm icon nhỏ lại. */
.box-title.box-title-ic { display: flex; align-items: center; gap: 9px; }
.box-title.box-title-ic > svg, .box-title.box-title-ic > svg.ic {
  flex: 0 0 30px; width: 30px; height: 30px; padding: 6px; margin: 0; box-sizing: border-box; opacity: 1; vertical-align: baseline;
  border-radius: 9px; background: var(--primary-soft); color: var(--primary-2);
}

/* v6.2 — Header desktop thẳng hàng với nội dung: cùng max-width (1200) + cùng padding ngang (20px) với .container của nội dung/footer
   ở MỌI độ rộng ≥961px. Lỗi cũ: rule 2 hàng (<1500px) đặt `padding: 8px 0 0` đè mất padding ngang → logo & nút tài khoản dính mép màn hình. */
@media (min-width: 961px) {
  .container { padding-left: 20px; padding-right: 20px; }
  .site-header .container, .site-header .header-inner.container { max-width: 1200px; padding-left: 20px; padding-right: 20px; }
}
@media (min-width: 961px) and (max-width: 1199px) {
  .site-header .main-nav { flex-wrap: wrap; }
}

/* =========================================================
   v6.2 — PHÒNG CHAT (bubble + panel thành viên) & TỦ TRUYỆN (thẻ truyện + tiến độ)
   ========================================================= */
.container-chat { max-width: 1100px; }
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 14px; align-items: start; }
.chat-box { padding: 0; overflow: hidden; display: flex; flex-direction: column; margin-bottom: 0; }
.chat-head { padding: 14px 16px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, rgba(255,255,255,.025), transparent); }
.chat-head-text { flex: 1; min-width: 0; }
.chat-head-text p { display: block; }
.chat-status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; vertical-align: baseline; }
.chat-status i { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.18); }
.chat-status.is-off { color: #f59e0b; }
.chat-status.is-off i { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.2); animation: chatPulse 1.2s ease-in-out infinite; }
@keyframes chatPulse { 50% { opacity: .35; } }
.chat-people-btn { display: none; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }
.chat-people-btn .ic, .chat-people-btn svg { width: 17px; height: 17px; color: var(--primary-2); }
.chat-stream { position: relative; }
.chat-box .chat-messages { height: min(62vh, 560px); max-height: none; margin: 0; padding: 16px 16px 10px; gap: 10px; scroll-behavior: smooth; overscroll-behavior: contain;
  background: radial-gradient(900px 260px at 50% 0, rgba(210,122,112,.05), transparent 70%); }
.chat-box .chat-messages::-webkit-scrollbar { width: 8px; }
.chat-box .chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 8px; }
.chat-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: auto; padding: 40px 12px; text-align: center; color: var(--muted); }
.chat-empty[hidden] { display: none; }
.chat-empty-ic { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-2); margin-bottom: 6px; }
.chat-empty b { color: var(--text); font-size: 16px; }
.chat-jump { position: absolute; right: 14px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 999px; border: 0; background: var(--primary); color: #fff; font: inherit; font-weight: 700; font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.4); cursor: pointer; z-index: 3; }
.chat-jump[hidden] { display: none; }
.chat-box .chat-form { margin: 0; padding: 10px 14px 14px; border-top: 1px solid var(--border); background: var(--surface); position: sticky; bottom: 0; z-index: 4; }
.chat-box .chat-composer { margin-top: 8px; padding: 5px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); gap: 4px; }
.chat-box .chat-composer:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(210,122,112,.15); }
.chat-box .chat-composer .input { border: 0; background: transparent; height: 40px; padding: 0 8px; box-shadow: none; }
.chat-box .chat-emoji-btn { border: 0; background: transparent; width: 40px; height: 40px; }
.chat-box .chat-send { width: 40px; height: 40px; transition: transform .15s, opacity .15s; }
.chat-box .chat-send:active { transform: scale(.92); }
.chat-box .chat-send.is-sending { opacity: .6; animation: chatPulse .8s ease-in-out infinite; }
.chat-box .chat-emoji-pop { bottom: calc(100% + 10px); left: 0; }
.chat-side { position: sticky; top: calc(var(--header-h, 64px) + 12px); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px; max-height: calc(100vh - var(--header-h, 64px) - 28px); overflow: auto; }
.chat-side-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; font-size: 14px; }
.chat-side-x { display: none; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; }
.chat-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-person { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 12px; position: relative; }
.chat-person:hover { background: rgba(255,255,255,.04); }
.chat-person .avatar-chat { width: 34px; height: 34px; flex: none; }
.cp-info { flex: 1; min-width: 0; display: block; }
.cp-info b { font-size: 13.5px; }
.cp-info small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.cp-dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.14); flex: none; }
.chat-person.is-online .cp-dot { background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.18); }
.chat-people-empty { color: var(--muted); font-size: 13px; padding: 8px 6px; }
.chat-side-note { margin: 12px 4px 2px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.chat-side-backdrop { display: none; }
@media (max-width: 899px) {
  .chat-layout { display: block; }
  .container-chat { padding-left: 8px; padding-right: 8px; }
  .chat-box { border-radius: 14px; }
  .chat-people-btn { display: inline-flex; }
  .chat-box .chat-messages { height: calc(100dvh - var(--header-h, 60px) - 232px); min-height: 300px; padding: 12px 10px 8px; }
  .chat-box .chat-form { padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); }
  .chat-side { position: fixed; top: 0; right: 0; bottom: 0; width: min(86vw, 320px); max-height: none; border-radius: 18px 0 0 18px; z-index: 1200; transform: translateX(104%); transition: transform .25s ease; padding: 14px; }
  .chat-side.is-open { transform: none; box-shadow: -12px 0 40px rgba(0,0,0,.5); }
  .chat-side-x { display: inline-grid; place-items: center; }
  .chat-side-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 1190; }
  .chat-side-backdrop:not([hidden]) { display: block; }
  body.chat-side-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .chat-box .chat-messages { scroll-behavior: auto; } .chat-side { transition: none; } .chat-status.is-off i, .chat-box .chat-send.is-sending { animation: none; } }

/* ---------- Tủ truyện / Lịch sử đọc ---------- */
.sh-box { padding-bottom: 18px; }
.sh-head { margin: 4px 0 12px; }
.sh-head .page-title { margin: 0 0 2px; }
.sh-head p { margin: 0; font-size: 13.5px; }
.sh-tabs { display: flex; gap: 6px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 14px; }
.sh-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 10px; border-radius: 10px; color: var(--muted); font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; }
.sh-tab .ic, .sh-tab svg { width: 16px; height: 16px; margin: 0; opacity: 1; }
.sh-tab em { font-style: normal; font-size: 12px; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,.07); text-align: center; }
.sh-tab:hover { color: var(--text); }
.sh-tab.is-active { background: var(--primary-soft); color: var(--primary-2); box-shadow: inset 0 0 0 1px rgba(210,122,112,.35); }
.sh-tab.is-active em { background: var(--primary); color: #fff; }
.sh-sort { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.sh-sort .muted { margin-right: 2px; }
.sh-chip { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; text-decoration: none; cursor: pointer; }
.sh-chip:hover { color: var(--text); border-color: rgba(255,255,255,.2); }
.sh-chip.is-active { background: var(--primary-soft); border-color: rgba(210,122,112,.45); color: var(--primary-2); }
.sh-chip-danger { color: #f87171; border-color: rgba(248,113,113,.35); }
.sh-chip-danger:hover { background: rgba(248,113,113,.1); color: #fca5a5; }
.sh-clear { margin-left: auto; }
.sh-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sh-card { display: flex; gap: 12px; padding: 10px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); transition: border-color .15s, transform .15s; min-width: 0; }
.sh-card:hover { border-color: rgba(210,122,112,.4); transform: translateY(-1px); }
.sh-cover { position: relative; flex: none; width: 92px; aspect-ratio: 2 / 3; border-radius: 11px; overflow: hidden; background: #1c1d20; display: block; align-self: flex-start; }
.sh-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sh-cover-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.sh-cover-ph .ic { width: 28px; height: 28px; margin: 0; }
.sh-badge { position: absolute; left: 5px; bottom: 5px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 800; letter-spacing: .02em; background: rgba(0,0,0,.72); color: #fff; backdrop-filter: blur(4px); }
.sh-badge .ic { width: 11px; height: 11px; margin: 0; opacity: 1; }
.sh-badge-aud { color: var(--accent); }
.sh-badge-full { color: #4ade80; }
.sh-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.sh-title { margin: 0; font-size: 15.5px; line-height: 1.3; }
.sh-title a { color: var(--text); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sh-title a:hover { color: var(--primary-2); }
.sh-meta { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 12px; color: var(--muted); }
.sh-meta span { display: inline-flex; align-items: center; gap: 4px; }
.sh-meta .ic { width: 13px; height: 13px; margin: 0; opacity: .8; }
.sh-prog { margin-top: auto; }
.sh-prog-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.sh-prog-top b { color: var(--text); }
.sh-pct { font-weight: 700; color: var(--primary-2); }
.sh-new { font-style: normal; font-size: 10.5px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: rgba(207,162,90,.16); color: var(--accent); margin-left: 4px; }
.sh-bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.sh-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.sh-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sh-go { display: inline-flex; align-items: center; gap: 6px; }
.sh-go .ic { width: 14px; height: 14px; margin: 0; opacity: 1; }
.sh-rm { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.sh-rm:hover { color: #f87171; border-color: rgba(248,113,113,.4); }
.sh-rm-form { margin: 0; }
.sh-empty { text-align: center; padding: 38px 12px 26px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sh-empty-ic { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-2); }
.sh-empty-ic .ic, .sh-empty-ic svg { width: 28px; height: 28px; margin: 0; opacity: 1; }
.sh-empty h2 { margin: 6px 0 0; font-size: 18px; }
.sh-empty p { margin: 0; max-width: 420px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.sh-empty-cta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
@media (max-width: 720px) {
  .sh-list { grid-template-columns: 1fr; gap: 10px; }
  .sh-cover { width: 78px; }
  .sh-tab { font-size: 13px; padding: 9px 6px; gap: 5px; }
  .sh-tab .ic, .sh-tab svg { display: none; }
  .sh-sort { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .sh-sort::-webkit-scrollbar { display: none; }
  .sh-chip { white-space: nowrap; flex: none; }
}

/* =========================================================
   v6.2 — Player audio: hàng điều khiển phụ KHÔNG xê dịch + popup cố định vị trí
   [Tốc độ] [Hẹn giờ] [Âm lượng] = 3 cột rộng cố định (chừa chỗ cho "1.75x", "Hết phần", "59:59", "1:00:00").
   ========================================================= */
.xp-opts { gap: 8px 8px; }
.xp-opts-main { display: grid; grid-template-columns: 92px 124px 156px; gap: 8px; align-items: center; }
.xp-opts-extra { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.xp-opts-main > .xp-pop, .xp-opts-main > .xp-vol { min-width: 0; }
.xp-opts-main .xp-pop > .xp-o { width: 100%; justify-content: center; padding: 0 8px; font-variant-numeric: tabular-nums; }
.xp-opts-main .xp-pop > .xp-o span { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.xp-opts-main [data-xp-rate] { min-width: 4ch; text-align: center; }
.xp-opts-main [data-xp-sleeplbl] { flex: 1 1 auto; min-width: 7ch; text-align: center; }
.xp-opts-main .xp-vol { width: 100%; box-sizing: border-box; padding: 0 12px 0 0; }
.xp-opts-main .xp-vol .xp-o { flex: none; width: 36px; padding: 0 0 0 10px; justify-content: flex-start; }
.xp-opts-main .xp-vol input[type=range] { flex: 1 1 auto; width: auto; min-width: 0; }
.xp-menu { position: fixed; bottom: auto; left: 0; top: 0; transform: none; animation: xp-fade .15s ease; z-index: 1300; max-height: min(60vh, 340px); overflow: auto; font-variant-numeric: tabular-nums; }
.xp-menu button[data-rate] { text-align: center; }
.xp-sheet-bk { position: fixed; inset: 0; z-index: 1290; background: rgba(0,0,0,.55); animation: xp-bk .18s ease; }
.xp-sheet-bk[hidden] { display: none; }
@keyframes xp-bk { from { opacity: 0; } to { opacity: 1; } }
@keyframes xp-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (max-width: 720px) {
  .xp-opts { flex-direction: column; align-items: stretch; }
  .xp-opts-main { grid-template-columns: 76px minmax(0, 1fr) 128px; gap: 6px; width: 100%; }
  .xp-opts-main .xp-pop > .xp-o { padding: 0 6px; gap: 4px; }
  .xp-opts-main .xp-vol .xp-o { width: 32px; padding: 0 0 0 8px; }
  .xp-opts-main .xp-vol { padding-right: 10px; }
  .xp-menu { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; min-width: 0; box-sizing: border-box; max-height: 70vh; border-radius: 20px 20px 0 0; border-bottom: 0;
    padding: 14px 12px calc(16px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; animation: xp-sheet-up .22s ease; }
  .xp-menu[data-xp-menu="sleep"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xp-menu::before { content: attr(aria-label); grid-column: 1 / -1; text-align: center; font-weight: 800; font-size: 14px; color: var(--muted); padding: 0 0 6px; }
  .xp-menu::after { content: ''; position: absolute; top: 6px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: rgba(255,255,255,.2); }
  .xp-menu button { padding: 12px 8px; text-align: center; background: rgba(255,255,255,.05); font-size: 14.5px; }
  .xp-menu button.on { background: var(--primary-soft); box-shadow: inset 0 0 0 1px rgba(210,122,112,.5); }
  html.xp-sheet-open { overflow: hidden; }
}
@media (max-width: 720px) and (prefers-reduced-motion: reduce) { .xp-menu, .xp-sheet-bk { animation: none; } }

/* =========================================================
   v6.3 — THẺ TRUYỆN TRONG DANH SÁCH (danh-sach, the-loai, phan-loai, tac-gia, tim-kiem, xep-hang…)
   Media-object thống nhất: cột bìa 3:4 cố định (cả khi không có thumbnail) + cột nội dung; mọi thẻ cao ngang nhau về nhịp.
   ========================================================= */
.story-rows { gap: 10px; }
.story-rows .story-row.sr { --cw: 88px; display: grid; grid-template-columns: var(--cw) minmax(0, 1fr); gap: 12px; align-items: stretch; padding: 10px; margin: 0;
  border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.022); transition: border-color .15s, background .15s; }
.story-rows .story-row.sr:last-child { border-bottom: 1px solid var(--border); }
.story-rows .story-row.sr:hover { border-color: rgba(210,122,112,.38); background: rgba(255,255,255,.035); }
.sr-cover { position: relative; display: block; width: var(--cw); aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: var(--surface-2); align-self: start; border: 0; height: auto; }
.sr-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; z-index: 1; }
.sr-ph { position: absolute; inset: 0; display: grid; place-items: center; color: hsla(var(--h), 70%, 82%, .9);
  background: radial-gradient(120% 90% at 20% 10%, hsla(var(--h), 55%, 38%, .85), transparent 60%), linear-gradient(160deg, hsl(var(--h), 38%, 24%), hsl(calc(var(--h) + 40), 34%, 13%)); }
.sr-ph b { font-size: calc(var(--cw) * .46); line-height: 1; font-weight: 800; letter-spacing: -.02em; text-shadow: 0 2px 10px rgba(0,0,0,.35); }
.sr-ph .ic { width: calc(var(--cw) * .38); height: calc(var(--cw) * .38); margin: 0; opacity: .9; }
.sr-badge { position: absolute; left: 5px; bottom: 5px; z-index: 2; display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 800; color: var(--accent); background: rgba(0,0,0,.72); backdrop-filter: blur(4px); line-height: 16px; }
.sr-badge .ic { width: 11px; height: 11px; margin: 0; opacity: 1; }
.sr-body { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.sr-title { margin: 0; font-size: 15.5px; line-height: 1.32; font-weight: 700; }
.sr-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.sr-title a { display: inline; }
.sr-title .label { margin: 0 0 0 6px; vertical-align: 1px; }
.sr-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 10px; font-size: 12.5px; }
.sr-meta .ic { width: 13px; height: 13px; margin: 0 3px 0 0; vertical-align: -2px; }
.srm-author { min-width: 0; max-width: 100%; display: inline-flex; align-items: center; }
.srm-au-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.sr-tags { display: flex; flex-wrap: nowrap; gap: 5px; margin: 1px 0 0; overflow: hidden; }
.sr-tags a, .sr-more { flex: 0 1 auto; min-width: 0; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; padding: 2px 9px; line-height: 17px; }
.sr-tags a.is-type { max-width: 55%; }
.sr-more { flex: none; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-weight: 700; }
.sr-desc { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-foot { margin-top: auto; padding-top: 4px; display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; text-align: left; }
.sr-foot .chap-link { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; }
.sr-foot .chap-link .ic { width: 13px; height: 13px; margin: 0; opacity: 1; }
.sr-foot time { font-size: 12px; }
.ranked-item .story-row.sr { border: 1px solid var(--border); }
@media (min-width: 721px) {
  .story-rows .story-row.sr { --cw: 112px; gap: 16px; padding: 12px; }
  .sr-title { font-size: 17px; }
  .sr-desc { font-size: 13.5px; -webkit-line-clamp: 3; }
  .sr-meta { font-size: 13px; }
  .sr-tags a, .sr-more { font-size: 12px; }
}
@media (max-width: 380px) { .story-rows .story-row.sr { --cw: 76px; gap: 10px; padding: 8px; } .srm-au-t { max-width: 110px; } }

/* =========================================================
   v6.3 — BONG BÓNG CHAT kiểu Messenger
   ========================================================= */
.chat-box .chat-messages { gap: 2px; padding: 14px 12px 10px; }
.chat-box .chat-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; margin-top: 10px; position: relative; }
.chat-box .chat-msg.is-cont { margin-top: 0; }
.chat-box .chat-msg.is-mine { flex-direction: row-reverse; align-self: flex-end; }
.chat-box .chat-msg .avatar-chat { width: 30px; height: 30px; flex: none; font-size: 12.5px; margin-bottom: 1px; }
.chat-box .chat-msg.is-mine .avatar-chat { display: none; }
.chat-box .chat-msg.has-next .avatar-chat { visibility: hidden; }
.chat-box .chat-col { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: min(78%, 520px); }
.chat-box .chat-msg.is-mine .chat-col { align-items: flex-end; }
.chat-box .chat-meta { display: flex; align-items: center; gap: 5px; margin: 0 0 3px 12px; line-height: 1; }
.chat-box .chat-meta .chat-name { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.chat-box .chat-meta .role-badge { font-size: 9.5px; padding: 1px 6px; line-height: 14px; margin: 0; }
.chat-box .chat-msg.is-mine .chat-meta, .chat-box .chat-msg.is-cont .chat-meta { display: none; }
.chat-box .chat-line { display: flex; align-items: center; gap: 4px; max-width: 100%; transition: transform .18s ease; }
.chat-box .chat-msg.is-mine .chat-line { flex-direction: row-reverse; }
.chat-box .chat-bubble { position: relative; display: block; width: fit-content; max-width: 100%; min-width: 0; padding: 6px 11px 6px; border-radius: 18px 18px 18px 5px; background: var(--surface-2); border: 0; overflow-wrap: anywhere; }
.chat-box .chat-msg.is-mine .chat-bubble { border-radius: 18px 18px 5px 18px; background: linear-gradient(135deg, #d27a70, #b95f56); color: #fff; }
.chat-box .chat-msg.is-cont .chat-bubble { border-top-left-radius: 5px; }
.chat-box .chat-msg.is-mine.is-cont .chat-bubble { border-top-left-radius: 18px; border-top-right-radius: 5px; }
.chat-box .chat-msg.has-next .chat-bubble { border-bottom-left-radius: 5px; }
.chat-box .chat-msg.is-mine.has-next .chat-bubble { border-bottom-left-radius: 18px; border-bottom-right-radius: 5px; }
.chat-box .chat-text { font-size: 14.5px; line-height: 1.4; display: inline; }
.chat-box .chat-text .emoji-img { width: 18px; height: 18px; vertical-align: -4px; margin: 0 1px; }
.chat-box .chat-bubble time { display: inline-block; float: right; margin: 6px 0 -1px 10px; font-size: 10px; line-height: 1; color: rgba(255,255,255,.42); letter-spacing: .01em; }
.chat-box .chat-msg.is-mine .chat-bubble time { color: rgba(255,255,255,.72); }
/* nút trả lời: icon nhỏ cạnh bong bóng, không bao giờ chiếm 1 hàng */
.chat-box .chat-reply-btn { flex: none; width: 26px; height: 26px; padding: 0; margin: 0; border-radius: 50%; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .15s, background .15s, color .15s; }
.chat-box .chat-reply-btn:hover { background: rgba(255,255,255,.08); color: var(--primary-2); }
.chat-box .chat-msg:hover .chat-reply-btn, .chat-box .chat-reply-btn:focus-visible { opacity: 1; }
@media (hover: none) { .chat-box .chat-reply-btn { opacity: .38; } }
.chat-box .chat-msg.swipe-ready .chat-line::before { content: ''; }
.chat-box .chat-msg.swipe-ready .chat-reply-btn { opacity: 1; color: var(--primary-2); background: var(--primary-soft); }
/* trích dẫn: dải mảnh 1 dòng trên đầu bong bóng */
.chat-box .chat-quote { display: flex; align-items: center; gap: 6px; margin: 1px 0 5px; padding: 3px 8px; border-left: 2px solid var(--primary-2); border-radius: 4px 8px 8px 4px; background: rgba(0,0,0,.2); font-size: 12px; line-height: 1.3; cursor: pointer; max-width: 100%; min-width: 0; }
.chat-box .chat-quote b { display: inline; flex: none; max-width: 38%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--primary-2); }
.chat-box .chat-quote span { display: block; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); -webkit-line-clamp: unset; }
.chat-box .chat-quote .emoji-img { width: 14px; height: 14px; vertical-align: -2px; }
.chat-box .chat-msg.is-mine .chat-quote { background: rgba(0,0,0,.18); border-left-color: rgba(255,255,255,.85); }
.chat-box .chat-msg.is-mine .chat-quote b { color: #fff; }
.chat-box .chat-msg.is-mine .chat-quote span { color: rgba(255,255,255,.78); }
.chat-box .chat-quote-gone { border-left-color: var(--border); font-style: italic; color: var(--muted); cursor: default; }
/* tin chỉ có emoji: to, không bong bóng */
.chat-box .chat-msg.is-emoji .chat-bubble { background: none !important; padding: 0 2px; border-radius: 0; color: inherit; }
.chat-box .chat-msg.is-emoji .chat-text { font-size: 24px; line-height: 1.2; } /* cssfix2: 32->24, Dung chot van to */
.chat-box .chat-msg.is-emoji .chat-text .emoji-img { width: 24px; height: 24px; vertical-align: -5px; margin: 0 1px; object-fit: contain; } /* cssfix2: 32->24 */
.chat-box .chat-msg.is-emoji .chat-bubble time { float: none; display: block; margin: 2px 0 0; text-align: right; color: var(--muted); }
.chat-box .chat-msg.flash .chat-bubble { box-shadow: 0 0 0 2px var(--primary); }
@media (max-width: 899px) { .chat-box .chat-col { max-width: 78%; } .chat-box .chat-msg { gap: 6px; } }

/* =========================================================
   v6.3 — DRAWER MOBILE gọn & đẹp: thẻ tài khoản trên cùng → lưới thao tác nhanh → menu → chuyên mục/thể loại → Đăng xuất dạng chữ
   ========================================================= */
.avatar-md { width: 46px; height: 46px; font-size: 19px; flex: none; }
.drawer-panel { overscroll-behavior: contain; }
.drawer-head { padding: 12px 12px 12px 18px; }
.drawer-body { padding: 12px 12px calc(18px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.dr-acc { display: flex; align-items: center; gap: 6px; padding: 10px; border-radius: 16px; background: linear-gradient(135deg, rgba(210,122,112,.18), rgba(207,162,90,.07)); border: 1px solid rgba(210,122,112,.25); }
.dr-acc-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.dr-acc-main:hover { text-decoration: none; color: var(--text); }
.dr-acc-info { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.dr-acc-info strong { font-size: 15.5px; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-acc-info small { font-size: 12px; color: var(--muted); }
.dr-acc-info .role-badge { margin: 0; }
.dr-acc-set { flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); background: rgba(255,255,255,.05); }
.dr-acc-set .ic { width: 17px; height: 17px; margin: 0; opacity: 1; }
.dr-acc-set:hover { color: var(--primary-2); text-decoration: none; }
.dr-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 0 6px; }
.dr-quick a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 2px 9px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); text-decoration: none; min-width: 0; }
.dr-quick a:hover, .dr-quick a:active { border-color: rgba(210,122,112,.45); background: var(--primary-soft); text-decoration: none; }
.dr-q-ic { position: relative; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-2); }
.dr-q-ic .ic { width: 19px; height: 19px; margin: 0; opacity: 1; }
.dr-q-ic em { position: absolute; top: -6px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary); color: #fff; font-size: 10.5px; font-style: normal; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface-2); }
.dr-quick b { font-size: 11.5px; font-weight: 700; letter-spacing: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-guest { padding: 14px; border-radius: 16px; background: linear-gradient(135deg, rgba(210,122,112,.16), rgba(207,162,90,.06)); border: 1px solid rgba(210,122,112,.25); }
.dr-guest-t { display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; }
.dr-guest-t strong { font-size: 16px; }
.dr-guest-t span { font-size: 13px; color: var(--muted); line-height: 1.45; }
.dr-guest-b { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dr-guest-b .btn { height: 40px; }
.drawer-nav { margin-top: 10px; gap: 1px; }
.drawer-nav a { padding: 9px 12px; font-size: 15px; gap: 13px; }
.drawer-nav + .drawer-label { margin-top: 12px; padding-top: 12px; }
.drawer-label { margin: 14px 8px 8px; }
.drawer-genres { padding: 0 4px; gap: 7px; }
.drawer-genres a { padding: 6px 12px; font-size: 13px; }
.dr-logout { margin: 18px 0 0; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.06); text-align: center; }
.dr-logout button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 10px; }
.dr-logout button .ic { width: 15px; height: 15px; margin: 0; opacity: 1; }
.dr-logout button:hover { color: #f87171; background: rgba(248,113,113,.08); }

/* =========================================================
   v6.4 — KHU TÁC GIẢ (Đăng truyện / Truyện của tôi / Soạn chương) + TÀI KHOẢN
   ========================================================= */
/* Tab người dùng: mobile chia đều 4 ô icon trên – chữ dưới, không bị cắt */
@media (max-width: 560px) {
  .box > .tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; overflow: visible; }
  .box > .tabs .tab { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 9px; font-size: 11.5px; line-height: 1.2; text-align: center; white-space: normal; }
  .box > .tabs .tab .ic { margin: 0; width: 19px; height: 19px; }
}
.wr-page .btn svg, .ac-page .btn svg { width: 16px; height: 16px; margin: 0; }

/* Ô bìa thống nhất (3:4) */
.wr-cv { --cw: 76px; position: relative; display: block; width: var(--cw); aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: var(--surface-2); flex: none; }
.wr-cv img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.wr-cv-ph { position: absolute; inset: 0; display: grid; place-items: center; color: hsla(var(--h), 70%, 82%, .92);
  background: radial-gradient(120% 90% at 20% 10%, hsla(var(--h), 55%, 38%, .85), transparent 60%), linear-gradient(160deg, hsl(var(--h), 38%, 24%), hsl(calc(var(--h) + 40), 34%, 13%)); }
.wr-cv-ph b { font-size: calc(var(--cw) * .46); line-height: 1; font-weight: 800; text-shadow: 0 2px 10px rgba(0,0,0,.35); }
.wr-cv-lg { --cw: 112px; }

/* Truyện của tôi */
.wr-hero { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.wr-hero .page-title { margin: 0 0 4px; }
.wr-hero p { margin: 0; max-width: 520px; }
.wr-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.wr-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.025); }
.wr-stat b { font-size: 20px; line-height: 1.1; }
.wr-stat span { font-size: 12px; color: var(--muted); }
.wr-stat.is-ok b { color: #8cc5a0; } .wr-stat.is-wait b { color: #e2b65a; }
.wr-list { display: flex; flex-direction: column; gap: 10px; }
.wr-card { --cw: 78px; display: grid; grid-template-columns: var(--cw) minmax(0, 1fr); gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.022); transition: border-color .15s; }
.wr-card:hover { border-color: rgba(210,122,112,.38); }
.wr-card-cv { display: block; align-self: start; }
.wr-card-cv .wr-cv { --cw: 78px; }
.wr-card-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.wr-card-title { font-size: 16px; line-height: 1.3; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.wr-card-title a { color: var(--text); }
.wr-card-title a:hover { color: var(--primary-2); text-decoration: none; }
.wr-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 12px; font-size: 13px; color: var(--muted); }
.wr-card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.wr-card-meta .ic { width: 14px; height: 14px; margin: 0; }
.wr-card-time { font-size: 12.5px; color: var(--muted); opacity: .85; }
.wr-card-act { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.wr-card-act .btn { padding: 6px 12px; font-size: 13px; }
.wr-st { display: inline-flex; align-items: center; }
.wr-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 36px 14px; border: 1px dashed var(--border); border-radius: 14px; color: var(--muted); }
.wr-empty b { color: var(--text); font-size: 16px; }
.wr-empty p { margin: 0; font-size: 14px; }
.wr-empty .btn { margin-top: 6px; }
.wr-empty-ic { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: var(--primary-soft); color: var(--primary-2); }
.wr-empty-ic .ic { width: 26px; height: 26px; margin: 0; }

/* Form đăng/sửa truyện: chia khối rõ ràng */
.wr-form2 { gap: 12px; }
.wr-sec2 { margin: 0; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.022); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.wr-sec2 legend { display: flex; align-items: center; gap: 8px; padding: 0 6px; margin-left: -6px; font-size: 15px; font-weight: 700; }
.wr-sec2 legend i { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-2); font-style: normal; font-size: 12px; }
.wr-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wr-two > label { min-width: 0; }
.wr-steps2 { list-style: none; display: flex; gap: 6px; margin: 4px 0 12px; padding: 0; }
.wr-steps2 li { flex: 1; display: flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--surface-2); min-width: 0; }
.wr-steps2 li i { display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,.08); font-style: normal; font-size: 11px; }
.wr-steps2 li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wr-steps2 li.on, .wr-steps2 li.cur { color: var(--primary-2); border-color: rgba(210,122,112,.4); background: var(--primary-soft); }
.wr-steps2 li.on i, .wr-steps2 li.cur i { background: var(--primary); color: #fff; }
.wr-steps2 li.done { color: #8cc5a0; border-color: rgba(34,197,94,.3); background: rgba(34,197,94,.08); }
.wr-steps2 li.done i { background: #3f9a63; color: #fff; }
.wr-gcount { margin-left: auto; font-weight: 600; color: var(--muted); }
.wr-gcount.is-max { color: #e2b65a; }
.wr-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.form .wr-chip, .wr-chip { flex-direction: row; display: inline-flex; margin: 0; font-weight: 500; cursor: pointer; }
.wr-chip input { position: absolute; opacity: 0; pointer-events: none; }
.wr-chip span { display: inline-flex; align-items: center; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13.5px; color: var(--muted); transition: .12s; user-select: none; }
.wr-chip:hover span { border-color: rgba(210,122,112,.5); color: var(--text); }
.wr-chip input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-2); font-weight: 700; }
.wr-chip input:checked + span::before { content: '✓'; margin-right: 6px; font-size: 12px; }
.wr-chip input:disabled + span { opacity: .4; cursor: not-allowed; }
.wr-chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-soft); }
.wr-cover-row { display: flex; gap: 14px; align-items: flex-start; }
.wr-cover-prev { flex: none; width: 96px; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; border: 1px dashed var(--border); background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.wr-cover-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wr-cover-prev .ic { width: 26px; height: 26px; margin: 0; opacity: .6; }
.wr-cover-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.wr-cover-side p { margin: 0; }
.wr-seg { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.form .wr-seg label { flex-direction: row; display: block; margin: 0; font-weight: 600; }
.wr-seg input { position: absolute; opacity: 0; pointer-events: none; }
.wr-seg span { display: block; text-align: center; padding: 8px 6px; border-radius: 8px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.wr-seg input:checked + span { background: var(--primary-soft); color: var(--primary-2); box-shadow: inset 0 0 0 1px rgba(210,122,112,.45); }
.wr-meter { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.wr-meter-bar { flex: 0 0 90px; height: 6px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.wr-meter-bar i { display: block; height: 100%; width: 0; background: #e2b65a; border-radius: inherit; transition: width .15s, background .15s; }
.wr-meter.is-ok .wr-meter-bar i { background: #3f9a63; }
.wr-meter-txt b { color: var(--text); font-weight: 700; }
.wr-autosave { margin: -4px 0 0; }
.wr-autosave button { background: none; border: 0; color: var(--primary-2); cursor: pointer; padding: 0 2px; font: inherit; text-decoration: underline; }
/* Thanh hành động dính đáy */
.wr-bar { position: sticky; bottom: 0; z-index: 6; display: flex; gap: 8px; align-items: center; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); margin-top: 4px;
  background: linear-gradient(to top, var(--surface) 78%, transparent); }
.wr-bar .btn { flex: 0 0 auto; }
.wr-bar .btn:first-child { flex: 1 1 auto; }

/* Quản lý truyện */
.wr-story2 { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 12px; min-width: 0; }
.wr-story2 .wr-story-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.wr-story2 .page-title { margin: 0; font-size: 21px; line-height: 1.25; overflow-wrap: anywhere; }
.wr-gtags { display: flex; flex-wrap: wrap; gap: 5px; }
.wr-gtags span { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.06); color: var(--muted); }
.wr-prog { margin-top: 0; }
.wr-actgrid { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.wr-actgrid .wr-inline { display: inline-flex; margin: 0; }
.wr-actgrid .btn { padding: 9px 14px; font-size: 14px; }
.wr-listhead { margin-top: 18px; }
.wr-listhead .box-title { margin-bottom: 8px; }
.wr-listhead small { color: var(--muted); font-weight: 500; }
.wr-chapters { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.wr-ch { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.02); }
.wr-ch-no { flex: none; display: grid; place-items: center; min-width: 36px; height: 36px; padding: 0 6px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-2); font-weight: 800; font-size: 14px; }
.wr-ch-no:hover { text-decoration: none; }
.wr-ch-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; color: var(--text); }
.wr-ch-main:hover { text-decoration: none; }
.wr-ch-main b { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wr-ch-sub { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.wr-ch-sub .ic { width: 12px; height: 12px; margin: 0 3px 0 0; vertical-align: -1px; }
.wr-ch-sub .wr-st { font-size: 11px; padding: 1px 7px; }
.wr-ch-act { display: flex; gap: 4px; flex: none; }
.wr-ch-act form { margin: 0; }
.wr-ib { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.wr-ib .ic { width: 15px; height: 15px; margin: 0; }
.wr-ib:hover { color: var(--primary-2); border-color: rgba(210,122,112,.5); text-decoration: none; }
.wr-ib.is-danger:hover { color: #f87171; border-color: rgba(248,113,113,.5); background: rgba(248,113,113,.08); }

/* Soạn chương */
.wr-edhead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.wr-edhead .page-title { margin: 0; font-size: 22px; }
.wr-edstory { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.wr-editor .wr-ch-row { grid-template-columns: 120px minmax(0, 1fr); }
.wr-editor .wr-content { min-height: 52vh; font-size: 16px; line-height: 1.75; padding: 14px; border-radius: 12px; }
.wr-create .wr-content-sm { min-height: 190px; }

/* Tài khoản */
.ac-hero { display: flex; align-items: center; gap: 16px; padding: 16px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 16px;
  background: radial-gradient(120% 140% at 0% 0%, rgba(210,122,112,.14), transparent 60%), rgba(255,255,255,.025); }
.ac-avatar { position: relative; flex: none; cursor: pointer; display: block; }
.ac-avatar .avatar-lg { width: 84px; height: 84px; display: flex; box-shadow: 0 0 0 3px rgba(255,255,255,.07); }
.ac-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.ac-cam { position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: #fff; border: 2px solid var(--surface); }
.ac-id { min-width: 0; }
.ac-id .page-title { margin: 0 0 4px; font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
.ac-id p { margin: 0; }
.ac-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.ac-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 11px 4px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.025); color: var(--text); }
a.ac-stat:hover { border-color: rgba(210,122,112,.45); text-decoration: none; }
.ac-stat b { font-size: 19px; line-height: 1.1; }
.ac-stat span { font-size: 12px; color: var(--muted); }
.acct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.ac-card { padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: rgba(255,255,255,.022); }
.ac-card-title { display: flex; align-items: center; gap: 8px; font-size: 16px; margin: 0 0 2px; }
.ac-card-title .i-user, .ac-card-title svg { width: 18px; height: 18px; color: var(--primary-2); }
.ac-hint { margin: -4px 0 0; }
.ac-card .btn { align-self: flex-start; min-width: 150px; }
.ac-card input[type=file] { padding: 6px; }
.ac-card input[type=file]::file-selector-button { margin-right: 10px; padding: 6px 12px; border: 0; border-radius: 7px; background: var(--primary-soft); color: var(--primary-2); font-weight: 600; cursor: pointer; }
.ac-pw { position: relative; display: block; }
.ac-pw .input { padding-right: 44px; }
.ac-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 8px; }
.ac-eye:hover, .ac-eye.is-on { color: var(--primary-2); }
.ac-out { margin: 16px 0 0; text-align: center; }
.ac-out button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border: 1px solid var(--border); border-radius: 10px; background: none; color: var(--muted); font-size: 14px; cursor: pointer; }
.ac-out button .ic { width: 16px; height: 16px; margin: 0; }
.ac-out button:hover { color: #f87171; border-color: rgba(248,113,113,.45); background: rgba(248,113,113,.07); }

@media (max-width: 680px) {
  .wr-two { grid-template-columns: 1fr; gap: 12px; }
  .wr-hero .wr-hero-cta { width: 100%; }
  .wr-hide-sm { display: none !important; }
  .wr-story2 { gap: 12px; }
  .wr-cv-lg { --cw: 92px; }
  .wr-story2 .page-title { font-size: 19px; }
  .wr-steps2 li { padding: 6px 8px; font-size: 12px; gap: 5px; }
  .wr-steps2 li span { font-size: 11.5px; }
  .wr-cover-prev { width: 84px; }
  .wr-actgrid { display: grid; grid-template-columns: 1fr 1fr; }
  .wr-actgrid .wr-inline, .wr-actgrid .wr-inline .btn { width: 100%; }
  .wr-actgrid .wr-act-main { grid-column: 1 / -1; }
  .wr-actgrid .btn { width: 100%; }
  .wr-editor .wr-ch-row { grid-template-columns: 96px minmax(0, 1fr); gap: 10px; }
  .wr-editor .wr-content { min-height: 56vh; }
  .acct-grid { grid-template-columns: 1fr; }
  .ac-card .btn { width: 100%; }
  .ac-hero { padding: 14px; gap: 14px; }
  .ac-avatar .avatar-lg { width: 72px; height: 72px; font-size: 30px; }
  .ac-id .page-title { font-size: 19px; }
}
@media (min-width: 681px) {
  .wr-card { --cw: 92px; gap: 16px; padding: 12px; }
  .wr-card-cv .wr-cv { --cw: 92px; }
  .wr-card-title { font-size: 17px; }
}

/* v6.6 — Khối "Truyện sex audio" trang chủ khớp demo truyen3x.com: PC 4 thẻ/hàng, ≤1100px 2 cột,
   ≤680px vẫn LƯỚI 2 CỘT với thẻ dọc gọn (nút play trên-trái, tiêu đề 2 dòng, "1 phần · thể loại", sóng nhạc dưới-phải).
   (đã bỏ hàng cuộn ngang của v6.5 và quy tắc 1 cột ≤520px làm thẻ bị kéo dài) */
@media (max-width: 680px) {
  .ac-grid { gap: 8px; }
  .audio-card { flex-direction: column; align-items: flex-start; gap: 10px; min-height: 0; padding: 12px; }
  .ac-play { width: 36px; height: 36px; }
  .ac-body strong { font-size: 14px; }
  .ac-body { max-width: 100%; }   /* tên thể loại dài không làm thẻ tràn: tiêu đề xuống dòng, meta cắt … */
}

/* v6.5 — Nút âm lượng trình phát audio: hai icon xếp chồng trong cùng một ô 18×18 cố định,
   bật/tắt tiếng chỉ đổi hiển thị (visibility) nên nút, thanh trượt và các nút bên cạnh không xê dịch. */
.xp-mute { display: inline-grid; align-items: center; justify-items: start; flex: none; line-height: 0; }
.xp-mute .xp-i-vol, .xp-mute .xp-i-mute { grid-area: 1 / 1; display: inline-flex !important; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex: none; line-height: 0; transform: none; transition: none; animation: none; }
.xp-mute .xp-i-vol svg, .xp-mute .xp-i-mute svg { display: block; width: 18px; height: 18px; flex: none; }
.xp-mute .xp-i-mute { visibility: hidden; }
.xp.is-muted .xp-mute .xp-i-mute { visibility: visible; }
.xp.is-muted .xp-mute .xp-i-vol { visibility: hidden; }
.xp-vol input[type=range] { flex: none; }

/* v6.5 — Truyện audio nguồn YouTube: chỉ nghe, video ẨN theo mặc định nhưng iframe vẫn chạy (không dùng display:none) */
.xp-yt.is-hid { position: fixed; left: 0; bottom: 0; width: 200px; height: 200px; max-width: none; margin: 0; aspect-ratio: auto; border: 0; border-radius: 0;
  opacity: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.xp-vid[hidden] { display: none; }
.xp-vid.is-active { color: var(--accent); border-color: rgba(207,162,90,.45); background: rgba(207,162,90,.1); }
@media (max-width: 520px) {
  .xp-opts-extra { gap: 6px; }
  .xp-opts-extra .xp-o { padding: 0 10px; gap: 5px; }
  .xp-opts-extra .xp-o > svg { width: 17px; height: 17px; }
}


/* =========================================================
   v6.7 — Khối "Bình luận mới" (trang chủ): sidebar PC + dưới danh sách truyện trên mobile
   ========================================================= */
.hc-list { list-style: none; margin: 0; padding: 0; }
.hc-list li + li { border-top: 1px solid rgba(255,255,255,.05); }
.hc-item { display: flex; gap: 11px; align-items: flex-start; padding: 11px 6px; margin: 0 -6px; border-radius: 12px; color: var(--text); transition: background .18s; }
.hc-item:hover { text-decoration: none; background: rgba(255,255,255,.035); color: var(--text); }
.hc-item .hc-av { width: 36px; height: 36px; font-size: 14px; margin-top: 1px; overflow: hidden; display: inline-flex; flex: none; box-shadow: 0 0 0 2px rgba(255,255,255,.05); }
.hc-item .hc-av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.hc-b { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.hc-head { display: flex; align-items: center; gap: 0; min-width: 0; font-size: 13.5px; line-height: 1.3; }
.hc-head b { font-weight: 700; color: #ececec; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; }
.hc-head .role-badge { margin-left: 7px; flex: none; font-size: 10px; padding: 1px 7px; vertical-align: baseline; }
.hc-head time { margin-left: auto; padding-left: 8px; flex: none; font-size: 12px; color: var(--muted); }
.hc-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; line-height: 1.45; color: #cfcfcf; overflow-wrap: anywhere; }
.hc-on { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12px; color: var(--primary-2); margin-top: 1px; }
.hc-on svg { width: 13px; height: 13px; flex: none; opacity: .8; padding: 0; background: none; border-radius: 0; }
.hc-on span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hc-item:hover .hc-on { color: #fff; }
.hc-box .box-title-ic svg { width: 30px; height: 30px; }
.home-cols > .col-main > .hc-box.hc-main { display: none; flex: none; margin-top: 16px; margin-bottom: 16px; }
@media (max-width: 960px) {
  .home-cols > .col-main > .hc-box.hc-main { display: block; }
  .hc-box.hc-side { display: none; }
}
/* nhảy tới bình luận từ khối trang chủ: chừa chỗ header dính + nháy nhẹ */
.comment { scroll-margin-top: calc(var(--header-h, 56px) + 14px); }
.comment.is-hl > .comment-body > .cmt-bubble, .comment.is-hl > .comment-body { animation: hcFlash 2.4s ease-out 1; }
@keyframes hcFlash { 0%, 35% { box-shadow: 0 0 0 2px rgba(210,122,112,.8); background-color: rgba(210,122,112,.14); } 100% { box-shadow: 0 0 0 0 rgba(210,122,112,0); } }

/* ===== v6.9: avatar LUÔN tròn, vuông 1:1 (ảnh tải lên không vuông không bị méo/letterbox) =====
   Gốc lỗi: <span class="avatar"><img></span> — span là inline nên width/height của .avatar bị bỏ qua,
   ảnh bị kéo theo kích thước gốc/hộp chứa (nút header ~40x28). Cho .avatar làm khối inline-flex + cắt tròn, ảnh phủ 100% object-fit: cover. */
.avatar { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; flex: none; overflow: hidden; border-radius: 50%; aspect-ratio: 1 / 1; vertical-align: middle; line-height: 1; }
.avatar > img { display: block; width: 100%; height: 100%; max-width: none; aspect-ratio: 1 / 1; border-radius: 50%; object-fit: cover; object-position: center; }
.avatar-chat { flex: none; }
/* header: nút tài khoản cao 38px như nút tìm kiếm, vòng viền nhẹ */
.site-header .user-btn { box-sizing: border-box; height: 38px; align-items: center; flex: none; }
.site-header .user-btn .avatar { width: 30px; height: 30px; box-shadow: 0 0 0 1.5px rgba(255,255,255,.16); font-size: 13px; }
@media (max-width: 960px) {
  .site-header .user-btn { width: 38px; padding: 3px; justify-content: center; gap: 0; border-radius: 50%; }
  .site-header .user-btn .avatar { width: 30px; height: 30px; }
}
.dr-acc .avatar, .dr-acc-main .avatar { flex: none; }

/* =========================================================
   v6.11 — nền tảng cho MỌI ô nhập liệu (kể cả ô không class / markup cũ)
   · :where() = độ ưu tiên 0 → class riêng (.input, .br-search input, chat…) vẫn ghi đè được
   · mobile: chữ ≥16px để iOS không tự phóng to khi bấm vào ô
   ========================================================= */
:where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]):not([type=submit]):not([type=button]):not([type=reset]):not([type=file]):not([type=color]):not([type=image]), select, textarea) {
  font: inherit; color: var(--text); background-color: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none;
}
:where(select) {
  padding-right: 32px; background-repeat: no-repeat; background-position: right 11px center; background-size: 11px 7px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238d9095' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
:where(select[multiple], select[size]) { background-image: none; padding-right: 12px; }
:where(input[type=file]) { max-width: 100%; padding: 6px; font-size: 14px; color: var(--muted); }
:where(input[type=file])::file-selector-button { margin-right: 10px; padding: 6px 12px; border: 0; border-radius: 6px; background: var(--primary-soft); color: var(--primary-2); font: inherit; font-weight: 700; cursor: pointer; }
:where(input[type=checkbox], input[type=radio]) { accent-color: var(--primary); }
:where(input, select, textarea)::placeholder { color: var(--muted); opacity: .8; }
:where(input[type=date], input[type=time], input[type=datetime-local]) { color-scheme: dark; }
:where(input:not([type=checkbox]):not([type=radio]):not([type=file]), select) { min-height: 38px; padding: 7px 12px; }
.chat-captcha .input { width: 108px; }
@media (max-width: 640px) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]):not([type=submit]):not([type=button]):not([type=reset]):not([type=file]):not([type=color]):not([type=image]), select, textarea { font-size: 16px; }
}

/* ===== v6.12: Truyện của tôi — 2 nút đăng, bộ lọc loại, icon cân đối ===== */
.wr-cta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px; }
.wr-cta-row.is-one { grid-template-columns: 1fr; max-width: 320px; }
.wr-cta { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 14px; font-size: 15px; font-weight: 700; border-radius: 12px; }
.wr-cta .ic { width: 20px; height: 20px; margin: 0; opacity: 1; }
.wr-cta-2 { background: var(--primary); color: #fff; border: 1px solid var(--primary); } /* cssfix1: giong nut Dang truyen */
.wr-cta-2:hover { background: var(--primary-2); border-color: var(--primary-2); color: #fff; text-decoration: none; } /* cssfix1: truoc day color trung mau nen hover -> mat chu */
.wr-empty .wr-cta-row { width: 100%; max-width: 420px; margin: 8px 0 0; }
.wr-empty .wr-cta { margin-top: 0; }
.wr-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.wr-filter a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-size: 13.5px; font-weight: 600; background: var(--surface-2); }
.wr-filter a b { font-weight: 700; color: var(--text); }
.wr-filter a.on { border-color: var(--primary); color: #fff; background: var(--primary-soft); text-decoration: none; }
.wr-type { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.wr-type .ic { width: 13px; height: 13px; margin: 0; opacity: .9; }
.wr-type.is-audio { color: #8db8f5; border-color: rgba(96,165,250,.35); background: rgba(96,165,250,.1); }
.wr-inline { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.wr-empty-ic { width: 64px; height: 64px; border-radius: 18px; }
.wr-empty-ic .ic, .wr-empty-ic svg { width: 30px; height: 30px; margin: 0; opacity: 1; }
.box > .tabs .tab .ic, .tabs .tab .ic { flex: none; }
@media (max-width: 480px) { .wr-cta { font-size: 14px; padding: 10px 8px; } }
/* v6.12: khu thành viên (có tab) — trên mobile bỏ khung ngoài để danh sách thẻ không bị bọc thêm 1 lớp */
@media (max-width: 640px) {
  .box:has(> .tabs) { background: transparent; border: 0; box-shadow: none; padding: 0; }
  .box:has(> .tabs) > .tabs { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 2px 4px; margin-bottom: 16px; }
  .box:has(> .tabs) > .tabs .tab { border-bottom: 0; border-radius: 10px; }
  .box:has(> .tabs) > .tabs .tab.active { background: var(--primary-soft); }
}
.dr-quick b { font-size: 11px; white-space: normal; overflow: visible; text-overflow: clip; text-align: center; line-height: 1.2; }

/* =========================================================
   cssfix4 (2026-11-12) — TIN CHỈ EMOJI KIỂU THƯỜNG, ĐỒNG NHẤT TIN CHỮ
   (thay cssfix3 gộp 1 hàng ngang — Dũng chê xấu)
   Giữ khung như tin chữ: tên ở trên, emoji ở dưới thay cho bong bóng.
   Emoji 24 -> 20px; tên canh thẳng với emoji; giờ nhỏ nằm ngay sau emoji cùng dòng,
   không rớt xuống dòng riêng nữa.
   ========================================================= */
.chat-box .chat-msg.is-emoji .chat-meta { margin: 0 0 3px 2px; }
.chat-box .chat-msg.is-emoji .chat-text { font-size: 20px; line-height: 1.25; }
.chat-box .chat-msg.is-emoji .chat-text .emoji-img { width: 20px; height: 20px; vertical-align: -4px; margin: 0 1px; object-fit: contain; }
.chat-box .chat-msg.is-emoji .chat-bubble time { float: none; display: inline; margin: 0 0 0 6px; text-align: left; }

/* =========================================================
   cssfix5 (2026-11-12) — DẢI THỜI GIAN KIỂU MESSENGER
   Bỏ giờ in trong từng bong bóng; thay bằng dải giờ căn giữa (.chat-tdiv)
   do app.js (retime) chèn khi sang ngày mới hoặc cách nhau > 20 phút.
   ========================================================= */
#chatMessages .chat-bubble time { display: none; }
.chat-tdiv { text-align: center; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; color: var(--muted); margin: 14px 0 2px; text-transform: uppercase; }
.chat-messages > .chat-tdiv:first-of-type { margin-top: 2px; }

/* =========================================================
   cssfix6 (2026-11-12) — ICON PHÍA MÌNH GỬI BỊ BÓP BÉ TÍ
   Gốc lỗi: hàng tin của mình (row-reverse, shrink-wrap) làm flex bóp ngang
   bong bóng emoji còn ~10px (đo rig: 9.67x20px). Chống bóp + khoá bề ngang icon.
   ========================================================= */
.chat-box .chat-msg.is-emoji .chat-bubble { flex: none; }
.chat-box .chat-msg.is-emoji .chat-text .emoji-img { min-width: 20px; }
