/* 优化版章节阅读CSS - 精简重复定义，合并样式 */
/* CSS变量定义 - 支持多种主题 */
:root {
    /* 默认主题（浅色） - 引用全局变量 */
    --bg-color: var(--bg-card);
    --text-color: var(--text-primary);
    --primary-color: var(--primary);
    --secondary-color: var(--primary-dark);
    --border-color: var(--border-color);
    --btn-bg: var(--bg-color);
    --btn-text: var(--text-secondary);
    --btn-border: var(--border-color);
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size: 16px;
    --nav-bg: var(--bg-color);
    --brightness-factor: 1;
    
    /* 间距调节变量 */
    --letter-spacing: 0.02em;
    --line-height: 1.8;
    --paragraph-spacing: 1.5em;
    
    /* 通用颜色 */
    --light-gray: var(--bg-card-hover);
    --medium-gray: var(--border-color);
    --dark-gray: var(--text-secondary);
    --white: var(--bg-card);
}

/* 浏览器兼容性提示栏 */
.browser-tip-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #fff3cd;
    color: #856404;
    padding: 10px 40px 10px 16px;
    font-size: 14px;
    line-height: 1.5;
    border-bottom: 2px solid #ffc107;
    flex-wrap: wrap;
}
.browser-tip-bar .fa-circle-exclamation {
    flex-shrink: 0;
    font-size: 16px;
}
.browser-tip-bar span {
    flex: 1;
    min-width: 0;
}
#browserTipClose {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #856404;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    line-height: 1;
}
#browserTipClose:hover {
    background: rgba(133,100,4,0.1);
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
    font-size: var(--font-size);
}

html, body {
    background: var(--bg-color);
    color: var(--text-color) !important;
    line-height: 1.8;
    transition: background-color 0.5s ease, color 0.5s ease, filter 0.3s ease;
    height: 100%;
    margin: 0;
    padding: 0;
}

/* 进度条 */
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* 遮罩层 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    right: -320px;
    top: 0;
    width: 320px;
    height: 100vh;
    background: var(--bg-card) !important;
    box-shadow: -2px 0 12px rgba(0,0,0,0.1);
    transition: right 0.3s;
    padding: 12px;
    z-index: 999;
    overflow-y: auto;
    color: var(--text-primary) !important;
    filter: none !important;
}

.sidebar.active {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color) !important;
}

/* 关闭按钮 */
.close-btn {
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    background: var(--primary-bg);
    border-radius: 8px;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-align: center;
}

.close-btn:hover {
    color: var(--primary-color);
    background: var(--primary-border);
}

.close-btn:active {
    transform: scale(0.95);
}

/* 菜单切换按钮 */
.menu-toggle {
    position: fixed;
    right: 16px;
    top: 16px;
    width: 42px;
    height: 42px;
    cursor: pointer;
    z-index: 100;
    background: var(--bg-color);
    padding: 0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.menu-toggle:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.menu-toggle:active {
    transform: scale(0.95);
}

.menu-toggle i {
    font-size: 18px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.menu-toggle:hover i {
    color: var(--primary-color);
}

/* 新版分页样式 */
.chapter-nav {
    margin: 16px auto;
    max-width: 800px;
    background: var(--bg-color);
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
}

.progress-wrapper {
    position: relative;
    height: 4px;
    background: var(--border-color);
    overflow: hidden;
}

.chapter-nav .progress-bar {
    height: 100%;
    width: var(--progress, 0%);
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
}

.progress-text {
    padding: 8px 16px 0;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
}

.progress-text i {
    color: var(--primary-color);
    margin-right: 2px;
}

.nav-buttons {
    padding: 12px 16px 16px;
}

.nav-button {
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
    padding: 10px;
    background: var(--btn-bg) !important;
    color: var(--btn-text) !important;
    border: 1px solid var(--btn-border) !important;
}

.nav-button:hover {
    background: var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    filter: brightness(0.9);
}

.nav-button i {
    font-size: 14px;
    margin: 0 8px;
    color: var(--primary-color);
}

/* 内容区域 */
.container {
    max-width: 800px;
    margin: 0 auto 50px;
    padding: 0 20px;
    background: var(--bg-color);
    color: var(--text-color);
    transition: filter 0.3s ease, mix-blend-mode 0.3s ease;
    font-size: var(--font-size);
    filter: brightness(var(--brightness-factor));
}

/* 章节头部 */
.chapter-header {
    margin: 24px 0 16px;
    padding-bottom: 16px;
    text-align: center;
}

.chapter-title {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
}

.chapter-title small {
    display: block;
    font-size: 0.85em;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* 内容段落 */
#crypto-content p {
    display: block !important;
    padding: 0 8px;
    margin: 16px 0;
    text-indent: 2em;
    font-weight: 400;
    line-height: var(--line-height);
    letter-spacing: var(--letter-spacing);
    text-align: justify;
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

#crypto-content p + p {
    margin-top: var(--paragraph-spacing);
}

/* 设置项 */
.settings-group {
    margin: 4px 0;
    padding: 8px;
    border-radius: 8px;
    background: var(--bg-card-hover) !important;
    color: var(--text-primary) !important;
}

/* 颜色选择器 */
.color-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 6px;
}

.color-option {
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s;
    position: relative;
}

.color-option:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
}

.color-option.active {
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 0 0 2px var(--primary-color);
    animation: activePulse 0.6s ease;
}

@keyframes activePulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 var(--primary-shadow-lg); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px var(--primary-shadow); }
    100% { transform: scale(1.05); box-shadow: 0 0 0 0 var(--primary-shadow); }
}

/* 主题选项特殊样式 */
.color-option.theme-option {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ddd;
}

.color-option.theme-option:hover,
.color-option.theme-option.active {
    border-color: var(--primary-color);
}

.color-option.theme-option.active {
    box-shadow: 0 0 0 2px var(--primary-shadow-lg);
}

[data-theme="dark"] .color-option.theme-option {
    border-color: var(--text-secondary);
}

[data-theme="dark"] .color-option.theme-option:hover,
[data-theme="dark"] .color-option.theme-option.active {
    border-color: var(--primary-color);
}

/* 应用.adjust-btn样式到具体按钮 */
.font-adjust-btn,
.brightness-adjust-btn,
.spacing-adjust-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--medium-gray);
    background: linear-gradient(135deg, var(--light-gray), var(--white));
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark-gray);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.font-adjust-btn:hover,
.brightness-adjust-btn:hover,
.spacing-adjust-btn:hover {
    border-color: var(--border-color);
    background: linear-gradient(135deg, var(--divider), var(--bg-card-hover));
    color: var(--text-secondary);
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.font-adjust-btn:active,
.brightness-adjust-btn:active,
.spacing-adjust-btn:active {
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.font-adjust-btn i,
.brightness-adjust-btn i,
.spacing-adjust-btn i {
    transition: all 0.3s ease;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}

.font-adjust-btn:hover i,
.brightness-adjust-btn:hover i,
.spacing-adjust-btn:hover i {
    transform: scale(1.05);
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}

/* 字体控制 */
.font-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0;
}

/* 亮度控制 */
.brightness-control {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0;
}

/* 间距控制 */
.spacing-control {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 4px 0;
}

.spacing-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.spacing-control-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.spacing-item label {
    font-size: 14px;
    font-weight: 500;
    color: var(--dark-gray);
}

/* 应用通用样式到具体组件 */
.brightness-slider-container,
.spacing-slider-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.brightness-slider-track,
.spacing-slider-track {
    position: relative;
    height: 6px;
    background: var(--medium-gray);
    border-radius: 3px;
    cursor: pointer;
    overflow: hidden;
}

.brightness-slider-thumb,
.spacing-slider-thumb {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.brightness-slider-thumb:active,
.spacing-slider-thumb:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.2);
}

.brightness-labels,
.spacing-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--dark-gray);
}

.brightness-labels span:nth-child(2),
.spacing-labels span:nth-child(2) {
    font-weight: bold;
    color: var(--primary-color);
}

/* 快捷入口链接 */
.quick-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 2px 0;
}
.quick-link-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 10px;
    border-radius: 7px;
    background: var(--primary-bg);
    color: var(--text-color);
    text-decoration: none;
    font-size: 12px;
    transition: background 0.2s, transform 0.15s;
    border: 1px solid var(--border-color);
}
.quick-link-item:hover {
    background: var(--primary-bg-light);
    transform: translateY(-1px);
}
.quick-link-item i {
    width: 16px;
    text-align: center;
    color: var(--primary-color);
    font-size: 14px;
}

.quick-link-item.disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

/* 加载和错误样式 */
.crypto-loading {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-muted);
    background: var(--primary-bg-light);
    border-radius: 10px;
    margin: 20px 0;
}

.crypto-loading p {
    margin: 12px 0 16px;
    font-size: 14px;
}

.loading-progress {
    width: 180px;
    height: 3px;
    background: var(--divider);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
}

.loading-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    animation: loadingProgress 2s ease-in-out infinite;
}

@keyframes loadingProgress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

.crypto-error {
    color: var(--error);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 8px;
    background: var(--primary-bg);
    text-align: center;
}

/* 动态对比度文字 */
.dynamic-contrast {
    color: var(--text-color) !important;
}

/* 安全降级方案 */
@media not (update: fast) {
    body {
        color: var(--text-color) !important;
    }
}

/* 移动端阅读器阻止样式 */
.mobile-reader-prevention {
    -webkit-user-select: none !important;
    user-select: none !important;
}

/* 阅读优化动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reading-optimized {
    animation: fadeInUp 0.6s ease-out;
}

/* 书签按钮（阅读设置侧边栏内） */
#add-bookcase {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: var(--primary-color);
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#add-bookcase i {
    font-size: 15px;
    flex-shrink: 0;
}

#add-bookcase:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

#add-bookcase:active {
    transform: scale(0.97);
}

/* 已在此处收藏（绿色） */
#add-bookcase[data-is-bookmark="1"] {
    background: #4CAF50;
    color: #fff;
    box-shadow: 0 2px 8px rgba(76,175,80,0.25);
}

/* 有书签但非当前章节（橙色，提示更新） */
#add-bookcase[data-is-bookmark="0"] {
    background: #FF9800;
    color: #fff;
    box-shadow: 0 2px 8px rgba(255,152,0,0.25);
}

#add-bookcase[data-is-bookmark="0"]:hover {
    background: #F57C00;
}

/* 加载中/禁用 */
#add-bookcase:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: none;
}

/* 分页样式 */
.pages {
    display: flex;
    width: 100%;
    margin: 0;
    justify-content: space-between;
    gap: 6px;
}

.pages li {
    height: 36px;
    flex-grow: 1;
    border: 1px solid var(--border-color);
    text-align: center;
    box-sizing: border-box;
    overflow: hidden;
    font-size: 14px;
    color: var(--text-secondary);
    border-radius: 6px;
    line-height: 36px;
    transition: all 0.15s ease;
    background: var(--bg-color);
}

.pages li:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pages li a {
    display: block;
    width: 100%;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.pages li i {
    margin-right: 3px;
    font-size: 12px;
}

/* 合并媒体查询 - 移动端优化 */
@media (max-width: 768px) {
    .container {
        margin: 0 auto 30px;
        padding: 0 15px;
        max-width: 100%;
        width: 100%;
    }
    
    .chapter-title {
        font-size: 1.2em;
        margin-bottom: 20px;
        font-weight: 600;
        letter-spacing: -0.01em;
    }
    
    #crypto-content p {
        text-indent: 40px;
        padding: 0 15px;
        margin-top: 15px;
        font-size: var(--font-size);
        line-height: var(--line-height);
        font-weight: 400;
        letter-spacing: var(--letter-spacing);
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }
    
    .menu-toggle {
        right: 12px;
        top: 12px;
        width: 38px;
        height: 38px;
        -webkit-appearance: none;
        border: none;
        outline: none;
    }
    
    .menu-toggle i {
        font-size: 16px;
    }
    
    .menu-toggle:active {
        transform: scale(0.95);
    }
    
    .sidebar {
        width: 280px;
        right: -280px;
    }
    
    .close-btn {
        font-size: 18px;
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        transition: all 0.15s ease;
    }
    
    .close-btn:active {
        transform: scale(0.9);
    }
    
    .chapter-nav {
        margin: 15px;
        border-radius: 8px;
    }
    
    .nav-buttons {
        padding: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-button {
        margin: 5px;
        flex: 1;
        min-width: 100px;
        text-align: center;
        font-size: 14px;
    }
    
    .progress-text {
        font-size: 11px;
        top: 6px;
    }
    
    .color-picker {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .color-option:hover::after {
        display: none;
    }
    
    .pages {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pages li {
        flex: 1;
        min-width: 60px;
        margin: 0;
        font-size: 13px;
        height: 34px;
        line-height: 34px;
    }
    
    /* 移动端解密错误样式 */
    
    
    /* 移动端间距调节优化 */
    .spacing-control {
        gap: 12px;
    }
    
    .spacing-control-row {
        gap: 6px;
    }
    
    .spacing-adjust-btn {
        width: 40px;
        height: 40px;
        font-size: 1em;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        touch-action: manipulation;
    }
    
    .spacing-slider-track {
        height: 8px;
    }
    
    .spacing-slider-thumb {
        width: 22px;
        height: 22px;
    }
    
    .spacing-labels {
        font-size: 13px;
    }
    
    .spacing-adjust-btn:active {
        transform: scale(0.95);
        background: var(--divider);
        transition: transform 0.1s ease;
    }
    
    .spacing-slider-thumb:active {
        transform: translate(-50%, -50%) scale(1.3);
        box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    }
    
    /* 移动端亮度调节优化 */
    .brightness-control {
        gap: 8px;
    }
    
    .brightness-adjust-btn {
        width: 44px;
        height: 44px;
        font-size: 1em;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        touch-action: manipulation;
    }
    
    .brightness-slider-track {
        height: 8px;
    }
    
    .brightness-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    .brightness-labels {
        font-size: 13px;
    }
    
    .brightness-adjust-btn:active {
        transform: scale(0.95);
        background: var(--divider);
        transition: transform 0.1s ease;
    }
    
    .brightness-slider-thumb:active {
        transform: translate(-50%, -50%) scale(1.3);
        box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    }
    
    /* 移动端加载样式优化 */
    .crypto-loading {
        background: rgba(255,255,255,0.95);
        backdrop-filter: none;
        margin: 10px 0;
        padding: 1.5rem 1rem;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        opacity: 0;
        transform: translateY(10px);
    }
    
    .crypto-loading p {
        font-size: 14px;
        margin: 10px 0 15px;
    }
    
    .loading-progress {
        width: 150px;
        height: 3px;
    }
    
    @keyframes mobileLoadingFadeIn {
        from {
            opacity: 0;
            transform: translateY(10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* ==================== 评分对话框样式 ==================== */
:root {
    --rating-primary: var(--primary);
    --rating-primary-dark: var(--primary-link);
    --rating-primary-light: var(--primary-bg);
    --rating-secondary: var(--bg-card-hover);
    --rating-secondary-dark: var(--border-color);
    --rating-text: var(--text-primary);
    --rating-text-light: var(--text-secondary);
    --rating-border: var(--border-color);
    --rating-bg: var(--bg-card);
    --rating-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
    --rating-shadow-hover: 0 6px 20px var(--primary-shadow-lg);
    --rating-radius-lg: 14px;
    --rating-radius-md: 10px;
    --rating-radius-sm: 6px;
    --rating-transition: all 0.2s ease;
}

.rating-dialog-mask {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    animation: rating-fade-in 0.2s ease;
}

.rating-dialog-container {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--rating-bg);
    border-radius: var(--rating-radius-lg);
    padding: 24px;
    width: 90%;
    max-width: 380px;
    box-shadow: var(--rating-shadow);
    z-index: 10001;
    animation: rating-slide-up 0.3s ease;
    border: 1px solid var(--border-light);
}

.rating-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.rating-dialog-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--rating-text);
    margin: 0;
}

.rating-dialog-close {
    background: var(--rating-secondary);
    border: none;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    color: var(--rating-text-light);
    padding: 4px;
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--rating-transition);
}

.rating-dialog-close:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.rating-dialog-content {
    text-align: center;
}

.rating-dialog-description {
    color: var(--rating-text-light);
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.6;
    padding: 0 4px;
}

.rating-options {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 10px;
}

.rating-option {
    flex: 1;
    padding: 16px 8px;
    border: 2px solid var(--rating-border);
    border-radius: var(--rating-radius-md);
    background: var(--rating-bg);
    cursor: pointer;
    transition: var(--rating-transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.rating-option:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
    transform: translateY(-2px);
}

.rating-option.active {
    border-color: var(--primary);
    background: var(--primary-bg);
    box-shadow: 0 0 0 3px var(--primary-shadow);
}

.rating-option:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.rating-option-icon {
    font-size: 26px;
    color: var(--primary);
    transition: var(--rating-transition);
}

.rating-option:hover .rating-option-icon { transform: scale(1.1); }

.rating-option-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--rating-text);
}

.rating-option-score {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.rating-dialog-footer {
    display: flex;
    gap: 10px;
}

.rating-dialog-button {
    flex: 1;
    padding: 11px;
    border: none;
    border-radius: var(--rating-radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--rating-transition);
}

.rating-dialog-button.primary {
    background: var(--primary);
    color: var(--text-inverse);
}

.rating-dialog-button.primary:hover:not(:disabled) {
    filter: brightness(1.1);
}

.rating-dialog-button.primary:disabled {
    background: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
}

.rating-dialog-button.secondary {
    background: var(--rating-secondary);
    color: var(--rating-text-light);
}

.rating-dialog-button.secondary:hover {
    background: var(--rating-secondary-dark);
    color: var(--text-primary);
}

.rating-feedback {
    margin-top: 16px;
    padding: 10px 14px;
    border-radius: var(--rating-radius-md);
    font-size: 13px;
    text-align: center;
    animation: rating-fade-in 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.rating-feedback.success {
    background: var(--primary-bg-light);
    color: var(--success);
}
.rating-feedback.error {
    background: var(--primary-bg-light);
    color: var(--error);
}
.rating-feedback.info {
    background: var(--primary-bg-light);
    color: var(--primary);
}

.rating-feedback::before { font-size: 14px; font-weight: bold; line-height: 1; }
.rating-feedback.success::before { content: '\2713'; }
.rating-feedback.error::before { content: '\2717'; }
.rating-feedback.info::before { content: '\2139'; }

@keyframes rating-fade-in {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes rating-slide-up {
    0% { opacity: 0; transform: translate(-50%, -40%) scale(0.92); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 480px) {
    .rating-dialog-container {
        padding: 20px 16px;
        max-width: 92vw;
    }
    .rating-dialog-title { font-size: 16px; }
    .rating-dialog-description { font-size: 13px; }
    .rating-options { gap: 8px; }
    .rating-option { padding: 14px 6px; }
    .rating-option-icon { font-size: 22px; }
    .rating-option-text { font-size: 13px; }
    .rating-dialog-footer { flex-direction: column; gap: 8px; }
    .rating-dialog-button { padding: 12px; }
    .rating-option.active { box-shadow: 0 0 0 2px var(--primary-shadow); }
}

@media (max-width: 320px) {
    .rating-dialog-container { padding: 16px 12px; }
    .rating-option { padding: 12px 4px; }
    .rating-option-icon { font-size: 20px; }
    .rating-option-text { font-size: 12px; }
}

/* ==================== 页面加载优化 ==================== */
body {
    opacity: 0;
    transition: opacity 0.3s ease;
}
body.css-variables-ready {
    opacity: 1;
}

/* 移动端阅读模式阻止 */
@media (max-width: 768px) {
    body {
        -webkit-touch-callout: none !important;
        -webkit-text-size-adjust: none !important;
        text-size-adjust: none !important;
    }
    .container, #crypto-content, #static-content {
        -webkit-user-select: text !important;
        user-select: text !important;
        max-height: none !important;
        overflow: visible !important;
    }
    * {
        touch-action: manipulation;
    }
}

/* 阅读体验优化 */
.reading-optimized {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
}

/* ==================== Toast 通知动画 ==================== */
.site-toast {
    position: fixed;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
    z-index: 10000;
    cursor: pointer;
    opacity: 0;
    transform: translateX(100px);
    transition: none;
}

.site-toast-enter {
    animation: toastSlideIn 0.3s ease forwards;
}
.toast-exit {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

/* reading-settings.js 降级方案的动画 */
@keyframes slideIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes slideOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

/* ===== 推文弹窗 ===== */
.post-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.post-modal {
    background: var(--bg-card, #fff);
    border-radius: 14px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
    overflow: hidden;
}
.post-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 18px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
}
.post-modal-close {
    cursor: pointer;
    padding: 4px;
    color: var(--text-muted);
    font-size: 18px;
}
.post-modal-close:hover { color: var(--text-primary); }
.post-modal-novel {
    padding: 6px 18px 4px;
    font-size: 13px;
    color: var(--text-muted);
}
.post-modal-novel i { color: var(--primary); margin-right: 4px; }
.post-modal-hint {
    padding: 4px 18px 8px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}
.post-modal-hint i { color: var(--primary); font-size: 12px; }
.post-modal-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 18px;
    border-bottom: 1px solid var(--border-light);
}
.post-toolbar-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: all 0.15s;
}
.post-toolbar-btn:hover { color: var(--primary); border-color: var(--primary); }
.post-toolbar-btn:active { background: var(--primary-bg-light); color: var(--primary); border-color: var(--primary); }
.post-toolbar-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
}
.post-modal textarea {
    width: 100%;
    border: none;
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.7;
    resize: none;
    overflow: hidden;
    min-height: 120px;
    max-height: 50vh;
    background: transparent;
    color: var(--text-primary);
    box-sizing: border-box;
    font-family: inherit;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.post-modal textarea:focus { outline: none; }
.post-modal textarea::placeholder { color: var(--text-muted); }
.post-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px 14px;
}
.post-char-count {
    font-size: 12px;
    color: var(--text-muted);
}
.post-char-count em { font-style: normal; }
.btn-post-submit {
    padding: 7px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: var(--primary);
    color: var(--text-inverse);
    transition: all 0.15s;
}
.btn-post-submit:hover { filter: brightness(1.1); }
.btn-post-submit:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 768px) {
    .post-modal { max-width: 92vw; }
    .post-modal-toolbar { flex-wrap: wrap; }
    .post-toolbar-hint { display: none; }
}
