@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700&family=Satisfy&display=swap");
/* ===== Biến theme: dark (mặc định) / light ===== */
:root{
  --bg:#0e0e12; --panel:#141419; --card:#17171d; --text:#e8e8e8;
  --muted:#9a9aa5; --accent:#6c8cff; --accent-soft:#7aa2ff;
  --border:#23232c; --input-bg:#23232c; --reader-bg:#000;
  --shadow:none; --danger:#ff5a5a;
}
:root.light{
  --bg:#f2f2f2; --panel:#ffffff; --card:#ffffff; --text:#333333;
  --muted:#666666; --accent:#3b5be0; --accent-soft:#3b5be0;
  --border:#e5e5e5; --input-bg:#f0f0f0; --reader-bg:#dcdcdc;
  --shadow:0 1px 4px rgba(0,0,0,.12); --danger:#c62828;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* ===== Thanh cuộn đẹp ===== */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px;
  border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
::-webkit-scrollbar-thumb:active { background: var(--accent-soft); }
body { font-family: "Segoe UI", Arial, sans-serif; background: var(--bg); color: var(--text); transition: background .3s, color .3s; }
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent-soft); }

/* Header */
.topbar { background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; transition: background .3s; }
/* Menubar nổi: khi cuộn xuống thì nền mờ */
.topbar.scrolled { background: color-mix(in srgb, var(--panel) 78%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 18px rgba(0,0,0,.25); }
/* Nút lên đầu trang góc phải dưới */
/* Nút tròn nổi góc phải dưới: lên đầu trang + tải lại ảnh lỗi (cùng kiểu) */
#to-top, #retry-all { position: fixed; right: 20px; width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none; font-size: 20px; cursor: pointer; z-index: 50;
  box-shadow: 0 6px 18px rgba(0,0,0,.35); transition: opacity .3s, transform .25s;
  display: inline-flex; align-items: center; justify-content: center; }
#to-top { bottom: 20px; opacity: 0; pointer-events: none; }
#to-top.show { opacity: 1; pointer-events: auto; }
#to-top:hover, #retry-all:hover { transform: translateY(-4px); }
#retry-all { bottom: 76px; display: none; }  /* JS bật display:block khi có ảnh lỗi */
/* Cụm nút nổi trang đọc: 1 nút bánh răng, bấm vào bung 2 nút con theo chữ L
   (cuộn lên: phía trên; tải lại ảnh: bên trái bánh răng) */
body.trang-doc #fab-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 60;
  width: 102px; height: 102px; pointer-events: none; }
body.trang-doc #fab-wrap button { pointer-events: auto; -webkit-tap-highlight-color: transparent; }
/* Mọi nút bấm trên mobile: không hiện ô vuông mờ khi chạm */
button { -webkit-tap-highlight-color: transparent; }
body.trang-doc #fab-setting { position: absolute; right: 0; bottom: 0;
  width: 46px; height: 46px; border-radius: 50%; border: none;
  cursor: pointer; background: #26262b; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.35); }
body.trang-doc #fab-setting svg { transition: transform .35s ease; }
body.trang-doc #fab-wrap.open #fab-setting { animation: fabNhan .3s ease; }
body.trang-doc #fab-wrap.open #fab-setting svg { transform: rotate(135deg); }
body.trang-doc #fab-wrap #to-top,
body.trang-doc #fab-wrap #retry-all { position: absolute; }
body.trang-doc #fab-wrap #to-top { right: 0; bottom: 56px; }      /* phía trên bánh răng */
body.trang-doc #fab-wrap #retry-all { right: 56px; bottom: 0; }   /* bên trái bánh răng */
body.trang-doc #fab-wrap .fab-act { display: none; }
/* trạng thái cuối sau animation: phải set opacity:1 rõ ràng, không thì rớt về opacity:0 của rule gốc */
body.trang-doc #fab-wrap.open #to-top.can-show,
body.trang-doc #fab-wrap.open #retry-all.can-show { display: inline-flex; opacity: 1; pointer-events: auto; }
/* animation: 2 nút bay ra từ vị trí bánh răng, so le nhau */
body.trang-doc #fab-wrap.open #to-top.can-show {
  animation: fabLen .28s cubic-bezier(.2,.9,.3,1.25); }
body.trang-doc #fab-wrap.open #retry-all.can-show {
  animation: fabTrai .28s cubic-bezier(.2,.9,.3,1.25) .07s backwards; }
@keyframes fabLen { from { opacity: 0; transform: translateY(46px) scale(.4); } to { opacity: 1; transform: none; } }
@keyframes fabTrai { from { opacity: 0; transform: translateX(46px) scale(.4); } to { opacity: 1; transform: none; } }
@keyframes fabNhan { 0% { transform: scale(1); } 40% { transform: scale(.88); } 100% { transform: scale(1); } }
body.trang-doc #fab-wrap.open .fab-act.can-show:hover { transform: scale(1.08); }
.header { max-width: 1200px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 30px; }
.logo { font-size: 24px; font-weight: bold; color: var(--accent); white-space: nowrap; }
.logo small { font-size: 11px; color: var(--muted); font-weight: normal; display: block; }
.logo-img { height: 56px; width: auto; display: block; }
.mainnav { display: flex; gap: 22px; }
.mainnav a { font-size: 13px; font-weight: 600; text-transform: uppercase; color: var(--muted);
  position: relative; transition: color .25s, transform .25s; padding: 4px 0; }
.mainnav a::after { content: ""; position: absolute; left: 0; bottom: -2px; height: 2px; width: 0;
  background: var(--accent); transition: width .3s ease; border-radius: 2px; }
.mainnav a:hover { transform: translateY(-2px); color: var(--text); }
.mainnav a:hover::after, .mainnav a.active::after { width: 100%; }
/* Dropdown Thể loại: rê chuột vào hiện bảng thể loại nhiều cột.
   padding-bottom trên .nav-drop tạo vùng đệm vô hình để rê chuột
   từ chữ "Thể loại" xuống menu không bị mất hover */
.nav-drop { position: relative; padding-bottom: 16px; margin-bottom: -16px; }
.drop-btn { font-size: 13px; font-weight: 600; text-transform: uppercase; color: var(--muted);
  position: relative; padding: 4px 0; cursor: pointer; transition: color .25s; }
.drop-btn::after { content: ""; position: absolute; left: 0; bottom: -2px; height: 2px; width: 0;
  background: var(--accent); transition: width .3s ease; border-radius: 2px; }
.nav-drop:hover .drop-btn, .drop-btn.active { color: var(--text); }
.nav-drop:hover .drop-btn::after, .drop-btn.active::after { width: 100%; }
.drop-menu { position: absolute; top: 100%; left: -20px; width: 560px; max-width: 90vw;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); padding: 14px 18px; z-index: 60;
  display: none; grid-template-columns: repeat(3, 1fr); gap: 2px 16px; }
.nav-drop:hover .drop-menu { display: grid; animation: fadeUp .25s ease; }
/* mở bằng click (mobile / touch) */
.nav-drop.open .drop-menu { display: grid; animation: fadeUp .25s ease; }
.nav-drop.open .drop-btn { color: var(--text); }
.nav-drop.open .drop-btn::after { width: 100%; }
.drop-menu::before { content: ""; position: absolute; top: -12px; left: 0; right: 0; height: 12px; }
.drop-menu a { font-size: 13px; font-weight: 400; text-transform: none; color: var(--text);
  padding: 7px 8px; border-radius: 6px; transition: color .2s, background .2s; }
.drop-menu a::after { display: none; }
.drop-menu a:hover { color: var(--accent); background: rgba(255,87,34,.08); transform: none; }
.drop-menu a.hot { color: var(--danger); font-weight: 600; }
/* Danh sách lịch sử đọc */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item { display: flex; align-items: center; gap: 14px; background: var(--card);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px;
  box-shadow: var(--shadow); transition: transform .2s; }
.history-item:hover { transform: translateX(4px); }
.history-item img { width: 48px; height: 64px; object-fit: cover; border-radius: 6px; }
.history-item .h-info { flex: 1; min-width: 0; }
.history-item .h-title { font-size: 14px; font-weight: 600; display: block; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item .h-chap { font-size: 12px; color: var(--muted); }
.history-item .btn { flex-shrink: 0; }
.head-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.userbox a { color: var(--muted); }
.userbox a:hover { color: var(--accent); }
#theme-toggle { background: var(--input-bg); border: 1px solid var(--border); border-radius: 50%;
  width: 38px; height: 38px; cursor: pointer; font-size: 17px; transition: transform .35s; color: var(--text);
  display: flex; align-items: center; justify-content: center; }
#theme-toggle:hover { transform: rotate(30deg) scale(1.1); }
button.username-label { font-size: 14px; font-weight: 600; color: var(--text);
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: none; border: none; cursor: pointer; padding: 6px 10px;
  border-radius: 8px; transition: background .2s; }
button.username-label:hover { background: var(--hover-bg, rgba(128,128,128,.15)); }
span.username-label { font-size: 14px; font-weight: 600; color: var(--text);
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .username-label { display: none; } }

/* Avatar + menu tài khoản */
.avatar-wrap { position: relative; }
.avatar-btn { width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; font-weight: bold;
  font-size: 17px; display: flex; align-items: center; justify-content: center;
  transition: transform .2s; padding: 0; }
.avatar-btn:hover { transform: scale(1.08); }
.bell-btn { position: relative; text-decoration: none; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; color: var(--text);
  background: transparent; border: none; cursor: pointer; padding: 0;
  transition: background .2s, transform .2s; }
.bell-btn:hover { background: var(--hover-bg, rgba(128,128,128,.15)); transform: rotate(12deg); }
.bell-btn svg { display: block; }
.bell-badge { position: absolute; top: -7px; right: -8px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 9px; background: #e0245e; color: #fff;
  font-size: 11px; font-weight: bold; display: flex; align-items: center;
  justify-content: center; }
.avatar-btn img, .avatar-big img { width: 100%; height: 100%; object-fit: cover;
  border-radius: 50%; display: block; }

/* Ngăn kéo "Tính Năng Tài Khoản": trượt từ phải vào */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55);
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 400; }
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.account-drawer { position: fixed; top: 0; right: 0; height: 100dvh; width: 560px;
  max-width: 94vw; background: var(--card); z-index: 401; display: flex;
  flex-direction: column; border-left: 1px solid var(--border);
  box-shadow: -8px 0 30px rgba(0,0,0,.4);
  transform: translateX(105%); transition: transform .38s cubic-bezier(.22,.9,.28,1); }
.account-drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px; font-size: 18px; font-weight: bold; color: var(--text);
  border-bottom: 1px solid var(--border); }
#drawer-close { background: none; border: none; color: var(--text); font-size: 20px;
  cursor: pointer; padding: 4px 8px; }
.drawer-user { display: flex; gap: 14px; align-items: center; padding: 18px;
  border-bottom: 1px solid var(--border); }
.drawer-user .avatar-big { width: 52px; height: 52px; font-size: 24px; }
.drawer-rank { color: var(--accent); font-weight: bold; font-size: 13px; margin-top: 4px; }
.drawer-nav { padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.drawer-nav a { display: flex; gap: 14px; align-items: center; padding: 13px 12px;
  border-radius: 8px; color: var(--text); font-size: 15px; }
.drawer-nav a:hover { background: var(--bg); }
.drawer-nav .di { width: 24px; text-align: center; color: var(--muted); font-size: 17px; }
.drawer-nav svg.di { display: inline-block; vertical-align: -3px; }
/* Submenu xổ xuống trong ngăn kéo (Trang quản lý) */
.drawer-submenu .submenu-items { display: flex; flex-direction: column;
  margin: 2px 0 2px 20px; border-left: 2px solid var(--border, #444);
  padding-left: 6px; }
.drawer-submenu .submenu-items a { font-size: 14px; padding: 10px 12px; }
.submenu-arrow { margin-left: auto; font-size: 12px; transition: transform .2s; }
.drawer-submenu.open .submenu-arrow { transform: rotate(180deg); }
/* Item trong ngăn kéo trượt nhẹ vào khi mở */
.account-drawer.open .drawer-user,
.account-drawer.open .drawer-nav a {
  animation: drawerItemIn .45s cubic-bezier(.22,.9,.28,1) both; }
.account-drawer.open .drawer-nav a:nth-child(2) { animation-delay: .06s; }
.account-drawer.open .drawer-nav a:nth-child(3) { animation-delay: .12s; }
.account-drawer.open .drawer-nav a:nth-child(4) { animation-delay: .18s; }
@keyframes drawerItemIn {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: none; } }
.avatar-big { width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #667eea, #764ba2); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: bold; }
.avatar-name { font-weight: bold; font-size: 14px; color: var(--text); }
/* Khung avatar theo cảnh giới: dùng biến --mau (màu cảnh giới) */
/* Tier 1: vòng đơn */
.ava-khung { --mau: #888; border-radius: 50%; padding: 2px; background: var(--mau);
  display: inline-flex; flex: none; }
.ava-khung > img, .ava-khung > span.ava-nd { border-radius: 50%; display: block;
  width: 100%; height: 100%; object-fit: cover; }
/* Tier 2: vòng + phát sáng nhẹ */
.ava-khung.k2 { box-shadow: 0 0 8px var(--mau); }
/* Tier 3: vòng + phát sáng vừa */
.ava-khung.k3 { box-shadow: 0 0 12px var(--mau), 0 0 4px var(--mau); }
/* Tier 4: vòng đôi + phát sáng mạnh */
.ava-khung.k4 { box-shadow: 0 0 16px var(--mau), 0 0 6px var(--mau);
  outline: 2px solid var(--mau); outline-offset: 3px; }
/* Sáng Thế: viền gradient vàng */
.ava-khung.ksangthe { background: conic-gradient(#bf953f,#fcf6ba,#d4af37,#fbf5b7,#aa771c,#bf953f);
  box-shadow: 0 0 16px #d4af37; }
/* Thiên Đạo: đen viền vàng */
.ava-khung.kthiendao { background: #000; box-shadow: 0 0 12px #d4af37;
  outline: 2px solid #d4af37; outline-offset: 2px; }
/* Nút xóa avatar */
.btn-xoa-ava { background: #c62828; margin-left: 8px; }
.btn-xoa-ava:hover { background: #a91f1f; }

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 28px 0 15px; }
.section-title { font-size: 17px; font-weight: bold; border-left: 3px solid var(--accent); padding-left: 10px; }
.section-head a { font-size: 12px; color: var(--muted); }

/* Banner hero: nền mờ từ bìa + bìa hiện nét bên trái (không kéo giãn) */
.hero { position: relative; height: 320px; border-radius: 10px; overflow: hidden;
  margin-bottom: 25px; background-color: var(--card); transition: opacity .35s ease; box-shadow: var(--shadow); }
.hero.fading .hero-bg, .hero.fading .hero-cover-link, .hero.fading .hero-content { opacity: 0; }
.hero-bg { position: absolute; inset: -30px; background-size: cover; background-position: center;
  filter: blur(24px) brightness(.7); transform: scale(1.05); transition: opacity .35s ease; }
.hero-overlay { position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(10,10,14,.88) 10%, rgba(10,10,14,.15)); }
/* Ảnh bìa banner bấm được -> sang trang chi tiết truyện */
.hero-cover-link { position: absolute; left: 40px; top: 50%; transform: translateY(-50%);
  height: 250px; aspect-ratio: 3/4; z-index: 1; border-radius: 8px; display: block;
  box-shadow: 0 12px 32px rgba(0,0,0,.6); transition: opacity .35s ease, transform .3s ease; }
.hero-cover-link:hover { transform: translateY(-50%) scale(1.05); }
.hero-cover { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; display: block; }
.hero-content { position: absolute; left: 240px; right: 30px; bottom: 34px; z-index: 1;
  transition: opacity .35s ease; }
.hero-content h2 { font-size: 30px; color: #fff; margin-bottom: 8px; text-shadow: 0 2px 10px #000; }
.hero-chap { font-size: 14px; color: #ffd54d; font-weight: bold; margin: 0 0 14px; }
#hero-btn { margin-bottom: 18px; }
.hero-dots { position: absolute; bottom: 14px; right: 18px;
  display: flex; gap: 8px; z-index: 2; }
.hero-dots span { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.35);
  cursor: pointer; transition: background .25s, transform .25s; }
.hero-dots span.active { background: #fff; transform: scale(1.3); }

/* Dải truyện theo dõi: 3 cột (thêm truyện sẽ tự xuống hàng 2) */
.follow-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 30px; }
/* Trang chủ: dải "Truyện theo dõi" chỉ hiện 2 hàng (6 truyện), còn lại xem ở trang Theo dõi */
#follow-strip .follow-card:nth-child(n+7) { display: none; }
.follow-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow); transition: background .3s; }
.follow-card img { width: 52px; height: 70px; object-fit: cover; border-radius: 5px; }
.follow-card .t { font-size: 13px; font-weight: 600; display: block; margin-bottom: 5px; line-height: 1.35; }
.follow-card .c { font-size: 12px; color: var(--muted); display: block; padding: 2px 0; }
.follow-card a.c.da-doc { opacity: .55; }

/* Lưới cập nhật gần đây - 6 cột */
.comic-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.comic-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; box-shadow: var(--shadow); transition: transform .2s, background .3s; }
.comic-card:hover { transform: translateY(-4px); }
.comic-card .cover { display: block; position: relative; }
.comic-card .cover img { width: 100%; aspect-ratio: 1/1.12; object-fit: cover; display: block; }
.cover .stats { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.85)); font-size: 11px; color: #ddd;
  display: flex; gap: 10px; }
.comic-card .info { padding: 10px; }
.comic-card .title { font-size: 13px; font-weight: 600; margin-bottom: 8px;
  line-height: 1.35; height: calc(1.35em * 2); overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.chap-line { display: flex; justify-content: space-between; font-size: 11px; padding: 5px 0; color: var(--muted); }
.chap-line a { color: var(--text); opacity: .85; }
.chap-line a:hover { color: var(--accent-soft); }
/* Chap đã đọc ở trang theo dõi: xám đi (vẫn bấm đọc lại được) */
.chap-line.da-doc a { color: var(--muted); opacity: .55; }
.chap-line.da-doc .time { opacity: .55; }
.chap-line .time { white-space: nowrap; margin-left: 6px; }

/* Phân trang (1 2 3 >>) */
.pagination { display: flex; gap: 8px; margin: 4px 0 20px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; height: 36px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 13px; font-weight: 700; text-decoration: none;
  transition: background .2s, transform .2s, border-color .2s; }
.pagination a:hover { transform: translateY(-2px); border-color: var(--accent); }
.pagination .cur { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Thanh lọc/sắp xếp (lỗi #5): 2 select nằm ngang, gọn như 1 dòng chú thích. */
.loc-bar { display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.loc-bar label { display: inline-flex; gap: 6px; align-items: center; }
.loc-bar select { background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
  font-size: 13px; }
.loc-bar-head { margin: 0; }

/* Tabs */
.tabs { display: flex; gap: 18px; font-size: 12px; font-weight: bold; margin-bottom: 15px; }
.tabs span { cursor: pointer; color: var(--muted); padding-bottom: 5px; transition: color .25s; }
.tabs span:hover { color: var(--text); }
.tabs span.active { color: var(--danger); border-bottom: 2px solid var(--danger); }

/* Ô tìm kiếm: thu gọn thành icon, bấm để mở */
.search input { background: var(--input-bg); border: 1px solid var(--border); color: var(--text);
  padding: 7px 14px; border-radius: 20px; font-size: 13px; width: 180px; outline: none; transition: border-color .25s; }
.search input:focus { border-color: var(--accent); }
.search-wrap { display: flex; align-items: center; }
/* Nút icon tìm kiếm: tròn, gradient, SVG sắc nét */
#search-toggle { width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  color: var(--text); background: transparent;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background .2s, transform .2s; }
#search-toggle:hover { background: var(--hover-bg, rgba(128,128,128,.15)); transform: scale(1.08); }
#search-toggle:active { transform: scale(.94); }
/* Animation khi click icon tìm kiếm: nảy + xoay nhẹ */
#search-toggle.clicked { animation: searchPop .45s ease; }
@keyframes searchPop {
  0% { transform: scale(1) rotate(0deg); }
  30% { transform: scale(.8) rotate(-14deg); }
  60% { transform: scale(1.15) rotate(6deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.search-form { display: flex; align-items: center; gap: 0; }
.search-form input { width: 220px; background: var(--input-bg); border: 1px solid var(--border);
  border-right: none; color: var(--text); padding: 9px 14px; border-radius: 20px 0 0 20px;
  font-size: 13px; outline: none; transition: border-color .25s, box-shadow .25s; }
.search-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,87,34,.12); }
.search-form button[type="submit"] { height: 35px; padding: 0 14px; border: 1px solid var(--accent);
  border-radius: 0 20px 20px 0; background: linear-gradient(135deg, var(--accent), var(--danger));
  color: #fff; cursor: pointer; display: inline-flex; align-items: center;
  transition: filter .2s, transform .2s; }
.search-form button[type="submit"]:hover { filter: brightness(1.12); transform: scale(1.04); }
/* Cửa sổ tìm kiếm nổi: bấm icon hiện lên, gõ là ra kết quả */
.search-modal { position: fixed; inset: 0; z-index: 100; display: none;
  align-items: flex-start; justify-content: center; padding: 12vh 16px 16px;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.search-modal.open { display: flex; animation: modalIn .28s ease; }
@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }
.search-modal.open .search-modal-box { animation: boxIn .34s cubic-bezier(.2,.9,.3,1.25); }
@keyframes boxIn {
  from { opacity: 0; transform: translateY(28px) scale(.95); }
  to { opacity: 1; transform: none; }
}
.search-modal-box { width: 560px; max-width: 100%; background: var(--card);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  overflow: hidden; }
.search-modal-bar { display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--border); }
.search-modal-bar input { flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 17px; }
.search-modal-bar input::placeholder { color: var(--muted); }
#search-close { background: var(--input-bg); border: 1px solid var(--border); color: var(--muted);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 13px;
  transition: transform .2s, color .2s; flex-shrink: 0; }
#search-close:hover { transform: rotate(90deg); color: var(--text); }
.search-modal-results { max-height: 46vh; overflow-y: auto; padding: 8px; }
.search-hint { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 10px; margin: 0; }
.sr-item { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 10px;
  text-decoration: none; transition: background .2s; }
.sr-item:hover { background: rgba(255,87,34,.08); }
.sr-item img, .sr-noimg { width: 44px; height: 58px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.sr-noimg { background: var(--input-bg); }
.sr-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sr-title { font-size: 14px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-chap { font-size: 12px; color: var(--muted); }
.search-modal-all { display: block; text-align: center; padding: 12px; font-size: 13px;
  font-weight: 600; color: var(--accent); border-top: 1px solid var(--border);
  text-decoration: none; }
.search-modal-all:hover { background: rgba(255,87,34,.08); }

/* Trang chi tiết */
.breadcrumb { font-size: 13px; color: var(--muted); margin: 6px 0;
  line-height: 1.6; display: flex; align-items: center; }
.breadcrumb a { text-decoration: underline; }
.breadcrumb + .section-head { margin-top: 6px; }
.detail-box { background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 20px; display: flex; gap: 25px; margin-bottom: 20px; box-shadow: var(--shadow); transition: background .3s; }
.detail-box img.cover { width: 200px; aspect-ratio: 3/4; border-radius: 6px; align-self: flex-start; }
.detail-box .detail-info { flex: 1; min-width: 0; }
.detail-genres { margin: 10px 0; }
.desc-box { background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.detail-box h1 { font-size: 24px; margin-bottom: 10px; }
.stat-ic { display: inline-flex; align-items: center; gap: 5px; }
.stat-ic svg { flex-shrink: 0; }
.stat-line { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center;
  font-size: 12px; min-height: 18px; }
.stat-row { display: flex; gap: 18px; font-size: 13px; color: var(--muted); margin: 8px 0; }
.genre { display: inline-block; background: var(--input-bg); color: var(--accent-soft);
  font-size: 12px; padding: 4px 10px; border-radius: 12px; margin: 0 5px 5px 0; }
.desc { color: var(--muted); line-height: 1.7; font-size: 14px; margin: 0; }
.chapter-box { background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 20px; box-shadow: var(--shadow); transition: background .3s; }
.chapter-list { list-style: none; max-height: 600px; overflow-y: auto; }
.chapter-list li { border-bottom: 1px solid var(--border); }
.chapter-list a { display: flex; justify-content: space-between; padding: 10px 5px; font-size: 14px; }
.chapter-list .time { font-size: 12px; color: var(--muted); }
/* ===== Lưới chapter kiểu card ===== */
.chapter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.chap-card { background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column;
  gap: 5px; transition: transform .2s, border-color .2s; }
.chap-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.chap-num { font-weight: 700; font-size: 15px; }
.chap-meta { display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--muted); }
.chap-meta .view { white-space: nowrap; }
.chap-hidden { display: none; }
.chapter-grid.expanded .chap-hidden { display: flex; }
.show-all-btn { width: 100%; margin-top: 14px; padding: 14px;
  background: transparent; border: 2px dashed var(--border); border-radius: 10px;
  color: var(--text); font-size: 14px; font-weight: 700; letter-spacing: 2px;
  cursor: pointer; transition: all .2s; }
.show-all-btn:hover { border-color: var(--accent); color: var(--accent); }
/* Nút yêu thích */
.btn-like { font-size: 16px; }
.btn-like.liked { color: #ff5a5a; border-color: #ff5a5a; }
.btn-like #like-count { font-size: 14px; margin-left: 4px; }
/* Cụm nút trang chi tiết: layout cũ, nút dài viền xanh nền đen */
.detail-actions { display: flex; gap: 10px; align-items: center;
  margin: 14px 0; flex-wrap: wrap; }
.btn-moi { padding: 10px 22px; border-radius: 12px;
  background: #0a0a0e; border: 1.5px solid var(--accent);
  color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform .15s, background .15s, box-shadow .15s; }
/* Nút "Đọc tiếp Chapter X": luôn 1 hàng, không xuống dòng trên mobile */
.btn-doc-tiep { white-space: nowrap; }
@media (max-width: 480px){
  .btn-doc-tiep { font-size: 13px; padding: 10px 12px; }
}
.btn-moi:hover { background: var(--accent); color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(108,140,255,.45); }
.btn-moi.liked { color: #ff6b6b; }
.btn-moi.liked:hover { background: #ff5a5a; border-color: #ff5a5a;
  color: #fff; box-shadow: 0 6px 18px rgba(255,90,90,.45); }
.btn-moi.active { color: var(--accent-soft); }
.btn-moi.danger { color: var(--muted); }
.btn-moi.danger:hover { background: var(--danger); border-color: var(--danger);
  color: #fff; box-shadow: 0 6px 18px rgba(255,90,90,.45); }
.btn-moi #like-count { font-weight: 700; }
/* Light mode: nút nền trong suốt, hover mới lên xanh */
:root.light .btn-moi { background: transparent; color: #333; }
:root.light .btn-moi:hover { background: var(--accent); color: #fff; }
:root.light .btn-moi.liked { color: #e04444; }
:root.light .btn-moi.liked:hover { background: #e04444; color: #fff; }
:root.light .btn-moi.danger { color: #777; }
:root.light .btn-moi.danger:hover { background: var(--danger); color: #fff; }
/* Mô tả rút gọn: hiện 4 dòng, bấm xem thêm để mở hết */
.desc-wrap { margin: 0; }
.desc.rut-gon { display: -webkit-box; -webkit-line-clamp: 4;
  -webkit-box-orient: vertical; overflow: hidden; }
.desc-toggle { background: none; border: none; color: var(--accent);
  font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 0 0; }
.desc-toggle:hover { text-decoration: underline; }
/* Bình luận */
.comment-box { margin-top: 22px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.bl-form { display: flex; gap: 10px; margin: 12px 0 16px; }
.bl-form textarea { flex: 1; background: var(--input-bg); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 10px 12px; font-size: 14px;
  font-family: inherit; resize: vertical; outline: none;
  min-height: 64px; max-height: 300px; }
.bl-form textarea:focus { border-color: var(--accent); }
.bl-form .btn { align-self: flex-end; }
.bl-item { border-top: 1px solid var(--border); padding: 12px 0;
  display: flex; gap: 12px; }
.bl-avatar { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--danger));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; position: relative; overflow: hidden; }
.bl-avatar img { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; }
.bl-main { flex: 1; min-width: 0; }
.bl-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.bl-head b { font-size: 14px; color: var(--accent-soft); }
.bl-time { font-size: 12px; color: var(--muted); }
.bl-xoa { margin-left: auto; background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 6px; }
.bl-xoa:hover { color: var(--danger); background: var(--card); }
.bl-body { font-size: 14px; line-height: 1.55; white-space: pre-wrap;
  word-break: break-word; }
.bl-mention { color: var(--accent); font-weight: 600; }
/* Nút like/dislike bình luận */
.bl-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.bl-vote { background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 12px; font-size: 14px; cursor: pointer;
  color: var(--text); transition: transform .15s, border-color .15s; }
.bl-vote:hover { transform: scale(1.08); border-color: var(--accent); }
.bl-vote.active-like { border-color: #4caf50; color: #4caf50; }
.bl-vote.active-dislike { border-color: var(--danger); color: var(--danger); }
/* Chapter đã đọc: chữ xám */
.chap-card.da-doc { opacity: .5; }
.chap-card.da-doc .chap-num { color: var(--muted); font-weight: 400; }
@media (max-width: 768px) { .chapter-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .chapter-grid { grid-template-columns: 1fr; } }
.note { color: var(--muted); font-size: 13px; margin-top: 12px; }
.loi { color: var(--danger); font-size: 13px; padding: 10px; }

/* Trang đọc */
.reader-nav { position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; z-index: 10; }
.reader-nav a { font-size: 14px; color: var(--muted); }
.reader-nav a:hover { color: var(--accent); }
.chap-title { font-weight: bold; }
#reader { max-width: 800px; margin: 0 auto; background: var(--reader-bg); min-height: 400px; transition: background .3s; }
#reader img { width: 100%; display: block; pointer-events: none; user-select: none;
  -webkit-user-select: none; -webkit-touch-callout: none;
  min-height: 52vh; background: #0d0d10; }
#reader img.ld { min-height: 0; background: transparent; }
.reader-bottom { background: var(--panel); padding: 20px; text-align: center; }
.btn { background: var(--accent); color: #fff; border: none; padding: 8px 16px; border-radius: 5px;
  cursor: pointer; font-size: 14px; display: inline-block; margin: 0 8px;
  transition: transform .2s, box-shadow .2s, background .2s; }
.btn:hover { background: var(--accent-soft); color: #fff; transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(108,140,255,.45); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-danger { background: #d33; }
.btn-danger:hover { background: #b22; }
.btn-small { padding: 5px 10px; font-size: 12px; }
.btn-ghost { background: var(--input-bg); color: var(--text); }
.btn-ghost:hover { background: var(--border); color: var(--text); transform: none; }

/* Trang quản lý admin */
.admin-tabs { display: flex; gap: 8px; margin: 15px 0 20px; flex-wrap: wrap; }
.admin-tab { padding: 9px 18px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); cursor: pointer; font-size: 14px; }
.admin-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.admin-pane { display: none; }
.admin-pane.active { display: block; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 9px 10px; border-bottom: 1px solid var(--border);
  text-align: left; vertical-align: middle; }
.admin-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.admin-table img.thumb { width: 44px; height: 58px; object-fit: cover; border-radius: 5px; }
.admin-form { background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 18px; margin-bottom: 20px; display: none; }
.admin-form.open { display: block; }
/* Form đăng truyện dạng popup modal */
.dt-form-wrap { display: none; }
.dt-form-wrap.open { display: block; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.65); backdrop-filter: blur(3px);
  overflow-y: auto; padding: 30px 16px; }
.dt-form-wrap.open .dt-form { display: block; margin: 0 auto; max-width: 900px;
  animation: dtPop .25s ease; }
@keyframes dtPop { from { opacity: 0; transform: translateY(24px) scale(.98); }
  to { opacity: 1; transform: none; } }
.admin-form label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.admin-form input[type=text], .admin-form input[type=password], .admin-form textarea {
  width: 100%; padding: 9px 10px; border-radius: 6px; font-size: 14px;
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text); }
.admin-form textarea { min-height: 90px; resize: vertical; font-family: inherit; }
.ok { color: #4caf50; font-size: 13px; margin: 6px 0; }
.role-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px;
  font-weight: bold; background: var(--input-bg); color: var(--muted); }
.role-badge.admin { background: rgba(255,180,0,.15); color: #ffb400; }
/* Dòng chapter trong form thêm truyện: tên + giờ + nút Chọn tệp */
#chapter-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.ch-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px; }
.ch-row .ch-ten { flex: 0 0 auto; min-width: 92px; font-weight: bold;
  font-size: 14px; color: var(--text); }
.ch-pick { position: relative; }
.ch-pick-menu { position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%); z-index: 50;
  display: flex; flex-direction: column; min-width: 150px;
  background: var(--bg, #1a1a1a); border: 1px solid var(--border, #444);
  border-radius: 8px; padding: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.ch-pick-menu button { background: none; border: none; text-align: left;
  padding: 9px 12px; border-radius: 6px; cursor: pointer;
  color: var(--text); font-size: 14px; }
.ch-pick-menu button:hover { background: rgba(127,127,127,.18); }
.upload-bar { height: 6px; border-radius: 3px; background: rgba(127,127,127,.25);
  margin-top: 6px; overflow: hidden; flex-basis: 100%; }
.upload-fill { height: 100%; border-radius: 3px;
  background: var(--accent, #e02020); transition: width .2s; }
.file-btn { display: inline-block; padding: 8px 14px; border-radius: 6px;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  font-size: 13px; cursor: pointer; white-space: nowrap; }
.file-btn:hover { border-color: var(--accent); color: var(--accent); }
.ch-info { font-size: 12px; color: var(--muted); }
.ch-xoa { background: none; border: none; color: var(--muted); font-size: 20px;
  cursor: pointer; padding: 2px 8px; line-height: 1; }
.ch-xoa:hover { color: #f44336; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 25px 0; }
.footer a { text-decoration: underline; padding: 4px 2px; }

/* Đăng nhập/đăng ký: khung bo tròn căn giữa, banner trái + form phải */
.auth-page { display: flex; align-items: center; justify-content: center;
  padding: 20px 16px; min-height: calc(100vh - 140px); }
.auth-box { display: flex; width: 960px; max-width: 100%; border-radius: 20px;
  overflow: hidden; background: var(--card); border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  max-height: calc(100vh - 180px); }
.auth-banner { width: 440px; flex-shrink: 0; position: relative; align-self: stretch;
  background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d); }
.auth-banner img.ab-slide { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity 1.4s ease; }
.auth-banner img.ab-slide.active { opacity: 1; }
.auth-form-side { flex: 1; display: flex;
  padding: 28px 36px; overflow-y: auto; }
@media (max-width: 820px) {
  .auth-box { flex-direction: column; width: 400px; }
  .auth-banner { width: 100%; min-height: 240px; }
}
.auth-card { position: relative; width: 400px; max-width: 100%;
  margin: auto; padding: 36px 34px; animation: fadeUp .45s ease; }
.auth-card h2 { text-align: center; margin: 0 0 6px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.auth-card input { width: 100%; background: var(--input-bg); border: 1px solid var(--border);
  color: var(--text); padding: 11px 14px; border-radius: 8px; margin-bottom: 12px;
  font-size: 14px; outline: none; transition: border-color .25s, box-shadow .25s; }
.auth-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,87,34,.15); }
.auth-card .btn { width: 100%; margin: 4px 0 6px; padding: 11px; font-size: 15px; }
.auth-loi { color: var(--danger); font-size: 13px; margin-bottom: 12px; text-align: center; }
.auth-sw { font-size: 13px; color: var(--muted); text-align: center; margin: 10px 0 0; }
.auth-remember { display: flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--muted); margin: 2px 0 12px; cursor: pointer; }
.auth-remember input { width: auto; margin: 0; padding: 0; accent-color: var(--accent); }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: #fff; color: #3c4043; border: 1px solid #dadce0; border-radius: 8px; padding: 10px;
  font-size: 14px; font-weight: 600; text-decoration: none;
  transition: box-shadow .25s, transform .2s; }
.btn-google:hover { box-shadow: 0 2px 12px rgba(0,0,0,.25); transform: translateY(-1px); }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--muted);
  font-size: 12px; margin: 18px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

@media (max-width: 1000px) { .comic-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 700px) {
  .comic-grid { grid-template-columns: repeat(3, 1fr); }
  /* Truyện theo dõi (mobile): lưới 2 hàng lướt ngang — mỗi khung hiện 2 truyện
     xếp chồng đúng kiểu mockup (bìa + tên trái, chapter phải), vuốt qua xem tiếp */
  .follow-strip { display: grid; grid-template-columns: none; grid-auto-flow: column;
    grid-template-rows: repeat(2, auto); grid-auto-columns: 100%;
    overflow-x: auto; scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 10px; padding-bottom: 4px; }
  .follow-strip::-webkit-scrollbar { display: none; }
  /* mobile hiện lại toàn bộ truyện để lướt xem (desktop giữ tối đa 6) */
  #follow-strip .follow-card:nth-child(n+7) { display: flex; }
  .follow-strip .follow-card { scroll-snap-align: start;
    display: flex; flex-direction: row; align-items: center; text-align: left;
    padding: 10px; gap: 12px; }
  .follow-strip .follow-card img { width: 62px; height: 82px; flex-shrink: 0; }
  /* cột chữ chiếm hết chiều rộng còn lại, không bị bóp */
  .follow-strip .follow-card > div { flex: 1; min-width: 0; }
  .follow-strip .follow-card .t { font-size: 14px; line-height: 1.35; }
  .follow-strip .follow-card .c { font-size: 12px; line-height: 1.5; }
  .detail-box { flex-direction: column; }
  .detail-box img.cover { width: 150px; }
  .hero { height: 200px; }
  .hero-cover-link { height: 160px; left: 20px; }
  .hero-content { left: 150px; bottom: 34px; }
  .hero-content h2 { font-size: 20px; }
  .hero-chap { font-size: 12px; margin-bottom: 8px; }
  .search-form input { width: 140px; }
  /* Mobile: dropdown 2 cột, có scroll vì màn hình thấp */
  .drop-menu { width: 78vw; left: -30px; grid-template-columns: repeat(2, 1fr);
    max-height: 62vh; overflow-y: auto; padding: 10px 12px; }
  .search-modal-box { width: 94vw; }
}
/* Huy hiệu tu vi ở header */
.tuvi-badge { font-size: 12px; padding: 4px 12px; border-radius: 12px;
  color: #fff; white-space: nowrap; font-weight: 700; letter-spacing: .3px;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
  box-shadow: 0 2px 8px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.25);
  border: 1px solid rgba(255,255,255,.25); }
/* Mô tả tích hợp trong khung thông tin truyện */
.detail-desc { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.detail-desc .desc { margin: 0; }
/* Huy hiệu tu tiên + tag chapter trong bình luận */
.bl-hh { font-size: 10px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
.bl-chap { font-size: 11px; color: var(--accent); border: 1px solid var(--accent);
  border-radius: 10px; padding: 1px 8px; margin-left: 6px; white-space: nowrap; }
/* Trả lời bình luận */
.bl-reply-btn { background: none; border: none; color: var(--accent);
  font-size: 13px; cursor: pointer; padding: 4px 8px; }
.bl-reply-btn:hover { text-decoration: underline; }
.bl-replies { margin-left: 48px; margin-top: 8px; }
.bl-item.bl-reply { margin-bottom: 10px; }
.bl-reply-form { margin-left: 48px; margin-top: 8px; }
.bl-reply-form textarea { width: 100%; background: var(--input-bg);
  border: 1px solid var(--border); color: var(--text); padding: 8px 12px;
  border-radius: 8px; font-size: 14px; margin-bottom: 8px;
  resize: vertical; min-height: 56px; max-height: 240px; font-family: inherit; }
.btn-sm { padding: 6px 16px; font-size: 13px; }
/* Picker cảm xúc Facebook */
.bl-react { position: relative; }
.bl-react-btn { background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 12px; font-size: 15px; cursor: pointer;
  transition: transform .15s; }
.bl-react-btn:hover { transform: scale(1.12); }
.bl-react-picker { position: absolute; bottom: 130%; left: 0; display: none;
  background: var(--card); border: 1px solid var(--border); border-radius: 24px;
  padding: 6px 10px; gap: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 20; }
.bl-react-picker.open { display: flex; animation: popIn .18s ease; }
.bl-react-picker span { font-size: 22px; cursor: pointer; padding: 4px;
  border-radius: 50%; transition: transform .15s; }
.bl-react-picker span:hover { transform: scale(1.35); }
.bl-cx-count { font-size: 13px; color: var(--muted); }
@keyframes popIn { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: scale(1); } }
/* Nút icon tròn giống chuông thông báo */
.icon-btn { display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  background: transparent; color: var(--text);
  transition: background .2s, transform .2s; }
.icon-btn:hover { background: var(--hover-bg, rgba(128,128,128,.15)); transform: scale(1.08); }
.icon-btn svg { display: block; }
.avatar-btn svg { display: block; margin: auto; }
/* Thanh tiến trình crawl thủ công trong menu tài khoản */
.crawl-progress { display: flex; align-items: center; gap: 8px; padding: 8px 16px; }
.crawl-bar-wrap { flex: 1; height: 8px; background: var(--input-bg); border-radius: 4px; overflow: hidden; }
.crawl-bar { height: 100%; width: 1%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #ff8a50);
  transition: width .4s ease; }
.crawl-pct { font-size: 12px; color: #fff; font-weight: 700; min-width: 52px; text-align: right;
  text-shadow: 0 1px 3px rgba(0,0,0,.6); }
/* Dropdown thông báo */
.bell-wrap { position: relative; }
.bell-btn.co-tb svg { animation: bellRing 1s ease; }
@keyframes bellRing { 0%,100% { transform: rotate(0); } 25% { transform: rotate(15deg); } 75% { transform: rotate(-15deg); } }
.bell-dropdown { position: absolute; top: 44px; right: 0; width: 340px; max-height: 420px;
  transform-origin: top right;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.4); z-index: 100; overflow: hidden;
  display: flex; flex-direction: column; }
.bell-dropdown.mo { animation: bellMo .25s cubic-bezier(.2,.9,.3,1.15); }
.bell-btn.ring svg { animation: bellRing .5s ease; }
@keyframes bellMo {
  from { opacity: 0; transform: scale(.92) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.bell-drop-head { display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 700; }
.bell-drop-head button { background: none; border: none; color: var(--accent);
  font-size: 12px; cursor: pointer; }
/* 2 tab Thông báo / Hộp thư ở đầu dropdown chuông */
.bell-drop-head .tb-tab { color: var(--muted); font-size: 14px; font-weight: 600;
  padding: 2px 0 5px; margin-right: 14px; }
.bell-drop-head .tb-tab.bat { color: var(--text); font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--accent); }
.tb-tab-so { display: inline-block; min-width: 16px; padding: 0 4px; margin-left: 5px;
  border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px;
  font-weight: 700; line-height: 16px; text-align: center; vertical-align: 2px; }
.bell-drop-list { overflow-y: auto; }
.tb-item { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 10px; }
.tb-bia { width: 44px; height: 58px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.tb-than { flex: 1; min-width: 0; }
.tb-item:hover { background: var(--hover-bg, rgba(128,128,128,.1)); }
.tb-item.tb-moi { background: rgba(128,128,128,.18); }
.tb-tieu-de { font-weight: 600; font-size: 14px; }
.tb-admin-tag { display: inline-block; background: #4A6CF7; color: #fff; font-size: 9px; font-weight: 700; letter-spacing: .4px; padding: 1px 5px; border-radius: 4px; vertical-align: 2px; margin-right: 5px; }
.tb-noi-dung { font-size: 13px; color: var(--muted); margin-top: 4px; }
.tb-time { font-size: 11px; color: var(--muted); margin-top: 4px; }
/* Hiệu ứng nhảy số lượt thích */
#like-count.nhay-so { display: inline-block; animation: nhaySo .6s ease; color: var(--accent); font-weight: 700; }
@keyframes nhaySo { 0% { transform: scale(1); } 30% { transform: scale(1.8); } 60% { transform: scale(0.9); } 100% { transform: scale(1); } }
/* Cảnh giới trong menu tài khoản */
.drawer-canh-gioi { padding: 13px 12px; font-size: 15px; color: var(--text);
  display: flex; gap: 14px; align-items: center; border-radius: 8px;
  white-space: nowrap; }
.drawer-canh-gioi .tuvi-badge { font-size: 12px; padding: 3px 10px; border-radius: 10px; color: #fff; }
/* Thanh EXP tu tiên trong menu tài khoản */
.exp-wrap { position: relative; flex: 1; min-width: 80px; height: 18px;
  background: var(--input-bg); border-radius: 9px; overflow: hidden; }
.exp-bar { display: block; height: 100%; border-radius: 9px; transition: width .5s ease; }
.exp-txt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.65); }
/* Dấu ... trong phân trang */
.pagination .dots { padding: 8px 4px; color: var(--muted); }
/* Thông báo đột phá cảnh giới: toast tối giản trên cùng, tự ẩn */
.toast-dotpha { position: fixed; top: 70px; left: 50%; transform: translate(-50%, -20px);
  z-index: 9999; background: rgba(20,22,28,.94); color: #fff;
  padding: 12px 22px; border-radius: 999px; font-size: 14px; font-weight: 500;
  white-space: nowrap; box-shadow: 0 8px 24px rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.1); cursor: pointer;
  opacity: 0; pointer-events: none; transition: all .35s ease; }
.toast-dotpha.hien { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-dotpha .ten { color: #ffb74d; font-weight: 700; }
/* Popup đột phá cảnh giới */
.len-canh-gioi-pop { position: fixed; inset: 0; z-index: 9999; display: flex;
  align-items: center; justify-content: center; background: rgba(0,0,0,.7);
  animation: lcgHien .4s ease; }
@keyframes lcgHien { from { opacity: 0; } to { opacity: 1; } }
.lcg-box { background: var(--card); border: 2px solid var(--accent); border-radius: 16px;
  padding: 32px 48px; text-align: center; box-shadow: 0 0 40px rgba(255,87,34,.5);
  animation: lcgPhong 0.5s ease; }
@keyframes lcgPhong { 0% { transform: scale(0.5); } 60% { transform: scale(1.1); } 100% { transform: scale(1); } }
.lcg-title { font-size: 20px; font-weight: 800; color: var(--accent); margin-bottom: 12px; }
.lcg-ten { font-size: 28px; font-weight: 800; margin-bottom: 8px; }
.lcg-tuvi { color: var(--muted); margin-bottom: 20px; }
.lcg-box button { background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 10px 24px; font-size: 15px; cursor: pointer; }
/* Toast thông báo góc phải dưới */
.toast-tc { position: fixed; right: 24px; bottom: 24px; z-index: 9999;
  background: #2e7d32; color: #fff; padding: 14px 22px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.4);
  opacity: 0; transform: translateY(20px); transition: all .35s ease; }
.toast-tc.hien { opacity: 1; transform: translateY(0); }
/* Toast trên cùng cho nút tải lại ảnh */
.toast-top { position: fixed; top: 70px; left: 50%; transform: translate(-50%, -20px);
  z-index: 9999; background: rgba(20,22,28,.92); color: #fff; padding: 12px 24px;
  border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.12);
  opacity: 0; pointer-events: none; transition: all .3s ease; }
.toast-top.hien { opacity: 1; transform: translate(-50%, 0); }
.toast-tc.toast-loi { background: #c62828; }
/* Popup thông báo mới góc phải dưới - kiểu hiện đại */
#tb-popup-box { position: fixed; right: 20px; bottom: 20px; z-index: 10001;
  display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 40px)); }
.tb-popup { display: flex; gap: 12px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 14px 14px 12px; box-shadow: 0 12px 32px rgba(0,0,0,.35);
  cursor: pointer; opacity: 0; transform: translateX(40px);
  transition: opacity .35s ease, transform .35s ease; position: relative; }
.tb-popup.hien { opacity: 1; transform: translateX(0); }
.tb-popup:hover { border-color: var(--accent); }
.tb-popup-icon { flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7b5cff); color: #fff;
  display: flex; align-items: center; justify-content: center; }
.tb-popup-body { flex: 1; min-width: 0; }
.tb-popup-title { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.tb-popup-msg { font-size: 13px; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tb-popup-time { font-size: 11px; color: var(--muted); margin-top: 4px; opacity: .8; }
.tb-popup-close { position: absolute; top: 6px; right: 8px; background: none; border: none;
  color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; padding: 2px 6px; }
.tb-popup-close:hover { color: var(--text); }

/* ===== Hộp Tải ứng dụng (mở nổi giữa màn hình, không cần cuộn trang) ===== */
.tai-app-modal { position: fixed; inset: 0; z-index: 1500; display: none;
  align-items: center; justify-content: center; background: rgba(0,0,0,.55); padding: 16px; }
.tai-app-modal.mo { display: flex; animation: taiAppFade .25s ease; }
.tai-app-modal.mo .tai-app-box { animation: taiAppPop .32s cubic-bezier(.21,1.02,.55,1.15); }
@keyframes taiAppFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes taiAppPop { from { opacity: 0; transform: translateY(16px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); } }
.tai-app-box { position: relative; width: 100%; max-width: 400px; max-height: 92vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 22px 22px 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.tai-app-x { position: absolute; top: 10px; right: 12px; background: none; border: none;
  color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px 8px; line-height: 1; }
.tai-app-x:hover { color: var(--text); }
.tai-app-title { font-size: 19px; font-weight: 700; margin-bottom: 16px; }
.tai-app-tabs { display: flex; gap: 4px; background: var(--input-bg); border-radius: 999px; padding: 4px; margin-bottom: 20px; }
.tai-app-tab { flex: 1; border: none; background: transparent; color: var(--muted); font-size: 14px;
  padding: 8px 0; border-radius: 999px; cursor: pointer; font-family: inherit; }
.tai-app-tab.bat { background: var(--panel); color: var(--text); font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.tai-app-qr { background: #fff; border-radius: 16px; padding: 14px; width: 224px; max-width: 100%; margin: 0 auto 16px; }
.tai-app-qr img { display: block; width: 100%; height: auto; }
.tai-app-cap { font-size: 13px; color: var(--muted); text-align: center; line-height: 1.55; }
.tai-app-dl { display: block; text-align: center; margin-top: 16px; padding: 11px 0; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 14px; text-decoration: none; }
.tai-app-dl:hover { opacity: .92; }

/* ===== Trang Đăng truyện hiện đại ===== */
.dt-btn-them { display: inline-flex; align-items: center; gap: 8px; font-size: 15px;
  padding: 11px 22px; border-radius: 10px; margin-bottom: 16px; }
.dt-form { max-width: 860px; padding: 0; overflow: hidden;
  border-radius: 14px; border: 1px solid var(--border); }
.dt-form-head { display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  background: var(--card2, rgba(255,255,255,.03)); }
.dt-form-head h3 { margin: 0; font-size: 18px; }
.dt-close { background: none; border: none; font-size: 28px; color: var(--muted);
  cursor: pointer; line-height: 1; padding: 0 4px; }
.dt-close:hover { color: var(--text); }
.dt-section { padding: 28px 24px; border-bottom: 1px solid var(--border); }
.dt-section:last-of-type { border-bottom: none; }
.dt-section-title { font-size: 16px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px; }
.dt-num { display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; font-size: 13px;
  background: var(--accent); color: #fff; flex-shrink: 0; }
.dt-hint { font-weight: 400; font-size: 13px; color: var(--muted); }
.dt-required { color: #e5484d; }
.dt-grid { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
@media (max-width: 640px){ .dt-grid { grid-template-columns: 1fr; } }
.dt-cover-box { display: flex; flex-direction: column; gap: 12px; }
.dt-cover-preview { width: 100%; aspect-ratio: 3/4; border-radius: 10px;
  border: 2px dashed var(--border); display: flex; align-items: center;
  justify-content: center; overflow: hidden; background: var(--card2, rgba(255,255,255,.02)); }
.dt-cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.dt-cover-empty { color: var(--muted); font-size: 13px; }
.dt-info-box { display: flex; flex-direction: column; gap: 10px; }
.dt-label { font-size: 13px; font-weight: 600; margin-top: 14px; }
.dt-label:first-child { margin-top: 0; }
.dt-info-box .dt-input { margin-bottom: 4px; }
.dt-input { width: 100%; padding: 11px 14px; border-radius: 9px; font-size: 14px;
  border: 1px solid var(--border); background: var(--input-bg); color: var(--text); }
.dt-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(66,133,244,.15); }
.dt-chapters { display: flex; flex-direction: column; gap: 14px; }
.dt-ch-card { border: 1px solid var(--border); border-radius: 12px; padding: 0;
  background: var(--card2, rgba(255,255,255,.02)); }
.dt-ch-card .dt-ch-head { border-radius: 12px 12px 0 0; }
.dt-ch-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  background: linear-gradient(135deg, rgba(66,133,244,.08), rgba(66,133,244,.02));
  border-bottom: 1px solid var(--border); }
.dt-ch-head .ch-ten { font-weight: 700; font-size: 16px; flex: 1;
  display: flex; align-items: center; gap: 8px; }
.dt-ch-head .ch-ten::before { content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0; }
.dt-ch-head .ch-info { font-size: 13px; color: var(--accent); font-weight: 600;
  background: rgba(66,133,244,.1); padding: 4px 12px; border-radius: 20px; }
.dt-ch-head .ch-xoa { background: rgba(229,72,77,.1); border: none; font-size: 18px;
  color: #e5484d; cursor: pointer; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; line-height: 1; }
.dt-ch-head .ch-xoa:hover { background: #e5484d; color: #fff; }
.dt-dropzone { margin: 16px; padding: 28px 20px; border: 2px dashed var(--border);
  border-radius: 12px; text-align: center; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transition: all .25s; background: rgba(127,127,127,.03); }
.dt-dropzone:hover { border-color: var(--accent); }
.dt-dropzone.drag { border-color: var(--accent); background: rgba(66,133,244,.1);
  color: var(--accent); transform: scale(1.01); }
.dt-dropzone svg { opacity: .6; }
.dt-dropzone.drag svg { opacity: 1; }
.dt-drop-text { font-size: 14px; }
.dt-dropzone .ch-pick-btn { margin-top: 4px; padding: 10px 24px; font-size: 14px;
  border-radius: 8px; }
.dt-thumbs { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px 16px; }
.dt-thumb { width: 56px; height: 72px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border); }
.dt-thumb-more { width: 56px; height: 72px; border-radius: 6px; display: flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
  background: var(--card2); border: 1px solid var(--border); color: var(--muted); }
.dt-btn-them-ch { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  padding: 9px 18px; border-radius: 9px; border: 1px dashed var(--accent);
  background: none; color: var(--accent); font-size: 14px; cursor: pointer; }
.dt-btn-them-ch:hover { background: rgba(66,133,244,.08); }
.dt-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 24px;
  border-top: 1px solid var(--border); background: var(--card2, rgba(255,255,255,.02)); }
.dt-btn-luu { display: inline-flex; align-items: center; gap: 8px; font-size: 15px;
  padding: 11px 28px; border-radius: 10px; }
.dt-progress { padding: 16px 24px; border-top: 1px solid var(--border); }
.dt-progress-bar { height: 8px; border-radius: 4px; background: var(--accent);
  width: 0%; transition: width .3s; }
.dt-progress-text { font-size: 13px; color: var(--muted); margin-top: 8px; text-align: center; }

/* ===== Hashtag thể loại ===== */
.dt-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; min-height: 10px; }
.dt-tag-chon { display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 20px; }
.dt-tag-chon b { cursor: pointer; font-size: 16px; line-height: 1; opacity: .8; }
.dt-tag-chon b:hover { opacity: 1; }
.dt-tags-goi-y { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px;
  max-height: 120px; overflow-y: auto; padding: 10px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--card2, rgba(255,255,255,.02)); }
.dt-tag { padding: 6px 13px; border-radius: 20px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); background: none; color: var(--text);
  transition: all .15s; }
.dt-tag:hover { border-color: var(--accent); color: var(--accent); }
.dt-tag.chon { background: var(--accent); border-color: var(--accent); color: #fff; }
.dt-tag-them { display: flex; gap: 8px; }
.dt-tag-them .dt-input { flex: 1; }

/* Tab chọn ảnh bìa: URL / Tải từ máy */
.dt-cover-tabs { display: flex; gap: 6px; margin: 10px 0 8px; }
.dt-cover-tab { flex: 1; padding: 8px; border-radius: 8px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); background: none; color: var(--muted); }
.dt-cover-tab.active { border-color: var(--accent); color: var(--accent); font-weight: 600;
  background: rgba(66,133,244,.08); }

/* Lưới truyện đã đăng */
.dt-truyen-grid { margin-top: 16px; }
.dt-truyen-card .info { display: flex; flex-direction: column; }
.dt-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.dt-card-actions .btn-small { min-width: 0; height: 32px; padding: 0 2px; font-size: 12px; font-weight: 600;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  gap: 3px; transition: all .2s; white-space: nowrap; overflow: hidden; line-height: 1; }
.dt-card-actions .btn-small svg { flex-shrink: 0; }
.dt-card-actions .btn-small:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.dt-card-actions .btn-small:active { transform: translateY(0); }

/* Ảnh bìa: icon thêm ảnh */
.dt-cover-preview { cursor: pointer; position: relative; }
.dt-cover-preview:hover { border-color: var(--accent); }
.dt-cover-add { display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--muted); font-size: 13px; }
.dt-cover-preview:hover .dt-cover-add { color: var(--accent); }
.dt-cover-preview.co-anh { border-style: solid; cursor: default; }
.dt-cover-doi { position: absolute; bottom: 10px; right: 10px; z-index: 5;
  width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(0,0,0,.65); color: #fff; display: flex;
  align-items: center; justify-content: center; }
.dt-cover-doi:hover { background: var(--accent); }

/* Checkbox công khai tên */
.dt-check { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px;
  cursor: pointer; font-size: 14px; }
.dt-check input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px;
  accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }

/* ===== Responsive: máy tính bảng (<=1024px) ===== */
@media (max-width: 1024px) {
  .container { padding: 0 14px; }
  .dt-form-wrap.open { padding: 20px 12px; }
  .dt-grid { grid-template-columns: 200px 1fr; }
}

/* ===== Responsive: điện thoại (<=768px) ===== */
@media (max-width: 768px) {
  /* Trang chi tiết */
  .detail-box { flex-direction: column; }
  .detail-box img.cover { width: 150px; margin: 0 auto; align-self: center; }
  .detail-box h1 { font-size: 20px; text-align: center; }
  .stat-row { justify-content: center; flex-wrap: wrap; }
  .detail-genres { text-align: center; }

  /* Form đăng truyện */
  .dt-grid { grid-template-columns: 1fr; }
  .dt-cover-box { max-width: 220px; margin: 0 auto; }
  .dt-form { padding: 14px; }
  .dt-form-head h3 { font-size: 16px; }
  .dt-card-actions { gap: 6px; }
  .dt-card-actions .btn-small { font-size: 11px; padding: 7px 4px; }

  /* Bảng admin -> cuộn ngang */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.admin-table { min-width: 640px; }
}

/* ===== Responsive: điện thoại nhỏ (<=480px) ===== */
@media (max-width: 480px) {
  .comic-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .section-title { font-size: 15px; }
  .detail-actions { flex-wrap: wrap; }
  .detail-actions .btn { flex: 1; min-width: 120px; }
  .dt-dropzone { margin: 12px; padding: 20px 12px; }
  .chapter-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== Trang duyệt yêu cầu ===== */
.duyet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.duyet-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
  transition: transform .2s, box-shadow .2s; }
.duyet-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.duyet-user { display: flex; align-items: center; gap: 12px; }
.duyet-avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #7b5cff); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; }
.duyet-name { font-weight: 600; font-size: 15px; }
.duyet-actions { display: flex; gap: 8px; }
.duyet-actions .btn-small { flex: 1; display: inline-flex; align-items: center;
  justify-content: center; gap: 5px; padding: 8px; }
.duyet-truyen { flex-direction: row; align-items: flex-start; }
.duyet-thumb { width: 64px; height: 86px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.duyet-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.duyet-empty { text-align: center; padding: 36px 20px; color: var(--muted);
  background: rgba(127,127,127,.05); border: 1px dashed var(--border); border-radius: 12px; }
.duyet-empty svg { opacity: .4; margin-bottom: 8px; }
.duyet-empty p { margin: 0; }
.duyet-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 10px; background: rgba(66,133,244,.15); color: var(--accent); margin-right: 6px; }
.duyet-tag-quyen { background: rgba(183,121,31,.15); color: #d99a3d; }
.duyet-ok { color: #2ecc71; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.duyet-no { color: #e5484d; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.duyet-log tr:hover td { background: rgba(127,127,127,.05); }
@media (max-width: 640px) { .duyet-grid { grid-template-columns: 1fr; } }

/* Chapter thu gọn/mở rộng */
.dt-ch-card .ch-toggle { display: inline-flex; color: var(--muted); transition: transform .2s; }
.dt-ch-card.thu-gon .ch-toggle { transform: rotate(-90deg); }
.dt-ch-card.thu-gon .dt-dropzone { display: none; }
.dt-ch-head { cursor: pointer; user-select: none; }
.dt-ch-card .ch-toggle svg { flex-shrink: 0; }
/* Mặc định thu gọn các chapter cũ khi sửa, chỉ mở chapter mới thêm */

/* Chapter card gọn */
.dt-ch-compact { cursor: default; padding: 10px 14px; }
.dt-ch-compact .ch-pick-btn { padding: 6px 14px; font-size: 12px; border-radius: 6px; }
.dt-ch-card { transition: border-color .2s, background .2s; }
.dt-ch-card.drag { border-color: var(--accent); background: rgba(66,133,244,.08); }
.dt-ch-card.drag .dt-ch-compact { border-color: var(--accent); }

/* =====================================================
   RESPONSIVE TOÀN DIỆN (bổ sung)
   - Nút hamburger .nav-toggle (desktop: ẩn)
   - Mobile <=768px, điện thoại nhỏ <=480px, rất nhỏ <=360px
   ===================================================== */

/* Nút hamburger: mặc định ẩn trên desktop */
.nav-toggle { display: none; background: transparent; border: none; cursor: pointer;
  color: var(--text); padding: 8px; border-radius: 8px; flex-shrink: 0; }
.nav-toggle:hover { background: var(--hover-bg, rgba(128,128,128,.15)); }
.nav-toggle svg { display: block; }
.nav-toggle svg line { transition: transform .3s ease, opacity .3s ease;
  transform-origin: center; transform-box: fill-box; }
/* Khi menu mở: 3 gạch biến thành X */
.nav-toggle[aria-expanded="true"] svg line:nth-child(1) {
  transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] svg line:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] svg line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg); }

/* ---------- Tablet + Mobile: <=768px ---------- */
@media (max-width: 768px) {
  /* Header gọn lại */
  .header { padding: 8px 12px; gap: 12px; position: relative; }
  .logo { font-size: 20px; }
  .logo small { display: none; }
  .logo-img { height: 44px; }
  .nav-toggle { display: block; }
  .head-right { gap: 8px; }
  .userbox { gap: 8px; }
  #theme-toggle { width: 34px; height: 34px; }

  /* Nav chính thành panel xổ xuống khi mở */
  .mainnav { display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--panel);
    border-bottom: 1px solid var(--border); box-shadow: 0 12px 28px rgba(0,0,0,.35);
    padding: 6px 0; z-index: 55; }
  .mainnav.open { display: flex; animation: navXoXuong .28s cubic-bezier(.2,.9,.3,1.2); transform-origin: top; }
  @keyframes navXoXuong {
    from { opacity: 0; transform: translateY(-12px) scaleY(.95); }
    to { opacity: 1; transform: translateY(0) scaleY(1); }
  }
  .mainnav > a, .mainnav .drop-btn { display: block; padding: 12px 20px;
    font-size: 14px; }
  .mainnav > a::after, .drop-btn::after { display: none; }
  .mainnav > a:hover, .mainnav .drop-btn:hover { background: rgba(128,128,128,.1); transform: none; }
  .nav-drop { padding-bottom: 0; margin-bottom: 0; }
  .nav-drop .drop-menu { position: static; width: auto; max-width: none;
    box-shadow: none; border: none; border-radius: 0; border-top: 1px solid var(--border);
    max-height: 40vh; }
  .topbar { position: sticky; }

  /* Dropdown thông báo không tràn màn hình */
  .bell-dropdown { width: min(340px, calc(100vw - 24px)); right: -8px; }

  /* Ngăn kéo tài khoản gọn trên mobile */
  .account-drawer { width: min(560px, 92vw); }

  /* Tiêu đề section */
  .section-head { margin: 20px 0 12px; flex-wrap: wrap; gap: 8px; }
  .breadcrumb { font-size: 12px; }

  /* Hero gọn hơn */
  .hero { height: 180px; border-radius: 8px; }
  .hero-cover-link { left: 14px; height: 140px; width: 100px; }
  .hero-content { left: 126px; right: 12px; bottom: 16px; }
  .hero-content h2 { font-size: 17px; }
  .hero-chap { font-size: 12px; margin-bottom: 6px; }
  .hero-dots { bottom: 8px; }

  /* Card truyện: chữ gọn */
  .comic-card .info { padding: 8px; }
  .comic-card .title { font-size: 12px; }

  /* Trang chi tiết */
  .detail-genres { display: flex; flex-wrap: wrap; gap: 6px; }
  .detail-actions { flex-wrap: wrap; }
  /* Mobile: nút hành động xếp lưới 2 cột đều nhau */
  .detail-actions { display: grid !important; grid-template-columns: 1fr 1fr; gap: 10px; }
  .detail-actions .btn-moi { justify-content: center; text-align: center; margin: 0 !important; width: auto !important; }
  /* Nút cuối lẻ giãn full hàng (do JS thêm class) */
  .detail-actions .btn-moi.btn-le-cuoi { grid-column: 1 / -1; }
  .bl-replies, .bl-reply-form { margin-left: 24px; }

  /* Lịch sử đọc: item gọn */
  .history-item { padding: 8px 10px; gap: 10px; }

  /* Form chung */
  .auth-card { padding: 28px 22px; }

  /* Trang thống kê: thẻ số liệu xếp dọc */
  .stat-cards { flex-direction: column; }
  .stat-card { width: 100%; }
}

/* ---------- Điện thoại nhỏ: <=480px ---------- */
@media (max-width: 480px) {
  .header { padding: 8px 10px; gap: 8px; }
  .logo { font-size: 18px; }
  .head-right { gap: 6px; }
  .icon-btn, .bell-btn { width: 32px; height: 32px; }
  #theme-toggle { width: 32px; height: 32px; font-size: 15px; }
  .userbox > a { font-size: 12px; }

  /* Trang đăng nhập/đăng ký: ẩn banner, form hiện ngay không cần cuộn */
  .auth-banner { display: none; }
  .auth-box { max-height: none; }
  .auth-form-side { padding: 20px; }
  .auth-page { min-height: auto; padding: 12px 16px; }

  /* Grid truyện 2 cột gọn */
  .comic-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .chap-line { font-size: 10px; }

  /* Trang chi tiết: nút xếp lưới 2x2 đều nhau */
  .detail-actions .btn-moi { text-align: center; padding: 11px 16px;
    display: flex; align-items: center; justify-content: center; }
  .detail-box { padding: 14px; }
  .detail-box img.cover { width: 130px; }
  .stat-row { gap: 10px; font-size: 12px; }

  /* Trang đọc: thanh công cụ gọn */
  .reader-end { padding: 28px 12px; }
  .reader-end .btn-big { padding: 11px 16px; font-size: 14px; flex: 1 1 100%; }

  /* Form đăng truyện */
  .dt-section { padding: 20px 14px; }
  .dt-actions { flex-direction: column-reverse; align-items: stretch; }
  .dt-actions .btn { width: 100%; text-align: center; }
  .dt-btn-them-ch { width: 100%; justify-content: center; }

  /* Duyệt truyện: nút xếp dọc */
  .duyet-actions { flex-direction: column; }
  .duyet-truyen { flex-direction: column; }
  .duyet-thumb { width: 100%; height: auto; aspect-ratio: 3/4; }

  /* Phân trang căn giữa */
  .pagination { justify-content: center; }

  /* Bình luận gọn */
  .bl-replies, .bl-reply-form { margin-left: 12px; }

  /* Footer gọn */
  .footer { padding: 18px 10px; font-size: 11px; }

  /* Nút lên đầu trang + tải lại ảnh nhỏ lại (cùng kích thước cho cân) */
  #to-top, #retry-all { width: 40px; height: 40px; right: 14px; font-size: 17px; }
  #to-top { bottom: 14px; }
  /* Cụm nút bánh răng trang đọc trên mobile (layout chữ L, nút 40px) */
  body.trang-doc #fab-wrap { right: 14px; bottom: 20px; width: 90px; height: 90px; }
  body.trang-doc #fab-setting { width: 40px; height: 40px; }
  body.trang-doc #fab-wrap #to-top { right: 0; bottom: 50px; }
  body.trang-doc #fab-wrap #retry-all { right: 50px; bottom: 0; }
}

/* ---------- Điện thoại rất nhỏ: <=360px ---------- */
@media (max-width: 360px) {
  .container { padding: 0 10px; }
  .comic-grid { gap: 8px; }
  .comic-card .info { padding: 6px; }
  .comic-card .title { font-size: 11px; }
  .section-title { font-size: 14px; }
  .detail-box h1 { font-size: 18px; }
  .bell-dropdown { right: -8px; }
}

/* Thanh điều hướng dưới chỉ cho điện thoại */
.bottom-nav { display: flex; flex-wrap: wrap; position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
  background: var(--panel); border-top: 1px solid var(--border);
  padding: 6px 4px calc(4px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 20px rgba(0,0,0,.25); }
@media (min-width: 481px) {
  .bottom-nav { display: none; }
}
@media (max-width: 480px) {
  /* Ẩn icon tìm kiếm/chuông/user trên header (đã chuyển xuống thanh dưới) */
  .head-right .search-wrap, .head-right #avatar-btn, .head-right .bell-wrap .bell-btn { display: none; }
  /* beta43: ẩn link khách Đăng nhập/Đăng ký trên header mobile — khách
     vẫn đăng nhập được qua icon Tài khoản ở thanh dưới (/tai-khoan ->
     /dang-nhap). Cùng breakpoint 480px với bottom-nav nên đường đăng
     nhập luôn có sẵn đúng lúc link trên bị ẩn; desktop giữ nguyên. */
  .head-right .guest-link { display: none; }
  .head-right .bell-wrap { position: static; }

  .bn-item { flex: 1; display: flex; align-items: center; justify-content: center;
    background: none; border: none; color: var(--muted); padding: 10px 4px;
    border-radius: 10px; cursor: pointer; text-decoration: none; position: relative;
    transition: color .2s; font-family: inherit; }
  .bn-item.active, .bn-item:active { color: var(--accent); }
  .bn-item svg { display: block; }
  .bn-badge { position: absolute; top: 2px; right: calc(50% - 20px); }
  .bell-dropdown.tu-bottom-nav { position: fixed; bottom: 76px; top: auto; right: 12px; left: 12px;
    width: auto; max-height: 60vh; }
  /* Chừa chỗ cho bottom nav để nội dung không bị che */
  body { padding-bottom: 64px; }
  /* Nút cuộn lên đầu trang: nhích lên trên bottom-nav để không bị che */
  #to-top { bottom: 76px; right: 14px; }
  /* Nút tải lại ảnh: xếp chồng lên trên nút cuộn lên đầu trang */
  #retry-all { bottom: 136px; right: 14px; }
  /* Trang đọc không có bottom-nav: cụm nút bánh răng sát mép dưới */
  body.trang-doc #fab-wrap { right: 14px; bottom: 20px; }
  /* Chống cuộn ngang trên mobile */
  html, body { overflow-x: hidden; max-width: 100vw; }
  /* Trang tìm kiếm & thông báo: gọn trên mobile */
  .search-form.search-big { flex-wrap: wrap; }
  .search-form.search-big input { min-width: 0; flex: 1; }
  .notif-page { padding: 0 2px; }
  .notif-item { word-break: break-word; }
  /* Breadcrumb trang tìm kiếm căn giữa */
  .breadcrumb { text-align: center; }
}

/* Trang hồ sơ tài khoản */
.profile-page { max-width: 600px; margin: 0 auto; }
.profile-cover { height: 120px; border-radius: 16px 16px 0 0;
  background: linear-gradient(135deg, var(--accent) 0%, #1a2a6c 100%); }
.profile-head { text-align: center; padding: 0 20px 20px; margin-top: -48px;
  background: var(--card); border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 16px 16px; }
.profile-avatar { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 12px;
  background: var(--panel); border: 4px solid var(--card); display: flex;
  align-items: center; justify-content: center; color: var(--muted); }
.profile-name { margin: 0 0 4px; font-size: 22px; }
.profile-rank { color: var(--accent); font-size: 14px; margin-bottom: 16px; }
.profile-stats { display: flex; justify-content: center; gap: 32px; }
.pstat { display: flex; flex-direction: column; align-items: center; }
.pstat b { font-size: 18px; }
.pstat span { font-size: 12px; color: var(--muted); }
.profile-menu { margin-top: 16px; background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden; }
.pm-item { display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border);
  font-size: 15px; }
.pm-item:last-child { border-bottom: none; }
.pm-item:hover { background: var(--hover); }
.pm-item svg { color: var(--accent); flex-shrink: 0; }
.pm-danger { color: #ff6b6b; }
.pm-danger svg { color: #ff6b6b; }


/* Hiệu ứng chuyển trang: trượt từ phải vào */
@keyframes pageSlideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.page-slide-in { animation: pageSlideIn .3s ease; }
/* Trang hồ sơ tài khoản */
.profile-page { max-width: 600px; margin: 0 auto; }
.profile-cover { height: 120px; border-radius: 16px 16px 0 0;
  background: linear-gradient(135deg, var(--accent) 0%, #1a2a6c 100%); }
.profile-head { text-align: center; padding: 0 20px 20px; margin-top: -48px;
  background: var(--card); border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 16px 16px; }
.profile-avatar { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 12px;
  background: var(--panel); border: 4px solid var(--card); display: flex;
  align-items: center; justify-content: center; color: var(--muted); }
.profile-name { margin: 0 0 4px; font-size: 22px; }
.profile-rank { color: var(--accent); font-size: 14px; margin-bottom: 16px; }
.profile-stats { display: flex; justify-content: center; gap: 32px; }
.pstat { display: flex; flex-direction: column; align-items: center; }
.pstat b { font-size: 18px; }
.pstat span { font-size: 12px; color: var(--muted); }

/* Trang thông báo */
.notif-page { max-width: 100%; margin: 0 auto; }
/* 2 tab Thông báo / Hộp thư ở đầu trang thông báo (giống dropdown chuông) */
.notif-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.notif-tabs .tb-tab { color: var(--muted); font-size: 14px; font-weight: 600;
  padding: 2px 12px 8px; text-decoration: none; }
.notif-tabs .tb-tab.bat { color: var(--text); font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--accent); }
.notif-page .btn-nho { color: var(--accent); background: none; border: none; cursor: pointer; font-size: 14px; }
.notif-page .section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.notif-list { display: flex; flex-direction: column; gap: 10px; }
.notif-item { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; gap: 12px; }
.notif-bia { width: 48px; height: 64px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.notif-than { flex: 1; min-width: 0; }
.notif-item.chua-doc { background: rgba(128, 128, 128, 0.18); border-color: var(--muted); }
.notif-item[onclick] { cursor: pointer; }
.notif-tieude { font-weight: 700; margin-bottom: 4px; }
.notif-noidung { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.notif-time { font-size: 12px; color: var(--muted); }


/* Animation chuyển trang cho bottom nav (không đè lớp) */
@keyframes pageIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}
.anim-page-in { animation: pageIn .25s ease both; }

/* Trang tìm kiếm gọn vừa màn hình điện thoại */
@media (max-width: 480px) {
  .search-page-compact { min-height: calc(100vh - 200px); display: flex; flex-direction: column; }
  .search-page-compact .search-form { margin-bottom: 12px; }
}

/* Trang tính năng tài khoản - đơn giản */
.taikhoan-page { width: 100%; }
.tk-user { display: flex; align-items: center; gap: 12px; width: 100%; box-sizing: border-box;
  padding: 16px; margin: 0 0 16px 0;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.tk-avatar { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  background: var(--panel); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--muted); overflow: hidden; }
.tk-avatar img { width: 100%; height: 100%; object-fit: cover; }
.tk-name { font-size: 17px; font-weight: 700; line-height: 1.3; }
.tk-rank { font-size: 13px; color: var(--accent); }
.pm-sub { padding-left: 36px !important; font-size: 14px; }
.tk-canhgioi { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Trang /tai-khoan mobile: tái dùng giao diện drawer PC dạng trang tĩnh */
.tk-mobile-page { position: static !important; transform: none !important; width: 100% !important; max-width: 600px; margin: 0 auto; height: auto !important; box-shadow: none !important; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.tk-mobile-page .drawer-head button { display: none; }

/* ===== Footer đơn giản ===== */
html, body { min-height: 100vh; }
body { display: flex; flex-direction: column; }
body .container { flex: 1 0 auto; width: 100%; }
/* Footer phương án A (4 cột, .152): màu cố định theo spec (không dùng biến
   theme — footer luôn nền tối ở cả 2 theme); font Be Vietnam Pro + wordmark
   Satisfy nạp qua @import ở đầu file. Dải cuối hiện version ĐỘNG qua
   {{ app_version }} trong template, không hardcode số bản. */
.footer-a { background: #0d1119; border-top: 1px solid #1d2338;
  margin-top: 30px; padding: 0; width: 100%; flex-shrink: 0;
  font-family: "Be Vietnam Pro", "Segoe UI", Arial, sans-serif;
  color: #e9edf7; text-align: left; }
.footer-a a { text-decoration: none; }
.f-inner { max-width: 1120px; margin: 0 auto; padding: 44px 30px 0;
  display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.25fr; gap: 34px; }
.f-wordmark { font-family: "Satisfy", cursive; font-size: 34px; line-height: 1.1;
  color: #6c8cff; }
.f-wordmark:hover { color: #4a6cf7; }
.f-tagline { margin: 12px 0 0; font-size: 14px; color: #98a2ba; line-height: 1.5; }
.f-social { display: flex; gap: 10px; margin-top: 16px; }
.f-social a { display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; background: #151a29;
  color: #e9edf7; border: 1px solid #232a44; transition: all .2s; }
.f-social a:hover { border-color: #4a6cf7; color: #6c8cff; }
.f-col h4 { margin: 0 0 14px; font-size: 15px; font-weight: 700; color: #e9edf7; }
.f-col ul { list-style: none; margin: 0; padding: 0; }
.f-col li { margin: 0 0 10px; }
.f-col li a { font-size: 14px; color: #98a2ba; transition: color .2s; }
.f-col li a:hover { color: #e9edf7; }
.f-app p { margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #98a2ba; }
.f-app-btn { display: inline-block; line-height: 0; }
.f-app-btn img { height: 48px; width: auto; display: block; }
.f-app-btn:hover img { opacity: .85; }
.f-bottom { max-width: 1120px; margin: 32px auto 0; padding: 16px 30px 20px;
  border-top: 1px solid #1d2338; display: flex; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; font-size: 13px; color: #98a2ba; }
@media (max-width: 620px) {
  .f-inner { grid-template-columns: 1fr 1fr; gap: 24px; padding: 32px 20px 0; }
  .f-brand, .f-app { grid-column: 1 / -1; }
  .f-bottom { padding: 14px 20px 18px; }
}
@media (max-width: 480px) {
  /* Mobile: chỉ hiện footer ở trang chủ (quy tắc cũ, giữ nguyên) */
  body:not(.trang-chu) .footer { display: none; }
}

/* Nút chọn Server 1/2/3 ở danh sách chapter */
.server-btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.server-btn { padding: 7px 16px; border-radius: 10px;
  background: var(--card); border: 1.5px solid var(--border);
  color: var(--text); font-size: 13px; font-weight: 600;
  text-decoration: none; transition: background .15s, border-color .15s; }
.server-btn:hover { border-color: var(--accent); }
.server-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
/* Mobile: 3 nút luôn nằm 1 hàng ngang, chia đều */
@media (max-width: 600px) {
  .server-btns { flex-wrap: nowrap; }
  .server-btn { flex: 1 1 0; min-width: 0; padding: 7px 4px; font-size: 12px;
    text-align: center; white-space: nowrap; }
}

/* Trang Người dùng (/admin/nguoi-dung): mobile hiện dạng thẻ, khỏi lướt ngang */
@media (max-width: 640px) {
  #bang-user { min-width: 0; }
  #bang-user tr:first-child { display: none; } /* ẩn hàng tiêu đề */
  #bang-user, #bang-user tbody, #bang-user tr, #bang-user td { display: block; width: auto; }
  #bang-user tr { background: var(--card); border: 1px solid var(--border);
    border-radius: 12px; margin: 0 0 10px; padding: 10px 14px 12px; }
  #bang-user td { border: 0; padding: 3px 0; font-size: 13px; }
  /* Tên tài khoản làm tiêu đề thẻ */
  #bang-user td[data-nhan="Tài khoản"] { font-size: 16px; font-weight: 700;
    padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
  #bang-user td[data-nhan="Tài khoản"] .role-badge { font-size: 11px; font-weight: 600; }
  /* Các dòng còn lại: "Nhãn: giá trị" cùng một hàng cho gọn */
  #bang-user td[data-nhan]:not([data-nhan=""]):not([data-nhan="Tài khoản"])::before {
    content: attr(data-nhan) ": "; font-size: 12px;
    color: var(--text); opacity: .55; }
  /* Hàng nút hành động */
  #bang-user td:last-child { display: flex; flex-wrap: wrap; gap: 6px;
    padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--border);
    white-space: normal !important; }
}

/* Ô quảng cáo Adsterra (beta26): wrapper căn giữa, không ép kích thước mã thật */
.qc-slot{margin:18px auto;text-align:center;max-width:728px}
.qc-slot:empty{display:none}
.qc-placeholder{display:flex;align-items:center;justify-content:center;height:90px;border:2px dashed #888;color:var(--muted, #666);background:rgba(128,128,128,.08);font-size:14px;padding:0 12px}
@media(max-width:480px){.qc-placeholder{height:50px;font-size:13px}}
