/* ===== TruyệnChữ WordPress Theme ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Noto+Serif:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Playfair+Display:wght@600;700;800&family=Source+Serif+4:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --accent: #f59e0b;
    --bg: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --reader-width: 720px;
    --header-height: 64px;
    --transition: 0.2s ease;
}

[data-theme="dark"] {
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --primary-light: #1e1b4b;
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.4);
}

[data-theme="sepia"] {
    --primary: #b45309;
    --primary-hover: #92400e;
    --primary-light: #fef3c7;
    --bg: #fdf6e3;
    --bg-secondary: #fef9ef;
    --bg-card: #fffbf0;
    --bg-input: #fef3c7;
    --text: #44331a;
    --text-secondary: #78653d;
    --text-muted: #a08c63;
    --border: #f0e6cc;
}

[data-theme="oled"] {
    --primary: #a78bfa;
    --primary-hover: #8b5cf6;
    --primary-light: #1a0a3e;
    --bg: #000000;
    --bg-secondary: #0a0a0a;
    --bg-card: #111111;
    --bg-input: #1a1a1a;
    --text: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border: #262626;
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }

/* ===== Header ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    height: var(--header-height);
    transition: background var(--transition), border-color var(--transition);
}

.header-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 20px;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), #ec4899);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    font-family: 'Noto Serif', serif;
}

.logo-text { font-size: 20px; font-weight: 800; color: var(--text); }

.main-nav { display: flex; gap: 4px; }
.main-nav a {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    white-space: nowrap;
}
.main-nav a:hover,
.main-nav .current-menu-item > a { color: var(--primary); background: var(--primary-light); }

.header-search {
    flex: 1;
    max-width: 360px;
    position: relative;
    margin-left: auto;
}

.header-search input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: all var(--transition);
}

.header-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

.header-search .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    transition: all var(--transition);
    flex-shrink: 0;
}
.btn-icon:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.btn-icon svg { width: 18px; height: 18px; }

.icon-moon { display: none; }
[data-theme="dark"] .icon-sun, [data-theme="oled"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon, [data-theme="oled"] .icon-moon { display: block; }

.mobile-menu-toggle { display: none; }

/* ===== Layout ===== */
.container { max-width: 1240px; margin: 0 auto; padding: 32px 24px; }

.breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--text); }

/* ===== Hero ===== */
.hero-banner {
    background: linear-gradient(135deg, var(--primary-light), var(--bg-secondary));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 44px 40px;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    position: relative;
}
.hero-content { max-width: 560px; position: relative; z-index: 2; }
.hero-title { font-size: 32px; font-weight: 800; line-height: 1.2; margin-bottom: 12px; }
.hero-title span {
    background: linear-gradient(135deg, var(--primary), #ec4899);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-desc { font-size: 15px; color: var(--text-secondary); line-height: 1.7; }
.hero-char { font-size: 120px; font-weight: 900; opacity: 0.08; color: var(--primary); font-family: 'Noto Serif', serif; user-select: none; }

/* ===== Sections ===== */
.section { margin-bottom: 44px; }
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.section-title { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-more { font-size: 13px; color: var(--primary); font-weight: 500; }
.section-more:hover { text-decoration: underline; }

/* ===== Novel Grid (poster cards like reference) ===== */
.novel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px 16px;
}

.poster-card { cursor: pointer; }

.poster-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: var(--bg-secondary);
}

.poster-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.poster-card:hover .poster-cover img { transform: scale(1.06); }

.poster-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 45%);
    opacity: 0;
    transition: opacity var(--transition);
}
.poster-card:hover .poster-cover::after { opacity: 1; }

.poster-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(15,23,42,0.82);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
}

.poster-hot {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    z-index: 2;
}

.poster-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    margin-top: 10px;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--transition);
    min-height: 38px;
}
.poster-card:hover .poster-title { color: var(--primary); }

.poster-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.poster-meta span { display: inline-flex; align-items: center; gap: 4px; }
.poster-meta svg { width: 13px; height: 13px; }

/* ===== Filters ===== */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip {
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}
.filter-chip.active, .filter-chip:hover {
    background: var(--primary); color: #fff; border-color: var(--primary);
}

/* ===== Content Layout (list + sidebar) ===== */
.content-layout { display: grid; grid-template-columns: 1fr 320px; gap: 36px; align-items: start; }

/* ===== Novel Row List ===== */
.novels-list { display: flex; flex-direction: column; gap: 16px; }
.novel-row {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    gap: 16px;
    transition: all var(--transition);
}
.novel-row:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateX(4px); }
.novel-row .row-cover { width: 76px; height: 104px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.row-info { flex: 1; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.row-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.row-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.row-title:hover { color: var(--primary); }
.row-author { font-size: 13px; color: var(--text-secondary); }
.row-desc {
    font-size: 13px; color: var(--text-muted); line-height: 1.5; margin: 8px 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row-meta { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.row-meta strong { color: var(--text-secondary); }
.badge-genre {
    background: var(--primary-light); color: var(--primary);
    padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; white-space: nowrap;
}

/* ===== Sidebar ===== */
.sidebar { display: flex; flex-direction: column; gap: 24px; position: sticky; top: 88px; }
.sidebar-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.sidebar-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.rank-list { display: flex; flex-direction: column; gap: 14px; }
.rank-item { display: flex; gap: 12px; align-items: center; }
.rank-item:hover .rank-title { color: var(--primary); }
.rank-num {
    width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; background: var(--bg-input); color: var(--text-muted);
}
.rank-item:nth-child(1) .rank-num { background: #ef4444; color: #fff; }
.rank-item:nth-child(2) .rank-num { background: #f97316; color: #fff; }
.rank-item:nth-child(3) .rank-num { background: #eab308; color: #fff; }
.rank-info { min-width: 0; }
.rank-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color var(--transition); }
.rank-meta { font-size: 11px; color: var(--text-muted); }

/* ===== Buttons ===== */
.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--primary); color: #fff; font-weight: 600;
    padding: 12px 24px; border-radius: var(--radius-sm); font-size: 14px;
    transition: all var(--transition); box-shadow: 0 4px 12px rgba(99,102,241,0.25);
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-secondary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--bg-input); color: var(--text); font-weight: 600;
    padding: 12px 24px; border-radius: var(--radius-sm); font-size: 14px;
    border: 1px solid var(--border); transition: all var(--transition);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

/* ===== Novel Detail ===== */
.book-header {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 32px; display: flex; gap: 32px; margin-bottom: 32px;
}
.book-cover { width: 190px; height: 264px; border-radius: var(--radius); overflow: hidden; flex-shrink: 0; box-shadow: var(--shadow-md); }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-info { flex: 1; display: flex; flex-direction: column; }
.book-title { font-size: 26px; font-weight: 800; line-height: 1.2; margin-bottom: 12px; }
.book-meta { display: flex; flex-wrap: wrap; gap: 10px 20px; font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }
.book-meta strong { color: var(--text); }
.book-meta a:hover { color: var(--primary); }
.book-genres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.book-stats { display: flex; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.stat { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 18px; text-align: center; }
.stat-value { font-size: 18px; font-weight: 700; color: var(--primary); display: block; }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.book-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: auto; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: 24px; flex-wrap: wrap; }
.tab { padding: 12px 4px; font-size: 15px; font-weight: 600; color: var(--text-muted); position: relative; transition: color var(--transition); background: none; }
.tab.active { color: var(--primary); }
.tab.active::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--primary); border-radius: 2px; }
.tab-panel { display: none; animation: fadeUp 0.25s ease; }
.tab-panel.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Stacked novel sections ===== */
.novel-sections { display: flex; flex-direction: column; gap: 36px; }
.novel-section { }
.novel-section-title {
    font-size: 19px; font-weight: 700; margin-bottom: 18px;
    display: flex; align-items: center; gap: 10px;
    padding-bottom: 12px; border-bottom: 2px solid var(--border); position: relative;
}
.novel-section-title::before {
    content: ''; width: 4px; height: 20px; border-radius: 2px; background: var(--primary); display: inline-block;
}
.section-count { font-size: 13px; font-weight: 500; color: var(--text-muted); }

.intro-text { line-height: 1.9; font-size: 15px; text-align: justify; }
.intro-text p { margin-bottom: 16px; }
.tag-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.tag-item { background: var(--bg-input); color: var(--text-secondary); padding: 5px 12px; border-radius: 16px; font-size: 12px; }
.tag-item:hover { color: var(--primary); }

/* ===== Chapters List ===== */
.chapters-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.chapters-search { position: relative; max-width: 320px; flex: 1; }
.chapters-search input {
    width: 100%; padding: 8px 12px 8px 34px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-input); color: var(--text); font-size: 13px; outline: none;
}
.chapters-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-muted); }
.chapters-sort { font-size: 13px; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; gap: 6px; user-select: none; }
.chapters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.chapter-item {
    padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: all var(--transition); color: var(--text);
}
.chapter-item:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.chapter-item.read { color: var(--text-muted); }

/* ===== Reader ===== */
.reader-page { background: var(--bg); min-height: 100vh; }
.reader-container { max-width: var(--reader-width); margin: 0 auto; padding: 32px 24px 80px; }
.reader-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 36px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.btn-back { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-secondary); font-weight: 500; transition: color var(--transition); }
.btn-back:hover { color: var(--primary); }
.btn-settings {
    display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm);
    background: var(--bg-input); border: 1px solid var(--border); color: var(--text); font-size: 13px; font-weight: 500; transition: all var(--transition);
}
.btn-settings:hover { border-color: var(--primary); color: var(--primary); }

.reader-head { text-align: center; margin-bottom: 40px; }
.reader-novel-name { display: block; font-size: 13px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 8px; }
.reader-novel-name:hover { color: var(--primary); }
.reader-chapter-title { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.3; font-family: 'Noto Serif', 'Source Serif 4', Georgia, serif; }

.reader-content {
    font-family: 'Noto Serif', Georgia, serif; font-size: 19px; line-height: 1.9;
    color: var(--text); text-align: justify; margin-bottom: 48px; min-height: 300px; transition: font-size 0.2s ease;
}
.reader-content.font-serif { font-family: 'Noto Serif', Georgia, serif; }
.reader-content.font-source { font-family: 'Source Serif 4', Georgia, serif; }
.reader-content.font-sans { font-family: 'Inter', sans-serif; }
.reader-content.font-playfair { font-family: 'Playfair Display', serif; }
.reader-content p { margin-bottom: 1.4em; text-indent: 2em; }
.reader-content p:first-child { text-indent: 0; }

.reader-nav { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 24px; gap: 12px; }
.btn-nav {
    display: flex; align-items: center; gap: 6px; padding: 10px 18px; background: var(--bg-input);
    border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; transition: all var(--transition);
}
.btn-nav:hover:not(.disabled) { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-nav.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.chapter-select-wrap { flex: 1; max-width: 240px; }
.chapter-select-wrap select {
    width: 100%; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--bg-input);
    border: 1px solid var(--border); color: var(--text); font-size: 13px; font-weight: 600; outline: none; text-align: center; cursor: pointer;
}
.reader-tip { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 32px; }

/* ===== Settings Panel ===== */
.settings-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 200; opacity: 0; visibility: hidden; transition: all 0.3s ease; }
.settings-overlay.active { opacity: 1; visibility: visible; }
.settings-panel {
    position: fixed; top: 0; right: 0; width: 340px; max-width: 90vw; height: 100vh; background: var(--bg-card);
    border-left: 1px solid var(--border); z-index: 201; transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1); display: flex; flex-direction: column;
}
.settings-panel.active { transform: translateX(0); }
.settings-header { padding: 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 16px; }
.btn-close { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-input); display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--text-secondary); }
.btn-close:hover { background: var(--border); }
.settings-body { padding: 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 24px; }
.setting-group { display: flex; flex-direction: column; gap: 10px; }
.setting-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.theme-options { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.theme-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border-radius: var(--radius-sm); border: 2px solid transparent; font-size: 11px; font-weight: 500; color: var(--text-secondary); transition: all var(--transition); background: none; }
.theme-btn.active { border-color: var(--primary); color: var(--primary); }
.theme-preview { width: 32px; height: 32px; border-radius: 8px; border: 1px solid #e2e8f0; }
.light-preview { background: #fff; }
.sepia-preview { background: #fdf6e3; border-color: #f0e6cc; }
.dark-preview { background: #1e293b; border-color: #334155; }
.oled-preview { background: #000; border-color: #333; }
.setting-select { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--bg-input); border: 1px solid var(--border); color: var(--text); font-size: 13px; outline: none; }
.size-controls { display: flex; gap: 8px; }
.btn-size { flex: 1; height: 36px; background: var(--bg-input); border: 1px solid var(--border); color: var(--text); font-size: 13px; font-weight: 600; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; transition: all var(--transition); }
.btn-size:hover { border-color: var(--primary); color: var(--primary); }
.size-value { width: 56px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; background: var(--bg-input); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.setting-row { display: flex; justify-content: space-between; align-items: center; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--border); border-radius: 24px; cursor: pointer; transition: .3s; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s; }
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.range-slider { width: 100%; accent-color: var(--primary); height: 4px; }
.range-value { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-align: center; }
.range-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }

/* ===== Comments ===== */
.comment-respond, .commentlist { margin-top: 8px; }
.comment-form textarea, .comment-form input[type=text], .comment-form input[type=email] {
    width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-input); color: var(--text); padding: 12px; font-family: inherit; font-size: 14px; outline: none; margin-bottom: 10px;
}
.comment-form textarea:focus { border-color: var(--primary); }
.commentlist { list-style: none; display: flex; flex-direction: column; gap: 16px; padding: 0; }
.commentlist .comment-body { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.commentlist .comment-author { font-weight: 600; font-size: 14px; }
.commentlist .comment-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.commentlist .comment-content { font-size: 14px; line-height: 1.6; }

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 36px; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 40px; height: 40px; padding: 0 12px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-card); font-size: 14px; font-weight: 500; color: var(--text); transition: all var(--transition);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== Footer ===== */
.site-footer { background: var(--bg-secondary); border-top: 1px solid var(--border); padding: 40px 24px; margin-top: 40px; transition: background var(--transition), border-color var(--transition); }
.footer-inner { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.footer-col h4 { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.footer-col p { font-size: 13px; color: var(--text-secondary); line-height: 1.7; }
.footer-col ul { display: flex; flex-direction: column; gap: 8px; }
.footer-col a { font-size: 13px; color: var(--text-secondary); }
.footer-col a:hover { color: var(--primary); }
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.footer-bottom { max-width: 1240px; margin: 24px auto 0; padding-top: 20px; border-top: 1px solid var(--border); text-align: center; font-size: 13px; color: var(--text-muted); }

/* ===== Empty ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ===== Scrollbar & Selection ===== */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
::selection { background: rgba(99,102,241,0.2); color: inherit; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
    .content-layout { grid-template-columns: 1fr; }
    .sidebar { position: static; margin-top: 8px; }
    .book-header { flex-direction: column; align-items: center; text-align: center; }
    .book-meta, .book-genres, .book-stats, .book-actions { justify-content: center; }
    .hero-title { font-size: 26px; }
    .hero-char { font-size: 90px; }
    .main-nav { display: none; }
}
@media (max-width: 600px) {
    .header-inner { padding: 0 16px; gap: 12px; }
    .header-search { display: none; }
    .container { padding: 20px 16px; }
    .hero-banner { flex-direction: column; text-align: center; padding: 28px 20px; }
    .hero-char { display: none; }
    .novel-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 16px 12px; }
    .poster-title { font-size: 13px; }
    .novel-row { padding: 12px; gap: 12px; }
    .novel-row .row-cover { width: 64px; height: 88px; }
    .row-title { font-size: 14px; }
    .reader-container { padding: 20px 16px 60px; }
    .reader-chapter-title { font-size: 21px; }
    .reader-content { font-size: 17px; }
    .reader-nav { flex-direction: column; }
    .btn-nav { width: 100%; justify-content: center; }
    .chapter-select-wrap { max-width: 100%; width: 100%; }
    .footer-inner { grid-template-columns: 1fr; }
    .book-cover { width: 150px; height: 208px; }
}

/* WP core alignment helpers */
.alignright { float: right; margin: 0 0 1em 1.5em; }
.alignleft { float: left; margin: 0 1.5em 1em 0; }
.aligncenter { display: block; margin: 0 auto 1em; }
.sticky, .gallery-caption, .bypostauthor { }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }

/* ===== Homepage: Featured row ===== */
.featured-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 150px;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x proximity;
}
.featured-row::-webkit-scrollbar { height: 6px; }
.featured-item { scroll-snap-align: start; }
.featured-cover {
    position: relative; width: 100%; aspect-ratio: 3/4;
    border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-md); background: var(--bg-secondary);
}
.featured-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.featured-item:hover .featured-cover img { transform: scale(1.06); }
.featured-chap {
    position: absolute; bottom: 8px; left: 8px;
    background: rgba(99,102,241,0.92); color: #fff; font-size: 11px; font-weight: 700;
    padding: 3px 9px; border-radius: 20px;
}
.featured-name {
    display: block; margin-top: 8px; font-size: 13px; font-weight: 600; line-height: 1.35;
    color: var(--text); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.featured-item:hover .featured-name { color: var(--primary); }

/* ===== Homepage: 3-column widgets ===== */
.widget-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 44px; }
.widget-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.widget-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.widget-head h3 { font-size: 15px; font-weight: 700; }
.widget-head a { font-size: 12px; color: var(--primary); font-weight: 500; }
.widget-head a:hover { text-decoration: underline; }

.rank-widget { display: flex; flex-direction: column; gap: 12px; counter-reset: none; margin: 0; padding: 0; }
.rank-widget li { display: flex; align-items: center; gap: 10px; }
.rw-num {
    width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
    background: var(--bg-input); color: var(--text-muted);
}
.rw-num-1 { background: #ef4444; color: #fff; }
.rw-num-2 { background: #f97316; color: #fff; }
.rw-num-3 { background: #eab308; color: #fff; }
.rw-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rw-title:hover { color: var(--primary); }
.rw-num-val { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }

/* ===== Homepage: Update list (Vừa lên chương) ===== */
.update-list { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; }
.update-item { display: flex; gap: 10px; align-items: flex-start; }
.ui-cover { flex-shrink: 0; width: 40px; height: 54px; border-radius: 5px; overflow: hidden; }
.ui-cover img { width: 100%; height: 100%; object-fit: cover; }
.ui-info { min-width: 0; flex: 1; }
.ui-novel { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-novel:hover { color: var(--primary); }
.ui-chap { display: block; font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.ui-chap:hover { color: var(--primary); }
.ui-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.ui-genre { font-size: 10px; font-weight: 600; color: var(--primary); background: var(--primary-light); padding: 1px 7px; border-radius: 4px; }
.ui-time { font-size: 11px; color: var(--text-muted); }

/* ===== Homepage: Poster row (horizontal scroll) ===== */
.poster-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 150px;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x proximity;
}
.poster-row::-webkit-scrollbar { height: 6px; }
.poster-fixed { scroll-snap-align: start; }
.poster-done {
    position: absolute; top: 8px; left: 8px;
    background: linear-gradient(135deg,#10b981,#059669); color: #fff;
    padding: 3px 8px; border-radius: 6px; font-size: 10px; font-weight: 700; z-index: 2;
}

/* ===== Homepage: Library ===== */
.library-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
}
.library-genres { display: flex; gap: 8px; flex-wrap: wrap; }
.library-sorts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; scroll-margin-top: 80px; }
.ls-label { font-size: 13px; color: var(--text-muted); margin-right: 2px; }
.sort-link {
    font-size: 13px; font-weight: 500; color: var(--text-secondary);
    padding: 5px 12px; border-radius: 16px; transition: all var(--transition);
}
.sort-link:hover { color: var(--primary); }
.sort-link.active { background: var(--primary); color: #fff; }
.library-more { text-align: center; margin-top: 28px; }

/* ===== Homepage responsive ===== */
@media (max-width: 1024px) {
    .widget-columns { grid-template-columns: 1fr 1fr; }
    .widget-columns .widget-box:last-child { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
    .widget-columns { grid-template-columns: 1fr; }
    .widget-columns .widget-box:last-child { grid-column: auto; }
    .library-toolbar { flex-direction: column; align-items: stretch; }
    .featured-row { grid-auto-columns: 120px; }
    .poster-row { grid-auto-columns: 120px; }
}
