:root {
    --bg-primary: #0F0F0F;
    --bg-card: #1A1A1A;
    --bg-hover: #252525;
    --border: #2A2A2A;
    --border-hover: #444444;
    --text-primary: #FFFFFF;
    --text-secondary: #888888;
    --text-tertiary: #555555;
    --text-highlight: #DDDDDD;
    --divider: #222222;
    --overlay: rgba(0,0,0,0.85);
    --success-border: #2A3B2A;
    --error-border: #3B2A2A;
    --radius-global: 2px;
    --radius-button: 2px;
    --radius-card: 4px;
    --radius-input: 2px;
    --radius-tag: 2px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    --nav-height: 56px;
    --mobile-nav-height: 48px;
    --mobile-tab-height: 52px;
    --max-width: 1400px;
}

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

html { font-size: 14px; line-height: 1.7; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font-sans);
    font-weight: 400;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

::selection { background-color: rgba(255,255,255,0.15); color: #FFF; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; display: block; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.text-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.shimmer {
    background: linear-gradient(90deg, #1A1A1A 25%, #252525 50%, #1A1A1A 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideRight { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

.animate-float { animation: float 3s ease-in-out infinite; }
.animate-spin { animation: spin 0.6s linear infinite; }
.animate-fade-in { animation: fadeIn 0.3s ease; }
.animate-slide-up { animation: slideUp 0.5s ease-out; }

/* ========== Desktop Navigation ========== */
.desktop-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--nav-height);
    display: flex; align-items: center;
    transition: all 0.25s ease;
    background: transparent;
}
.desktop-nav.scrolled {
    background: rgba(15,15,15,0.8);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--divider);
}
.desktop-nav .nav-inner {
    max-width: var(--max-width); margin: 0 auto; width: 100%;
    display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.desktop-nav .logo { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }
.desktop-nav .nav-links { display: flex; align-items: center; gap: 24px; }
.desktop-nav .nav-links a {
    font-size: 14px; color: var(--text-secondary);
    transition: color 0.2s; position: relative; display: flex; align-items: center; gap: 6px;
}
.desktop-nav .nav-links a::after {
    content: ''; position: absolute; bottom: -4px; left: 0; width: 0; height: 1px;
    background: var(--text-primary); transition: width 0.25s; transform-origin: left;
}
.desktop-nav .nav-links a:hover { color: var(--text-primary); }
.desktop-nav .nav-links a:hover::after { width: 100%; }
.desktop-nav .nav-right { display: flex; align-items: center; gap: 16px; }
.desktop-nav .search-box { position: relative; }
.desktop-nav .search-box input {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-global);
    height: 32px; padding: 0 12px 0 36px; font-size: 12px; color: var(--text-primary);
    outline: none; width: 200px; transition: all 0.2s;
}
.desktop-nav .search-box input:focus { width: 320px; border-color: var(--border-hover); }
.desktop-nav .search-box input::placeholder { color: var(--text-tertiary); }
.desktop-nav .search-box .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); }
.desktop-nav .icon-btn {
    padding: 6px; border-radius: var(--radius-global); transition: background 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.desktop-nav .icon-btn:hover { background: var(--bg-hover); }
.desktop-nav .user-link { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-secondary); transition: color 0.2s; }
.desktop-nav .user-link:hover { color: var(--text-primary); }

/* ========== Mobile Navigation ========== */
.mobile-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--mobile-nav-height); display: none; align-items: center;
    justify-content: space-between; padding: 0 16px;
    background: rgba(15,15,15,0.8); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--divider);
}
.mobile-nav .logo { font-size: 16px; font-weight: 700; }
.mobile-nav .nav-right { display: flex; align-items: center; gap: 12px; }

.mobile-tab {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    height: var(--mobile-tab-height); display: none; align-items: center;
    justify-content: space-around;
    background: rgba(15,15,15,0.8); backdrop-filter: blur(16px);
    border-top: 1px solid var(--divider);
}
.mobile-tab a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--text-tertiary); font-size: 11px; transition: color 0.2s; position: relative;
}
.mobile-tab a.active { color: var(--text-primary); }
.mobile-tab a.active::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 24px; height: 2px; background: var(--text-primary);
}

.mobile-drawer-overlay {
    position: fixed; inset: 0; z-index: 200; background: var(--overlay);
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.mobile-drawer-overlay.active { opacity: 1; pointer-events: auto; }
.mobile-drawer {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 201; width: 280px;
    background: var(--bg-primary); border-right: 1px solid var(--divider);
    transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
}
.mobile-drawer.active { transform: translateX(0); }
.mobile-drawer .drawer-header {
    height: var(--mobile-nav-height); display: flex; align-items: center;
    justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--divider);
}
.mobile-drawer .drawer-header .logo { font-weight: 700; }
.mobile-drawer .drawer-body { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.mobile-drawer .drawer-body a {
    padding: 10px 12px; font-size: 14px; color: var(--text-secondary);
    border-radius: var(--radius-global); transition: all 0.2s;
}
.mobile-drawer .drawer-body a:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ========== Hero Section ========== */
.hero {
    height: 420px; position: relative; overflow: hidden;
}
.hero .container { height: 100%; display: flex; align-items: center; }
.hero-left { width: 60%; }
.hero-left h1 { font-size: 36px; font-weight: 700; line-height: 1.2; margin-bottom: 12px; animation: slideUp 0.5s ease-out; }
.hero-left p { font-size: 16px; color: var(--text-secondary); margin-bottom: 32px; animation: slideUp 0.5s ease-out 0.08s both; }
.hero-left .btn-group { display: flex; gap: 16px; animation: slideUp 0.5s ease-out 0.16s both; }
.hero-right { width: 40%; position: relative; perspective: 1000px; display: flex; align-items: center; justify-content: center; }

.btn-primary {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--text-primary); color: var(--bg-primary);
    padding: 10px 24px; font-size: 14px; font-weight: 500;
    border-radius: var(--radius-button); transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-outline {
    display: inline-flex; align-items: center; gap: 8px;
    border: 1px solid var(--text-tertiary); color: var(--text-primary);
    padding: 10px 24px; font-size: 14px; font-weight: 500;
    border-radius: var(--radius-button); transition: border-color 0.2s;
}
.btn-outline:hover { border-color: var(--text-secondary); }

.hero-cover {
    position: absolute; width: 140px; height: 187px;
    background: var(--bg-card); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
}
.hero-cover:nth-child(1) { transform: rotateY(-8deg) translateX(-60px) translateZ(0); animation: slideUp 0.5s ease-out 0.3s both, float 3s ease-in-out infinite; }
.hero-cover:nth-child(2) { transform: rotateY(-8deg) translateZ(30px); animation: slideUp 0.5s ease-out 0.45s both, float 3s ease-in-out infinite 0.5s; }
.hero-cover:nth-child(3) { transform: rotateY(-8deg) translateX(60px) translateZ(60px); animation: slideUp 0.5s ease-out 0.6s both, float 3s ease-in-out infinite 1s; }

/* ========== Three Column Layout ========== */
.main-layout { display: flex; gap: 24px; padding-top: 32px; }
.sidebar-left { width: 220px; flex-shrink: 0; }
.sidebar-left .cat-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; font-size: 14px; color: var(--text-secondary);
    border-radius: var(--radius-global); transition: all 0.2s; cursor: pointer;
    border-left: 2px solid transparent;
}
.sidebar-left .cat-item:hover { color: var(--text-primary); background: var(--bg-hover); }
.sidebar-left .cat-item.active { color: var(--text-primary); background: var(--bg-hover); border-left-color: var(--text-primary); }
.sidebar-left .cat-item .cat-count { font-size: 12px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.sidebar-left .sub-cats { padding-left: 16px; }
.sidebar-left .sub-cats a { display: block; padding: 6px 12px; font-size: 12px; color: var(--text-tertiary); transition: color 0.2s; }
.sidebar-left .sub-cats a:hover { color: var(--text-secondary); }

.content-main { flex: 1; min-width: 0; }
.sidebar-right { width: 280px; flex-shrink: 0; }

/* ========== Tabs ========== */
.tabs { display: flex; align-items: center; gap: 4px; margin-bottom: 16px; }
.tab-btn {
    display: flex; align-items: center; gap: 6px; padding: 6px 12px;
    font-size: 14px; color: var(--text-tertiary); border-radius: var(--radius-global);
    transition: all 0.2s;
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--text-primary); background: var(--bg-hover); }

/* ========== Book Grid ========== */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
.book-list { display: flex; flex-direction: column; gap: 12px; }

.book-card {
    display: flex; flex-direction: column; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius-card);
    overflow: hidden; transition: all 0.3s ease;
}
.book-card:hover { transform: translateY(-2px); border-color: var(--border-hover); }
.book-card .cover {
    width: 100%; aspect-ratio: 3/4; background: var(--bg-hover);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; transition: all 0.3s;
}
.book-card:hover .cover { transform: scale(1.02); filter: brightness(1.1); }
.book-card .info { padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.book-card .info h3 { font-size: 14px; font-weight: 600; }
.book-card .info .author { font-size: 12px; color: var(--text-tertiary); }
.book-card .info .tags { display: flex; gap: 6px; margin-top: 2px; }
.book-card .info .tags span {
    font-size: 11px; color: var(--text-tertiary);
    border: 1px solid var(--border); padding: 2px 6px; border-radius: var(--radius-tag);
}
.book-card .info .desc { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

.book-card-list {
    display: flex; gap: 16px; padding: 12px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius-card);
    transition: all 0.3s;
}
.book-card-list:hover { transform: translateY(-2px); border-color: var(--border-hover); }
.book-card-list .cover-sm { width: 80px; height: 107px; flex-shrink: 0; background: var(--bg-hover); display: flex; align-items: center; justify-content: center; }
.book-card-list .info { flex: 1; min-width: 0; padding: 4px 0; }

/* ========== Right Panel ========== */
.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px; margin-bottom: 24px; }
.panel h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.rank-item .rank-num { width: 20px; text-align: center; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-item .rank-num.top3 { color: var(--text-primary); }
.rank-item .rank-num.normal { color: var(--text-tertiary); }
.rank-item .rank-info { flex: 1; min-width: 0; }
.rank-item .rank-info .title { font-size: 14px; }
.rank-item .rank-info .author { font-size: 12px; color: var(--text-tertiary); }
.rank-item .rank-rating { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-tertiary); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a {
    padding: 4px 10px; font-size: 12px; color: var(--text-tertiary);
    border: 1px solid var(--border); border-radius: var(--radius-tag);
    transition: all 0.2s;
}
.tag-cloud a:hover { color: var(--text-secondary); border-color: var(--border-hover); }

/* ========== Book Detail ========== */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-tertiary); margin-bottom: 24px; }
.breadcrumb a:hover { color: var(--text-secondary); }

.detail-layout { display: flex; gap: 32px; }
.detail-cover { width: 280px; flex-shrink: 0; }
.detail-cover .cover-img { width: 100%; aspect-ratio: 3/4; background: var(--bg-card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; }
.detail-info { flex: 1; min-width: 0; }
.detail-info h1 { font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.detail-info .meta { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 14px; color: var(--text-secondary); }
.detail-info .meta .icon-text { display: flex; align-items: center; gap: 4px; }
.detail-info .rating { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.detail-info .rating .stars { display: flex; gap: 2px; }
.detail-info .rating .score { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.detail-info .rating .count { font-size: 12px; color: var(--text-tertiary); display: flex; align-items: center; gap: 4px; }
.detail-info .desc { font-size: 14px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 16px; }
.detail-info .latest { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }

.action-btns { display: flex; gap: 12px; margin-top: 16px; }
.action-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; font-size: 14px; border-radius: var(--radius-button);
    transition: all 0.2s;
}
.action-btn.primary { background: var(--text-primary); color: var(--bg-primary); }
.action-btn.primary:hover { opacity: 0.9; }
.action-btn.outline { border: 1px solid var(--text-tertiary); }
.action-btn.outline:hover { border-color: var(--text-secondary); }
.action-btn.small { padding: 6px 12px; font-size: 12px; color: var(--text-tertiary); border: 1px solid var(--border); }
.action-btn.small:hover { color: var(--text-secondary); border-color: var(--border-hover); }

.detail-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--divider); margin-top: 32px; }
.detail-tab {
    display: flex; align-items: center; gap: 6px; padding: 10px 16px;
    font-size: 14px; color: var(--text-tertiary); border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.detail-tab:hover { color: var(--text-secondary); }
.detail-tab.active { color: var(--text-primary); border-bottom-color: var(--text-primary); }

.chapter-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 16px; }
.chapter-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; font-size: 14px; border-radius: var(--radius-global);
    transition: background 0.2s;
}
.chapter-item:hover { background: var(--bg-hover); }
.chapter-item .left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chapter-item .left .icon { flex-shrink: 0; }
.chapter-item .left .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-item .vip-badge { font-size: 11px; color: var(--text-tertiary); }
.chapter-item .free-badge { font-size: 11px; color: var(--text-tertiary); }

/* ========== Reader ========== */
.reader-wrap { position: fixed; inset: 0; z-index: 200; }
.reader-toolbar {
    position: absolute; top: 0; left: 0; right: 0; height: 56px;
    display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1); transition: transform 0.2s;
}
.reader-toolbar.hidden { transform: translateY(-100%); }
.reader-toolbar .left { display: flex; align-items: center; gap: 12px; }
.reader-toolbar .right { display: flex; align-items: center; gap: 8px; }

.reader-content { max-width: 720px; margin: 0 auto; padding: 64px 24px 80px; }
.reader-content p { margin-bottom: 16px; text-indent: 2em; }

.reader-nav { display: flex; justify-content: space-between; align-items: center; padding: 32px 0; border-top: 1px solid rgba(255,255,255,0.1); margin-top: 32px; }
.reader-nav a {
    display: flex; align-items: center; gap: 6px; padding: 8px 16px;
    font-size: 14px; border: 1px solid rgba(255,255,255,0.15); border-radius: var(--radius-global);
    transition: opacity 0.2s;
}
.reader-nav a:hover { opacity: 0.7; }
.reader-nav a.disabled { opacity: 0.3; pointer-events: none; }

.reader-progress { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: rgba(255,255,255,0.05); }
.reader-progress .bar { height: 100%; background: rgba(255,255,255,0.3); transition: width 0.3s; }

.reader-settings {
    position: absolute; bottom: 0; left: 0; right: 0; padding: 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.reader-settings .setting-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.reader-settings .setting-row:last-child { margin-bottom: 0; }
.reader-settings .setting-label { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.reader-settings .setting-controls { display: flex; align-items: center; gap: 12px; }
.reader-settings .setting-btn {
    padding: 4px; border: 1px solid rgba(255,255,255,0.15); border-radius: var(--radius-global);
    display: flex; align-items: center; justify-content: center;
}
.reader-settings .setting-value { font-size: 14px; font-variant-numeric: tabular-nums; width: 32px; text-align: center; }
.reader-settings .theme-btn {
    width: 32px; height: 32px; border-radius: var(--radius-global);
    border: 2px solid transparent; transition: border-color 0.2s;
}
.reader-settings .theme-btn.active { border-color: var(--text-primary); }

/* ========== Footer ========== */
.footer { border-top: 1px solid var(--divider); margin-top: 80px; padding: 40px 0; }
.footer .grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 32px; margin-bottom: 32px; }
.footer h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.footer p { font-size: 12px; color: var(--text-tertiary); line-height: 1.7; }
.footer a { font-size: 12px; color: var(--text-tertiary); display: flex; align-items: center; gap: 6px; transition: color 0.2s; }
.footer a:hover { color: var(--text-primary); }
.footer .copyright { border-top: 1px solid var(--divider); padding-top: 24px; text-align: center; font-size: 12px; color: var(--text-tertiary); }

/* ========== Toast ========== */
.toast-container { position: fixed; top: 72px; right: 16px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
    display: flex; align-items: center; gap: 8px; padding: 12px 16px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-global);
    min-width: 280px; animation: slideInRight 0.2s ease;
}
.toast.success { border-color: var(--success-border); }
.toast.error { border-color: var(--error-border); }
.toast .toast-msg { font-size: 14px; flex: 1; }
.toast .toast-close { color: var(--text-tertiary); cursor: pointer; }

/* ========== Auth Modal ========== */
.modal-overlay { position: fixed; inset: 0; z-index: 250; background: var(--overlay); display: flex; align-items: center; justify-content: center; }
.modal {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card);
    padding: 32px; width: 400px; max-width: 90vw;
}
.modal h2 { font-size: 22px; font-weight: 700; margin-bottom: 24px; text-align: center; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input {
    width: 100%; height: 40px; padding: 0 12px; background: var(--bg-primary);
    border: 1px solid var(--border); border-radius: var(--radius-input);
    color: var(--text-primary); font-size: 14px; outline: none; transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--border-hover); }
.form-group input::placeholder { color: var(--text-tertiary); }
.form-submit {
    width: 100%; height: 40px; background: var(--text-primary); color: var(--bg-primary);
    font-size: 14px; font-weight: 500; border-radius: var(--radius-button);
    transition: opacity 0.2s; margin-top: 8px;
}
.form-submit:hover { opacity: 0.9; }
.form-footer { text-align: center; margin-top: 16px; font-size: 12px; color: var(--text-tertiary); }
.form-footer a { color: var(--text-secondary); }
.form-footer a:hover { color: var(--text-primary); }

/* ========== Pagination ========== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 32px; }
.pagination a, .pagination span {
    padding: 6px 12px; font-size: 14px; border: 1px solid var(--border);
    border-radius: var(--radius-global); transition: all 0.2s;
}
.pagination a:hover { border-color: var(--border-hover); color: var(--text-highlight); }
.pagination .active { background: var(--bg-hover); border-color: var(--border-hover); color: var(--text-primary); }

/* ========== Responsive ========== */
@media (max-width: 1024px) {
    .sidebar-left, .sidebar-right { display: none; }
    .hero { display: none; }
}
@media (max-width: 768px) {
    .desktop-nav { display: none !important; }
    .mobile-nav { display: flex !important; }
    .mobile-tab { display: flex !important; }
    body { padding-bottom: var(--mobile-tab-height); }
    .detail-layout { flex-direction: column; }
    .detail-cover { width: 100%; }
    .detail-cover .cover-img { max-width: 200px; margin: 0 auto; }
    .chapter-list { grid-template-columns: 1fr; }
    .footer .grid { grid-template-columns: 1fr; }
    .book-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}
@media (max-width: 480px) {
    .book-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ========== Mobile Home Sections ========== */
.mobile-banner { position: relative; height: 160px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.mobile-banner .slide { position: absolute; inset: 0; display: flex; align-items: center; padding: 24px; opacity: 0; transition: opacity 0.5s; }
.mobile-banner .slide.active { opacity: 1; }
.mobile-banner .dots { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.mobile-banner .dots .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-tertiary); cursor: pointer; }
.mobile-banner .dots .dot.active { background: var(--text-primary); }

.mobile-cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mobile-cats a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0; transition: background 0.2s; border-radius: var(--radius-card); }
.mobile-cats a:hover { background: var(--bg-hover); }
.mobile-cats a .cat-icon { color: var(--text-secondary); }
.mobile-cats a .cat-name { font-size: 12px; color: var(--text-secondary); }

.h-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.h-scroll::-webkit-scrollbar { display: none; }
.h-scroll .h-item { flex-shrink: 0; width: 100px; }
.h-scroll .h-item .cover-sm { width: 100px; height: 133px; background: var(--bg-card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.h-scroll .h-item .title { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-scroll .h-item .author { font-size: 11px; color: var(--text-tertiary); }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-header h3 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.section-header a { font-size: 12px; color: var(--text-tertiary); display: flex; align-items: center; gap: 4px; }
.section-header a:hover { color: var(--text-secondary); }

/* ========== Admin/Author ========== */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 240px; background: var(--bg-card); border-right: 1px solid var(--divider); padding: 20px 0; flex-shrink: 0; }
.admin-sidebar .logo { padding: 0 20px; font-size: 18px; font-weight: 700; margin-bottom: 24px; }
.admin-sidebar a { display: flex; align-items: center; gap: 8px; padding: 10px 20px; font-size: 14px; color: var(--text-secondary); transition: all 0.2s; }
.admin-sidebar a:hover, .admin-sidebar a.active { color: var(--text-primary); background: var(--bg-hover); }
.admin-content { flex: 1; padding: 24px; }
.admin-content h1 { font-size: 22px; font-weight: 700; margin-bottom: 24px; }

.data-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px; }
.data-card .label { font-size: 12px; color: var(--text-tertiary); margin-bottom: 8px; }
.data-card .value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }

.data-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

table.data-table { width: 100%; border-collapse: collapse; }
table.data-table th, table.data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--divider); font-size: 14px; }
table.data-table th { color: var(--text-tertiary); font-weight: 500; font-size: 12px; }
table.data-table tr:hover td { background: var(--bg-hover); }

.editor-area { width: 100%; min-height: 400px; padding: 16px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-input); color: var(--text-primary); font-size: 14px; line-height: 1.8; outline: none; resize: vertical; font-family: var(--font-sans); }
.editor-area:focus { border-color: var(--border-hover); }

.star-rating { display: inline-flex; gap: 4px; }
.star-rating .star { transition: transform 0.15s; }
.star-rating .star:hover { transform: scale(1.1); }

.cat-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; font-size: 14px; color: var(--text-secondary);
    border-radius: var(--radius-global); transition: all 0.2s; cursor: pointer;
    border-left: 2px solid transparent;
}
.cat-item:hover { color: var(--text-primary); background: var(--bg-hover); }
.cat-item.active { color: var(--text-primary); background: var(--bg-hover); border-left-color: var(--text-primary); }

textarea { box-sizing: border-box; }
select { cursor: pointer; }

/* ========== Light Theme ========== */
body.light-theme {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

body.light-theme ::-webkit-scrollbar-track { background: var(--bg-primary); }
body.light-theme ::-webkit-scrollbar-thumb { background: #CCCCCC; }
body.light-theme ::-webkit-scrollbar-thumb:hover { background: #999999; }

body.light-theme .hero { background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-primary) 100%); }

body.light-theme .book-card:hover,
body.light-theme .book-card-list:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

body.light-theme .toast { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

/* ========== Image Styling ========== */
.cover img, .cover-sm img, .cover-img img {
    width: 100%; height: 100%; object-fit: cover;
}

/* ========== Main Content Spacing ========== */
main { min-height: calc(100vh - 56px - 200px); }

/* ========== Mobile Spacing Improvements ========== */
@media (max-width: 768px) {
    main { padding-bottom: 80px; }
    .container { padding: 0 16px; }
    .book-card { margin-bottom: 12px; }
    .panel { margin-bottom: 16px; padding: 12px; }
    .data-card { padding: 16px; }
    .detail-info h1 { font-size: 22px; }
    .reader-content { padding: 48px 16px 64px; font-size: 16px; }
}

/* ========== Utility Classes ========== */
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
