/* MHentai - dark theme (responsive, performance, admin-ready tokens) */

:root {
  --accent: #ff9d2e;          /* doi duoc qua setting accent_color */
  --bg: #14161f;
  --bg-header: #0d0f16;
  --card: #23273a;
  --input: #1b1e2b;
  --line: #333a4d;
  --line-soft: #2b3047;
  --text: #e6e6ea;
  --text-dim: #b9bdcf;
  --text-mute: #6f7590;
  --accent-ink: #14161f;      /* chu tren nen accent */
  --accent-soft: #ffcf9a;
  --radius: 6px;
  --tap: 44px;                /* kich thuoc cham toi thieu (mobile) */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
body {
  background: var(--bg); color: var(--text);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px; line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 14px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ------------------------------------------------------------- header */
.site-header {
  background: var(--bg-header);
  border-bottom: 2px solid var(--accent);
  position: sticky; top: 0; z-index: 50;
}
.site-header .wrap {
  display: flex; align-items: center; gap: 18px;
  padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--accent); white-space: nowrap; min-width: 0;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 10px; object-fit: cover;
  display: block; background: var(--input); flex-shrink: 0;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; flex-shrink: 0;
}
.brand-name {
  font-size: 22px; font-weight: 800; letter-spacing: 1px;
  overflow: hidden; text-overflow: ellipsis; max-width: 260px;
}
/* desktop: 1 hang brand | search | nav */
@media (min-width: 900px) {
  .site-header .wrap { flex-wrap: nowrap; }
  .search { min-width: 0; }
}
/* mobile: brand + toggle 1 hang, search full hang duoi (ke thua) */
@media (max-width: 640px) {
  .brand-name { font-size: 18px; max-width: 180px; }
  .brand-logo, .brand-mark { width: 32px; height: 32px; border-radius: 8px; }
  .brand-mark { font-size: 18px; }
}
.search { display: flex; gap: 6px; flex: 1; min-width: 180px; }
.search input {
  flex: 1; min-width: 0; padding: 9px 12px;
  border: 1px solid var(--line); background: var(--input); color: #fff;
  border-radius: var(--radius); font-size: 15px;
}
.search button {
  padding: 9px 16px; background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: var(--radius); font-weight: 700;
  cursor: pointer; font-size: 15px;
}
.main-nav { display: flex; gap: 6px; }
.main-nav a {
  color: #cfd3e0; font-weight: 600;
  padding: 10px 12px; border-radius: var(--radius);
  min-height: var(--tap); display: inline-flex; align-items: center;
}
.main-nav a:hover { color: var(--accent); background: var(--input); text-decoration: none; }
/* dropdown The loai: hover/focus mo panel full khung noi dung, tap vao link cha di trang index */
.site-header .wrap { position: relative; }
.nav-genres { position: static; display: inline-flex; }
.nav-genres-link { white-space: nowrap; }
.nav-panel {
  display: none; position: absolute; left: 14px; right: 14px; top: calc(100% - 6px); z-index: 70;
  max-height: min(420px, calc(100vh - 160px)); overflow: auto;
  padding: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
}
.nav-genres:hover .nav-panel,
.nav-genres:focus-within .nav-panel { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; }
.tag-link {
  display: block; padding: 8px 10px; border-radius: var(--radius);
  color: var(--text-dim); font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tag-link:hover { background: var(--input); color: var(--accent); text-decoration: none; }
.nav-toggle {
  display: none; background: var(--input); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 18px; padding: 8px 14px; cursor: pointer;
  min-height: var(--tap); min-width: var(--tap);
}
.announce {
  background: var(--line-soft); border-top: 1px solid var(--line);
  padding: 9px 0; font-size: 14px; color: var(--accent-soft);
}
.announce a { text-decoration: underline; }

.ad-slot {
  margin: 14px auto; text-align: center; min-height: 1px;
}

/* khung duoi slide Truyen Hot (trang chu): rong full khung noi dung 1100px. */
.below-stories {
  max-width: 1100px; margin: 6px auto 4px; text-align: center;
}
.below-stories > * { max-width: 100%; height: auto; }
.below-stories img, .below-stories iframe { max-width: 100%; height: auto; }

/* --------------------------------------------------------- story grid */
.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 16px; padding: 20px 0;
}
.story-card { position: relative; }
.story-card .thumb {
  display: block; aspect-ratio: 2/3; overflow: hidden;
  background: var(--card); border-radius: var(--radius);
}
.story-card .thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .18s ease;
}
.story-card:hover .thumb img { transform: scale(1.04); }
.story-card .name {
  margin-top: 6px; color: var(--text);
  font-size: 14px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.story-card .name:hover { color: var(--accent); }
.read-ch {
  display: block; font-size: 12px; color: var(--text-mute); margin-top: 2px;
}
.section-title {
  color: var(--accent); font-size: 18px; margin: 18px 0 2px;
  display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

/* trang index The loai: grid chip dong bo story-card */
.tag-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px; padding: 16px 0 20px;
}
.tag-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; background: var(--card);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  color: var(--text); font-weight: 600; font-size: 14px;
}
.tag-chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.tag-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-count {
  flex-shrink: 0; min-width: 22px; padding: 0 6px;
  background: var(--line-soft); color: var(--text-dim);
  border-radius: 999px; font-size: 12px; font-weight: 700; text-align: center; line-height: 20px;
}

/* ------------------------------------------------------------- detail */
.detail-top { display: flex; gap: 22px; padding: 24px 0; flex-wrap: wrap; }
.detail-cover {
  width: 240px; border-radius: 8px; overflow: hidden;
  background: var(--card); flex-shrink: 0;
  aspect-ratio: 2/3;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-info { flex: 1; min-width: 260px; }
.detail-info h1 { font-size: 26px; margin-bottom: 10px; line-height: 1.25; }
.meta-list { list-style: none; margin: 12px 0; }
.meta-list li { margin-bottom: 7px; color: var(--text-dim); }
.meta-list b { color: var(--text); }
.badge {
  display: inline-block; background: var(--line-soft); color: var(--accent-soft);
  padding: 3px 10px; border-radius: 12px; font-size: 13px;
  margin: 2px 4px 2px 0;
}
a.badge:hover { background: var(--accent); color: var(--accent-ink); text-decoration: none; }
.badge.running { background: #174a2c; color: #7fe0a6; }
.badge.done { background: #17364a; color: #8fd0ff; }
.btn-row { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px; border-radius: 5px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
  border: 0; cursor: pointer; min-height: var(--tap);
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn.secondary { background: var(--line-soft); color: var(--accent-soft); }
.btn.disabled { opacity: .45; pointer-events: none; }

/* ------------------------------------------------------- chapter list */
.chapter-box { margin: 22px 0; }
.chapter-box h2 { font-size: 18px; margin-bottom: 10px; color: var(--accent); }
.chap-search {
  width: 100%; max-width: 320px; padding: 9px 12px; margin-bottom: 10px;
  background: var(--input); color: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 15px;
}
.chap-list { list-style: none; max-height: 480px; overflow-y: auto; }
.chap-list li { border-bottom: 1px dashed var(--line-soft); }
.chap-list a {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 6px; color: #cfd3e0; min-height: var(--tap);
  align-items: center;
}
.chap-list a:hover { color: var(--accent); background: var(--input); }
.chap-list .date { color: var(--text-mute); font-size: 13px; white-space: nowrap; }
.chap-list.clamped li.chap-more { display: none; }
.chap-list.searching li.chap-more { display: list-item; }
.chap-more-btn { margin-top: 10px; }

/* ------------------------------------------------------------- reader */
.reader-title {
  text-align: center; padding: 16px 0 10px;
  color: var(--accent); font-size: 20px; line-height: 1.3;
}
.reader-nav {
  position: sticky; top: 52px; z-index: 40;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 10px 12px; margin: 0 -14px 12px;
  background: rgba(13, 15, 22, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(4px);
}
.reader-select {
  padding: 9px; background: var(--input); color: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
  max-width: 260px; min-height: var(--tap); font-size: 15px;
}
.reader-select-label { color: var(--text-dim); font-size: 14px; }
.reader-hint { color: var(--text-mute); font-size: 12px; margin-left: auto; }
.reader-images { text-align: center; padding-bottom: 24px; }
.reader-images img {
  display: block; margin: 0 auto 6px;
  width: 100%; max-width: 800px;
  height: auto;                     /* khong ep aspect-ratio - giu ti le that */
  background: var(--card);
}
.pager { display: flex; justify-content: center; gap: 10px; padding: 16px 0; flex-wrap: wrap; align-items: center; }
.pager-num {
  min-width: var(--tap); min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text-dim); background: var(--input);
}
.pager-num:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pager-cur {
  min-width: var(--tap); min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink);
  border-radius: var(--radius); font-weight: 700;
}
.pager-gap { color: var(--text-mute); align-self: center; }

/* ------------------------------------------------------------- footer */
.site-footer {
  border-top: 1px solid var(--card); margin-top: 34px;
  padding: 18px 0; color: var(--text-mute); font-size: 13px; text-align: center;
}
.back-top {
  position: fixed; right: 16px; bottom: 20px; z-index: 60;
  width: var(--tap); height: var(--tap); border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  border: 0; font-size: 20px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}
.back-top[hidden] { display: none; }

.notice {
  background: var(--line-soft); border-left: 4px solid var(--accent);
  padding: 14px 16px; margin: 20px 0; border-radius: 4px;
}
.notice code { background: var(--input); padding: 1px 6px; border-radius: 4px; }
.page-head { margin-top: 18px; }
.page-head h1 { color: var(--accent); font-size: 22px; margin-bottom: 4px; }
.page-head p { color: var(--text-mute); margin-bottom: 8px; }

/* --------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .detail-cover { width: 180px; }
  .detail-info h1 { font-size: 22px; }
}

@media (max-width: 640px) {
  .site-header .wrap { gap: 10px; }
  .brand { font-size: 20px; }
  .nav-toggle { display: inline-block; margin-left: auto; }
  .main-nav {
    display: none; order: 10; width: 100%;
    flex-direction: column; gap: 4px;
    border-top: 1px solid var(--line); padding-top: 8px;
  }
  .main-nav.open { display: flex; }
  .main-nav a { width: 100%; }
  .main-nav .nav-genres { width: 100%; }
  .main-nav .nav-panel { display: none !important; }
  .main-nav .user-menu { display: block; width: 100%; }
  .main-nav .user-trigger { width: 100%; }
  .main-nav .user-drop {
    position: static; width: 100%; box-shadow: none; margin-top: 4px;
  }
  .search { order: 5; flex-basis: 100%; min-width: 100%; }

  .story-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .detail-top { gap: 14px; padding-top: 16px; }
  .detail-cover { width: 140px; }
  .detail-info { flex-basis: 100%; }
  .detail-info h1 { font-size: 19px; }

  .reader-title { font-size: 17px; padding-top: 12px; }
  .reader-nav {
    top: 46px; margin: 0 -14px 10px; padding: 8px;
    justify-content: center; gap: 6px;
  }
  .reader-nav .btn { padding: 9px 12px; font-size: 14px; flex: 1 1 auto; }
  .reader-select { max-width: 100%; flex: 1 1 100%; }
  .reader-select-label, .reader-hint { display: none; }

  .chap-list { max-height: 380px; }
  .btn { width: auto; }
  .btn-row .btn { flex: 1 1 45%; }
}

/* Tim kiem: highlight + badge nhom khop */
.story-card .name mark {
  background: rgba(255, 157, 46, .35); color: inherit;
  border-radius: 3px; padding: 0 1px;
}
.badge.s-match {
  display: inline-block; margin-top: 4px;
  font-size: 11px; border: 1px solid var(--line);
  color: var(--text-dim); border-radius: 999px; padding: 1px 8px;
}

/* ---------------------------------------------- user auth + account */
.nav-cta { color: var(--accent) !important; }
.nav-badge {
  display: inline-block; min-width: 18px; padding: 0 5px;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; font-size: 12px; font-weight: 800;
  text-align: center; line-height: 18px; margin-left: 4px;
}
.main-nav .nav-logout { display: inline-flex; margin: 0; }
.main-nav .nav-logout button {
  background: none; border: 0; cursor: pointer;
  color: #cfd3e0; font: inherit; font-weight: 600;
  padding: 10px 12px; border-radius: var(--radius);
  min-height: var(--tap); display: inline-flex; align-items: center;
}
.main-nav .nav-logout button:hover { color: var(--accent); background: var(--input); }

/* nut khach: dang nhap (ghost) + dang ky (primary) */
.btn-auth {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 8px 16px;
  border-radius: var(--radius); font-weight: 700; font-size: 14px;
  border: 1px solid var(--line); color: #cfd3e0; white-space: nowrap;
}
.btn-auth:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.btn-auth.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-auth.primary:hover { color: var(--accent-ink); filter: brightness(1.08); }

/* cum tai khoan: avatar + ten + dropdown Thong tin | Dang xuat */
.user-menu { position: relative; display: inline-flex; }
.user-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: var(--tap); padding: 5px 10px 5px 5px;
  background: var(--input); border: 1px solid var(--line);
  border-radius: 999px; color: var(--text); cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600; max-width: 220px;
}
.user-trigger:hover { border-color: var(--accent); }
.user-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.user-avatar {
  width: 32px; height: 32px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 50%; font-weight: 800; font-size: 15px; overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-name {
  max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-drop {
  display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 70;
  min-width: 200px; padding: 6px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
}
.user-menu.open .user-drop { display: block; }
.user-drop a {
  display: flex; align-items: center; width: 100%;
  padding: 10px 12px; border-radius: var(--radius);
  color: var(--text); font-weight: 600; font-size: 14px;
}
.user-drop a:hover { background: var(--input); color: var(--accent); text-decoration: none; }
.user-drop .nav-logout { display: block; width: 100%; }
.user-drop .nav-logout button {
  width: 100%; justify-content: flex-start; text-align: left;
}

/* nut theo doi o trang truyen */
.follow-form { display: inline-flex; }
.btn.following { border-color: var(--accent); color: var(--accent); }

.auth-wrap { max-width: 440px; margin: 34px auto 10px; }
.auth-card {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 24px;
}
.auth-card h1 { color: var(--accent); font-size: 22px; margin-bottom: 4px; }
.auth-sub { color: var(--text-mute); font-size: 14px; margin-bottom: 16px; }
.auth-submit { width: 100%; margin-top: 4px; }
.auth-alt { margin-top: 16px; text-align: center; color: var(--text-mute); font-size: 14px; }

.f-field { margin-bottom: 14px; }
.f-field label {
  display: block; margin-bottom: 5px; font-size: 14px;
  font-weight: 600; color: var(--text-dim);
}
.f-field input {
  width: 100%; padding: 10px 12px; min-height: var(--tap);
  background: var(--input); color: #fff; font-size: 15px;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.f-field input:focus { outline: none; border-color: var(--accent); }
.f-field input:disabled { opacity: .6; cursor: not-allowed; }
.f-field input[type="file"] { padding: 8px; color: var(--text-dim); }
.f-hint { color: var(--text-mute); font-size: 12.5px; margin-top: 4px; }
.f-row { display: flex; gap: 14px; }
.f-row .f-field { flex: 1; min-width: 0; }
.f-err {
  background: rgba(255, 82, 82, .12); border: 1px solid rgba(255, 107, 107, .45);
  color: #ff9a9a; padding: 10px 12px; border-radius: var(--radius);
  margin-bottom: 14px; font-size: 14px;
}
.f-ok {
  background: rgba(64, 190, 120, .12); border: 1px solid rgba(64, 190, 120, .45);
  color: #8fe6b3; padding: 10px 12px; border-radius: var(--radius);
  margin-bottom: 14px; font-size: 14px;
}
.f-honeypot {
  position: absolute !important; left: -9999px !important;
  width: 1px; height: 1px; overflow: hidden;
}

.acc-head { display: flex; gap: 16px; align-items: center; padding: 22px 0 4px; }
.acc-avatar {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  background: var(--line-soft); border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: var(--accent); overflow: hidden;
}
.acc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.acc-name { font-size: 20px; font-weight: 700; }
.acc-meta { color: var(--text-mute); font-size: 13px; margin-top: 2px; }

.acc-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); margin: 14px 0 18px;
}
.acc-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; min-height: var(--tap);
  color: var(--text-dim); font-weight: 600;
  border-bottom: 2px solid transparent;
}
.acc-tab:hover { color: var(--accent); text-decoration: none; }
.acc-tab.on { color: var(--accent); border-bottom-color: var(--accent); }

.acc-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.acc-card {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 20px;
}
.acc-card h2 { color: var(--accent); font-size: 16px; margin-bottom: 14px; }
.acc-bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.acc-bar .muted { color: var(--text-mute); font-size: 14px; }
.muted { color: var(--text-mute); }

.btn.mini { padding: 6px 12px; font-size: 13px; min-height: 34px; }
.btn.danger { background: #58232f; color: #ffb3c0; }
.hist-list, .notice-list { list-style: none; display: grid; gap: 12px; }
.hist-list {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.hist-item .thumb {
  display: block; aspect-ratio: 2/3; overflow: hidden;
  background: var(--input); border-radius: var(--radius);
}
.hist-item .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hist-item .name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-top: 6px; color: var(--text);
  font-size: 14px; font-weight: 600;
}
.hist-item .name:hover { color: var(--accent); }
.hist-item .read-ch { display: block; font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.hist-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.hist-actions form { margin: 0; }

.notice-item {
  background: var(--card); border: 1px solid var(--line-soft);
  border-left: 3px solid var(--line);
  border-radius: 6px; padding: 14px 16px;
}
.notice-item.unread { border-left-color: var(--accent); }
.notice-item h3 { font-size: 15px; margin-bottom: 6px; }
.notice-item p { color: var(--text-dim); font-size: 14px; white-space: pre-line; }
.notice-meta {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-top: 10px; color: var(--text-mute); font-size: 12.5px;
}
.notice-meta form { margin: 0; }
.ok-tag { color: #8fe6b3; font-size: 12.5px; }

@media (max-width: 640px) {
  .f-row { flex-direction: column; gap: 0; }
  .acc-head { padding-top: 14px; }
  .acc-tab { padding: 10px 10px; font-size: 14px; }
  .auth-wrap { margin-top: 20px; }
  .auth-card { padding: 18px; }
  .hist-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

/* ------------------------------------------------------- slide Truyen Hot */
.hot { margin-top: 6px; }
.hot-head { display: flex; align-items: center; gap: 12px; }
.hot-head .section-title { flex: 1; margin-top: 18px; }
.hot-ctrl { display: flex; gap: 6px; margin-top: 18px; }
.hot-btn {
  width: 34px; height: 34px; flex-shrink: 0;
  background: var(--card); color: var(--text-dim);
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 20px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.hot-btn:hover { color: var(--accent); border-color: var(--accent); }
.hot-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hot-track {
  display: flex; gap: 16px;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 16px 0 6px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-x: contain;
}
.hot-track::-webkit-scrollbar { display: none; }
.hot-track:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
/* 5 card/duong (desktop) -> 1100px / 5 - gap */
.hot-track .story-card { flex: 0 0 calc((100% - 64px) / 5); scroll-snap-align: start; }

.story-card .thumb { position: relative; }
.hot-rank {
  position: absolute; top: 6px; left: 6px; z-index: 1;
  background: rgba(13, 15, 22, .86); color: var(--text-dim);
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 12px; font-weight: 700;
  padding: 2px 8px; line-height: 1.5;
}
.hot-rank.top {
  background: var(--accent); color: var(--accent-ink);
  border-color: var(--accent);
}
.hot-views {
  display: block; margin-top: 3px;
  font-size: 12px; color: var(--text-mute);
}
.shelf-note {
  display: block; margin-top: 3px;
  font-size: 12px; color: var(--text-dim);
}
.shelf-new {
  display: inline-block; margin-top: 4px;
  background: var(--accent); color: var(--accent-ink);
  border-radius: var(--radius); font-size: 11px; font-weight: 800;
  padding: 1px 8px; line-height: 1.6;
}

.hot-dots { display: flex; gap: 7px; justify-content: center; padding: 8px 0 4px; }
.hot-dot {
  width: 8px; height: 8px; padding: 0;
  background: var(--line); border: 0; border-radius: 50%;
  cursor: pointer;
}
.hot-dot:hover { background: var(--text-mute); }
.hot-dot.on { background: var(--accent); }
.hot-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 900px) {
  .hot-track .story-card { flex-basis: calc((100% - 32px) / 3); }
}
@media (max-width: 640px) {
  .hot-track .story-card { flex-basis: calc((100% - 16px) / 2); }
  .hot-btn { width: var(--tap); height: var(--tap); }
}
/* reduce motion: khong smooth scroll, JS dung tu chay (xem app.js) */
@media (prefers-reduced-motion: reduce) {
  .hot-track { scroll-behavior: auto; }
}

/* --------------------------------------------- ria 2 ben (inner 250px canh giua gutter) */
.side-rail {
  position: fixed;
  top: var(--ad-top, 76px);
  /* container rong = gutter 2 ben ((viewport - 1100px noi dung) / 2) nen khong bao gio
     lan vao noi dung; inner 250px tu canh giua, gutter hep thi co lai theo. */
  width: calc((100vw - 1100px) / 2);
  height: auto;
  max-height: calc(100vh - var(--ad-top, 76px) - 12px);
  overflow: hidden;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none; /* container trong suot khong chan click noi dung */
}
.rail-card, .rail-btn { pointer-events: auto; }
.side-rail-l { left: 0; }
.side-rail-r { right: 0; }
.side-rail img, .side-rail iframe, .side-rail ins { max-width: 100%; }
.side-rail > * { width: 100%; max-width: 250px; height: auto; margin-left: auto; margin-right: auto; }
/* moi ben 2 o 250x300 doc lap: trong o nao an o do (server bo qua o rong). */
.rail-card { width: 100%; max-width: 250px; max-height: 300px; overflow: hidden; margin-left: auto; margin-right: auto; }
.rail-card > * { max-width: 100% !important; height: auto !important; }
/* nut mo rail cho man hep: 2 nut doc lap sat mep trai/phai. */
.rail-btn {
  position: fixed; top: 50%; z-index: 61;
  width: var(--tap); height: var(--tap);
  display: none; align-items: center; justify-content: center;
  background: var(--input); color: var(--text-dim);
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.rail-btn-l { left: 6px; }
.rail-btn-r { right: 6px; }
.rail-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
/* gutter < ~200px (viewport < 1500px: 1100 noi dung + 2 x 200) thi banner < ~184px
   la het doc duoc -> an rail, mo bang nut QC dang drawer (user bam = dong y che tam). */
@media (max-width: 1499px) {
  .side-rail { display: none; }
  .rail-btn { display: inline-flex; }
  body.rail-open-l .side-rail-l,
  body.rail-open-r .side-rail-r {
    display: flex;
    width: 250px;
    max-height: calc(100vh - var(--ad-top, 76px) - 12px);
    overflow: auto;
    z-index: 60;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  }
}
@media (min-width: 1500px) {
  .rail-btn { display: none !important; }
}
