/* ========== Reset nhẹ + Base ========== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
:root{
  --primary: #2badee;
  --bg-light: #f6f7f8;
  --bg-dark: #101c22;
  --bg-card: #1c2a33;
  --border: #233c48;
  --text: #111c22;
  --muted: #92b7c9;
  --muted-2: #5c7a8a;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 20px 60px rgba(0,0,0,.35);
  --container: 1400px;
  --pad: 16px;
  --pad-lg: 40px;
  --font: "Be Vietnam Pro","Noto Sans",system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

html.theme-dark .app{
  background: var(--bg-dark);
  color: #fff;
}
html:not(.theme-dark) .app{
  background: var(--bg-light);
  color: var(--text);
}

.app{
  font-family: var(--font);
  min-height: 100%;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
.page-content a{
  color: #00BCD4;
}

/* Scrollbar (giống bản gốc) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { filter: brightness(.9); }

/* Helpers */
.container{
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--pad);
}
@media (min-width: 1024px){
  .container{ padding: 0 var(--pad-lg); }
}
.material-symbols-outlined{
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

/* clamp */
.clamp-1{
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.clamp-2{
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (min-width: 1024px){
  .clamp-3-lg{
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* ========== Header ========== */
.site-header{
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: rgba(17,28,34,.95);
  backdrop-filter: blur(10px);
  padding: 12px 0;
}
.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  white-space: nowrap;
}
.header-left{
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand{
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  transition: color .2s ease;
}
.brand:hover{ color: var(--primary); }
.brand-icon{
  color: var(--primary);
  font-size: 32px;
  line-height: 1;
}
.brand-name{
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 20px;
  display: none;
}
@media (min-width: 640px){
  .brand-name{ display: inline; }
}

/* Search */
.search-wrapper{
  position: relative;
  display: none;
}
.search{
  display: flex;
  align-items: center;
  height: 40px;
  min-width: 260px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid transparent;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.search:focus-within{
  border-color: rgba(43,173,238,.35);
  box-shadow: 0 0 0 3px rgba(43,173,238,.18);
}
.search-ic{
  color: var(--muted);
  padding-left: 14px;
}
.search-input{
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0 14px 0 10px;
  color: #fff;
  font-size: 14px;
}
.search-input::placeholder{ color: var(--muted); }

.search-results{
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-dark);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  max-height: 480px;
  overflow-y: auto;
  z-index: 1000;
}
.search-results.is-visible{
  display: block;
}

.search-header{
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.search-label{
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.search-item{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .2s ease;
}
.search-item:hover{
  background: var(--bg-card);
}
.search-thumb{
  width: 48px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.search-info{
  flex: 1;
  min-width: 0;
}
.search-title{
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.search-chapter{
  font-size: 13px;
  color: var(--primary);
}

.search-empty{
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.search-all{
  display: block;
  padding: 12px 16px;
  text-align: center;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  border-top: 1px solid var(--border);
}
.search-all:hover{
  background: var(--bg-card);
}

@media (min-width: 768px){
  .search-wrapper{ display: block; }
  .search{ min-width: 320px; }
}
@media (min-width: 1024px){
  .search{ min-width: 420px; }
}

.header-right{
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: flex-end;
  flex: 1;
}
.nav{
  display: none;
}
@media (max-width: 1023px){
  .nav.is-open{
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-dark);
    padding: 24px;
    gap: 12px;
    z-index: 999;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    border-top: 1px solid var(--border);
    animation: slideDown 0.3s ease;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
  }
  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  .nav .nav-link{
    width: 100%;
    padding: 16px 20px;
    text-align: left;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
  }
  .nav .nav-link:hover,
  .nav .nav-link.is-active{
    background: var(--bg-card);
  }
}
@media (min-width: 1024px){
  .nav{ 
    display: flex;
    flex-direction: row;
    position: static;
    background: transparent;
    padding: 0;
    gap: 28px;
    box-shadow: none;
    border: none;
    animation: none;
  }
  .nav .nav-link{
    width: auto;
    padding: 0;
    font-size: 14px;
  }
}
.nav-link{
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  transition: color .2s ease;
}
.nav-link:hover{ color: var(--primary); }
.nav-link.is-active{
  color: var(--primary);
  font-weight: 800;
}
.header-actions{
  display: flex;
  align-items: center;
  gap: 12px;
}

/* User Menu */
.user-menu-wrapper{
  position: relative;
}

.user-menu-btn{
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-menu-btn:hover{
  background: rgba(255,255,255,0.05);
}

.user-avatar{
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.user-avatar-text{
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.user-name{
  font-size: 14px;
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 768px){
  .user-name{
    display: none;
  }
}

.user-menu-dropdown{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
}

.user-menu-dropdown.is-open{
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-header{
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.user-menu-name{
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.user-menu-email{
  font-size: 13px;
  color: var(--muted);
}

.user-menu-items{
  padding: 8px;
}

.user-menu-item{
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}

.user-menu-item:hover{
  background: var(--bg-card);
}

.user-menu-item .material-symbols-outlined{
  font-size: 20px;
}

.user-menu-divider{
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.icon-btn{
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.icon-btn:hover{
  background: var(--bg-card);
  color: var(--primary);
}
.header-menu{ display: inline-flex; }
@media (min-width: 1024px){
  .header-menu{ display: none; }
}

/* Buttons */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  height: 36px;
  padding: 0 14px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .01em;
  border: 1px solid transparent;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, opacity .2s ease;
}
.btn:active{ transform: translateY(1px); }
.btn-primary{
  background: var(--primary);
  color: #111c22;
}
.btn-primary:hover{ filter: brightness(.95); }
.btn-secondary{
  background: #233c48;
  color: #fff;
}
.btn-secondary:hover{ background: #2d4b5a; }
.btn-outline{
  background: transparent;
  border-color: var(--border);
  color: #fff;
}
.btn-outline:hover{
  background: #233c48;
  border-color: rgba(43,173,238,.4);
}
.btn-lg{
  height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 16px;
}

/* ========== Main ========== */
.site-main{
  flex: 1;
  padding: 24px 0;
}

/* Hero */
.hero{ margin-bottom: 40px; }
.hero-card{
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  box-shadow: var(--shadow);
  min-height: 400px;
}
@media (min-width: 1024px){
  .hero-card{ min-height: 500px; }
}
.hero-bg{
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.01);
}
.hero-overlay{
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(16,28,34,1) 0%, rgba(16,28,34,.7) 40%, rgba(16,28,34,0) 100%);
}
@media (min-width: 1024px){
  .hero-overlay{
    background: linear-gradient(to right, rgba(16,28,34,1) 0%, rgba(16,28,34,.8) 55%, rgba(16,28,34,0) 100%);
  }
}
.hero-content{
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  max-width: 720px;
  height: 100%;
}
@media (min-width: 1024px){
  .hero-content{ padding: 48px; }
}
.tag-row{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.tag{
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.10);
  color: #fff;
}
.tag-primary{
  border-color: rgba(43,173,238,.30);
  background: rgba(43,173,238,.20);
  color: var(--primary);
}
.hero-title{
  margin: 0 0 14px 0;
  font-size: 40px;
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: -0.03em;
  text-shadow: 0 10px 30px rgba(0,0,0,.35);
}
@media (min-width: 1024px){
  .hero-title{ font-size: 60px; }
}
.hero-desc{
  margin: 0 0 22px 0;
  color: rgba(229,231,235,.92);
  font-size: 14px;
  line-height: 1.7;
  max-width: 640px;
  text-shadow: 0 10px 26px rgba(0,0,0,.35);
}
@media (min-width: 1024px){
  .hero-desc{ font-size: 18px; }
}
.hero-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Genres chips */
.genres{ margin-bottom: 40px; }
.chip-row{
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 10px;
}
.chip-row::-webkit-scrollbar{ height: 0; } /* ẩn nhẹ */
.chip{
  flex: 0 0 auto;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  background: #233c48;
  border: 1px solid rgba(255,255,255,.06);
  transition: transform .15s ease, background .2s ease;
}
.chip:hover{ background: #2d4b5a; }
.chip-primary{
  background: var(--primary);
  color: #111c22;
}
.chip-primary:hover{ transform: scale(1.03); }

/* Layout grid */
.layout{
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 1024px){
  .layout{
    grid-template-columns: 1fr 360px;
    gap: 32px;
  }
}
.section-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.section-title{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 24px;
  font-weight: 900;
}
.section-title[data-icon]::before{
  content: attr(data-icon);
  font-family: 'Material Symbols Outlined';
  font-size: 28px;
  color: var(--primary);
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'liga';
}
.section-title .material-symbols-outlined{
  color: var(--primary);
}
.section-more{
  color: var(--muted);
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color .2s ease;
}
.section-more:hover{ color: #fff; }

/* Cards grid */
.card-grid{
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 14px;
}
@media (min-width: 640px){
  .card-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 768px){
  .card-grid{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.manga-card{ display: flex; }
.manga-link{ display: flex; flex-direction: column; gap: 10px; width: 100%; }
.cover{
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  overflow: hidden;
  background: #233c48;
}
.cover-bg{
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform .5s ease;
}
.manga-card:hover .cover-bg{ transform: scale(1.1); }

.cover-hover{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 44px;
  background: rgba(0,0,0,.40);
  opacity: 0;
  transition: opacity .2s ease;
  text-shadow: 0 10px 25px rgba(0,0,0,.4);
}
.manga-card:hover .cover-hover{ opacity: 1; }

.badge{
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 8px;
  color: #fff;
  box-shadow: 0 8px 18px rgba(0,0,0,.25);
}
.badge-hot{ background: #dc2626; }
.badge-new{ background: #ca8a04; }
.badge-success{ background: #10b981; }
.badge-primary{ background: var(--primary); color: #111c22; }

.manga-meta{ display: flex; flex-direction: column; gap: 6px; }
.manga-title{
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.25;
  transition: color .2s ease;
}
.manga-card:hover .manga-title{ color: var(--primary); }

.manga-sub{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pill{
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  background: rgba(255,255,255,.08);
  color: #fff;
}
.pill-primary{
  background: rgba(43,173,238,.10);
  color: var(--primary);
}
.muted{
  color: var(--muted);
  font-size: 12px;
}

/* Load more */
.load-more{
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

/* History Grid */
.history-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 768px){
  .history-grid{ grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px){
  .history-grid{ grid-template-columns: repeat(3, 1fr); }
}

.history-card{
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.history-card:hover{
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,.25);
  border-color: rgba(43,173,238,.35);
}

.history-cover-link{
  display: block;
  position: relative;
}
.history-cover{
  position: relative;
  width: 100%;
  padding-bottom: 140%;
  overflow: hidden;
  background: var(--bg-dark);
}
.history-cover .cover-bg{
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform .5s ease;
}
.history-card:hover .history-cover .cover-bg{
  transform: scale(1.08);
}

.history-content{
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-title-link{
  text-decoration: none;
  color: inherit;
}
.history-title{
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.3;
  transition: color .2s ease;
}
.history-title-link:hover .history-title{
  color: var(--primary);
}

.history-meta{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-continue{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  background: var(--primary);
  color: #111c22;
  border-radius: 10px;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  transition: all .2s ease;
}
.btn-continue:hover{
  filter: brightness(.92);
  transform: translateY(-1px);
}
.btn-continue:active{
  transform: translateY(0);
}
.btn-continue .material-symbols-outlined{
  font-size: 18px;
}

/* Sidebar panels */
.panel{
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}
.panel + .panel{ margin-top: 22px; }
.panel-head{
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.panel-title{
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 900;
}
.panel-title .material-symbols-outlined{ color: var(--primary); }
.panel:first-of-type .panel-title .material-symbols-outlined{ color: #fbbf24; }

.rank-list{ display: flex; flex-direction: column; gap: 14px; }
.rank-item{
  display: flex;
  align-items: center;
  gap: 12px;
}
.rank-no{
  width: 28px;
  display: inline-flex;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  color: var(--muted-2);
}
.rank-no--gold{ color: #fbbf24; font-style: italic; font-size: 24px; }
.rank-thumb{
  width: 48px;
  height: 64px;
  border-radius: 10px;
  background-color: #374151;
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
}
.rank-info{ min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rank-name{
  font-weight: 900;
  font-size: 14px;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color .2s ease;
}
.rank-item:hover .rank-name{ color: var(--primary); }
.rank-views{
  color: var(--muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rank-views .material-symbols-outlined{ font-size: 14px; }

.tag-cloud{ display: flex; flex-wrap: wrap; gap: 8px; }
.tagpill{
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: #233c48;
  border: 1px solid rgba(255,255,255,.06);
  font-weight: 900;
  font-size: 12px;
  color: var(--muted);
  transition: background .2s ease, color .2s ease;
}
.tagpill:hover{
  background: var(--primary);
  color: #111c22;
}

/* ========== Footer ========== */
.site-footer{
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-dark);
  padding: 40px 0 18px;
}
.footer-top{
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}
@media (min-width: 768px){
  .footer-top{ grid-template-columns: 1.3fr 1fr; align-items: start; }
}
.footer-desc{
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.social{
  display: flex;
  gap: 14px;
  margin-top: 12px;
}
.social-link img{
  width: 24px;
  height: 24px;
  opacity: .7;
  transition: opacity .2s ease;
}
.social-link:hover img{ opacity: 1; }

.footer-links{
  display: flex;
  flex-wrap: wrap;
  gap: 26px 50px;
}
.footer-links h4{
  margin: 0 0 10px 0;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
}
.footer-links .col{
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-links a{
  color: var(--muted);
  font-size: 14px;
  transition: color .2s ease;
}
.footer-links a:hover{ color: var(--primary); }

.footer-bottom{
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted-2);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
@media (min-width: 768px){
  .footer-bottom{
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* ========== Series Detail Page ========== */
.container-narrow{
  max-width: 1200px;
}

.breadcrumb{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  font-size: 14px;
  color: var(--muted);
  flex-wrap: wrap;
}
.breadcrumb a{ transition: color .2s ease; }
.breadcrumb a:hover{ color: var(--primary); }
.breadcrumb-sep{ font-size: 16px; }

.manga-detail{
  margin: 24px 0;
}

.manga-grid{
  display: grid;
  gap: 24px;
}
@media (min-width: 1024px){
  .manga-grid{
    grid-template-columns: 300px 1fr;
    gap: 40px;
  }
}

/* Cover Card */
.cover-card{
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.cover-wrap{
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
}

.cover-img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-grad{
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background: linear-gradient(to top, rgba(0,0,0,.8), transparent);
}

.rating{
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ffd700;
  font-weight: 700;
  font-size: 18px;
}

.cover-actions{
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row-actions{
  display: flex;
  gap: 8px;
}

.w-full{ width: 100%; }
.icon-only{
  padding: 0;
  width: 48px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Stats Card */
.stats-card{
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-row{
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.stat-k{
  color: var(--muted);
}

.stat-v{
  font-weight: 600;
}

.status{
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
}

.status-green{
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

/* Manga Main */
.manga-head{
  margin-bottom: 24px;
}

.manga-main-title{
  font-size: 32px;
  font-weight: 900;
  margin: 0 0 16px;
  line-height: 1.2;
}

.meta-row{
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
}

.meta-item{
  display: flex;
  align-items: center;
  gap: 6px;
}

.genre-tags{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.genre-tag{
  padding: 6px 14px;
  background: rgba(43, 173, 238, 0.1);
  color: var(--primary);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  transition: all .2s ease;
}

.genre-tag:hover{
  background: var(--primary);
  color: #fff;
}

/* Panel */
.panel{
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}

.panel-title{
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-bar{
  width: 4px;
  height: 20px;
  background: var(--primary);
  border-radius: 2px;
}

.panel-text{
  color: var(--muted);
  line-height: 1.7;
  font-size: 15px;
}

/* Chapters */
.chapters{
  margin-bottom: 32px;
}

.chapters-head{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 16px;
}

.chapters-title{
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.segmented{
  display: inline-flex;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 4px;
}

.seg-btn{
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  transition: all .2s ease;
  font-size: 14px;
  font-weight: 600;
}

.seg-btn:hover{
  color: #fff;
}

.seg-btn.is-active{
  background: var(--primary);
  color: #fff;
}

/* Chapter Table */
.chapter-table{
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chapter-more{
  padding: 24px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.chapter-more .btn{
  min-width: 200px;
}

#loading-icon{
  animation: spin 1s linear infinite;
}

@keyframes spin{
  from{ transform: rotate(0deg); }
  to{ transform: rotate(360deg); }
}

.chapter-th{
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 16px 20px;
  background: rgba(255,255,255,0.03);
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.chapter-body{
  max-height: 600px;
  overflow-y: auto;
}

.chapter-row{
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  transition: background .2s ease;
  cursor: pointer;
}

.chapter-row:hover{
  background: rgba(43, 173, 238, 0.08);
}

.chapter-row:last-child{
  border-bottom: none;
}

.chapter-name{
  display: flex;
  align-items: center;
  gap: 10px;
}

.chapter-title{
  font-weight: 600;
  font-size: 15px;
}

.chapter-time{
  color: var(--muted);
  font-size: 13px;
}

.t-center{
  text-align: center;
}

.chapter-more{
  padding: 16px;
  text-align: center;
}

.link-primary{
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s ease;
}

.link-primary:hover{
  opacity: 0.8;
}

.empty-state{
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

/* Reader Page */
.container-reader{
  max-width: 900px;
}

.reader-head{
  padding: 24px 0;
  margin-bottom: 24px;
}

.reader-title{
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 12px;
}

.reader-meta{
  display: flex;
  gap: 20px;
  color: var(--muted);
  font-size: 14px;
}

.reader-controls{
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pager{
  display: flex;
  gap: 8px;
  align-items: center;
}

.pager-btn{
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  transition: all .2s ease;
}

.pager-btn:hover:not(:disabled){
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pager-btn:disabled{
  opacity: 0.3;
  cursor: not-allowed;
}

.pager-mid{
  padding: 0 20px;
  height: 40px;
  display: flex;
  color: #fff;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
}

.pager-mid:hover{
  border-color: var(--primary);
  color: var(--primary);
}

/* Chapter Dropdown */
.pager-mid-wrapper{
  position: relative;
}

.chapter-dropdown{
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 250px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transition: all .2s ease;
  z-index: 1000;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.chapter-dropdown.is-open{
  opacity: 1;
  visibility: visible;
}

.chapter-dropdown-item{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  transition: all .2s ease;
  cursor: pointer;
}

.chapter-dropdown-item:hover{
  background: rgba(255,255,255,0.05);
}

.chapter-dropdown-item.is-active{
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
}

.chapter-dropdown-title{
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.chapter-dropdown-divider{
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.segmented--reader{
  height: 40px;
}

/* Reader */
.panel--reader{
  padding: 0;
  background: transparent;
}

.reader-hint{
  text-align: center;
  padding: 16px;
  color: var(--muted-2);
  font-size: 14px;
}

.pages{
  display: flex;
  flex-direction: column;
  gap: 0;
}

.page{
  margin: 0;
  line-height: 0;
}

.page img{
  width: 100%;
  height: auto;
  display: block;
}

/* Original size mode */
.pages--original .page img{
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}

.reader-end{
  padding: 48px 20px;
  text-align: center;
}

.reader-end-actions{
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* FAB */
.fab{
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s ease;
  z-index: 100;
}

.fab:hover{
  transform: translateY(-4px);
  box-shadow: 0 24px 68px rgba(0,0,0,.45);
}

/* Comments */
.comments{
  margin: 32px 0;
}

.comments-title{
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.comment-input{
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.avatar{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-img{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.comment-form{
  flex: 1;
}

.textarea{
  width: 100%;
  min-height: 100px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  font-family: inherit;
  resize: vertical;
}

.textarea:focus{
  outline: none;
  border-color: var(--primary);
}

.comment-send{
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.comment-list{
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.comment-item{
  display: flex;
  gap: 12px;
}

.comment-body{
  flex: 1;
}

.comment-head{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.comment-head strong{
  font-weight: 600;
}

.comment-text{
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 12px;
}

.comment-actions{
  display: flex;
  gap: 16px;
}

.link-btn{
  background: none;
  border: none;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color .2s ease;
}

.link-btn:hover{
  color: var(--primary);
}

/* ========== Auth Pages ========== */
.auth-container{
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 64px - 200px);
  padding: 40px 0;
}

.auth-card{
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow);
}

.auth-header{
  text-align: center;
  margin-bottom: 32px;
}

.auth-title{
  font-size: 28px;
  font-weight: 900;
  margin: 0 0 8px;
  color: #fff;
}

.auth-subtitle{
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.auth-form{
  margin-bottom: 24px;
}

.form-group{
  margin-bottom: 20px;
}

.form-label{
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #fff;
}

.form-input{
  width: 100%;
  height: 48px;
  padding: 0 16px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-input:focus{
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43,173,238,.18);
}

.form-input.is-invalid{
  border-color: #ef4444;
}

.form-error{
  display: block;
  font-size: 13px;
  color: #ef4444;
  margin-top: 6px;
}

.checkbox-label{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.checkbox-input{
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.auth-divider{
  position: relative;
  text-align: center;
  margin: 24px 0;
}

.auth-divider::before{
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

.auth-divider span{
  position: relative;
  display: inline-block;
  padding: 0 16px;
  background: var(--bg-card);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.btn-google{
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 600;
}

.btn-google:hover{
  background: #f9fafb;
}

.auth-footer{
  text-align: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
}

.auth-link{
  color: var(--primary);
  font-weight: 600;
}

.auth-link:hover{
  text-decoration: underline;
}

.alert{
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.alert-error{
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success{
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.w-full{
  width: 100%;
}

/* ========== Pagination ========== */
.pagination-wrap{
  margin: 32px 0;
}

.pagination{
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.page-item{
  display: inline-block;
}

.page-item.disabled .page-link{
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}

.page-item.active .page-link{
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.page-link{
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
  font-size: 14px;
  font-weight: 500;
  transition: all .2s ease;
  cursor: pointer;
}

.page-link:hover:not(.page-item.disabled .page-link):not(.page-item.active .page-link){
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
}

.page-link .material-symbols-outlined{
  font-size: 18px;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

/* Splide Carousel Custom Styles */
.splide{
  position: relative;
  margin-top: 1.5rem;
}

.splide__track{
  overflow: hidden;
}

.splide__list{
  display: flex;
  align-items: stretch;
}

.splide__slide{
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Tắt zoom cho carousel */
.splide__slide .manga-card:hover .cover-bg{
  transform: scale(1) !important;
}

/* Lazy Load Images */
.page img.lazy-image{
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
  min-height: 400px;
}

@keyframes loading{
  0%{
    background-position: 200% 0;
  }
  100%{
    background-position: -200% 0;
  }
}

.page img.loaded{
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn{
  from{
    opacity: 0;
  }
  to{
    opacity: 1;
  }
}



/* Custom Arrow Buttons */
.splide__arrow{
  position: absolute;
  top: -60px;
  width: 44px;
  height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s ease;
  z-index: 10;
  opacity: 1;
}

.splide__arrow:hover{
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.1);
}

.splide__arrow:disabled{
  opacity: 0.3;
  cursor: not-allowed;
}

.splide__arrow svg{
  width: 20px;
  height: 20px;
  fill: var(--text-primary);
  transition: fill .2s ease;
}

.splide__arrow:hover svg{
  fill: #111c22;
}

.splide__arrow--prev{
  right: 60px;
}

.splide__arrow--next{
  right: 8px;
}

/* Mobile adjustments */
@media (max-width: 768px){
  .splide__arrow{
    top: 50%;
    transform: translateY(-50%);
  }
  .splide__arrow--prev{
    left: -22px;
    right: auto;
  }
  .splide__arrow--next{
    right: -22px;
  }
  .splide__arrow:hover{
    transform: translateY(-50%) scale(1.1);
  }
}

/* Responsive pagination */
@media (max-width: 640px){
  .pagination{
    gap: 4px;
  }
  
  .page-link{
    min-width: 36px;
    height: 36px;
    padding: 6px 10px;
    font-size: 13px;
  }
}
