/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f0eb;
    color: #2c2c2c;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== 头部 ========== */
.header {
    background: linear-gradient(135deg, #2c1810 0%, #4a2c20 100%);
    color: #f5ede8;
    padding: 16px 0;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.logo {
    font-size: 26px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    color: #f5cba0;
    font-size: 30px;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    color: #d4c5b8;
    transition: color 0.3s;
    font-size: 15px;
    padding: 6px 12px;
    border-radius: 20px;
}

.nav-link:hover {
    color: #f5ede8;
    background: rgba(255,255,255,0.1);
}

.nav-link i {
    margin-right: 6px;
}

/* ========== 主内容 ========== */
.main-content {
    flex: 1;
    padding: 30px 0;
}

/* ========== 页脚 ========== */
.footer {
    background: #2c1810;
    color: #a89585;
    padding: 30px 0;
    text-align: center;
    margin-top: auto;
}

.footer-links {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.footer-links a {
    color: #c4b5a8;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #f5ede8;
}

/* ========== 消息提示 ========== */
.alert {
    padding: 14px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-block;
    padding: 10px 24px;
    background: #4a2c20;
    color: #f5ede8;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.3s;
}

.btn:hover {
    background: #6b3f2e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-primary {
    background: #2c6b8f;
}

.btn-primary:hover {
    background: #3a8ab8;
}

.btn-danger {
    background: #b33c3c;
}

.btn-danger:hover {
    background: #d44a4a;
}

.btn-success {
    background: #2d7d4a;
}

.btn-success:hover {
    background: #3a9f5e;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* ========== 表单 ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #4a3a32;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0d6cc;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
    background: #faf8f5;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6b3f2e;
}

.form-group textarea {
    min-height: 200px;
    resize: vertical;
    font-family: inherit;
}

/* ========== 前台首页 ========== */
.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
    padding: 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.category-link {
    padding: 6px 18px;
    border-radius: 20px;
    background: #f5f0eb;
    color: #6b5a4a;
    transition: all 0.3s;
    font-size: 14px;
}

.category-link:hover,
.category-link.active {
    background: #4a2c20;
    color: #f5ede8;
}

.search-box {
    margin-bottom: 30px;
}

.search-box form {
    display: flex;
    gap: 10px;
    max-width: 500px;
}

.search-box input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid #e0d6cc;
    border-radius: 30px;
    font-size: 15px;
}

.search-box button {
    padding: 12px 24px;
    background: #4a2c20;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.3s;
}

.search-box button:hover {
    background: #6b3f2e;
}

/* ===== 首页小说列表 - 图片墙风格 ===== */
.novel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.novel-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transition: transform 0.3s, box-shadow 0.3s;
    aspect-ratio: 2 / 3;
    background: #2c1810;
}

.novel-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.novel-cover {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-color: #2c1810;
    position: relative;
}

.novel-cover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65%;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
    pointer-events: none;
}

.novel-status {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    color: white;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 2;
}

.novel-status.ongoing {
    background: rgba(44, 107, 143, 0.85);
}

.novel-status.finished {
    background: rgba(45, 125, 74, 0.85);
}

.novel-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 16px 16px;
    z-index: 1;
    color: #f5ede8;
}

.novel-info h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.novel-info h3 a {
    color: #f5ede8;
    transition: color 0.3s;
}

.novel-info h3 a:hover {
    color: #f5cba0;
}

.novel-info .novel-author {
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.novel-info .novel-author .category-tag {
    font-size: 11px;
    background: rgba(255,255,255,0.15);
    padding: 1px 10px;
    border-radius: 12px;
    color: rgba(255,255,255,0.9);
}

.novel-info .novel-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.novel-info .novel-desc {
    display: none;
}

.novel-info .btn-read {
    display: none;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9a8a7a;
}

.empty-state i {
    font-size: 60px;
    margin-bottom: 16px;
}

@media (max-width: 600px) {
    .novel-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 14px;
    }
    .novel-info {
        padding: 14px 12px 12px;
    }
    .novel-info h3 {
        font-size: 15px;
    }
    .novel-info .novel-author {
        font-size: 12px;
    }
}

/* ========== 阅读页面 ========== */
.reader-container {
    display: flex;
    gap: 30px;
    min-height: 600px;
    padding-bottom: 160px;
}

.reader-sidebar {
    width: 320px;
    flex-shrink: 0;
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    max-height: 700px;
    overflow-y: auto;
    position: sticky;
    top: 100px;
}

.reader-sidebar::-webkit-scrollbar {
    width: 6px;
}

.reader-sidebar::-webkit-scrollbar-thumb {
    background: #d4c5b8;
    border-radius: 10px;
}

.novel-info-side {
    padding-bottom: 16px;
    border-bottom: 2px solid #f0e8e0;
    margin-bottom: 16px;
}

.novel-info-side .novel-meta-line {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #8a7a6a;
    flex-wrap: wrap;
    margin-top: 4px;
}

.novel-info-side .novel-meta-line span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.novel-info-side .novel-status-badge {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: white;
    gap: 6px;
}

.novel-info-side .novel-status-badge.ongoing {
    background: #2c6b8f;
}

.novel-info-side .novel-status-badge.finished {
    background: #2d7d4a;
}

.novel-info-side .novel-status-badge i {
    font-size: 12px;
}

.novel-info-side h2 {
    font-size: 20px;
    color: #2c1810;
    margin-bottom: 4px;
}

.novel-info-side .author {
    color: #8a7a6a;
    font-size: 14px;
}

.chapter-list h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #4a3a32;
}

.chapter-list ul {
    list-style: none;
}

.chapter-list li {
    border-bottom: 1px solid #f0e8e0;
}

.chapter-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    transition: background 0.2s;
    border-radius: 6px;
}

.chapter-link:hover {
    background: #f5f0eb;
}

.chapter-link.active {
    background: #e8ddd0;
    color: #4a2c20;
    font-weight: 600;
}

.chapter-num {
    color: #b0a090;
    font-size: 13px;
    min-width: 40px;
}

.chapter-title {
    flex: 1;
}

.chapter-words {
    color: #b0a090;
    font-size: 12px;
}

/* 阅读主区域 */
.reader-main {
    flex: 1;
    background: white;
    border-radius: 16px;
    padding: 30px 35px 100px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
}

.reader-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0e8e0;
    margin-bottom: 20px;
}

.reader-header h2 {
    font-size: 22px;
    color: #2c1810;
}

.reader-content {
    flex: 1;
    line-height: 2.2;
    font-size: 17px;
    color: #2c2c2c;
    padding: 10px 0;
    min-height: 400px;
}

.reader-content .placeholder-text {
    text-align: center;
    color: #b0a090;
    padding: 60px 0;
}

.reader-content .placeholder-text i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.reader-content .placeholder-text .hint {
    font-size: 14px;
    margin-top: 8px;
}

/* 阅读内容段落首行缩进 */
.reader-content p {
    text-indent: 2em;
    margin: 0.5em 0;
}

.reader-content .sentence {
    display: block;
    text-indent: 2em;
    margin: 0.5em 0;
}

.reader-content p + p {
    margin-top: 0.8em;
}

/* 句子高亮 */
.sentence-highlight {
    background: #ffe68f;
    border-radius: 4px;
    padding: 0 2px;
    transition: background 0.2s;
}

/* ===== 播放器 - 强制固定底部 ===== */
#readerControls.reader-controls {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: #faf8f5 !important;
    border-top: 1px solid #e0d6cc !important;
    padding: 10px 20px !important;
    z-index: 9999 !important;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12) !important;
    border-radius: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

#readerControls.reader-controls .audio-controls {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    max-width: 1280px !important;
    margin: 0 auto !important;
}

#readerControls.reader-controls .chapter-nav {
    display: flex !important;
    gap: 10px !important;
}

#readerControls.reader-controls .btn-audio,
#readerControls.reader-controls .btn-icon {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    border: none !important;
    background: #4a2c20 !important;
    color: white !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    flex-shrink: 0 !important;
}

#readerControls.reader-controls .btn-audio:hover,
#readerControls.reader-controls .btn-icon:hover {
    background: #6b3f2e !important;
}

#readerControls.reader-controls .btn-audio:disabled,
#readerControls.reader-controls .btn-icon:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
}

#readerControls.reader-controls .progress-wrap {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    min-width: 120px !important;
}

#readerControls.reader-controls .progress-bar {
    flex: 1 !important;
    height: 4px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    background: #e0d6cc !important;
    border-radius: 4px !important;
    outline: none !important;
}

#readerControls.reader-controls .progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 16px !important;
    height: 16px !important;
    border-radius: 50% !important;
    background: #4a2c20 !important;
    cursor: pointer !important;
    border: 2px solid white !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2) !important;
}

#readerControls.reader-controls .time-label {
    font-size: 13px !important;
    color: #8a7a6a !important;
    min-width: 40px !important;
}

#readerControls.reader-controls .speed-select {
    padding: 4px 10px !important;
    border: 2px solid #e0d6cc !important;
    border-radius: 20px !important;
    background: #faf8f5 !important;
    cursor: pointer !important;
    font-size: 13px !important;
}

#readerControls.reader-controls .speed-select:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
}

#readerControls.reader-controls .btn-nav {
    padding: 6px 16px !important;
    background: #f5f0eb !important;
    border: none !important;
    border-radius: 20px !important;
    cursor: pointer !important;
    transition: all 0.3s !important;
    font-size: 13px !important;
}

#readerControls.reader-controls .btn-nav:hover:not(:disabled) {
    background: #e0d6cc !important;
}

#readerControls.reader-controls .btn-nav:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
}

/* 手机端适配 */
@media (max-width: 768px) {
    .reader-container {
        padding-bottom: 180px;
    }
    .reader-main {
        padding: 20px 20px 80px;
    }
    #readerControls.reader-controls {
        padding: 8px 12px !important;
        padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    }
    #readerControls.reader-controls .audio-controls {
        gap: 6px !important;
    }
    #readerControls.reader-controls .btn-audio,
    #readerControls.reader-controls .btn-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 14px !important;
    }
    #readerControls.reader-controls .speed-select {
        font-size: 12px !important;
        padding: 3px 8px !important;
        max-width: 100px !important;
    }
    #readerControls.reader-controls .progress-wrap {
        min-width: 80px !important;
        gap: 6px !important;
    }
    #readerControls.reader-controls .time-label {
        font-size: 11px !important;
        min-width: 30px !important;
    }
    #readerControls.reader-controls .btn-nav {
        font-size: 12px !important;
        padding: 4px 12px !important;
    }
    .reader-sidebar {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .reader-container {
        padding-bottom: 200px;
    }
    .reader-main {
        padding: 16px 14px 70px;
    }
    #readerControls.reader-controls {
        padding: 6px 8px !important;
        padding-bottom: calc(6px + env(safe-area-inset-bottom)) !important;
    }
    #readerControls.reader-controls .btn-audio,
    #readerControls.reader-controls .btn-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 12px !important;
    }
    #readerControls.reader-controls .speed-select {
        font-size: 11px !important;
        padding: 2px 6px !important;
        max-width: 70px !important;
    }
    #readerControls.reader-controls .progress-wrap {
        min-width: 60px !important;
        gap: 4px !important;
    }
    #readerControls.reader-controls .time-label {
        font-size: 10px !important;
        min-width: 25px !important;
    }
    #readerControls.reader-controls .btn-nav {
        font-size: 11px !important;
        padding: 3px 10px !important;
    }
    .reader-header h2 {
        font-size: 18px;
    }
    .reader-content {
        font-size: 15px;
    }
}

/* ========== 后台管理 ========== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-box {
    background: white;
    padding: 40px 45px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header i {
    font-size: 48px;
    color: #4a2c20;
}

.login-header h1 {
    font-size: 28px;
    color: #2c1810;
    margin: 8px 0 4px;
}

.login-header p {
    color: #8a7a6a;
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-form label {
    font-size: 14px;
    font-weight: 500;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: #4a2c20;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-login:hover {
    background: #6b3f2e;
}

.login-hint {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: #b0a090;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.stat-card .number {
    font-size: 36px;
    font-weight: bold;
    color: #4a2c20;
    display: block;
}

.stat-card .label {
    color: #8a7a6a;
    font-size: 14px;
    margin-top: 4px;
}

.table-container {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    background: #f5f0eb;
    color: #4a3a32;
    padding: 14px 18px;
    text-align: left;
    font-weight: 600;
}

.table td {
    padding: 12px 18px;
    border-bottom: 1px solid #f0e8e0;
}

.table tr:hover td {
    background: #faf8f5;
}

.table .actions {
    white-space: nowrap;
    vertical-align: middle;
}

/* 改用 inline-block 按钮 */
.table .actions .btn-sm {
    display: inline-block;
    vertical-align: middle;
    margin: 0 2px;
}

.table .actions a {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 28px;
    color: #2c1810;
}

.form-card {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    max-width: 800px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .reader-container {
        flex-direction: column;
    }
    .reader-sidebar {
        width: 100%;
        max-height: 300px;
        position: static;
    }
}

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        align-items: stretch;
    }
    .nav {
        justify-content: center;
    }
    .novel-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }
    .reader-main {
        padding: 20px;
    }
    .audio-controls {
        flex-wrap: wrap;
    }
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    .login-box {
        padding: 30px 24px;
    }
}

@media (max-width: 480px) {
    .novel-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .reader-content {
        font-size: 15px;
    }
}

/* ===== 小说阅读页 - 全书总字数 ===== */
.novel-info-side .author .total-words {
    font-size: 14px;
    color: #2d7d4a;
    font-weight: 500;
    margin-left: 4px;
}

/* ===== 章节列表 - 缩小标题字体 ===== */
.chapter-list .chapter-title {
    font-size: 13px;
}

/* ===== 侧边栏修复 - 防止内容溢出 ===== */
.reader-sidebar {
    width: 340px; /* 稍微加宽 */
    flex-shrink: 0;
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    max-height: 700px;
    overflow-y: auto;
    position: sticky;
    top: 100px;
}

/* 侧边栏内的元信息行 - 允许换行 */
.novel-info-side .novel-meta-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #8a7a6a;
    flex-wrap: wrap;
    margin-top: 2px;
}

/* 下载按钮区域 */
.novel-info-side .download-buttons {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.novel-info-side .download-buttons a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    font-size: 12px;
    text-decoration: none;
    border-radius: 20px;
    white-space: nowrap;
}

/* 章节列表标题 */
.chapter-list h3 {
    font-size: 15px;
    margin-bottom: 10px;
    color: #4a3a32;
}

/* 章节列表项 - 防止溢出 */
.chapter-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 4px;
    transition: background 0.2s;
    border-radius: 4px;
    font-size: 13px;
    overflow: hidden;
}

.chapter-num {
    color: #b0a090;
    font-size: 11px;
    min-width: 48px;
    flex-shrink: 0;
}

.chapter-title {
    flex: 1;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .reader-sidebar {
        width: 100%;
        max-height: 300px;
        position: static;
        padding: 16px;
    }
    .novel-info-side .download-buttons a {
        font-size: 11px;
        padding: 3px 10px;
    }
    .chapter-title {
        font-size: 12px;
    }
}

/* ===== 顶部小说信息栏响应式 ===== */
@media (max-width: 768px) {
    .novel-header-bar {
        flex-direction: column;
        align-items: center !important;
        text-align: center;
        padding: 16px !important;
    }
    .novel-header-bar .cover {
        width: 100px !important;
        height: 133px !important;
    }
    .reader-container {
        flex-direction: column;
    }
    .reader-sidebar {
        width: 100% !important;
        max-height: 250px;
        position: static !important;
    }
    .reader-main {
        padding: 16px !important;
    }
}

/* 修复后台表格操作列对齐问题 */
.table td {
    vertical-align: middle !important;
}

.table .actions .btn-sm {
    display: inline-block;
    vertical-align: middle;
    line-height: 1.2;
    padding: 3px 10px;
    font-size: 13px;
    height: auto;
    margin: 0 2px;
}

/* 或者干脆统一所有 td 的垂直对齐 */
.table tbody td {
    vertical-align: middle;
}

@media (max-width: 480px) {
    .reader-sidebar {
        width: 260px !important;
        left: -280px !important;
    }
    .reader-main {
        padding: 12px 14px 70px !important;
    }
    .reader-content {
        font-size: 15px !important;
    }
}

/* 手机端章节导航按钮 */
@media (max-width: 768px) {
    .chapter-navigation .btn-nav {
        font-size: 13px !important;
        padding: 10px 12px !important;
        min-height: 44px !important;
        border-radius: 12px !important;
    }
}

@media (max-width: 480px) {
    .chapter-navigation .btn-nav {
        font-size: 12px !important;
        padding: 8px 10px !important;
        min-height: 40px !important;
    }
}

.header {
    background: linear-gradient(135deg, #2c1810 0%, #4a2c20 100%);
    color: #f5ede8;
    padding: 16px 0;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

/* 手机端导航栏更窄 */
@media (max-width: 768px) {
    .header {
        padding: 10px 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
    }
    .header .logo {
        font-size: 20px;
    }
    .header .logo i {
        font-size: 22px;
    }
    .header .nav-link {
        font-size: 13px;
        padding: 4px 10px;
    }
    /* 给主内容留出导航栏空间 */
    .main-content {
        padding-top: 60px;
    }
    .reader-main {
        padding-top: 10px !important;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 8px 0;
    }
    .header .logo {
        font-size: 17px;
    }
    .header .logo i {
        font-size: 18px;
    }
    .header .nav-link {
        font-size: 12px;
        padding: 3px 8px;
    }
    .main-content {
        padding-top: 50px;
    }
}

/* ===== 阅读器控制栏 ===== */
.reader-control-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.reader-control-bar .btn-icon {
    background: none;
    border: 1px solid #e0d6cc;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 14px;
    cursor: pointer;
    color: #4a3a32;
    transition: all 0.2s;
}

.reader-control-bar .btn-icon:hover {
    background: #f0e8e0;
}

.reader-control-bar .btn-icon.active {
    border-color: #4a2c20;
    background: #f0e8e0;
}

/* 背景颜色按钮 */
.bg-btn {
    width: 32px;
    height: 28px;
    border: 2px solid #e0d6cc;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.bg-btn:hover {
    transform: scale(1.1);
}

.bg-btn.active {
    border-color: #4a2c20;
    box-shadow: 0 0 0 2px #4a2c20;
}

/* 背景色块按钮 */
.bg-btn {
    width: 36px !important;
    height: 30px !important;
    border: 2px solid #d4c5b8 !important;
    border-radius: 6px !important;
    padding: 0 !important;
    cursor: pointer;
    transition: all 0.2s;
}

.bg-btn:hover {
    transform: scale(1.1);
}

.bg-btn.active {
    border-color: #4a2c20 !important;
    box-shadow: 0 0 0 2px #4a2c20;
}

/* ===== 手机端侧边栏控制 ===== */
/* ===== 手机端侧边栏宽度控制 ===== */
@media (max-width: 768px) {
    .reader-sidebar {
        width: 350px !important;
        left: -380px !important;
        position: fixed !important;
        top: 0 !important;
        height: 100vh !important;
        z-index: 9999 !important;
        background: white !important;
        transition: left 0.3s ease !important;
        padding-top: 50px !important;
        box-shadow: 2px 0 20px rgba(0,0,0,0.15) !important;
        border-radius: 0 !important;
        max-height: 100vh !important;
        overflow-y: auto !important;
    }
    
    .reader-sidebar.open {
        left: 0 !important;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 9998;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .sidebar-close {
        position: absolute;
        top: 12px;
        right: 16px;
        font-size: 24px;
        color: #4a3a32;
        cursor: pointer;
        background: none;
        border: none;
        padding: 8px;
    }
}

/* ===== 手机端章节标题换行 ===== */
@media (max-width: 768px) {
    .chapter-link {
        align-items: flex-start !important;
        gap: 8px !important;
        padding: 8px 6px !important;
    }
    
    .chapter-title {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: unset !important;
        word-break: break-word !important;
        font-size: 13px !important;
        line-height: 1.5 !important;
        flex: 1 !important;
    }
    
    .chapter-num {
        flex-shrink: 0 !important;
        padding-top: 2px !important;
        font-size: 12px !important;
        min-width: 44px !important;
    }
}

/* ===== 手机端导航栏遮挡修复 ===== */
@media (max-width: 768px) {
    .main-content {
        padding-top: 75px !important;
    }
    .welcome-bar {
        margin-top: 8px !important;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding-top: 65px !important;
    }
}

/* ===== 封面左上角分类标签 ===== */
.novel-category-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 2px 12px;
    border-radius: 4px;
    font-size: 11px;
    color: white;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 2;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   Footer 样式
   ============================================================ */
.footer {
    background: #f5f0eb;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid #e8e0d8;
    font-size: 14px;
    color: #8a8078;
}

.footer .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.footer-copyright p {
    margin: 0;
}

.footer-beian {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 24px;
}

.footer-beian p {
    margin: 0;
    font-size: 13px;
}

.footer-beian a {
    color: #8a8078;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-beian a:hover {
    color: #5a8a6a;
    text-decoration: underline;
}

.footer-links {
    display: flex;
    gap: 16px;
    font-size: 13px;
}

.footer-links a {
    color: #8a8078;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #5a8a6a;
    text-decoration: underline;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .footer-beian {
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }
    
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* 限制头像大小 */
.user-avatar {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
}

.user-avatar img {
    width: 32px !important;
    height: 32px !important;
    object-fit: cover !important;
}

.user-avatar i {
    font-size: 28px !important;
    color: #8a7a6a !important;
}

/* 用户信息行内显示 */
.user-info {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.header-right {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.user-dropdown {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    cursor: pointer !important;
}

/* ===== 手机端导航强制一行显示 ===== */
@media screen and (max-width: 768px) {
    .header-inner {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 8px 10px !important;
        gap: 4px !important;
        align-items: center !important;
    }
    
    .header-inner::-webkit-scrollbar {
        height: 0 !important;
        display: none !important;
    }
    
    .logo {
        flex: 0 0 auto !important;
        margin-right: 8px !important;
    }
    
    .logo a {
        font-size: 13px !important;
        white-space: nowrap !important;
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
    }
    
    .logo img {
        height: 22px !important;
        width: auto !important;
    }
    
    .nav {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 4px !important;
        flex: 0 1 auto !important;
        align-items: center !important;
        overflow: visible !important;
    }
    
    .nav .nav-link {
        display: inline-flex !important;
        align-items: center !important;
        gap: 3px !important;
        padding: 5px 8px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        border-radius: 4px !important;
        text-decoration: none !important;
    }
    
    .nav .nav-link i {
        font-size: 13px !important;
        margin-right: 1px !important;
    }
    
    /* 如果还是太挤，隐藏部分文字只显示图标 */
    .nav .nav-link .link-text {
        display: inline !important;
    }
    
    /* 极端情况：当导航项超过6个时，隐藏文字只显示图标 */
    .nav .nav-link:nth-child(n+5) .link-text {
        display: none !important;
    }
    
    /* 或者让"退出"按钮特殊处理 */
    .nav a:last-child .link-text {
        display: none !important;
    }
}

/* ============================================================
   首页幻灯片样式（横屏宽幅轮播）
   ============================================================ */

/* ============================================================
   首页幻灯片样式（完整版）
   ============================================================ */

/* 幻灯片容器 */
.slideshow-container {
    position: relative;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto 24px auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    aspect-ratio: 16 / 6;
    min-height: 180px;
    background: #2c1810;
}

.slideshow-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

.slide-item {
    width: 100%;
    height: 100%;
    display: none;
    position: relative;
}

.slide-item:first-child {
    display: block;
}

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

/* 无封面占位 */
.slide-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4a2c20, #2c1810);
    color: #f5cba0;
    font-size: 48px;
    gap: 12px;
}
.slide-placeholder span {
    font-size: 20px;
    color: #f5ede8;
}

/* 底部遮罩和信息 */
.slide-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 40px 24px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 70%, transparent 100%);
}

.slide-info h2 {
    font-size: 28px;
    color: #f5ede8;
    margin: 0 0 4px 0;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.slide-author {
    font-size: 15px;
    color: rgba(255,255,255,0.85);
    margin: 4px 0 8px 0;
}

.slide-status {
    display: inline-block;
    padding: 3px 16px;
    border-radius: 20px;
    font-size: 13px;
    color: white;
}
.slide-status.ongoing {
    background: #2c6b8f;
}
.slide-status.finished {
    background: #2d7d4a;
}

/* 导航按钮 */
.slide-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}
.slide-btn:hover {
    background: rgba(0,0,0,0.8);
    transform: translateY(-50%) scale(1.05);
}
.slide-prev {
    left: 16px;
}
.slide-next {
    right: 16px;
}

/* 底部指示点 */
.slide-dots {
    position: absolute;
    bottom: 14px;
    right: 40px;
    display: flex;
    gap: 8px;
    z-index: 10;
}
.slide-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s;
}
.slide-dots .dot.active {
    background: #f5cba0;
    transform: scale(1.2);
}
.slide-dots .dot:hover {
    background: rgba(255,255,255,0.9);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .slideshow-container {
        aspect-ratio: 16 / 6;  /* 保持 1280:480 原始比例 */
        border-radius: 12px;
        margin-bottom: 16px;
    }
    .slide-overlay {
        padding: 20px 24px 16px;
    }
    .slide-info h2 {
        font-size: 20px;
    }
    .slide-author {
        font-size: 13px;
    }
    .slide-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    .slide-prev {
        left: 10px;
    }
    .slide-next {
        right: 10px;
    }
    .slide-dots {
        right: 16px;
        bottom: 10px;
    }
    .slide-dots .dot {
        width: 8px;
        height: 8px;
    }
    /* 关键修改：手机端图片完整显示 */
    .slide-image {
        object-fit: contain;
        background: #1a100c;
    }
}

@media (max-width: 480px) {
    .slideshow-container {
        aspect-ratio: 16 / 6;  /* 保持 1280:480 原始比例 */
        border-radius: 8px;
        min-height: 120px;
        margin-bottom: 12px;
    }
    .slide-overlay {
        padding: 14px 16px 12px;
    }
    .slide-info h2 {
        font-size: 16px;
    }
    .slide-author {
        font-size: 12px;
        margin: 2px 0 4px 0;
    }
    .slide-status {
        font-size: 11px;
        padding: 2px 12px;
    }
    .slide-btn {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }
    .slide-prev {
        left: 6px;
    }
    .slide-next {
        right: 6px;
    }
    .slide-dots {
        right: 12px;
        bottom: 8px;
        gap: 5px;
    }
    .slide-dots .dot {
        width: 6px;
        height: 6px;
    }
    /* 关键修改：小屏手机图片完整显示 */
    .slide-image {
        object-fit: contain;
        background: #1a100c;
    }
}