/* ============================================================
   TruyệnChữ — truyenfull.today clone
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:      #2c3e50;
  --primary-dark: #1e2d3d;
  --accent:       #27ae60;
  --accent-h:     #1e8449;
  --link:         #2980b9;
  --link-h:       #1a6da3;
  --bg:           #f0f0f0;
  --card-bg:      #fff;
  --text:         #222;
  --text-muted:   #777;
  --border:       #ddd;
  --badge-full:   #27ae60;
  --badge-new:    #e67e22;
  --nav-h:        42px;
  --font:         'Segoe UI', Arial, sans-serif;
  --r:            4px;
  --shadow:       0 1px 3px rgba(0,0,0,.12);
}

body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-h); text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ---- Site Tagline ---- */
.site-tagline {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 5px 0;
  font-size: .78rem;
  color: var(--text-muted);
}

/* ---- Container ---- */
.container { max-width: 1280px; margin: 0 auto; padding: 0 10px; }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  background: var(--primary);
  height: var(--nav-h);
  position: sticky; top: 0; z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,.4);
}
.navbar-inner {
  display: flex; align-items: center; height: 100%; gap: 0;
}

.brand {
  color: #fff; font-size: 1.3rem; font-weight: 700;
  font-family: "Oswald", sans-serif;
  flex-shrink: 0; text-decoration: none;
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px 0 0; white-space: nowrap;
}
.brand:hover { color: #ddd; text-decoration: none; }
.brand i { font-size: 1.1rem; color: #f39c12; }

/* Nav links */
.nav-links {
  display: flex; list-style: none; align-items: stretch; height: 100%;
  margin: 0; padding: 0;
}
.nav-links > li {
  position: relative; display: flex; align-items: center;
}
.nav-links > li > a {
  color: #ccc; padding: 0 12px; font-size: 13px;
  font-family: "Be Vietnam Pro", sans-serif; font-weight: 400;
  height: var(--nav-h); display: flex; align-items: center; gap: 4px;
  transition: background .15s, color .15s; white-space: nowrap;
}
.nav-links > li > a:hover,
.nav-links > li > a.active { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.nav-links > li.has-dropdown:hover > a { background: rgba(255,255,255,.12); color: #fff; }

/* Dropdown — always dark regardless of theme */
.dropdown {
  display: none; position: absolute; top: var(--nav-h); left: 0;
  background: #16213e; border: 1px solid #2a2a4a; border-top: 2px solid var(--accent);
  list-style: none; min-width: 240px; z-index: 2000;
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
  columns: 2; column-gap: 0;
}
.has-dropdown:hover .dropdown { display: block; }
.dropdown li a {
  display: block; padding: 7px 14px; font-size: 13px;
  font-family: "Be Vietnam Pro", sans-serif; font-weight: 400;
  color: #b8c7ce; border-bottom: 1px solid #2a2a4a;
  transition: background .1s;
}
.dropdown li a:hover { background: #1e2a3a; color: var(--accent); text-decoration: none; }

/* Nav right */
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-wrap {
  display: flex; align-items: center;
  background: #fff; border: 1px solid rgba(255,255,255,.2);
  border-radius: 3px; overflow: hidden;
}
.search-wrap input {
  background: transparent; border: none; outline: none;
  color: #555; padding: 4px 10px; font-size: 14px; width: 180px;
  font-family: "Be Vietnam Pro", sans-serif; font-weight: 400;
}
.search-wrap input::placeholder { color: #aaa; }
.search-wrap button {
  background: var(--accent); border: none; color: #fff;
  padding: 0 10px; height: 28px; cursor: pointer; font-size: .8rem;
  transition: background .15s;
}
.search-wrap button:hover { background: var(--accent-h); }

.menu-toggle {
  display: none; background: transparent; border: 1px solid rgba(255,255,255,.3);
  color: #fff; padding: 3px 8px; border-radius: 3px; cursor: pointer;
}
.dark-toggle-btn {
  background: transparent; border: 1px solid rgba(255,255,255,.3);
  color: #fff; padding: 3px 9px; border-radius: 3px; cursor: pointer;
  font-size: .82rem; transition: background .15s; flex-shrink: 0;
}
.dark-toggle-btn:hover { background: rgba(255,255,255,.12); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content { padding: 14px 0 30px; }

/* Section blocks */
.section-block { margin-bottom: 20px; }
.section-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
  border-bottom: 2px solid var(--accent); padding-bottom: 6px;
}
.section-title {
  font-size: .98rem; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: .3px;
}
.section-more { font-size: .78rem; color: var(--accent); margin-left: auto; white-space: nowrap; }
.section-more:hover { color: var(--accent-h); }

/* ============================================================
   FEATURED STRIP
   ============================================================ */
.featured-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(103px, 1fr));
  gap: 8px;
}
.novel-card {
  background: var(--card-bg); border-radius: var(--r);
  overflow: hidden; box-shadow: var(--shadow);
  cursor: pointer; text-decoration: none; color: inherit;
  transition: transform .15s, box-shadow .15s; display: block;
}
.novel-card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.18); text-decoration: none; }
.card-cover {
  position: relative; padding-top: 140%; overflow: hidden; background: #e0e0e0;
}
.card-cover img {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover; transition: transform .3s;
}
.novel-card:hover .card-cover img { transform: scale(1.04); }
.card-badge {
  position: absolute; top: 0; left: 0;
  background: var(--badge-full); color: #fff;
  font-size: .62rem; font-weight: 700; padding: 2px 5px;
  text-transform: uppercase;
}
.card-badge.new-badge { background: var(--badge-new); }
.card-cover-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.82));
  padding: 22px 5px 5px;
}
.card-title {
  color: #fff; font-size: .72rem; font-weight: 700;
  line-height: 1.3; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}

/* ============================================================
   HOMEPAGE 2-COLUMN LAYOUT
   ============================================================ */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 270px;
  gap: 16px;
  align-items: start;
}
.home-main {}

/* Table toolbar */
.tbl-toolbar {
  display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap;
}
.tbl-search {
  padding: 3px 8px; border: 1px solid var(--border); border-radius: var(--r);
  font-size: .78rem; outline: none; width: 150px;
}
.tbl-search:focus { border-color: var(--accent); }
.tbl-sort-btn {
  padding: 3px 9px; border: 1px solid var(--border); border-radius: var(--r);
  background: #fff; font-size: .75rem; cursor: pointer; white-space: nowrap;
  transition: all .15s;
}
.tbl-sort-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Novel list table */
.novel-list-table {
  width: 100%; border-collapse: collapse; table-layout: fixed;
  background: var(--card-bg); border-radius: var(--r);
  overflow: hidden; box-shadow: var(--shadow);
}
.novel-list-table th:nth-child(1), .novel-list-table td:nth-child(1) { width: 40%; }
.novel-list-table th:nth-child(2), .novel-list-table td:nth-child(2) { width: 23%; }
.novel-list-table th:nth-child(3), .novel-list-table td:nth-child(3) { width: 24%; }
.novel-list-table th:nth-child(4), .novel-list-table td:nth-child(4) { width: 13%; }
.novel-list-table td:nth-child(3) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.novel-list-table thead tr { background: var(--primary); color: #fff; }
.novel-list-table th {
  padding: 8px 10px; text-align: left; font-size: .85rem; font-weight: 600;
  white-space: nowrap;
}
.novel-list-table td {
  padding: 8px 10px; border-bottom: 1px solid #f0f0f0; font-size: .9rem;
  vertical-align: middle;
}
.novel-list-table tbody tr { cursor: pointer; transition: background .1s; }
.novel-list-table tbody tr:hover { background: #f6fff9; }
.novel-list-table tbody tr:last-child td { border-bottom: none; }

.col-title a { color: var(--text); font-weight: 600; font-size: .92rem; }
.col-title a:hover { color: var(--accent); text-decoration: none; }
.col-genre { font-size: .84rem; color: var(--text-muted); white-space: nowrap; }
.col-chap a { color: var(--link); font-size: .84rem; }
.col-chap a:hover { color: var(--link-h); }
.col-views { color: var(--text-muted); font-size: .82rem; white-space: nowrap; }
.col-updated { color: var(--text-muted); font-size: .82rem; white-space: nowrap; }

.badge-new  { background: var(--badge-new);  color: #fff; font-size: .62rem; padding: 1px 4px; border-radius: 2px; margin-left: 3px; font-weight: 700; vertical-align: middle; }
.badge-full { background: var(--badge-full); color: #fff; font-size: .62rem; padding: 1px 4px; border-radius: 2px; margin-left: 3px; font-weight: 700; vertical-align: middle; }

/* ============================================================
   RIGHT SIDEBAR
   ============================================================ */
.home-sidebar {}

.sidebar-widget {
  background: var(--card-bg); border-radius: var(--r);
  box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden;
}
.sidebar-widget-header {
  background: var(--primary); color: #fff;
  padding: 7px 12px; font-size: .82rem; font-weight: 700;
  display: flex; align-items: center; gap: 6px;
}
.sidebar-widget-header i { font-size: .85rem; opacity: .85; }

/* Filter form inside sidebar */
.filter-form { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.filter-group { display: flex; flex-direction: column; gap: 3px; }
.filter-group label { font-size: .7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; }
.filter-group select {
  width: 100%; padding: 5px 6px; border: 1px solid var(--border);
  border-radius: var(--r); font-size: .8rem; color: var(--text); background: #fff;
}
.filter-group select:focus { outline: none; border-color: var(--accent); }
.filter-apply {
  background: var(--accent); color: #fff; border: none;
  padding: 7px; border-radius: var(--r); cursor: pointer;
  font-size: .82rem; font-weight: 700; width: 100%;
  transition: background .15s;
}
.filter-apply:hover { background: var(--accent-h); }

/* Genre list in sidebar */
.genre-list { display: flex; flex-direction: column; }
.genre-list a {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; font-size: .8rem; color: var(--text);
  border-bottom: 1px solid #f0f0f0; transition: background .1s, color .1s;
}
.genre-list a:last-child { border-bottom: none; }
.genre-list a:hover { background: #f6fff9; color: var(--accent); text-decoration: none; }
.genre-list a i { font-size: .65rem; color: var(--accent); flex-shrink: 0; }

/* 2-column genre grid for sidebar */
.genre-2col {
  display: grid; grid-template-columns: 1fr 1fr; padding: 4px 6px; gap: 0;
}
.genre-2col a {
  padding: 5px 6px; font-size: .77rem; color: var(--text);
  display: block; transition: color .1s; border-bottom: 1px solid #f5f5f5;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.genre-2col a:hover { color: var(--accent); text-decoration: none; }
.genre-2col a::before { content: '›'; margin-right: 4px; color: var(--accent); }

/* Reading history items */
.reading-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 12px; border-bottom: 1px solid #f0f0f0; gap: 6px;
}
.reading-item:last-child { border-bottom: none; }
.reading-item-title {
  font-size: .78rem; color: var(--text); flex: 1; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
}
.reading-item-chap { font-size: .72rem; color: var(--link); white-space: nowrap; flex-shrink: 0; }

/* Sidebar novel items */
.sidebar-novel-item {
  display: flex; align-items: flex-start; gap: 7px;
  padding: 8px 12px; border-bottom: 1px solid #f0f0f0;
  transition: background .1s; text-decoration: none; color: inherit;
}
.sidebar-novel-item:last-child { border-bottom: none; }
.sidebar-novel-item:hover { background: #f6fff9; text-decoration: none; }
.sni-rank {
  width: 18px; height: 18px; border-radius: 2px; flex-shrink: 0;
  background: #bbb; color: #fff; font-size: .65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.sni-rank.r1 { background: #e74c3c; }
.sni-rank.r2 { background: #e67e22; }
.sni-rank.r3 { background: #f39c12; }
.sni-title { font-size: .8rem; line-height: 1.35; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sni-meta { font-size: .72rem; color: var(--text-muted); margin-top: 1px; }

/* ============================================================
   COMPLETED GRID
   ============================================================ */
.completed-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
}
.completed-item {
  display: flex; align-items: center; gap: 9px;
  background: var(--card-bg); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 8px 10px;
  cursor: pointer; text-decoration: none; color: inherit;
  transition: box-shadow .15s;
}
.completed-item:hover { box-shadow: 0 3px 10px rgba(0,0,0,.14); text-decoration: none; }
.completed-cover { position: relative; flex-shrink: 0; }
.completed-cover img { width: 44px; height: 60px; object-fit: cover; border-radius: 2px; }
.completed-cover .card-badge { font-size: .55rem; padding: 1px 3px; }
.completed-info { flex: 1; min-width: 0; }
.completed-title {
  font-size: .82rem; font-weight: 600; line-height: 1.3;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.completed-meta { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   NOVEL DETAIL PAGE
   ============================================================ */
.page-title-bar {
  background: #e8e8e8; border-bottom: 1px solid var(--border);
  padding: 5px 0; font-size: .78rem; color: var(--text-muted);
}
.page-title-bar a { color: var(--link); }
.page-title-bar a:hover { color: var(--link-h); }
.breadcrumb-sep { margin: 0 5px; }

.detail-layout { display: grid; grid-template-columns: 1fr 220px; gap: 14px; align-items: start; }

.info-section {
  background: var(--card-bg); border-radius: var(--r);
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.info-section-title {
  font-size: .88rem; font-weight: 700; color: var(--primary); text-transform: uppercase;
  border-left: 3px solid var(--accent); padding-left: 8px; margin-bottom: 14px;
}

.novel-detail-wrap { display: flex; gap: 16px; }
.novel-cover-col { flex-shrink: 0; width: 185px; }
.novel-cover-wrap { position: relative; }
.novel-cover-img { width: 185px; height: 290px; object-fit: cover; border-radius: var(--r); box-shadow: var(--shadow); }
.cover-meta { margin-top: 10px; font-size: .8rem; }
.cover-meta .meta-row { margin-bottom: 5px; }
.badge-lg { font-size: .75rem; padding: 2px 7px; }

.novel-meta { flex: 1; min-width: 180px; }
.novel-title { font-size: 1.25rem; font-weight: 700; color: var(--primary); margin-bottom: 6px; line-height: 1.3; }
.rating-row { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.stars { font-size: .9rem; }
.star-on { color: #f39c12; }
.star-off { color: #ddd; }
.rating-text { font-size: .8rem; color: var(--text-muted); }
.novel-desc { margin-bottom: 10px; color: var(--text-muted); font-size: .92rem; line-height: 1.7; }
.novel-desc.collapsed { max-height: 72px; overflow: hidden; }
.meta-row { margin-bottom: 5px; font-size: .83rem; }
.meta-label { font-weight: 700; color: var(--primary); margin-right: 4px; }
.author-link { color: var(--accent); }
.author-link:hover { text-decoration: underline; }
.genre-inline { color: var(--accent); }
.genre-inline:hover { text-decoration: underline; }
.genre-tag {
  display: inline-block; background: #e8f5e9; border: 1px solid #a5d6a7;
  color: var(--accent); padding: 1px 8px; border-radius: 10px; font-size: .75rem; margin: 1px 2px;
}
.genre-tag:hover { background: var(--accent); color: #fff; text-decoration: none; }
.genre-tag-link { cursor: pointer; }
.status-full    { color: var(--accent); font-weight: 700; }
.status-ongoing { color: var(--badge-new); font-weight: 700; }

.action-btns { display: flex; gap: 7px; margin-top: 12px; flex-wrap: wrap; }
.latest-chaps { margin-top: 10px; font-size: .82rem; line-height: 1.8; }
.latest-chaps-label { font-weight: 700; color: var(--primary); margin-right: 4px; }
.latest-chap-link { display: block; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.latest-chap-link:hover { text-decoration: underline; }
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 16px; border: none; border-radius: var(--r); cursor: pointer;
  font-size: .83rem; font-weight: 700; text-decoration: none; transition: background .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-secondary { background: #2980b9; color: #fff; }
.btn-secondary:hover { background: #1f6898; }
.btn-outline { background: #fff; border: 1px solid var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; }

/* Chapter list */
.chapter-section { background: var(--card-bg); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.chapter-controls { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; flex-wrap: wrap; }
.chapter-search-input {
  padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--r);
  font-size: .78rem; outline: none; width: 150px;
}
.chapter-search-input:focus { border-color: var(--accent); }
.sort-btn {
  padding: 4px 9px; border: 1px solid var(--border); border-radius: var(--r);
  background: #fff; font-size: .75rem; cursor: pointer; transition: all .15s;
}
.sort-btn:hover, .sort-btn.active { border-color: var(--accent); color: var(--accent); }

.chapter-list-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.chapter-list-grid ul { list-style: none; }
.chapter-list-grid li { border-bottom: none; }
.chapter-list-grid li a {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 2px; font-size: .8rem; color: var(--text); transition: color .15s;
}
.chapter-list-grid li a:hover { color: var(--accent); text-decoration: none; }
.chap-icon { font-size: .45rem; color: var(--accent); flex-shrink: 0; }

.pagination { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.page-btn {
  padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--r);
  background: #fff; cursor: pointer; font-size: .78rem; transition: all .15s;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: default; }

/* Hot tab bar in sidebar */
.hot-tabs { display: flex; border-bottom: 1px solid var(--border); background: #fff; }
.hot-tab {
  padding: 6px 10px; font-size: .75rem; font-weight: 700; cursor: pointer;
  border: none; background: none; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all .15s;
}
.hot-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ============================================================
   CHAPTER READER
   ============================================================ */
.chapter-reader { max-width: 1170px; margin: 0 auto; padding: 24px 15px 60px; }
.chapter-novel-title {
  font-family: "Roboto Condensed", Tahoma, sans-serif;
  font-size: 24px; font-weight: 400; color: #669900;
  text-align: center; display: block; margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .5px;
  text-decoration: none;
}
.chapter-novel-title:hover { color: #4d7200; text-decoration: none; }
.chapter-select-wrap { display: flex; justify-content: center; margin: 8px 0 14px; }
.chapter-select-wrap .chapter-select { font-size: .95rem; padding: 5px 10px; max-width: 260px; text-align: center; }
.chapter-name-display { text-align: center; font-size: 1rem; color: var(--text-muted); margin: 6px 0 14px; }
.chap-select-panel { display: flex; justify-content: center; padding: 10px 0 6px; }
.chap-select-panel .chapter-select { font-size: .95rem; padding: 5px 10px; width: 280px; }
select.nav-chap-select { font-size: 16px !important; padding: 11px 10px !important; height: 40px !important; border-radius: 4px; min-width: 160px; max-width: 280px; box-sizing: border-box; }
.ornament {
  text-align: center; color: #aaa; margin: 12px 0; font-size: 1rem;
  letter-spacing: 6px; font-family: Georgia, 'Times New Roman', serif;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
}

.chapter-nav {
  display: flex; justify-content: center; align-items: center; gap: 5px; margin: 14px 0; flex-wrap: wrap;
}
.nav-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 11px 22px; border: none; border-radius: 4px; cursor: pointer;
  font-size: 16px; font-weight: 400; background: #5cb85c; color: #fff;
  transition: background .15s, opacity .15s;
}
.nav-btn:hover { background: #449d44; }
.nav-btn:disabled { opacity: .35; cursor: not-allowed; }
.nav-btn-index { background: #5cb85c; padding: 11px 14px; }
.nav-btn-index:hover { background: #449d44; }

.reader-settings { display: flex; justify-content: center; align-items: center; gap: 5px; margin: 5px 0 18px; flex-wrap: wrap; }
.setting-btn {
  padding: 4px 11px; border: 1px solid var(--border); border-radius: var(--r);
  background: #fff; cursor: pointer; font-size: .78rem; color: var(--text); transition: all .15s;
}
.setting-btn:hover { border-color: var(--accent); color: var(--accent); }
.chapter-select { padding: 3px 7px; border: 1px solid var(--border); border-radius: var(--r); font-size: .78rem; outline: none; }
.chapter-select:focus { border-color: var(--accent); }

#chapterContent {
  font-family: "Palatino Linotype", Arial, "Times New Roman", sans-serif;
  font-size: 26px; line-height: 1.9; color: rgb(43, 43, 43);
  background: transparent; padding: 0;
}
#chapterContent p { margin: 0 0 14px; }

.progress-bar { position: fixed; bottom: 0; left: 0; height: 3px; background: var(--accent); z-index: 999; transition: width .1s; }
.back-top {
  position: fixed; bottom: 20px; right: 20px; width: 36px; height: 36px;
  border-radius: 50%; background: var(--accent); color: #fff; border: none;
  cursor: pointer; font-size: .9rem; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(39,174,96,.4); opacity: .85; transition: opacity .2s;
}
.back-top:hover { opacity: 1; }

/* Dark theme */
body.dark-theme {
  --bg: #1a1a2e; --card-bg: #16213e; --text: #ddd; --text-muted: #999; --border: #2a2a4a;
}
body.dark-theme .page-title-bar { background: #16213e; }
body.dark-theme .novel-card, body.dark-theme .completed-item,
body.dark-theme .info-section, body.dark-theme .chapter-section,
body.dark-theme .sidebar-widget { background: #16213e; }
body.dark-theme .novel-list-table { background: #16213e; }
body.dark-theme .novel-list-table tbody tr:hover { background: #1e2a4a; }
body.dark-theme #chapterContent { background: transparent; color: #d4d4d4; }
body.dark-theme .filter-group select { background: #16213e; color: #ddd; border-color: #2a2a4a; }
body.dark-theme .tbl-search, body.dark-theme .tbl-sort-btn, body.dark-theme .sort-btn,
body.dark-theme .setting-btn, body.dark-theme .page-btn { background: #16213e; color: #ddd; border-color: #2a2a4a; }
body.dark-theme .chapter-select { background: #16213e; color: #ddd; }
body.dark-theme .col-title a { color: #ddd; }
body.dark-theme .genre-list a { color: #ddd; border-color: #2a2a4a; }
body.dark-theme .genre-list a:hover { background: #1e3a2e; }
body.dark-theme .novel-title, body.dark-theme .section-title { color: #ddd; }
body.dark-theme .chapter-list-grid li a { color: #ddd; }
body.dark-theme .sidebar-novel-item:hover { background: #1e2a3a; }
body.dark-theme .site-tagline { background: #16213e; border-color: #2a2a4a; color: #888; }
body.dark-theme .section-header { border-color: #2a6a4a; }
body.dark-theme .cat-item { background: #16213e; }
body.dark-theme .cat-item:hover { box-shadow: 0 3px 10px rgba(0,0,0,.4); }
body.dark-theme .cat-item-title { color: #ddd; }
body.dark-theme .cat-item-meta { color: #888; }
body.dark-theme .cat-item-desc { color: #888; }
body.dark-theme .search-page-header h2 { color: #ddd; }
body.dark-theme .search-bar-large input { background: #16213e; color: #ddd; border-color: #2a2a4a; }
body.dark-theme .genre-tag { background: #1e2a3e; border-color: #2a3a5e; color: #7ec87e; }
body.dark-theme .genre-tag:hover { background: var(--accent); color: #fff; }
body.dark-theme .genre-2col a { color: #bbb; border-color: #2a2a4a; }
body.dark-theme .reading-item-title { color: #bbb; }
body.dark-theme .reading-item { border-color: #2a2a4a; }
body.dark-theme .completed-item { background: #16213e; }
body.dark-theme .completed-title { color: #ddd; }
body.dark-theme .page-title-bar a { color: #6ab0d4; }
body.dark-theme .novel-desc { color: #999; }
body.dark-theme .meta-label { color: #bbb; }
body.dark-theme .novel-title { color: #ddd; }
body.dark-theme .chapter-name { color: #aaa; }
body.dark-theme .chapter-novel-title { color: #8fba00; }

/* ============================================================
   SEARCH / CATEGORY PAGE
   ============================================================ */

/* Genre filter bar */
.genre-filter-bar {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.gf-tag {
  padding: 5px 13px; border: 1px solid var(--border); border-radius: 20px;
  background: var(--card-bg); color: var(--text); font-size: .82rem;
  cursor: pointer; transition: all .15s; white-space: nowrap;
  user-select: none;
}
.gf-tag:hover { border-color: var(--accent); color: var(--accent); }
.gf-tag.active {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600;
}
.gf-clear {
  padding: 5px 12px; border: 1px solid #e74c3c; border-radius: 20px;
  background: #fff; color: #e74c3c; font-size: .82rem;
  cursor: pointer; transition: all .15s; white-space: nowrap;
  margin-left: auto;
}
.gf-clear:hover { background: #e74c3c; color: #fff; }
body.dark-theme .gf-tag { background: #16213e; border-color: #2a2a4a; color: #ccc; }
body.dark-theme .gf-tag:hover { border-color: var(--accent); color: var(--accent); }
body.dark-theme .gf-tag.active { background: var(--accent); color: #fff; border-color: var(--accent); }
body.dark-theme .gf-clear { background: #16213e; }

.cat-item {
  display: flex; gap: 10px; background: var(--card-bg); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 10px; margin-bottom: 8px;
  text-decoration: none; color: inherit; transition: box-shadow .15s;
}
.cat-item:hover { box-shadow: 0 3px 10px rgba(0,0,0,.14); text-decoration: none; }
.cat-item-cover img { width: 58px; height: 78px; object-fit: cover; border-radius: 2px; }
.cat-item-info { flex: 1; min-width: 0; }
.cat-item-title { font-size: .9rem; font-weight: 700; color: var(--primary); margin-bottom: 3px; }
.cat-item-meta  { font-size: .76rem; color: var(--text-muted); margin-bottom: 4px; }
.cat-item-desc  { font-size: .78rem; color: var(--text-muted); overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ============================================================
   LOADING / ERROR
   ============================================================ */
.loading-spinner { text-align: center; padding: 28px; color: var(--text-muted); font-size: .9rem; }
.error-box { background: #fff3f3; border: 1px solid #f5c6cb; border-radius: var(--r); padding: 14px; color: #c0392b; font-size: .85rem; }
.empty-msg { color: var(--text-muted); padding: 18px; text-align: center; font-size: .85rem; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--primary-dark); color: #888;
  padding: 22px 14px; margin-top: 30px;
  text-align: center; font-size: .8rem; line-height: 1.9;
}
.site-footer a { color: #aaa; margin: 0 5px; }
.site-footer a:hover { color: #fff; text-decoration: none; }
.footer-links { margin-bottom: 5px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .home-layout { grid-template-columns: 1fr 230px; }
  .featured-strip { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
}
@media (max-width: 700px) {
  .home-layout { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .completed-grid { grid-template-columns: 1fr; }
  .chapter-list-grid { grid-template-columns: 1fr; }
  .novel-detail-wrap { flex-direction: column; }
  .novel-cover-col { width: 130px; }
  .novel-cover-img { width: 130px; height: 200px; }
  #chapterContent { padding: 16px 12px; }
  .menu-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: var(--primary-dark); flex-direction: column; align-items: flex-start;
    padding: 8px; gap: 0; box-shadow: 0 4px 12px rgba(0,0,0,.3); z-index: 1001;
  }
  .nav-links > li { width: 100%; }
  .nav-links > li > a { height: auto; padding: 10px 14px; width: 100%; }
  .nav-links.open { display: flex; }
  .dropdown { position: static; columns: 1; border: none; box-shadow: none; background: rgba(255,255,255,.05); }
  .has-dropdown:hover .dropdown { display: none; }
  .has-dropdown.open .dropdown { display: block; }
  .search-wrap { display: none; }
  .featured-strip { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
}
@media (max-width: 460px) {
  .featured-strip { grid-template-columns: repeat(auto-fill, minmax(75px, 1fr)); }
}
