/* ===== 设计系统变量 ===== */
:root {
    /* 主色调 */
    --primary: #217346;
    --primary-light: #2e8f5a;
    --primary-dark: #1a5c38;
    --secondary: #f3f3f3;
    --accent: #ff6b35;
    --accent-yellow: #ffd93d;
    --success: #4caf50;
    --error: #ff6b6b;
    --warning: #ffa726;

    /* 文字颜色 */
    --text: #333;
    --text-light: #666;
    --text-lighter: #999;
    --text-white: #fff;

    /* 背景色 */
    --bg: #fff;
    --bg-dark: #f8f9fa;
    --bg-gray: #f1f3f4;
    --bg-code: #2d2d2d;

    /* 边框 */
    --border: #e0e0e0;
    --border-light: #e9ecef;
    --shadow: rgba(0,0,0,0.08);
    --shadow-md: rgba(0,0,0,0.15);

    /* 夜间模式变量 - 默认日间模式 */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f4;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-tertiary: #999999;

    /* 圆角规范 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 12px;
    --radius-pill: 25px;
    --radius-full: 50%;

    /* 间距规范 */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 15px;
    --space-xl: 20px;
    --space-2xl: 25px;

    /* 布局 */
    --sidebar-width: 240px;
    --header-height: 60px;
    --panel-width: 50%;

    /* 动画 */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: var(--text);
    background: transparent;
    line-height: 1.6;
}

/* ===== 布局 ===== */
.app {
    display: flex;
    min-height: 100vh;
}

/* ===== 移动端菜单按钮 ===== */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 200;
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ===== 侧边栏 ===== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1a5c38 0%, #217346 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    box-shadow: 2px 0 10px var(--shadow);
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-collapse-btn {
    position: fixed;
    left: 208px;
    top: 20px;
    width: 32px;
    height: 32px;
    background: rgba(33, 115, 70, 0.9);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 101;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sidebar-collapse-btn:hover {
    background: rgba(255,255,255,0.25);
}

.sidebar-collapse-btn {
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease;
}

.sidebar-collapse-btn.collapsed {
    left: 0;
    border-radius: 0 6px 6px 0;
    opacity: 0;
    visibility: hidden;
}

.sidebar-collapse-btn span {
    transition: transform 0.3s ease;
}

.sidebar-collapse-btn.collapsed span {
    transform: rotate(180deg);
}

.sidebar-expand-btn {
    position: fixed;
    left: 20px;
    top: 20px;
    width: 32px;
    height: 32px;
    background: var(--primary);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99;
}

.sidebar-expand-btn.visible {
    display: flex;
}

.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 13px;
    opacity: 0.8;
}

/* ===== 回到首页按钮 ===== */
.home-button-section {
    padding: 0 20px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.home-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(33, 115, 70, 0.3);
}

.home-button:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 115, 70, 0.4);
}

.home-button:active {
    transform: translateY(0);
}

.home-icon {
    font-size: 16px;
}

.home-text {
    font-size: 14px;
}

.nav-menu {
    padding: 20px 0;
}

/* ===== 搜索功能 ===== */
.search-section {
    padding: 0 20px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box input {
    width: 100%;
    padding: 10px 35px 10px 12px;
    border: none;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.search-box input::placeholder {
    color: rgba(255,255,255,0.6);
}

.search-box input:focus {
    background: rgba(255,255,255,0.25);
    box-shadow: 0 0 0 2px rgba(255,107,53,0.5);
}

.search-icon {
    position: absolute;
    right: 10px;
    font-size: 14px;
    opacity: 0.7;
}

.search-results {
    margin-top: 8px;
    max-height: 350px;
    overflow-y: auto;
    display: none;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 8px;
}

.search-results.active {
    display: block;
}

/* 搜索框清空按钮 */
.search-clear-btn {
    position: absolute;
    right: 35px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.search-clear-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* 搜索分类标题 */
.search-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px 4px;
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    font-weight: 500;
}

.search-section-title:first-child {
    padding-top: 0;
}

.clear-history-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 10px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s;
}

.clear-history-btn:hover {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.1);
}

/* 搜索标签 */
.search-history-tags,
.search-hot-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px;
    margin-bottom: 8px;
}

.search-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.history-tag {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.9);
    position: relative;
    padding-right: 20px;
}

.history-tag:hover {
    background: rgba(255,255,255,0.2);
}

/* 标签删除按钮 */
.tag-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-left: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    color: rgba(255,255,255,0.7);
}

.tag-delete-btn:hover {
    background: rgba(244,67,54,0.8);
    color: white;
}

.hot-tag {
    background: rgba(255,107,53,0.2);
    color: #ffaa80;
}

.hot-tag:hover {
    background: rgba(255,107,53,0.3);
}

/* 搜索结果头部 */
.search-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 4px;
}

.result-count {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
}

.clear-search-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s;
}

.clear-search-btn:hover {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.1);
}

/* 搜索结果项 */
.search-result-item {
    padding: 8px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    margin-bottom: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    border-left: 3px solid transparent;
}

.search-result-item:hover,
.search-result-item.selected {
    background: rgba(255,255,255,0.2);
    border-left-color: #ff6b35;
}

.search-result-item.selected {
    background: rgba(255,107,53,0.2);
}

.search-result-item .result-number {
    font-size: 11px;
    opacity: 0.7;
    min-width: 20px;
}

.search-result-item .result-text {
    flex: 1;
}

.search-result-item .result-highlight {
    color: #ff6b35;
    font-weight: 600;
}

.search-result-item .result-category {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    margin-right: 6px;
    opacity: 0.9;
}

.search-result-item .result-chapter {
    display: block;
    font-size: 11px;
    opacity: 0.7;
    margin-top: 2px;
    margin-left: 26px;
}

/* 无结果提示 */
.search-no-results {
    padding: 20px 15px;
    text-align: center;
}

.no-result-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.no-result-title {
    font-size: 14px;
    color: rgba(255,255,255,0.9);
    margin-bottom: 15px;
}

.no-result-tips {
    text-align: left;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
}

.no-result-tips p {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 8px;
}

.no-result-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.no-result-tips li {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    padding: 3px 0 3px 16px;
    position: relative;
}

.no-result-tips li::before {
    content: '•';
    position: absolute;
    left: 4px;
    color: rgba(255,255,255,0.4);
}

.search-hot-suggestions {
    text-align: left;
}

.search-hot-suggestions p {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 8px;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-title {
    padding: 0 20px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
    margin-bottom: 10px;
}

.nav-list {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    border-left-color: #ff6b35;
}

.nav-item.completed::after {
    content: '✓';
    position: absolute;
    right: 15px;
    color: #4caf50;
    font-weight: bold;
    font-size: 12px;
}

.nav-number {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.7;
    margin-right: 12px;
    min-width: 24px;
}

.nav-text {
    font-size: 14px;
}

.progress-section {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 20px;
}

.progress-label {
    font-size: 12px;
    margin-bottom: 10px;
    opacity: 0.8;
}

.progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 12px;
    margin-top: 8px;
    text-align: right;
    opacity: 0.8;
}

.progress-stats {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 11px;
    opacity: 0.9;
}

.progress-stats .stat-item {
    display: block;
    margin-bottom: 6px;
}

.progress-stats .stat-item b {
    color: var(--accent);
    font-weight: 600;
}

.progress-recommend {
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    font-size: 11px;
}

.progress-recommend a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.progress-recommend a:hover {
    text-decoration: underline;
}

.reset-progress-btn {
    margin-top: 15px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    color: rgba(255,255,255,0.8);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    transition: all 0.2s ease;
}

.reset-progress-btn:hover {
    background: rgba(255,100,100,0.3);
    border-color: rgba(255,100,100,0.5);
    color: white;
}

.reset-progress-btn span {
    font-size: 14px;
}

/* ===== 主内容区 ===== */
.main-content {
    margin-left: calc(var(--sidebar-width) - 100px);
    flex: 1;
    min-height: 100vh;
    background: transparent;
    position: relative;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed + .sidebar-expand-btn + .main-content {
    margin-left: 0;
}

.main-content-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(135deg, rgba(33, 115, 70, 0.03) 0%, rgba(255, 255, 255, 0.05) 100%),
        url('../bg/bg.png') center center no-repeat;
    background-size: cover;
    opacity: 0.08;
    pointer-events: none;
    z-index: 1;
}

.content-container {
    position: relative;
    z-index: 3;
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding-right: 0;
}

.content-wrapper {
    flex: 1;
    padding: 40px 50px;
    transition: opacity 0.3s ease;
    min-width: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 16px;
    margin: 20px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* ===== 大纲导航 ===== */
.outline-nav {
    width: 200px;
    padding: 20px 15px 20px 20px;
    position: fixed;
    right: 20px;
    top: 100px;
    height: auto;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 10;
}

.outline-nav.collapsed {
    width: 0;
    padding: 80px 0 0 0;
    opacity: 0;
    overflow: hidden;
    border: none;
    box-shadow: none;
    background: transparent;
}

.outline-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.outline-toggle {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.outline-toggle:hover {
    background: var(--bg-dark);
    color: var(--primary);
}

.outline-toggle .toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.outline-nav.collapsed .toggle-icon {
    transform: rotate(180deg);
}

/* 大纲展开按钮 */
.outline-expand-btn {
    position: fixed;
    right: 20px;
    top: 80px;
    width: 40px;
    height: 40px;
    background: rgba(33, 115, 70, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    z-index: 50;
    display: none;
    backdrop-filter: blur(4px);
}

.outline-expand-btn:hover {
    background: var(--primary-light);
    transform: translateY(-50%) scale(1.1);
}

.outline-expand-btn.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

.outline-content {
    font-size: 13px;
}

.outline-item {
    padding: 6px 0;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 2px solid transparent;
    padding-left: 10px;
    margin-left: -10px;
}

.outline-item:hover {
    color: var(--primary);
    border-left-color: var(--primary-light);
}

.outline-item.active {
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
}

.outline-item.level-1 {
    font-weight: 600;
    color: var(--text);
    margin-top: 8px;
}

.outline-item.level-2 {
    padding-left: 20px;
    font-size: 12px;
}

.outline-item.level-3 {
    padding-left: 30px;
    font-size: 11px;
}

.outline-empty {
    color: var(--text-lighter);
    font-size: 12px;
    font-style: italic;
}

/* ===== 内容样式 ===== */
.chapter-header {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.chapter-number {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
}

.chapter-title {
    font-size: 36px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}

.chapter-desc {
    font-size: 16px;
    color: var(--text-light);
}

.section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-content p {
    margin-bottom: 16px;
    font-size: 15px;
    line-height: 1.8;
}

/* ===== 学习目标卡片 ===== */
.goals-card {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 30px;
    border-left: 4px solid var(--primary);
}

.goals-card h3 {
    color: var(--primary-dark);
    margin-bottom: 15px;
    font-size: 18px;
}

.goals-card ul {
    list-style: none;
    padding: 0;
}

.goals-card li {
    padding: 8px 0;
    padding-left: 28px;
    position: relative;
    font-size: 14px;
}

.goals-card li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* ===== 提示框 ===== */
.tip-box {
    background: #fff3e0;
    border-left: 4px solid var(--accent);
    padding: 20px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 20px 0;
}

.tip-box .tip-title {
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.tip-box p {
    margin: 0;
    font-size: 14px;
}

/* ===== 警告框 ===== */
.warning-box {
    background: #ffebee;
    border-left: 4px solid #f44336;
    padding: 20px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 20px 0;
}

.warning-box .warning-title {
    color: #c62828;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

/* ===== 代码块 ===== */
.code-block {
    margin: 20px 0;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow);
}

.code-header {
    background: #2d2d2d;
    color: #ccc;
    padding: 10px 15px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-header .lang-label {
    background: rgba(255,255,255,0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.copy-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: #ccc;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    z-index: 100;
    pointer-events: auto;
}

.copy-btn:hover {
    background: rgba(255,255,255,0.25);
    color: white;
    border-color: rgba(255,255,255,0.3);
}

.copy-btn.copied {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

/* 掌握度评分样式 */
.mastery-score {
    margin: 15px 0;
    padding: 12px;
    background: rgba(0,0,0,0.03);
    border-radius: 8px;
    text-align: center;
}

.mastery-label {
    font-size: 12px;
    color: #333;
    font-weight: 600;
    margin-bottom: 8px;
}

.mastery-value {
    font-size: 32px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.mastery-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.mastery-fill {
    height: 100%;
    background: #4CAF50;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* 薄弱环节提示样式 */
.weak-areas {
    font-size: 12px;
    background: #fff3cd !important;
    border-left: 3px solid #ffc107 !important;
}

.weak-areas div {
    color: #333 !important;
}

.weak-areas div[onclick] {
    transition: opacity 0.2s;
    color: #333 !important;
}

.weak-areas div[onclick]:hover {
    opacity: 0.8;
    text-decoration: underline;
}

pre {
    margin: 0 !important;
    border-radius: 0 !important;
}

code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

/* ===== 步骤列表 ===== */
.steps {
    counter-reset: step;
    list-style: none;
    padding: 0;
}

.steps li {
    position: relative;
    padding-left: 60px;
    margin-bottom: 25px;
    min-height: 40px;
}

.steps li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.steps li strong {
    display: block;
    margin-bottom: 5px;
    color: var(--primary-dark);
}

/* ===== 练习区域 ===== */
.exercise {
    background: var(--bg-dark);
    border-radius: var(--radius);
    padding: 30px;
    margin: 30px 0;
    border: 1px solid var(--border);
}

.exercise-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 15px;
}

.exercise-desc {
    margin-bottom: 20px;
    font-size: 14px;
}

.exercise-desc p {
    margin-bottom: 12px;
    padding-left: 20px;
    position: relative;
}

.exercise-desc p::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--primary);
}

/* ===== 导航按钮 ===== */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 50px;
    border-top: 1px solid var(--border);
}

.btn-prev, .btn-next {
    padding: 12px 30px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-prev {
    background: var(--secondary);
    color: var(--text);
}

.btn-prev:hover {
    background: #e0e0e0;
}

.btn-next {
    background: var(--primary);
    color: white;
}

.btn-next:hover {
    background: var(--primary-light);
}

/* ===== 表格样式 ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
    box-shadow: 0 1px 3px var(--shadow);
    border-radius: var(--radius);
    overflow: hidden;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-dark);
    font-weight: 600;
    color: var(--primary-dark);
}

tr:hover {
    background: var(--bg-dark);
}

/* ===== 首页特殊样式 ===== */
.hero {
    text-align: center;
    padding: 60px 0;
}

.hero-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.hero h1 {
    font-size: 42px;
    margin-bottom: 15px;
    color: var(--primary-dark);
}

.hero p {
    font-size: 18px;
    color: var(--text-light);
    margin-bottom: 40px;
}

.start-btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 15px 50px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(33,115,70,0.3);
}

.start-btn:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33,115,70,0.4);
}

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 60px;
}

.feature-card {
    background: white;
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: 0 2px 10px var(--shadow);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow);
}

.feature-icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.feature-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--primary-dark);
}

.feature-card p {
    font-size: 14px;
    color: var(--text-light);
}

/* ===== 章节锚点 ===== */
.section-anchor {
    opacity: 0;
    margin-left: 10px;
    font-size: 16px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.section-title:hover .section-anchor {
    opacity: 0.5;
}

.section-anchor:hover {
    opacity: 1 !important;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-container {
        flex-direction: column;
    }
    
    .content-wrapper {
        padding: 20px;
        padding-top: 60px;
    }
    
    .outline-nav {
        display: none;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .chapter-title {
        font-size: 28px;
    }
    
    .nav-buttons {
        padding: 20px;
    }
}

@media (max-width: 1024px) {
    .outline-nav {
        display: none;
    }
    
    .content-container {
        max-width: 900px;
        padding-right: 0;
    }
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

/* ===== 动画 ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-wrapper > * {
    animation: fadeIn 0.5s ease;
}

/* ===== 打印样式 ===== */
@media print {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .nav-buttons {
        display: none;
    }
}

/* ===== 夜间模式切换按钮 ===== */
.theme-toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(33, 115, 70, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
    background: var(--primary-light);
}

.theme-icon {
    transition: transform 0.3s ease;
}

.theme-toggle-btn:hover .theme-icon {
    transform: rotate(15deg);
}

/* ===== 夜间模式样式 ===== */
[data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --text-primary: #eaeaea;
    --text-secondary: #b8b8b8;
    --text-tertiary: #888888;
    --text: #eaeaea;
    --text-light: #b8b8b8;
    --text-lighter: #888888;
    --bg: #1a1a2e;
    --bg-dark: #16213e;
    --bg-gray: #0f3460;
    --border: #2d2d44;
    --border-light: #3d3d5c;
    --shadow: rgba(0,0,0,0.3);
    --shadow-md: rgba(0,0,0,0.5);
}

[data-theme="dark"] body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

[data-theme="dark"] .content-wrapper {
    background: rgba(22, 33, 62, 0.85);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .outline-nav {
    background: rgba(22, 33, 62, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .outline-header {
    color: var(--text-primary);
}

[data-theme="dark"] .chapter-title {
    color: var(--text-primary);
}

[data-theme="dark"] .section-title {
    color: #4ecca3;
    border-bottom-color: var(--border);
}

[data-theme="dark"] .feature-card {
    background: rgba(22, 33, 62, 0.9);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

[data-theme="dark"] .feature-card h3 {
    color: #4ecca3;
}

[data-theme="dark"] .feature-card p {
    color: var(--text-secondary);
}

[data-theme="dark"] .goals-card {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    border-left-color: #4ecca3;
}

[data-theme="dark"] .goals-card h3 {
    color: #4ecca3;
}

[data-theme="dark"] .tip-box {
    background: #2d2d44;
    border-left-color: #ffa726;
}

[data-theme="dark"] .warning-box {
    background: #3d2d2d;
    border-left-color: #f44336;
}

[data-theme="dark"] .exercise {
    background: rgba(22, 33, 62, 0.6);
    border-color: var(--border);
}

[data-theme="dark"] .exercise-title {
    color: #4ecca3;
}

[data-theme="dark"] table {
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

[data-theme="dark"] th {
    background: var(--bg-tertiary);
    color: #4ecca3;
}

[data-theme="dark"] tr:hover {
    background: rgba(78, 204, 163, 0.1);
}

[data-theme="dark"] .btn-prev {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="dark"] .btn-prev:hover {
    background: var(--border);
}

[data-theme="dark"] .mastery-score {
    background: rgba(0,0,0,0.2);
}

[data-theme="dark"] .mastery-label {
    color: var(--text-secondary);
}

[data-theme="dark"] .mastery-value {
    color: var(--text-primary);
}

[data-theme="dark"] .weak-areas {
    background: #3d3d2d !important;
    border-left-color: #ffc107 !important;
}

[data-theme="dark"] .theme-toggle-btn {
    background: rgba(78, 204, 163, 0.9);
}

[data-theme="dark"] .theme-toggle-btn:hover {
    background: #3dbb94;
}

/* 移动端夜间模式适配 */
@media (max-width: 768px) {
    .theme-toggle-btn {
        top: 70px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}
