/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow-x: hidden;
}

.app-container {
    max-width: 414px;
    margin: 0 auto;
    background: #f8f9fa;
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* 头部搜索栏 - 重新设计 */
.app-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 20px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.08);
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 414px;
    z-index: 100;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

.search-container {
    position: relative;
    background: linear-gradient(135deg, #f1f3f4 0%, #e9ecef 100%);
    border-radius: 30px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.search-container:focus-within {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.search-icon {
    color: #667eea;
    margin-right: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-container:focus-within .search-icon {
    color: #5a6fd8;
    transform: scale(1.1);
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.search-input::placeholder {
    color: #999;
    font-weight: 400;
}

/* 主要内容区域 */
.main-content {
    margin-top: 80px;
    margin-bottom: 70px;
    min-height: calc(100vh - 150px);
}

.page-content {
    display: none;
    padding: 20px 15px;
}

.page-content.active {
    display: block;
}

/* 页面标题 */
.page-title {
    margin-bottom: 20px;
}

.page-title h2 {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.subtitle {
    color: #666;
    font-size: 14px;
}

/* 标签页 */
.tabs-container {
    background: white;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.tabs {
    display: flex;
    overflow-x: auto;
    padding: 10px;
    border-radius: 15px;
    gap: 8px;
}

.tabs::-webkit-scrollbar {
    height: 4px;
}

.tabs::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 2px;
}

.tabs::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 2px;
}

.tabs::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}

.tab-item {
    white-space: nowrap;
    padding: 12px 20px;
    margin: 0;
    border-radius: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    color: #666;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 14px;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    min-width: fit-content;
    flex-shrink: 0;
}

.tab-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
}

.tab-item.active::before {
    left: 100%;
}

.tab-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.tab-item:hover:not(.active) {
    background: linear-gradient(135deg, #e9ecef 0%, #f1f3f4 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
    border-color: rgba(102, 126, 234, 0.2);
}

/* 响应式设计 - 小屏幕优化 */
@media (max-width: 480px) {
    .tabs {
        padding: 8px;
        gap: 6px;
    }
    
    .tab-item {
        padding: 10px 16px;
        font-size: 13px;
        border-radius: 18px;
    }
}

@media (max-width: 375px) {
    .tab-item {
        padding: 8px 14px;
        font-size: 12px;
        border-radius: 16px;
    }
}

/* 内容区域 */
.content-area {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

/* 书籍列表 */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.book-item {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid rgba(102, 126, 234, 0.1);
    position: relative;
    overflow: hidden;
}

.book-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.05), transparent);
    transition: left 0.6s;
}

.book-item:hover::before {
    left: 100%;
}

.book-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
}

.book-cover {
    width: 90px;
    height: 135px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.book-item:hover .book-cover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.book-title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    background: linear-gradient(135deg, #333 0%, #667eea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.book-author {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.book-stats {
    font-size: 12px;
    color: #999;
    background: linear-gradient(135deg, #f1f3f4 0%, #e9ecef 100%);
    padding: 4px 12px;
    border-radius: 15px;
    display: inline-block;
    font-weight: 600;
}

/* 排行榜样式 */
.ranking-list {
    list-style: none;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.ranking-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.ranking-number {
    width: 30px;
    height: 30px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
    background: #f1f3f4;
    color: #666;
}

.ranking-number.top3 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ranking-book-cover {
    width: 50px;
    height: 75px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 15px;
}

.ranking-book-info {
    flex: 1;
}

.ranking-book-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.ranking-book-stats {
    display: flex;
    align-items: center;
    color: #666;
    font-size: 14px;
}

.ranking-book-stats i {
    margin-right: 5px;
    color: #667eea;
}

/* 我的页面样式 */
.profile-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.user-info {
    display: flex;
    align-items: center;
}

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    margin-right: 15px;
}

.user-details h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 5px;
}

.user-details p {
    color: #666;
    font-size: 14px;
}

.menu-section {
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: background 0.3s ease;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: #f8f9fa;
}

.menu-item i:first-child {
    width: 20px;
    color: #667eea;
    margin-right: 15px;
}

.menu-item span {
    flex: 1;
    font-size: 16px;
    color: #333;
}

.menu-item i:last-child {
    color: #ccc;
}

/* 底部导航栏 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 414px;
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(248,249,250,0.95) 100%);
    display: flex;
    padding: 15px 0 max(15px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 30px rgba(0,0,0,0.1);
    z-index: 100;
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(102, 126, 234, 0.1);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #999;
    border-radius: 15px;
    margin: 0 5px;
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-item.active::before {
    opacity: 1;
}

.nav-item.active {
    color: #667eea;
    transform: translateY(-3px);
}

.nav-item:hover:not(.active) {
    color: #667eea;
    transform: translateY(-1px);
}

.nav-item i {
    font-size: 22px;
    margin-bottom: 6px;
    transition: all 0.3s ease;
}

.nav-item.active i {
    transform: scale(1.1);
}

.nav-item span {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    margin: 20px;
    border-radius: 20px;
    width: calc(100% - 40px);
    max-width: 380px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #f1f3f4;
}

.close {
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.book-actions {
    display: flex;
    gap: 10px;
}

.share-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.share-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.modal-body {
    padding: 20px;
}

.book-info {
    display: flex;
    margin-bottom: 20px;
}

.book-info .book-cover {
    width: 80px;
    height: 120px;
    margin-right: 15px;
}

.book-details h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #333;
}

.book-details p {
    color: #666;
    margin-bottom: 10px;
}

.book-description {
    margin-bottom: 20px;
    line-height: 1.6;
    color: #555;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.read-btn {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 15px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.read-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.read-btn i {
    margin-right: 8px;
}

/* 阅读页面样式 */
.reading-container {
    display: none;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 414px;
    height: 100vh;
    background: white;
    z-index: 2000;
}

.reading-container.show {
    display: flex;
    flex-direction: column;
}

.reading-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-bottom: none;
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
    position: relative;
}

.back-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    font-size: 14px;
    color: white;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn:hover {
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.back-btn:active {
    transform: translateY(0) scale(0.95);
}

.reading-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    text-align: center;
    flex: 1;
    margin: 0 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.reading-content {
    flex: 1;
    padding: 20px;
    line-height: 1.8;
    font-size: 16px;
    color: #333;
    overflow-y: auto;
    /* 默认相对定位 */
    position: relative;
}

.chapter-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #f1f3f4;
}

.chapter-content {
    line-height: 2;
    text-indent: 2em;
    margin-bottom: 20px;
}

/* 阅读控制按钮 - 紧凑设计 */
.reading-controls {
    display: none;
}

/* 旧的阅读进度样式已移动到统一控制栏中 */

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f1f3f4;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 375px) {
    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .book-cover {
        width: 60px;
        height: 90px;
    }
    
    .modal-content {
        margin: 10px;
        width: calc(100% - 20px);
    }
}

/* 安全区域适配 */
@supports (padding: max(0px)) {
    .app-header {
        padding-top: max(15px, env(safe-area-inset-top));
    }
    
    .main-content {
        margin-top: calc(80px + env(safe-area-inset-top));
    }
}

/* 搜索结果样式 */
.search-results {
    padding: 20px 0;
}

.search-results h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    padding: 0 20px;
}

/* 错误提示样式 */
.error-message {
    text-align: center;
    padding: 40px 20px;
    color: #e74c3c;
    background: #fdf2f2;
    border-radius: 10px;
    margin: 20px;
}

.error-message i {
    font-size: 24px;
    margin-bottom: 10px;
    display: block;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 20px;
    display: block;
    color: #ddd;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #666;
}

.empty-state p {
    font-size: 14px;
    line-height: 1.5;
}

.empty-subtitle {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
    margin-bottom: 20px;
}

.retry-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.retry-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

/* 网络状态提示 */
.network-status {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 414px;
    background: #e74c3c;
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 14px;
    z-index: 3000;
    display: none;
}

.network-status.show {
    display: block;
}

/* 安全区域适配 */
@supports (padding: max(0px)) {
    .app-header {
        padding-top: max(15px, env(safe-area-inset-top));
    }
    
    .main-content {
        margin-top: calc(80px + env(safe-area-inset-top));
    }
    
    .bottom-nav {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}

/* 章节列表样式 */
.chapter-list-content {
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 90%;
    max-width: 380px;
    margin: 20px;
}

.chapter-list-content .modal-header {
    flex-shrink: 0;
    border-bottom: 1px solid #f1f3f4;
    padding: 20px;
    margin-bottom: 0;
}

.chapter-list-content .modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.chapter-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    max-height: 60vh;
    min-height: 300px;
}

.chapter-list-container::-webkit-scrollbar {
    width: 6px;
}

.chapter-list-container::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 3px;
}

.chapter-list-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.chapter-list-container::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}

.chapter-item {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f1f1;
    background: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.chapter-item:hover {
    background: #f7f7fa;
}

.chapter-item.current {
    background: #f0f7ff;
}

.chapter-info {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
}

.chapter-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chapter-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
    justify-content: flex-end;
    font-size: 13px;
    color: #888;
    flex-shrink: 0;
    line-height: 1;
}

.chapter-status {
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    background: #e6f7e6;
    color: #2ecc40;
}

.chapter-status.free {
    background: #e6f7e6;
    color: #2ecc40;
}

.chapter-status.vip {
    background: #ffe6e6;
    color: #e74c3c;
}

.chapter-item.current .chapter-title {
    color: #2a6de6;
}

.chapter-item.current .chapter-status {
    background: #dbeafe;
    color: #2563eb;
}

.chapter-item.current .chapter-meta {
    color: #2563eb;
}

/* 阅读设置样式 */
.reading-settings-content {
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 90%;
    max-width: 380px;
    margin: 20px;
}

.settings-section {
    margin-bottom: 25px;
}

.settings-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

/* 字体大小控制 */
.font-size-controls {
    display: flex;
    gap: 10px;
}

.font-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #f1f3f4;
    border-radius: 8px;
    background: white;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.font-btn.active,
.font-btn:hover {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

/* 主题控制 */
.theme-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.theme-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border: 2px solid #f1f3f4;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-btn.active,
.theme-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.theme-preview {
    width: 40px;
    height: 30px;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid #ddd;
}

.light-theme {
    background: #ffffff;
}

.sepia-theme {
    background: #f7f3e9;
}

.dark-theme {
    background: #2d2d2d;
}

.green-theme {
    background: #e8f5e8;
}

.theme-btn span {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

/* 行间距控制 */
.line-height-controls {
    display: flex;
    gap: 10px;
}

.line-height-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #f1f3f4;
    border-radius: 8px;
    background: white;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.line-height-btn.active,
.line-height-btn:hover {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

/* 阅读主题样式 */
.reading-content.light-theme {
    background: #ffffff;
    color: #333;
}

.reading-content.sepia-theme {
    background: #f7f3e9;
    color: #5c4b37;
}

.reading-content.dark-theme {
    background: #2d2d2d;
    color: #e0e0e0;
}

.reading-content.green-theme {
    background: #e8f5e8;
    color: #2e5d2e;
}

/* 字体大小样式 */
.reading-content.font-small {
    font-size: 14px;
}

.reading-content.font-medium {
    font-size: 16px;
}

.reading-content.font-large {
    font-size: 18px;
}

.reading-content.font-xlarge {
    font-size: 20px;
}

/* 章节导航样式 - 紧凑设计 */
.chapter-navigation {
    display: none;
}

/* 响应式设计 - 紧凑版本 */
@media (max-width: 480px) {
    .chapter-navigation {
        padding: 12px 15px;
        gap: 10px;
    }
    
    .prev-chapter-btn, .next-chapter-btn {
        padding: 8px 14px;
        font-size: 12px;
        min-width: 70px;
        height: 32px;
        border-radius: 16px;
    }
    
    .prev-chapter-btn span, .next-chapter-btn span {
        font-size: 11px;
    }
    
    .prev-chapter-btn i, .next-chapter-btn i {
        font-size: 11px;
    }
}

.reading-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #e0e0e0 50%, transparent 100%);
}

.reading-header .share-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.reading-header .share-btn:hover {
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.reading-header .share-btn:active {
    transform: translateY(0) scale(0.95);
}

/* 统一的底部控制栏 - 四个按钮一行 */
.reading-bottom-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-top: 1px solid rgba(102, 126, 234, 0.1);
    gap: 6px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.reading-bottom-controls::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #e0e0e0 50%, transparent 100%);
}

.reading-bottom-controls .prev-chapter-btn,
.reading-bottom-controls .next-chapter-btn,
.reading-bottom-controls .chapter-btn,
.reading-bottom-controls .settings-btn {
    flex: 1;
    padding: 6px 8px;
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
    position: relative;
    overflow: hidden;
    min-height: 40px;
    max-width: 70px;
}

.reading-bottom-controls .prev-chapter-btn::before,
.reading-bottom-controls .next-chapter-btn::before,
.reading-bottom-controls .chapter-btn::before,
.reading-bottom-controls .settings-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.reading-bottom-controls .prev-chapter-btn:hover::before,
.reading-bottom-controls .next-chapter-btn:hover::before,
.reading-bottom-controls .chapter-btn:hover::before,
.reading-bottom-controls .settings-btn:hover::before {
    left: 100%;
}

.reading-bottom-controls .prev-chapter-btn:hover,
.reading-bottom-controls .next-chapter-btn:hover,
.reading-bottom-controls .chapter-btn:hover,
.reading-bottom-controls .settings-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.reading-bottom-controls .prev-chapter-btn:active,
.reading-bottom-controls .next-chapter-btn:active,
.reading-bottom-controls .chapter-btn:active,
.reading-bottom-controls .settings-btn:active {
    transform: translateY(0) scale(0.98);
    transition: all 0.1s;
}

.reading-bottom-controls .prev-chapter-btn:disabled,
.reading-bottom-controls .next-chapter-btn:disabled {
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
    color: #999;
    cursor: not-allowed;
    box-shadow: 0 1px 5px rgba(0,0,0,0.1);
    transform: none;
}

.reading-bottom-controls .prev-chapter-btn:disabled:hover,
.reading-bottom-controls .next-chapter-btn:disabled:hover {
    transform: none;
    box-shadow: 0 1px 5px rgba(0,0,0,0.1);
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
}

.reading-bottom-controls .prev-chapter-btn:disabled::before,
.reading-bottom-controls .next-chapter-btn:disabled::before {
    display: none;
}

.reading-bottom-controls i {
    font-size: 12px;
    margin-bottom: 1px;
}

.reading-bottom-controls span {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-align: center;
    line-height: 1;
}

/* 阅读进度 - 调整位置 */
.reading-progress {
    position: fixed;
    bottom: 60px;
    right: 15px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 9px;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    z-index: 1000;
    min-width: 30px;
    text-align: center;
}

.reading-progress:hover {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.4);
}

/* 响应式设计 */
@media (max-width: 480px) {
    .reading-bottom-controls {
        padding: 6px 10px;
        gap: 4px;
    }
    
    .reading-bottom-controls .prev-chapter-btn,
    .reading-bottom-controls .next-chapter-btn,
    .reading-bottom-controls .chapter-btn,
    .reading-bottom-controls .settings-btn {
        padding: 4px 6px;
        min-height: 35px;
        max-width: 60px;
        border-radius: 12px;
    }
    
    .reading-bottom-controls i {
        font-size: 10px;
    }
    
    .reading-bottom-controls span {
        font-size: 8px;
    }
    
    .reading-header {
        padding: 10px 12px;
    }
    
    .back-btn, .reading-header .share-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .reading-title {
        font-size: 14px;
        margin: 0 12px;
    }
}

/* 沉浸式阅读模式 - 修复底部控制栏闪现问题 */
.reading-container.immersive-mode .reading-header {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.reading-container.immersive-mode .reading-bottom-controls {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.reading-container.immersive-mode .reading-progress {
    opacity: 0;
    pointer-events: none;
}

/* 统一的过渡动画 - 确保底部控制栏正确定位 */
.reading-header {
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), 
                opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.reading-bottom-controls {
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), 
                opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.reading-progress {
    transition: opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.reading-content {
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* 沉浸式模式下阅读内容占满全屏 */
.reading-container.immersive-mode .reading-content {
    /* 延伸到头部和底部区域 */
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    margin: 0;
}

/* 移除所有蒙版相关样式 */
.last-chapter-overlay,
.last-chapter-overlay::before,
.download-app-btn,
.download-app-btn::before,
.download-app-btn:hover::before,
.download-app-btn:hover,
.download-app-btn:active,
.download-app-btn i,
.download-app-btn span {
    display: none;
}

#google-signin-container {
    display: flex;
    justify-content: center;
    width: 100%;
}
#google-signin-container > div {
    width: 100% !important;
    max-width: 300px;
}

.login-btn.facebook {
    width: 100%;
    padding: 14px 20px;
    margin-top: 16px;
    background: #1877F2;
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(24, 119, 242, 0.2);
}

.login-btn.facebook:hover {
    background: #166FE5;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(24, 119, 242, 0.35);
}

.login-btn i {
    font-size: 18px;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* 手机适配 */
@media (max-width: 375px) {
    .login-modal-panel {
        width: 95%;
        padding: 24px 20px;
    }
}
/* 用户头像容器 - 固定尺寸 */
.user-info .avatar {
  position: relative;
  width: 40px; /* 与原图一致 */
  height: 40px;
  border-radius: 50%;
  overflow: hidden; /* 防止图片溢出 */
  background-color: #667eea; /* 紫色背景，匹配原图 */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 默认用户图标 */
#default-avatar-icon {
  color: white;
  font-size: 18px;
  margin-top: 2px;
  position: absolute; /* 保持在容器中 */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%); /* 居中 */
  z-index: 1; /* 默认图标在图片下方 */
}

/* 真实头像图片 */
.user-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2; /* 头像显示在默认图标上方 */
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal.show {
  display: flex;
}

/* 充值样式 */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal.show {
  display: flex;
}

.modal-content.recharge-content {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 380px;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.recharge-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.recharge-option {
  border: 1px solid #f0d6aa;
  border-radius: 10px;
  background: #fff6eb;
  text-align: center;
  padding: 12px 8px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.recharge-option.active {
  background: #ffda9b;
  border-color: #e6b65c;
  box-shadow: 0 0 6px rgba(255, 165, 0, 0.4);
}

.plan-badge {
  position: absolute;
  top: -8px;
  left: 8px;
  background: #f5c27f;
  color: #000;
  font-weight: bold;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
}

.plan-badge.auto {
  background: #000;
  color: #fff;
}

.plan-price {
  font-size: 22px;
  font-weight: bold;
  margin-top: 12px;
}

.plan-duration {
  font-size: 14px;
  color: #333;
}

.confirm-recharge-btn {
  margin-top: 20px;
  width: 100%;
  background: #000;
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
}

.confirm-recharge-btn:hover {
  opacity: 0.9;
}
/* 右侧紧凑版 VIP 徽章 - 上下排列优化版 */
.vip-badge {
  display: flex;
  flex-direction: column;       /* 关键：垂直排列 */
  align-items: center;          /* 内容居中对齐 */
  justify-content: center;

  width: auto;
  min-width: 70px;              /* 比原来稍窄，适配两行文本 */
  height: auto;                 /* 高度自适应两行内容 */
  padding: 6px 10px;            /* 上下稍多，左右适中 */

  background: linear-gradient(135deg, #FFD700 0%, #FFC107 100%);
  color: #333;
  font-size: 12px;
  font-weight: 600;
  border-radius: 16px;
  box-shadow: 0 2px 6px rgba(255, 215, 0, 0.4);
  transition: all 0.3s ease;

  margin-left: auto;            /* 自动靠右 */
  white-space: nowrap;
  line-height: 1.2;
}

/* 顶部：👑 VIP */
.vip-badge .vip-top {
  display: flex;
  align-items: center;
  gap: 4px;                     /* 图标与文字间距 */
  font-weight: bold;
}

.vip-badge .vip-top i {
  font-size: 14px;
  color: #FF6B6B;               /* 红色皇冠更醒目 */
}

/* 底部：33 days left */
.vip-badge .vip-bottom {
  font-size: 10px;
  opacity: 0.85;
  margin-top: 2px;              /* 与上一行的间距 */
}

/* 悬停效果增强 */
.vip-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
  background: linear-gradient(135deg, #FFD700 0%, #FFB300 100%);
}

/* 点击反馈 */
.vip-badge:active {
  transform: scale(0.98);
}

/* ===== 登录弹窗（彻底修复版） ===== */
#login-modal.login-modal-overlay {
  position: fixed !important;   /* 全屏固定定位 */
  left: 0 !important;
  top: 0 !important;
  width: 100vw !important;
  height: 100vh !important;

  background: rgba(0,0,0,0.45);
  display: none;
  justify-content: center;
  align-items: flex-end;        /* 底部吸附 */
  z-index: 5000 !important;
}

#login-modal.login-modal-overlay.show {
  display: flex !important;
}

.login-modal-panel {
  position: relative;
  width: 92%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 22px 20px 30px;
  box-shadow: 0 -10px 35px rgba(0,0,0,0.18);
}
.login-title {
text-align: center;
font-size: 18px;
 font-weight: 600;
 color: #333;
 margin-bottom: 24px;
 }

 /* 通用确认弹窗遮罩 */
 .confirm-modal-overlay {
     position: fixed;
     inset: 0;
     background: rgba(0,0,0,0.45);
     display: none;
     justify-content: center;
     align-items: center;
     z-index: 6000;
 }

 /* 显示状态 */
 .confirm-modal-overlay.show {
     display: flex;
 }

 /* 内容框 */
 .confirm-panel {
     background: #fff;
     width: 80%;
     max-width: 320px;
     padding: 24px;
     border-radius: 12px;
     box-shadow: 0 6px 30px rgba(0,0,0,0.15);
     text-align: center;
 }

 .confirm-title {
     font-size: 18px;
     font-weight: 700;
     margin-bottom: 10px;
 }

 .confirm-message {
     font-size: 14px;
     margin-bottom: 20px;
     color: #444;
 }

 .confirm-actions {
     display: flex;
     justify-content: space-between;
     gap: 12px;
 }

 .cancel-btn {
     flex: 1;
     background: #ddd;
     border: none;
     border-radius: 6px;
     padding: 10px 0;
     font-size: 14px;
 }

 .yes-btn {
     flex: 1;
     background: #ff4d4f;
     color: white;
     border: none;
     border-radius: 6px;
     padding: 10px 0;
     font-size: 14px;
 }

/* ========== 分享弹窗遮罩层 ========== */
.share-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.45);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 50000; /* 高于所有阅读/书籍层 */
}

/* 显示状态 */
.share-overlay.show {
    display: flex;
}

/* ========== 分享面板 ========== */
.share-panel {
    width: 90%;
    max-width: 414px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transform: translateY(12px);
    opacity: 0;
    transition: all 160ms ease;
}

/* 显示动画 */
.share-overlay.show .share-panel {
    transform: translateY(0);
    opacity: 1;
}

/* Header */
.share-header {
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.share-title {
    font-size: 16px;
    font-weight: 600;
}
.share-close-btn {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

/* 内容 */
.share-content {
    padding: 14px 16px;
}
.meta-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}
.meta-author,
.meta-desc {
    font-size: 13px;
    color: #555;
    margin-bottom: 6px;
}

/* 按钮 */
.share-btns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}
.share-btn {
    padding: 10px 8px;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
}
.share-btn.whatsapp { background: #25D366; }
.share-btn.telegram { background: #229ED9; }
.share-btn.copy { background: #667eea; }

/* 购买记录顶部标题栏 */
.purchase-header-bar {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 10;
}

/* 购买记录返回按钮（圆形） */
.purchase-back {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f2f2f2;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    cursor: pointer;
}

.purchase-back i {
    font-size: 16px;
    color: #333;
}

/* 购买记录标题 */
.purchase-title {
    font-size: 18px;
    font-weight: 600;
    color: #222;
}


/* 单条购买记录（一行布局） */
.purchase-row {
    display: grid;
    grid-template-columns: 40px 1fr 70px 70px;
    align-items: center;
    padding: 14px 16px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* 序号 */
.purchase-col.index {
    font-weight: 700;
    color: #555;
}

/* 时间 */
.purchase-col.date {
    color: #444;
    font-size: 14px;
}

/* 天数 badge 风格 */
.purchase-col.days {
    background: #eef2ff;
    padding: 4px 8px;
    border-radius: 8px;
    text-align: center;
    color: #4a4de5;
    font-weight: 600;
    font-size: 13px;
}

/* 金额 */
.purchase-col.amount {
    text-align: right;
    font-size: 15px;
    font-weight: 700;
    color: #222;
}
/* 让购买记录支持上下滚动 */
.purchase-scroll {
    height: calc(100vh - 70px);  /* 70px 是 page-header 的高度，可按实际调整 */
    overflow-y: auto;
    padding-bottom: 40px;
    box-sizing: border-box;
}

/* ========== PWA 安装提示框 ========== */
.modal-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 380px;
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
}

.install-content {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 12px;
}

.install-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.install-text h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 700;
    color: #333;
}

.install-text p {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.install-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    flex-shrink: 0;
    min-width: 60px;
    text-align: center;
}

.install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.install-close {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
    flex-shrink: 0;
}

.install-close:hover {
    background: #f0f0f0;
    color: #666;
}

