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

/* VIP标签统一样式 */
.vip-tag {
    font-size: 10px;
    color: #f1c40f;
    margin-left: 4px;
}

html,
body {
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', sans-serif;
    background: #deb887;
}

body {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

h1 {
    text-align: center;
    font-size: clamp(1.2rem, 5vw, 2rem);
    margin: 5px 0;
    color: #2c3e50;
}

/* 顶部菜单栏样式 */
.top-menu {
    display: flex;
    justify-content: space-between;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 0;
    padding: 0 20px;
    margin: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    height: 50px;
    align-items: center;
    flex-shrink: 0;
}

.menu-left {
    display: flex;
    align-items: center;
}

.menu-item {
    color: white;
    padding: 12px 24px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    border-radius: 8px;
    transition: all 0.3s;
    margin-right: 10px;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.menu-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-user {
    color: #f39c12;
    font-size: 16px;
    font-weight: bold;
    padding: 12px 0;
}

.lang-switch {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.lang-switch-btn {
    color: white;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.12);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.lang-switch-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 100;
    min-width: 120px;
}

.lang-dropdown.show {
    display: block;
}

.lang-option {
    padding: 10px 18px;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-option:hover {
    background: #f0f0f0;
}

.lang-option.active {
    background: #e8f0fe;
    color: #1a73e8;
    font-weight: 600;
}

/* 视图容器 */
#views-slot {
    flex: 1;
    min-height: 0;
    height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.view-container {
    display: none;
    flex: 1;
    min-height: 0;
    width: 100%;
    height: 0;
}

.view-container.active {
    display: flex;
    flex: 1;
    gap: 15px;
    min-height: 0;
    height: auto;
    width: 100%;
}

/* 各视图基础设置：不设display，由.view-container控制显隐 */
#homeView,
#gameView,
#helpView,
#docView,
#adminView {
    width: 100%;
}

/* 主页视图激活时 */
#homeView.active {
    flex-direction: row;
    height: 100%;
}

/* 游戏视图激活时：棋盘和侧边栏横向排列，占满窗口 */
#gameView.active {
    flex-direction: row;
    overflow: hidden;
    gap: 0;
    flex: 1;
    min-height: 0;
}

#gameView.active > .board-wrapper {
    flex: 1;
    min-height: 0;
}

#gameView.active > .sidebar {
    flex-shrink: 0;
    width: 320px;
    min-height: 0;
    overflow-y: auto;
}

/* 帮助视图激活时 */
#helpView.active {
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

/* 文档视图激活时 */
#docView.active {
    flex-direction: row;
    height: 100%;
}

/* 管理员视图激活时 */
#adminView.active {
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

#adminView.active > .help-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.board-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #c4a27a;
    border-radius: 12px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2), 0 8px 20px rgba(0, 0, 0, 0.3);
    padding: 8px;
}

canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1/1;
    background: #eec085;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 0 0 2px #b68b5c;
}

.sidebar {
    width: 320px;
    min-height: 100%;
    background: rgba(255, 250, 240, 0.9);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 18px 14px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border: 1px solid #e0c9a6;
}

.sidebar h3 {
    margin: 0 0 15px 0;
    color: #1e3c72;
    text-align: center;
    border-bottom: 2px solid #b68b5c;
    padding-bottom: 8px;
}

input,
button {
    font-size: 15px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #ccc;
    transition: all 0.2s;
    font-family: inherit;
}

button {
    background: #4a6fa5;
    color: white;
    border: none;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

button:hover {
    background: #3a5a8a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button:disabled {
    background: #aaa;
    cursor: not-allowed;
    transform: none;
}

.info-panel {
    background: #f5efe6;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 20px;
    border-left: 5px solid #b68b5c;
    font-size: 0.95rem;
}

.info-item {
    margin: 6px 0;
}

#turn-indicator {
    font-weight: bold;
    color: #1e3c72;
    font-size: 1.1rem;
}

#analysis-display {
    margin-top: 8px;
    padding: 5px;
    background: #fff9e6;
    border-radius: 6px;
    color: #2c3e50;
    font-weight: bold;
}

#score-display {
    font-weight: bold;
    color: #2c3e50;
    margin-top: 8px;
    padding: 5px;
    background: #fff9e6;
    border-radius: 6px;
}

#message {
    margin-top: 10px;
    padding: 10px;
    background: #fff9e6;
    border-radius: 8px;
    color: #a94442;
    font-weight: 500;
    text-align: center;
    min-height: 55px;
}

.footer-note {
    margin-top: auto;
    font-size: 12px;
    color: #7a6a5a;
    text-align: center;
    padding-top: 10px;
}

/* 登录面板样式 */
.auth-panel {
    background: #f0ede6;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.auth-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

.auth-tab {
    flex: 1;
    background: #ddd;
    color: #333;
    border: none;
    padding: 8px;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
}

.auth-tab.active {
    background: #4a6fa5;
    color: white;
}

.auth-form input {
    width: 100%;
    margin-bottom: 8px;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

#logoutBtn {
    background: #a94442;
    padding: 6px 12px;
    font-size: 13px;
}

/* 在线用户列表样式 */
.online-users-list {
    max-height: 250px;
    overflow-y: auto;
    margin-top: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 5px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin: 5px 0;
    background: white;
    border-radius: 6px;
    border: 1px solid #ddd;
    min-height: 40px;
}

.user-item:hover {
    background: #f9f9f9;
}

.user-info-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 10px;
}

.invite-btn {
    background: #5a9;
    padding: 6px 12px;
    font-size: 13px;
    min-width: 80px;
}

.invite-btn:hover {
    background: #4a8;
}

.invite-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 操作按钮样式 */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.action-buttons button {
    padding: 10px 8px;
    font-size: 14px;
}

/* 打谱控制条样式 */
.replay-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding: 12px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecef 100%);
    border-radius: 12px;
    border: 2px solid #b68b5c;
}

.replay-btn {
    min-width: 28px;
    height: 28px;
    padding: 6px;
    font-size: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.replay-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

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

.replay-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.replay-btn.active {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.5);
}

.replay-separator {
    width: 2px;
    height: 24px;
    background: #b68b5c;
    margin: 0 4px;
    border-radius: 1px;
}

/* 邀请通知样式 */
.invitation-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 350px;
    border-left: 5px solid #4a6fa5;
}

.invitation-notification h4 {
    margin: 0 0 10px 0;
    color: #1e3c72;
}

.invitation-notification p {
    margin: 5px 0;
    color: #555;
}

.invitation-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.accept-btn {
    background: #5a9;
}

.reject-btn {
    background: #a94442;
}

/* 结束对局确认对话框样式 */
.end-game-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    border-left: 5px solid #f44336;
}

.end-game-dialog h4 {
    margin: 0 0 10px 0;
    color: #d32f2f;
}

.end-game-dialog p {
    margin: 5px 0;
    color: #555;
}

.end-game-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

/* 悔棋请求对话框样式 */
.undo-request-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    border-left: 5px solid #ff9800;
}

.undo-request-dialog h4 {
    margin: 0 0 10px 0;
    color: #f57c00;
}

/* 超时提示弹窗样式 */
.timeout-dialog {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 9999 !important;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    max-width: 400px;
    border-left: 5px solid #ff9800;
}

.timeout-dialog h4 {
    margin: 0 0 10px 0;
    color: #f57c00;
    font-size: 18px;
}

.timeout-dialog p {
    margin: 5px 0;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}

.undo-request-dialog p {
    margin: 5px 0;
    color: #555;
}

.undo-request-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* 棋谱列表对话框样式 */
.games-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 500px;
    max-height: 600px;
    border-left: 5px solid #4a6fa5;
    display: flex;
    flex-direction: column;
}

.games-dialog h4 {
    margin: 0 0 15px 0;
    color: #1e3c72;
}

.games-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.game-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.game-item:hover {
    background: #f5f5f5;
}

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

.game-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.game-item-players {
    font-weight: bold;
    color: #333;
}

.game-item-result {
    font-weight: bold;
}

.game-item-info {
    font-size: 12px;
    color: #666;
}

.games-close-btn {
    margin-top: 15px;
    background: #999;
}

.no-games-message {
    text-align: center;
    padding: 30px;
    color: #999;
}

/* VIP 套餐卡片悬停效果 */
.vip-plan-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.vip-plan-card:hover .vip-buy-btn {
    background: #e67e22 !important;
}

.vip-status-active {
    color: #f39c12;
    font-weight: bold;
}

.vip-status-inactive {
    color: #999;
}

/* VIP 开关 toggle 样式 */
.vip-slider {
    background: #ccc;
}
.vip-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}
input:checked + .vip-slider {
    background: #f39c12;
}
input:checked + .vip-slider:before {
    transform: translateX(20px);
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
}

.modal-content h3 {
    margin: 0 0 20px 0;
    color: #1e3c72;
    font-size: 20px;
}

/* 帮助页面样式 */
.help-content {
    background: rgba(255, 250, 240, 0.95);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    max-width: 1000px;
    margin: 0 auto;
    overflow-y: auto;
}

.help-content h2 {
    color: #1e3c72;
    margin-bottom: 20px;
    border-bottom: 2px solid #b68b5c;
    padding-bottom: 10px;
}

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

.help-section h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 18px;
}

.help-section p,
.help-section li {
    color: #555;
    line-height: 1.8;
    margin-bottom: 8px;
}

.help-section ul {
    padding-left: 25px;
}

.help-tip {
    background: #fff9e6;
    border-left: 4px solid #f39c12;
    padding: 12px;
    margin: 15px 0;
    border-radius: 6px;
}

@media (max-width: 700px) {
    /* ========== 通用样式 ========== */
    .sidebar {
        width: 100%;
        max-height: 35vh;
    }

    /* 只对激活的视图设置样式,不影响其他视图 */
    .view-container.active {
        flex-direction: column !important;
    }

    /* ========== 主页视图 ========== */
    #homeView.active {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        overflow-y: auto !important;
    }

    #homeView.active > .sidebar {
        max-width: 100% !important;
        flex: none !important;
        width: 100% !important;
        max-height: none !important;
    }

    /* 主页第一个侧边栏(在线用户)限制高度 */
    #homeView.active > .sidebar:first-child {
        max-height: 35vh !important;
        overflow-y: auto !important;
    }

    /* 主页第二个侧边栏(登录)不限制高度 */
    #homeView.active > .sidebar:nth-child(2) {
        max-height: none !important;
        overflow-y: auto !important;
    }

    /* ========== 游戏视图 ========== */
    #gameView.active {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        overflow-y: auto !important;
    }

    #gameView.active > .board-wrapper {
        flex: none !important;
        width: 100% !important;
        height: 100vw !important;
        max-height: none !important;
    }

    #gameView.active > .sidebar {
        flex: none !important;
        width: 100% !important;
        max-height: none !important;
        overflow-y: auto !important;
    }

    /* 移动端打谱控制条显示在侧边栏最上方 */
    #gameView.active .replay-controls {
        order: -1 !important;
        margin-top: 0 !important;
        margin-bottom: 15px !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
        background: linear-gradient(135deg, #f5f7fa 0%, #e8ecef 100%) !important;
    }

    /* ========== 帮助视图 ========== */
    #helpView.active {
        overflow-y: auto !important;
        height: 100% !important;
    }

    #helpView.active .help-content {
        max-width: 100% !important;
        padding: 15px !important;
    }

    /* ========== 文档视图 ========== */
    #docView.active {
        display: block !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    #docView.active > div {
        flex-direction: column !important;
        padding: 10px !important;
        gap: 10px !important;
        height: 100% !important;  /* 占满父容器高度 */
        overflow: hidden !important;  /* 父容器不滚动 */
        display: flex !important;
        width: 100% !important;
    }

    /* 文档左侧边栏(目录导航) - 移动端隐藏 */
    #docView.active #docTocSidebar {
        display: none !important;
    }

    /* 文档浏览区 - 移动端默认隐藏，添加 doc-viewing 时显示 */
    #docView.active #docContentWrapper {
        display: none !important;
    }

    #docView.active.doc-viewing #docContentWrapper {
        display: block !important;
        max-width: 100% !important;
        width: 100% !important;
        flex: 1 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 20px !important;
        background: white !important;
        border-radius: 8px !important;
    }

    /* 确保文档内容区域可以正常显示 */
    #docView.active #docMarkdownContent {
        overflow: visible !important;
        height: auto !important;
    }

    /* 文档右侧边栏(文件列表) - 移动端默认显示，添加 doc-viewing 时隐藏 */
    #docView.active #docRightSidebar {
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: 1 !important;
        overflow-y: auto !important;
    }

    #docView.active.doc-viewing #docRightSidebar {
        display: none !important;
    }

    /* 移动端隐藏文档工具栏 */
    #docView.active #docToolbar {
        display: none !important;
    }

    /* ========== 管理员视图 ========== */
    #adminView.active {
        display: flex !important;
        flex: 1 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
    }

    #adminView.active > div {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        width: 100% !important;
    }

    #adminView.active .help-content {
        width: 100% !important;
        max-width: 100% !important;
        overflow-y: auto !important;
    }

    #adminView.active .help-content > div[style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
        display: grid !important;
        gap: 15px !important;
    }

    #adminView.active .help-content > div > div {
        max-width: 100% !important;
        overflow-x: auto !important;
    }
}

/* ========== Markdown 文档专业样式 ========== */
#docMarkdownContent {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    max-width: 100%;
    word-wrap: break-word;
}

/* 标题样式 */
#docMarkdownContent h1 {
    font-size: 2.2em;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0.8em 0 0.5em 0;
    padding-bottom: 0.3em;
    border-bottom: 2px solid #e0e0e0;
    line-height: 1.3;
}

#docMarkdownContent h2 {
    font-size: 1.8em;
    font-weight: 600;
    color: #2c3e50;
    margin: 0.9em 0 0.4em 0;
    padding-bottom: 0.2em;
    border-bottom: 1px solid #eee;
    line-height: 1.4;
}

#docMarkdownContent h3 {
    font-size: 1.4em;
    font-weight: 600;
    color: #34495e;
    margin: 1em 0 0.3em 0;
    line-height: 1.4;
}

#docMarkdownContent h4,
#docMarkdownContent h5,
#docMarkdownContent h6 {
    font-size: 1.1em;
    font-weight: 600;
    color: #555;
    margin: 1em 0 0.3em 0;
}

/* 段落样式 */
#docMarkdownContent p {
    margin: 1em 0;
    text-align: justify;
}

/* 链接样式 */
#docMarkdownContent a {
    color: #0366d6;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

#docMarkdownContent a:hover {
    color: #0056b3;
    border-bottom-color: #0056b3;
}

/* 列表样式 */
#docMarkdownContent ul,
#docMarkdownContent ol {
    margin: 1em 0;
    padding-left: 2em;
}

#docMarkdownContent li {
    margin: 0.5em 0;
    line-height: 1.6;
}

#docMarkdownContent ul li {
    list-style-type: disc;
}

#docMarkdownContent ol li {
    list-style-type: decimal;
}

#docMarkdownContent ul ul,
#docMarkdownContent ol ol,
#docMarkdownContent ul ol,
#docMarkdownContent ol ul {
    margin: 0.5em 0;
}

/* 引用块样式 */
#docMarkdownContent blockquote {
    margin: 1.5em 0;
    padding: 1em 1.5em;
    border-left: 5px solid #3498db;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 0 8px 8px 0;
    color: #555;
    font-style: italic;
}

#docMarkdownContent blockquote p {
    margin: 0;
}

/* ========== 代码块专业样式 ========== */
/* 代码块容器 */
#docMarkdownContent pre {
    margin: 1.5em 0;
    padding: 0;
    background: #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* 代码块内容 */
#docMarkdownContent pre code {
    display: block;
    padding: 1em 1.25em;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 18px;
    line-height: 1.7;
    tab-size: 4;
    color: #d4d4d4;
    background: #1e1e1e;
}

/* 行内代码（非代码块中的 code） */
#docMarkdownContent code:not(pre code) {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    background: #f5f5f5;
    color: #d63384;
    padding: 0.2em 0.4em;
    border-radius: 4px;
}

/* ========== 语法高亮 - VS Code Dark+ 主题 ========== */
/* 所有高亮样式都限定在 #docMarkdownContent 内 */
#docMarkdownContent .hljs-comment,
#docMarkdownContent .hljs-quote {
    color: #6a9955 !important;
    font-style: italic;
}

#docMarkdownContent .hljs-keyword,
#docMarkdownContent .hljs-selector-tag {
    color: #569cd6 !important;
}

#docMarkdownContent .hljs-string {
    color: #ce9178 !important;
}

#docMarkdownContent .hljs-number {
    color: #b5cea8 !important;
}

#docMarkdownContent .hljs-title {
    color: #dcdcaa !important;
}

#docMarkdownContent .hljs-variable,
#docMarkdownContent .hljs-params {
    color: #9cdcfe !important;
}

#docMarkdownContent .hljs-built_in,
#docMarkdownContent .hljs-type {
    color: #4ec9b0 !important;
}

#docMarkdownContent .hljs-attribute,
#docMarkdownContent .hljs-property {
    color: #9cdcfe !important;
}

#docMarkdownContent .hljs-class {
    color: #4ec9b0 !important;
}

#docMarkdownContent .hljs-constant {
    color: #4fc1ff !important;
}

#docMarkdownContent .hljs-symbol,
#docMarkdownContent .hljs-bullet {
    color: #b5cea8 !important;
}

#docMarkdownContent .hljs-regexp {
    color: #d16969 !important;
}

#docMarkdownContent .hljs-meta,
#docMarkdownContent .hljs-meta-keyword,
#docMarkdownContent .hljs-meta-string {
    color: #9cdcfe !important;
}

#docMarkdownContent .hljs-selector-class {
    color: #d7ba7d !important;
}

#docMarkdownContent .hljs-selector-attr {
    color: #9cdcfe !important;
}

#docMarkdownContent .hljs-selector-pseudo {
    color: #d7ba7d !important;
}

#docMarkdownContent .hljs-name,
#docMarkdownContent .hljs-tag {
    color: #569cd6 !important;
}

#docMarkdownContent .hljs-link {
    color: #4ec9b0 !important;
}

#docMarkdownContent .hljs-addition {
    color: #b5cea8 !important;
    background: rgba(181, 206, 168, 0.15) !important;
}

#docMarkdownContent .hljs-deletion {
    color: #ce9178 !important;
    background: rgba(206, 145, 120, 0.15) !important;
}

#docMarkdownContent .hljs-emphasis {
    font-style: italic !important;
}

#docMarkdownContent .hljs-strong {
    font-weight: bold !important;
}

#docMarkdownContent .hljs-literal {
    color: #569cd6 !important;
}

#docMarkdownContent .hljs-template-variable {
    color: #ce9178 !important;
}

#docMarkdownContent .hljs-attr {
    color: #9cdcfe !important;
}

#docMarkdownContent .hljs-function {
    color: #dcdcaa !important;
}

#docMarkdownContent .hljs-selector-id {
    color: #dcdcaa !important;
}

/* 默认文本颜色 */
#docMarkdownContent .hljs {
    color: #d4d4d4;
    background: transparent;
}

/* 表格样式 */
#docMarkdownContent table {
    width: 100%;
    margin: 1.5em 0;
    border-collapse: collapse;
    font-size: 0.95em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

#docMarkdownContent thead {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

#docMarkdownContent th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
}

#docMarkdownContent td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

#docMarkdownContent tbody tr {
    transition: background 0.2s ease;
}

#docMarkdownContent tbody tr:hover {
    background: #f5f5f5;
}

#docMarkdownContent tbody tr:last-child td {
    border-bottom: none;
}

/* 分隔线样式 */
#docMarkdownContent hr {
    margin: 2em 0;
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ccc, transparent);
}

/* 图片样式 */
#docMarkdownContent img {
    max-width: 100%;
    height: auto;
    margin: 1em 0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* 强调样式 */
#docMarkdownContent strong {
    font-weight: 700;
    color: #1a1a1a;
}

#docMarkdownContent em {
    font-style: italic;
    color: #555;
}

/* 删除线样式 */
#docMarkdownContent del {
    color: #999;
    text-decoration: line-through;
}

/* 任务列表样式 */
#docMarkdownContent input[type="checkbox"] {
    margin-right: 0.5em;
    transform: scale(1.2);
}

/* 文档浏览区容器增强 */
#docView > div > div:first-child {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8e8e8;
}

/* 滚动条美化 */
#docMarkdownContent::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#docMarkdownContent::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#docMarkdownContent::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#docMarkdownContent::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ========== 文档目录导航样式 ========== */
#docTocSidebar {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8e8e8;
}

#docTocContent {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

#docTocContent::-webkit-scrollbar {
    width: 6px;
}

#docTocContent::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#docTocContent::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#docTocContent::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 目录项激活状态 */
.doc-toc-item.active {
    background: #3498db !important;
    color: white !important;
}

/* 文档内容包装器滚动条 */
#docContentWrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#docContentWrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#docContentWrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#docContentWrapper::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ========================================
   打印样式 - 只打印文档正文
   ======================================== */
@media print {
    /* 隐藏所有非正文区域 */
    .top-menu,
    #menuBar,
    #docTocSidebar,
    #docRightSidebar,
    #docMdFileList,
    #docToolbar,
    .modal,
    .modal-overlay,
    #notification,
    #loadingOverlay {
        display: none !important;
    }
    
    /* 重置 body 和 html 样式 */
    body, html {
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        position: static !important;
    }
    
    /* 重置所有视图容器 */
    .view-container {
        display: none !important;
    }
    
    /* 只显示文档视图 */
    #docView {
        display: block !important;
        position: static !important;
        padding: 0 !important;
        gap: 0 !important;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        flex: none !important;
    }
    
    /* 重置文档视图内的 flex 容器 */
    #docView > div {
        display: block !important;
        position: static !important;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        flex: none !important;
        gap: 0 !important;
        padding: 0 !important;
    }
    
    /* 让文档内容区域占满整个页面 */
    #docContentWrapper {
        display: block !important;
        position: static !important;
        max-width: 100% !important;
        width: 100% !important;
        flex: none !important;
        overflow: visible !important;
        padding: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        height: auto !important;
        min-height: auto !important;
    }
    
    /* 优化文档内容样式 */
    #docMarkdownContent {
        display: block !important;
        position: static !important;
        padding: 20px 40px !important;
        max-width: 210mm !important;
        margin: 0 auto !important;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        font-size: 11pt !important;
        line-height: 1.5 !important;
    }
    
    /* 确保所有内容可见 */
    #docMarkdownContent * {
        overflow: visible !important;
        max-height: none !important;
    }
    
    /* 调整标题字体大小 */
    #docMarkdownContent h1 {
        font-size: 18pt !important;
        margin-top: 0.8em !important;
        margin-bottom: 0.4em !important;
    }
    
    #docMarkdownContent h2 {
        font-size: 16pt !important;
        margin-top: 0.7em !important;
        margin-bottom: 0.3em !important;
    }
    
    #docMarkdownContent h3 {
        font-size: 14pt !important;
        margin-top: 0.6em !important;
        margin-bottom: 0.3em !important;
    }
    
    #docMarkdownContent h4 {
        font-size: 12pt !important;
        margin-top: 0.5em !important;
        margin-bottom: 0.2em !important;
    }
    
    #docMarkdownContent h5 {
        font-size: 11pt !important;
        margin-top: 0.4em !important;
        margin-bottom: 0.2em !important;
    }
    
    #docMarkdownContent h6 {
        font-size: 10pt !important;
        margin-top: 0.4em !important;
        margin-bottom: 0.2em !important;
    }
    
    /* 调整段落和列表 */
    #docMarkdownContent p,
    #docMarkdownContent li {
        font-size: 11pt !important;
        line-height: 1.5 !important;
        margin: 0.3em 0 !important;
    }
    
    /* 优化代码块打印 */
    #docMarkdownContent pre {
        white-space: pre-wrap !important;
        word-wrap: break-word !important;
        page-break-inside: avoid;
        overflow: visible !important;
        max-height: none !important;
        font-size: 9pt !important;
        line-height: 1.4 !important;
        padding: 8px !important;
        margin: 0.5em 0 !important;
        border: none !important;
        background: #f5f5f5 !important;
        box-shadow: none !important;
    }
    
    #docMarkdownContent code {
        font-size: 9pt !important;
        border: none !important;
        background: transparent !important;
    }
    
    /* 优化表格打印 */
    #docMarkdownContent table {
        page-break-inside: avoid;
        font-size: 10pt !important;
    }
    
    #docMarkdownContent th,
    #docMarkdownContent td {
        padding: 4px 8px !important;
    }
    
    /* 优化图片打印 */
    #docMarkdownContent img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
    
    /* 避免标题和段落跨页 */
    #docMarkdownContent h1,
    #docMarkdownContent h2,
    #docMarkdownContent h3,
    #docMarkdownContent h4,
    #docMarkdownContent h5,
    #docMarkdownContent h6 {
        page-break-after: avoid;
    }
    
    #docMarkdownContent p,
    #docMarkdownContent li {
        orphans: 3;
        widows: 3;
    }
}
