/* =============================================================================
   古代汉语项目 - 公共样式表 (common.css)
   =============================================================================

   ┌─────────────────────────────────────────────────────────────────────────────┐
   │                                目 录 (Table of Contents)                      │
   ├─────────────────────────────────────────────────────────────────────────────┤
   │  01. CSS 变量（Design Tokens）.............................................  │
   │      ├── 1.1 亮色主题变量................................................  │
   │      ├── 1.2 深色主题变量................................................  │
   │      └── 1.3 辅助变量....................................................  │
   │                                                                             │
   │  02. 基础重置（Base Reset）................................................  │
   │      ├── 2.1 盒模型重置....................................................│
   │      ├── 2.2 滚动条隐藏....................................................│
   │      └── 2.3 全局选择器..................................................│
   │                                                                             │
   │  03. 头部区域（Header Area）..............................................  │
   │      ├── 3.1  通用头部容器 (.site-header)................................. │
   │      ├── 3.2  头部左侧区域 (.header-left)................................  │
   │      ├── 3.3  头部右侧区域 (.header-right)................................  │
   │      ├── 3.4  头部导航栏 (.header-nav).................................... │
   │      ├── 3.5  头部标题 (.site-title / h1)................................  │
   │      ├── 3.6  项目计数器 (.item-counter)................................. │
   │      ├── 3.7  搜索切换按钮 (.search-toggle).............................. │
   │      ├── 3.8  主题切换按钮 (.theme-toggle)............................... │
   │      ├── 3.9  头部搜索容器 (.search-container-header).................... │
   │      └── 3.10 头部媒体查询................................................│
   │                                                                             │
   │  04. 布局容器（Layout Containers）.........................................  │
   │      ├── 4.1 页面容器 (.page)............................................. │
   │      ├── 4.2 主体区域 (.main-body / .main-area)............................ │
   │      └── 4.3 内容卡片 (.content-card / .file-card)........................ │
   │                                                                             │
   │  05. 按钮组件（Button Components）...........................................  │
   │      ├── 5.1 通用按钮基类 (.btn / .action-btn)............................  │
   │      ├── 5.2 主要按钮 (.btn-primary)...................................... │
   │      ├── 5.3 成功按钮 (.btn-success)....................................... │
   │      └── 5.4 操作按钮 (.action-btn)........................................ │
   │                                                                             │
   │  06. 表单输入（Form Inputs）................................................  │
   │      ├── 6.1 文本/数字输入框............................................... │
   │      ├── 6.2 下拉选择框................................................... │
   │      ├── 6.3 文件输入框................................................... │
   │      ├── 6.4 跳转输入相关样式............................................. │
   │      └── 6.5 页面主体和布局容器...........................................│
   │                                                                             │
   │  07. 侧边栏组件（Sidebar Components）.......................................  │
   │      ├── 7.1 侧边栏基础样式 (.leftbar / .Lsidebar)......................... │
   │      ├── 7.2 侧边栏切换按钮 (.sidebar-toggle).............................. │
   │      ├── 7.3 侧边栏折叠状态................................................ │
   │      └── 7.4 分隔器 (.resizer)............................................. │
   │                                                                             │
   │  08. 列表菜单（List Menu）..................................................  │
   │      ├── 8.1 列表容器 (.article-list / .menu-item)......................... │
   │      └── 8.2 列表项悬停/激活状态........................................... │
   │                                                                             │
   │  09. 内容区域（Content Areas）..............................................  │
   │      ├── 9.1 主内容区 (.content)......................................... │
   │      ├── 9.2 搜索容器 (.search-container)................................. │
   │      └── 9.3 搜索高亮 (.search-highlight)................................. │
   │                                                                             │
   │  10. 卡片组件（Card Components）............................................  │
   │      ├── 10.1 卡片基础样式 (.card / .draw-card)............................ │
   │      └── 10.2 问题卡片 (.question-item).................................... │
   │                                                                             │
   │  11. 选项卡组件（Tab Components）...........................................  │
   │      ├── 11.1 选项卡容器 (.tab)............................................  │
   │      └── 11.2 选项卡内容 (.tab-content)..................................... │
   │                                                                             │
   │  12. 媒体查询（Media Queries）..............................................  │
   │      ├── 12.1 平板尺寸 (max-width: 1024px)................................. │
   │      ├── 12.2 大手机尺寸 (max-width: 768px)................................ │
   │      └── 12.3 小手机尺寸 (max-width: 640px / 480px)........................ │
   │                                                                             │
   │  13. 工具类（Utility Classes）..............................................  │
   │      ├── 13.1 隐藏类 (.hidden)............................................ │
   │      └── 13.2 溢出省略 (.text-ellipsis)................................... │
   │                                                                             │
   └─────────────────────────────────────────────────────────────────────────────┘

   ========================================================================== */


/* =============================================================================
   01. CSS 变量（Design Tokens）
   ========================================================================== */

/* -----------------------------------------------------------------------------
   1.1 亮色主题变量（Light Theme Variables）
   ----------------------------------------------------------------------------- */
:root {
    /* 尺寸 */
    --ctrl-h: 44px;                      /* 控件高度 */
    --header-height: 56px;                /* 头部高度 */

    /* 背景色 - iOS风格 */
    --page-bg: #f2f2f7;                  /* 页面背景色 - iOS浅灰 */
    --card-bg: #ffffff;                   /* 卡片/容器背景色 */

    /* 表面色（用于hover/active状态） */
    --surface-hover: rgba(0, 122, 255, 0.08);   /* 悬停状态背景 */
    --surface-active: rgba(0, 122, 255, 0.12); /* 激活状态背景 */

    /* 文本色 - iOS风格 */
    --text: #000000;                      /* 主文本颜色 */
    --text-muted: #8e8e93;                /* 次要文本颜色 - iOS灰色 */

    /* 边框色 - iOS风格 */
    --border: #c7c7cc;                    /* 边框颜色 - iOS浅灰 */

    /* 主题色 - iOS风格 */
    --accent: #007aff;                    /* 主强调色 - iOS蓝 */
    --accent-hover: #0056b3;              /* 悬停状态 - 深iOS蓝 */
    --red-accent: #ff3b30;                /* 红色强调色 - iOS红 */
    --yellow-accent: #ff9500;              /* 黄色强调色 - iOS黄 */
    --green-accent: #34c759;              /* 绿色强调色 - iOS绿 */
    --purple-accent: #af52de;              /* 紫色强调色 - iOS紫 */

    /* 阴影 - iOS风格 */
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1);
                                           /* iOS柔和阴影 */

    /* 圆角 - iOS风格 */
    --radius: 12px;                       /* 圆角半径 - iOS风格 */

    /* 字体栈 - iOS风格 */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
                                           /* 系统字体栈 */
    --font-serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
                                           /* 衬线字体（古文/诗句） */
}

/* -----------------------------------------------------------------------------
   1.2 深色主题变量（Dark Theme Variables）
   ----------------------------------------------------------------------------- */
[data-theme="dark"] {
    /* 背景色 - iOS深色模式 */
    --page-bg: #1c1c1e;                   /* 页面背景色 - iOS深色 */
    --card-bg: #2c2c2e;                   /* 卡片背景色 - iOS深灰 */

    /* 表面色 */
    --surface-hover: rgba(0, 122, 255, 0.2);   /* 深色悬停状态 */
    --surface-active: rgba(0, 122, 255, 0.3); /* 深色激活状态 */

    /* 文本色 */
    --text: #ffffff;                      /* 主文本颜色 - 白色 */
    --text-muted: #8e8e93;                /* 次要文本颜色 - iOS灰色 */

    /* 边框色 */
    --border: #3a3a3c;                    /* 深色边框颜色 - iOS风格 */

    /* 主题色 - iOS风格 */
    --accent: #0a84ff;                    /* 深色主题强调色 - iOS蓝 */
    --accent-hover: #0066cc;              /* 深色悬停状态 - 深iOS蓝 */
    --red-accent: #ff453a;                /* 红色强调色 - iOS红 */
    --yellow-accent: #ff9f0a;              /* 黄色强调色 - iOS黄 */
    --green-accent: #30d158;              /* 绿色强调色 - iOS绿 */
    --purple-accent: #bf5af2;              /* 紫色强调色 - iOS紫 */

    /* 阴影 */
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.3);
                                           /* iOS深色阴影 */
}

/* -----------------------------------------------------------------------------
   1.3 辅助变量（Additional Variables）
   ----------------------------------------------------------------------------- */
:root {
    /* 头部 - iOS风格 */
    --header-bg: #ffffff;                         /* 头部背景（亮色） */
    --header-blur: 10px;                          /* 毛玻璃效果 */

    /* 过渡动画 */
    --transition-fast: 0.15s ease;                 /* 快速过渡（按钮按下） */
    --transition-normal: 0.2s ease;                /* 正常过渡（悬停） */
    --transition-slow: 0.3s ease;                  /* 慢速过渡（展开/收起） */

    /* z-index层级 */
    --z-header: 50;                                /* 头部层级 */
    --z-overlay: 100;                             /* 覆盖层层级 */
    --z-modal: 9999;                              /* 模态框层级 */
}

[data-theme="dark"] {
    --header-bg: #1c1c1e;                         /* 头部背景（深色） */
}


/* =============================================================================
   02. 基础重置（Base Reset）
   ========================================================================== */

/* -----------------------------------------------------------------------------
   2.1 盒模型重置（Box Sizing Reset）
   ----------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;              /* 统一盒模型计算方式 */
}

/* -----------------------------------------------------------------------------
   2.2 滚动条隐藏（Scrollbar Hidden）
   用于移动端或需要自定义滚动条的场景
   ----------------------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* -----------------------------------------------------------------------------
   2.3 全局选择器（Global Styles）
   ----------------------------------------------------------------------------- */
html,
body {
    margin: 0;                           /* 清除默认外边距 */
    height: 100%;                        /* 确保body占满视口高度 */
    font-family: var(--font-sans);       /* 默认使用无衬线字体 */
    font-size: 14px;                     /* 基础字号 - Google风格 */
    line-height: 1.5;                    /* 行高 - Google风格 */
    color: var(--text);                  /* 默认文本颜色 */
    background: var(--page-bg);          /* 默认背景色 */
    -webkit-font-smoothing: antialiased; /* 抗锯齿渲染（WebKit） */
    -moz-osx-font-smoothing: grayscale;  /* 抗锯齿渲染（Mozilla） */
}


/* =============================================================================
   03. 布局容器（Layout Containers）
   ========================================================================== */

/* -----------------------------------------------------------------------------
   3.1 页面容器（Page Container）
   用于页面最外层容器，撑满整个视口
   ----------------------------------------------------------------------------- */
.page {
    height: 100%;                        /* 占满父容器高度 */
    min-height: 100vh;                    /* 最小高度为视口高度 */
    min-height: 100dvh;                   /* 动态视口高度（移动端） */
    display: flex;                        /* 弹性盒布局 */
    flex-direction: column;                /* 垂直排列子元素 */
    min-height: 0;                         /* 允许flex子项收缩 */
}

/* -----------------------------------------------------------------------------
   3.2 主体区域（Main Body / Main Area）
   用于页面主内容区域
   ----------------------------------------------------------------------------- */
.main-body,
.main-area {
    flex: 1;                             /* 占据剩余空间 */
    padding: 20px;                        /* 内边距 */
    min-height: 0;                        /* 允许收缩 */
    overflow-y: auto;                     /* 垂直滚动（需要时） */
}

.main-area {
    width: 100%;                         /* 占满宽度 */
    max-width: 800px;                     /* 最大宽度限制 */
    margin: 0 auto;                       /* 水平居中 */
}

/* -----------------------------------------------------------------------------
   3.3 内容卡片（Content Card / File Card）
   用于包裹主要内容的卡片容器
   ----------------------------------------------------------------------------- */
.content-card,
.file-card,
.card {
    background: var(--card-bg);          /* 卡片背景色 */
    border: 1px solid var(--border);      /* 边框 */
    border-radius: var(--radius);         /* 圆角 */
    box-shadow: var(--shadow);            /* 卡片阴影 */
    overflow: hidden;                     /* 溢出隐藏 */
    padding: 20px;                        /* 内边距 */
    transition: all var(--transition-normal); /* 过渡动画 */
}

.content-card:hover,
.file-card:hover,
.card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* 悬停阴影 */
    transform: translateY(-2px);          /* 轻微上浮 */
}

.content-card {
    width: 100%;                         /* 占满宽度 */
    max-width: 800px;                     /* 最大宽度 */
    margin: 0 auto;                       /* 居中 */
    min-height: calc(100vh - 120px);      /* 最小高度 */
}

/* =============================================================================
   03. 头部区域（Header Area）
   ========================================================================== */

/* -----------------------------------------------------------------------------
   3.1 通用头部容器（Site Header）
   页面顶部的导航/工具栏区域
   ----------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 20px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: 8px;
    background: var(--header-bg);
    backdrop-filter: blur(var(--header-blur));
    -webkit-backdrop-filter: blur(var(--header-blur));
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex-wrap: nowrap;
    overflow: visible;
    min-width: 0;
    height: var(--header-height, auto);
}

/* -----------------------------------------------------------------------------
   3.2 头部左侧区域（Header Left）
   包含标题、计数器等
   ----------------------------------------------------------------------------- */
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    min-width: 0;
    overflow: hidden;
    flex-shrink: 1;
}

.header-left > * {
    flex-shrink: 0;
}

/* -----------------------------------------------------------------------------
   3.3 头部右侧区域（Header Right）
   包含搜索、主题切换等操作按钮
   ----------------------------------------------------------------------------- */
.header-right {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    flex-shrink: 0;
    overflow: visible;
}

/* -----------------------------------------------------------------------------
   3.4 头部导航栏（Header Nav）
   用于多个操作按钮的容器
   ----------------------------------------------------------------------------- */
.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
}

/* -----------------------------------------------------------------------------
   3.5 头部标题（Site Title / H1）
   ----------------------------------------------------------------------------- */
.site-title,
.site-header h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

/* -----------------------------------------------------------------------------
   3.6 项目计数器（Item Counter）
   显示列表行数等信息
   ----------------------------------------------------------------------------- */
.item-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--ctrl-h);
    min-width: 60px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    border-radius: 10px;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* -----------------------------------------------------------------------------
   3.7 搜索切换按钮（Search Toggle）
   ----------------------------------------------------------------------------- */
.search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--ctrl-h);
    height: var(--ctrl-h);
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--surface-hover);
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition-normal),
                color var(--transition-normal),
                transform var(--transition-fast);
    flex-shrink: 0;
}

.search-toggle:hover {
    background: var(--surface-active);
    color: var(--text);
}

.search-toggle:active {
    transform: scale(0.95);
}

.search-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.4);
}

/* -----------------------------------------------------------------------------
   3.8 主题切换按钮（Theme Toggle）
   ----------------------------------------------------------------------------- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--ctrl-h);
    height: var(--ctrl-h);
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--surface-hover);
    color: var(--accent);
    cursor: pointer;
    transition: background var(--transition-normal),
                transform var(--transition-fast);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--surface-active);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.4);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    display: none;
    width: 20px;
    height: 20px;
}

[data-theme="light"] .theme-toggle .icon-moon {
    display: block;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

/* -----------------------------------------------------------------------------
   3.9 头部搜索容器（Header Search Container）
   ----------------------------------------------------------------------------- */
.search-container-header {
    flex: 1;
    margin: 0 12px;
    max-width: 300px;
    min-width: 100px;
    transition: all var(--transition-slow);
    overflow: hidden;
}

.search-container-header.hidden {
    max-width: 0;
    min-width: 0;
    margin: 0;
    opacity: 0;
}

.search-wrapper-header {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.search-wrapper-header input[type="text"],
#searchInputHeader {
    width: 100%;
    padding: 8px 36px 8px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: var(--font-sans);
    box-sizing: border-box;
    background: var(--card-bg);
    color: var(--text);
    transition: all var(--transition-slow);
    min-width: 0;
}

.search-wrapper-header input[type="text"]:focus,
#searchInputHeader:focus {
    outline: none;
    border-color: var(--accent);
    border-radius: 10px;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

.clear-search-header {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.clear-search-header:hover {
    color: var(--text);
    background: var(--surface-active);
}

/* -----------------------------------------------------------------------------
   3.10 头部媒体查询（Header Media Queries）
   ----------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .site-header {
        padding: 8px 16px;
        padding-top: max(8px, env(safe-area-inset-top));
        gap: 8px;
    }

    .header-left {
        gap: 8px;
    }

    .header-right {
        gap: 4px;
    }

    .search-container-header {
        flex: 1;
        max-width: none;
        min-width: 60px;
        margin: 0 6px;
    }

    .site-title,
    .site-header h1 {
        font-size: 16px;
    }

    .item-counter {
        min-width: 50px;
        padding: 0 8px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .site-header {
        padding: 6px 10px;
        gap: 6px;
    }

    .search-container-header {
        flex: 1;
        max-width: none;
        min-width: 50px;
        margin: 0 4px;
    }

    .item-counter {
        display: none;
    }

    .sidebar-toggle,
    .search-toggle,
    .theme-toggle {
        padding: 6px;
    }
}


/* =============================================================================
   06. 按钮组件（Button Components）
   ========================================================================== */

/* -----------------------------------------------------------------------------
   6.1 通用按钮基类
   ----------------------------------------------------------------------------- */
.btn,
.action-btn {
    height: var(--ctrl-h);               /* 高度 */
    padding: 0 16px;                      /* 水平内边距 */
    font: inherit;                         /* 继承字体 */
    font-size: 14px;                      /* 字号 */
    font-weight: 500;                     /* 字重 */
    border: none;                         /* 无边框 */
    border-radius: var(--radius);         /* 圆角 */
    cursor: pointer;                      /* 指针光标 */
    transition: all var(--transition-normal);
                                           /* 过渡动画 */
}

.btn {
    min-width: 100px;                     /* 最小宽度 */
}

.action-btn {
    min-width: 56px;                      /* 最小宽度（操作按钮较小） */
}

/* -----------------------------------------------------------------------------
   6.2 主要按钮（Primary Button）
   ----------------------------------------------------------------------------- */
.btn-primary,
.btn,
input[type="submit"],
.upload-panel-btn {
    background: var(--accent);            /* 蓝色背景 */
    color: #fff;                          /* 白色文字 */
    box-shadow: 0 2px 4px rgba(0, 122, 255, 0.2); /* 按钮阴影 */
}

.btn-primary:hover,
.btn:hover,
input[type="submit"]:hover,
.upload-panel-btn:hover {
    background: var(--accent-hover);      /* 深蓝悬停 */
    box-shadow: 0 4px 8px rgba(0, 122, 255, 0.3); /* 悬停阴影 */
}

.btn-primary:active,
.btn:active,
input[type="submit"]:active,
.upload-panel-btn:active {
    transform: scale(0.97);               /* 按下缩小 */
    box-shadow: 0 2px 4px rgba(0, 122, 255, 0.2); /* 按下阴影 */
}

/* -----------------------------------------------------------------------------
   6.3 成功按钮（Success Button）
   ----------------------------------------------------------------------------- */
.btn-success,
.show-all-answers,
.file-label {
    background: var(--green-accent);     /* 绿色背景 */
    color: #fff;                          /* 白色文字 */
    box-shadow: 0 2px 4px rgba(52, 199, 89, 0.2); /* 按钮阴影 */
}

.btn-success:hover,
.show-all-answers:hover,
.file-label:hover {
    background: var(--green-accent);      /* 保持原背景色 */
    filter: brightness(1.1);              /* 提亮效果 */
    box-shadow: 0 4px 8px rgba(52, 199, 89, 0.3); /* 悬停阴影 */
}

.btn-success:active,
.show-all-answers:active,
.file-label:active {
    transform: scale(0.97);               /* 按下缩小 */
    box-shadow: 0 2px 4px rgba(52, 199, 89, 0.2); /* 按下阴影 */
}

/* -----------------------------------------------------------------------------
   6.4 操作按钮（Action Button）
   ----------------------------------------------------------------------------- */
.action-btn {
    background: var(--card-bg);              /* 卡片背景 */
    color: var(--text);                   /* 文字颜色 */
    border: 1px solid var(--border);      /* 边框 */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); /* 轻微阴影 */
}

.action-btn:hover {
    background: var(--surface-hover);     /* 悬停背景 */
    border-color: var(--accent);          /* 边框变主题色 */
}

.action-btn:active {
    transform: scale(0.97);               /* 按下缩小 */
    background: var(--surface-active);    /* 按下背景 */
}

/* 操作按钮-删除变体 */
.action-btn.delete {
    background: var(--card-bg);              /* 卡片背景 */
    color: var(--red-accent);             /* 红色文字 */
    border: 1px solid var(--red-accent);  /* 红色边框 */
}

.action-btn.delete:hover {
    background: var(--red-accent);        /* 红色背景 */
    color: #fff;                          /* 白色文字 */
}

/* -----------------------------------------------------------------------------
   6.5 禁用状态
   ----------------------------------------------------------------------------- */
.btn:disabled,
.action-btn:disabled {
    opacity: 0.5;                         /* 半透明 */
    cursor: not-allowed;                  /* 禁用光标 */
}


/* =============================================================================
   07. 表单输入（Form Inputs）
   ========================================================================== */

/* -----------------------------------------------------------------------------
   7.1 文本/数字输入框基础样式
   ----------------------------------------------------------------------------- */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea {
    height: var(--ctrl-h);                /* 高度 */
    padding: 0 16px;                      /* 水平内边距 */
    font: inherit;                         /* 继承字体 */
    font-size: 14px;                      /* 字号 */
    color: var(--text);                   /* 文字颜色 */
    background: var(--card-bg);           /* 背景色 */
    border: 1px solid var(--border);      /* 边框 */
    border-radius: var(--radius);         /* 圆角 */
    transition: all var(--transition-normal);
                                           /* 过渡动画 */
}

textarea {
    height: auto;                          /* textarea高度自适应 */
    padding: 12px 16px;                    /* 内边距 */
    resize: vertical;                      /* 只允许垂直拖拽 */
    min-height: 80px;                      /* 最小高度 */
}

/* -----------------------------------------------------------------------------
   7.2 悬停/焦点状态
   ----------------------------------------------------------------------------- */
input[type="text"]:hover,
input[type="number"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
textarea:hover {
    border-color: var(--text-muted);      /* 边框颜色 */
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
    outline: none;                         /* 清除默认焦点框 */
    border-color: var(--accent);          /* 边框变主题色 */
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2); /* 焦点阴影 */
}

/* -----------------------------------------------------------------------------
   7.3 下拉选择框（Select）
   ----------------------------------------------------------------------------- */
select {
    font: inherit;                         /* 继承字体 */
    font-size: 14px;                      /* 字号 */
    height: var(--ctrl-h);                /* 高度 */
    padding: 0 32px 0 16px;               /* 内边距（左留箭头空间） */
    border: 1px solid var(--border);      /* 边框 */
    border-radius: var(--radius);         /* 圆角 */
    background: var(--card-bg);           /* 背景 */
    color: var(--text);                   /* 文字颜色 */
    cursor: pointer;                      /* 指针光标 */
    appearance: none;                     /* 清除默认箭头 */
    -webkit-appearance: none;             /* Safari */
    -moz-appearance: none;               /* Firefox */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
                                           /* 自定义下拉箭头 */
    background-repeat: no-repeat;          /* 不重复 */
    background-position: right 10px center;
                                           /* 箭头位置 */
    transition: all var(--transition-normal);
                                           /* 过渡动画 */
    box-sizing: border-box;                /* 盒模型 */
}

select:hover {
    border-color: var(--text-muted);      /* 边框颜色 */
}

select:focus {
    outline: none;
    border-color: var(--accent);          /* 边框变主题色 */
}

/* -----------------------------------------------------------------------------
   7.4 浮动搜索框（Floating Search Bar）
   ----------------------------------------------------------------------------- */
.search-float {
    position: absolute;
    top: 50%;
    right: calc(100% + 12px);
    transform: translateY(-50%);
    z-index: 100;
    width: 0;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.search-float:not(.hidden) {
    width: 280px;
    max-width: 280px;
    opacity: 1;
}

.search-float-input {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 8px 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-float-input svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-float-input input {
    flex: 1;
    min-width: 0;
    padding: 8px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    background: transparent;
    color: var(--text);
    font-family: var(--font-sans);
}

.search-float-input input:focus {
    outline: none;
}

.search-float-input input::placeholder {
    color: var(--text-muted);
}

.search-float .clear-btn {
    width: 28px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.search-float .clear-btn:hover {
    background: var(--surface-active);
    color: var(--text);
}

.search-float .clear-btn.visible {
    display: flex;
}

@media (max-width: 768px) {
    .search-float:not(.hidden) {
        width: 220px;
        max-width: 220px;
    }
}

@media (max-width: 480px) {
    .search-float:not(.hidden) {
        width: 180px;
        max-width: 180px;
    }
}

/* -----------------------------------------------------------------------------
   7.5 搜索框容器（Search Bar）- 内嵌版本
   ----------------------------------------------------------------------------- */
.search-bar {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.search-bar.hidden {
    display: none;
}

.search-input-wrapper {
    flex: 1;
    max-width: 320px;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 2px;
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 4px;
    border-radius: 24px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all var(--transition-normal);
}

.search-input-wrapper:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-input-wrapper svg {
    margin-left: 10px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    flex-shrink: 0;
}

.search-input-wrapper input[type="text"],
.search-input-wrapper input {
    flex: 1;
    padding: 8px 10px;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    background: transparent;
    color: var(--text);
    font-family: var(--font-sans);
}

.search-input-wrapper input[type="text"]:focus,
.search-input-wrapper input:focus {
    outline: none;
    background: #ffffff;
}

.search-input-wrapper:focus-within {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(66, 133, 244, 0.2);
    border-color: var(--accent);
}

.search-input-wrapper input[type="text"]::placeholder,
.search-input-wrapper input::placeholder {
    color: var(--text-muted);
}

/* 清除按钮 */
.clear-btn,
.clear-search-header {
    width: 28px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.clear-btn:hover,
.clear-search-header:hover {
    background: var(--surface-active);
    color: var(--text);
}

.clear-btn.visible,
.clear-search-header.visible {
    display: flex;
}

/* -----------------------------------------------------------------------------
   7.5 搜索输入框（Search Input）- 旧样式兼容
   ----------------------------------------------------------------------------- */
.search-container-header {
    flex: 1;
    margin: 0 12px;
    max-width: 300px;
    min-width: 100px;
    transition: all var(--transition-slow);
    overflow: hidden;
}

.search-container-header.hidden {
    max-width: 0;
    min-width: 0;
    margin: 0;
    opacity: 0;
}

.search-wrapper-header {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

#searchInputHeader,
.search-input {
    width: 100%;
    padding: 8px 36px 8px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    box-sizing: border-box;
    background: var(--card-bg);
    color: var(--text);
    transition: all var(--transition-slow);
    font-family: var(--font-sans);
}

#searchInputHeader:focus,
.search-input:focus {
    outline: none;
    border-color: var(--accent);
    border-radius: 10px;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

/* 清除搜索按钮 - 旧样式 */
.clear-search-header,
.clear-search {
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-normal);
}

.clear-search-header:hover,
.clear-search:hover {
    color: var(--text);
    background: var(--surface-active);
}

/* -----------------------------------------------------------------------------
   7.5 文件输入框（File Input）
   ----------------------------------------------------------------------------- */
.file-input {
    flex: 1;                                /* 占据剩余空间 */
    min-width: 200px;                       /* 最小宽度 */
    padding: 10px 14px;                    /* 内边距 */
    border: 1px solid var(--border);       /* 边框 */
    border-radius: 10px;                   /* 圆角 */
    font-size: 15px;                        /* 字号 */
    font-family: var(--font-sans);         /* 字体 */
    box-sizing: border-box;                 /* 盒模型 */
    background: var(--surface-hover);       /* 背景 */
    color: var(--text);                    /* 文字色 */
    transition: background var(--transition-normal);
}

.file-input:hover {
    background: var(--surface-active);
}

.file-input:focus {
    outline: none;
    background: var(--surface-active);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.4);
}


/* -----------------------------------------------------------------------------
   7.7 跳转输入相关样式（Goto Input Styles）
   ----------------------------------------------------------------------------- */
.goto-container-header {
    flex-grow: 1;                             /* 占据剩余空间 */
    margin: 0 12px;                            /* 外边距 */
    max-width: 300px;                         /* 最大宽度 */
    transition: all var(--transition-slow);   /* 过渡动画 */
    overflow: visible;                         /* 可见溢出 */
}

.goto-container-header.hidden {
    max-width: 0;                              /* 收缩到0 */
    margin: 0;                                  /* 清除边距 */
    opacity: 0;                                 /* 透明 */
    overflow: hidden;                           /* 隐藏溢出 */
}

.goto-wrapper-header {
    position: relative;                       /* 相对定位 */
    width: 100%;                               /* 宽度100% */
    display: flex;                             /* 弹性盒 */
    align-items: center;                       /* 垂直居中 */
    gap: 8px;                                  /* 间距 */
}

.goto-input-header {
    flex: 1;                                   /* 占据剩余空间 */
    min-width: 80px;                          /* 最小宽度 */
    padding: 8px 12px;                         /* 内边距 */
    border: 1px solid var(--border);           /* 边框 */
    border-radius: 10px;                       /* 圆角 */
    font-size: 14px;                           /* 字号 */
    box-sizing: border-box;                     /* 盒模型 */
    background: var(--card-bg);                 /* 背景色 */
    color: var(--text);                        /* 文字色 */
    transition: all var(--transition-slow);     /* 过渡 */
    font-family: var(--font-sans);            /* 字体 */
}

.goto-input-header:focus {
    outline: none;                             /* 清除焦点框 */
    border-color: var(--accent);               /* 边框变主题色 */
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.4);
}

.goto-btn-header {
    height: 36px;                              /* 高度 */
    min-width: 60px;                           /* 最小宽度 */
    padding: 0 14px;                           /* 内边距 */
    font: inherit;                             /* 继承字体 */
    font-size: 14px;                           /* 字号 */
    font-weight: 600;                         /* 字重 */
    border: none;                              /* 无边框 */
    border-radius: 10px;                       /* 圆角 */
    background: var(--accent);                 /* 背景色 */
    color: #fff;                               /* 白色文字 */
    cursor: pointer;                           /* 指针光标 */
    transition: background var(--transition-normal),
                transform var(--transition-fast);
                                           /* 过渡动画 */
}

.goto-btn-header:hover {
    background: var(--accent-hover);           /* 悬停背景 */
}

.goto-btn-header:active {
    transform: scale(0.96);                   /* 按下缩小 */
}

.goto-toggle {
    width: var(--ctrl-h);                    /* 宽度 */
    height: var(--ctrl-h);                   /* 高度 */
    flex-shrink: 0;                           /* 不收缩 */
    display: inline-flex;                     /* 行内弹性盒 */
    align-items: center;                       /* 居中 */
    justify-content: center;                  /* 居中 */
    border: none;                             /* 无边框 */
    border-radius: 50%;                       /* 圆形 */
    background: var(--surface-hover);         /* 背景色 */
    color: var(--accent);                    /* 图标颜色 */
    cursor: pointer;                          /* 指针光标 */
    transition: background var(--transition-normal),
                transform var(--transition-fast);
                                           /* 过渡动画 */
}

.goto-toggle:hover {
    background: var(--surface-active);        /* 悬停背景 */
}

.goto-toggle:active {
    transform: scale(0.95);                   /* 按下缩小 */
}


/* -----------------------------------------------------------------------------
   7.6 页面主体容器和布局容器（Body Container / Layout Container）
   ----------------------------------------------------------------------------- */
.body {
    flex: 1;                                /* 占据剩余空间 */
    display: flex;                          /* 弹性盒 */
    min-height: 0;                          /* 允许收缩 */
    overflow: hidden;                      /* 溢出隐藏 */
}

.container {
    display: flex;                          /* 弹性盒 */
    flex: 1;                               /* 占据剩余空间 */
    min-height: 0;                         /* 允许收缩 */
    overflow: hidden;                      /* 溢出隐藏 */
}


/* =============================================================================
   08. 侧边栏组件（Sidebar Components）
   ========================================================================== */

/* -----------------------------------------------------------------------------
   8.1 侧边栏基础样式（Leftbar / Lsidebar）
   ----------------------------------------------------------------------------- */
.leftbar,
.Lsidebar {
    background: var(--page-bg);           /* 背景色 - 与页面一致 */
    overflow-y: auto;                     /* 垂直滚动 */
    overflow-x: hidden;                    /* 水平隐藏 */
    overscroll-behavior: contain;           /* 滚动行为 */
    padding: 16px;                         /* 内边距 */
    width: 280px;                          /* 固定宽度 - 稍窄 */
    min-width: 180px;                       /* 最小宽度 */
    border-right: 1px solid var(--border);
                                           /* 右边框 */
    flex-shrink: 0;                       /* 不允许收缩 */
    transition: width var(--transition-slow),
                padding var(--transition-slow);
                                           /* 过渡动画 */
}

/* 侧边栏折叠状态 */
.leftbar.collapsed,
.Lsidebar.collapsed,
.sidebar.collapsed {
    display: none !important;              /* 隐藏 */
    width: 0 !important;                    /* 宽度0 */
    min-width: 0 !important;               /* 最小宽度0 */
    padding: 0 !important;                  /* 无内边距 */
    border-right: none !important;          /* 无边框 */
    overflow: hidden !important;             /* 隐藏溢出 */
}

/* -----------------------------------------------------------------------------
   8.2 侧边栏切换按钮（Sidebar Toggle）
   ----------------------------------------------------------------------------- */
.sidebar-toggle {
    display: inline-flex;                 /* 行内弹性盒 */
    align-items: center;                   /* 居中 */
    justify-content: center;               /* 居中 */
    width: 32px;                           /* 宽度 */
    height: 32px;                           /* 高度 */
    padding: 0;                             /* 无内边距 */
    flex-shrink: 0;                        /* 不收缩 */
    border: none;                          /* 无边框 */
    border-radius: 8px;                    /* 圆角 */
    background: var(--surface-hover);     /* 背景 */
    color: var(--text-muted);               /* 灰色 */
    cursor: pointer;                        /* 指针 */
    transition: background var(--transition-normal),
                color var(--transition-normal);
}

.sidebar-toggle:hover {
    background: var(--surface-active);    /* 深色悬停 */
    color: var(--text);                    /* 黑色图标 */
}

.sidebar-toggle svg {
    transition: transform var(--transition-slow);
}

.sidebar-toggle.collapsed svg {
    transform: rotate(180deg);             /* 旋转箭头 */
}

/* -----------------------------------------------------------------------------
   8.3 分隔器（Resizer）
   用于可调整宽度的分隔线
   ----------------------------------------------------------------------------- */
.resizer {
    width: 1px;                             /* 宽度1px */
    background: var(--border);              /* 边框色 */
    cursor: col-resize;                     /* 列调整光标 */
    transition: background var(--transition-normal);
    flex-shrink: 0;                        /* 不收缩 */
}

.resizer:hover {
    background: var(--accent);              /* 悬停变主题色 */
}

.resizer.collapsed {
    display: none !important;              /* 折叠时隐藏 */
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
}


/* =============================================================================
   09. 列表菜单（List Menu）
   ========================================================================== */

/* -----------------------------------------------------------------------------
   9.1 列表容器（Article List / Menu Item）
   ----------------------------------------------------------------------------- */
.article-list,
.menu-item {
    list-style: none;                      /* 清除列表样式 */
    margin: 0;                              /* 清除外边距 */
    padding: 0;                              /* 清除内边距 */
}

.article-item,
.menu-item {
    padding: 8px 12px;                      /* 内边距 - 更紧凑 */
    margin: 2px 0;                          /* 垂直间距 */
    border-radius: var(--radius);           /* 圆角 */
    cursor: pointer;                        /* 指针 */
    transition: all var(--transition-normal);
    white-space: nowrap;                    /* 不换行 */
    overflow: hidden;                       /* 溢出隐藏 */
    text-overflow: ellipsis;                /* 省略号 */
    font-size: 13px;                        /* 字号 */
    font-weight: 400;                       /* 字重 */
    color: var(--text);                     /* 颜色 */
}

/* -----------------------------------------------------------------------------
   9.2 列表项状态
   ----------------------------------------------------------------------------- */
.article-item:hover,
.menu-item:hover {
    background-color: var(--surface-hover); /* 悬停背景 */
}

.article-item.active,
.menu-item.active {
    background-color: var(--surface-active); /* 激活背景 */
    color: var(--accent);                   /* 主题色文字 */
}


/* =============================================================================
   10. 内容区域（Content Areas）
   ========================================================================== */

/* -----------------------------------------------------------------------------
   10.1 主内容区（Content）
   ----------------------------------------------------------------------------- */
.content {
    background: var(--page-bg);            /* 背景色 */
    padding: 20px;                         /* 内边距 */
    flex: 1;                                /* 占据剩余空间 */
    overflow-y: auto;                      /* 垂直滚动 */
    overscroll-behavior: contain;            /* 滚动行为 */
    width: 100%;                            /* 宽度100% */
    word-wrap: break-word;                  /* 长单词换行 */
    overflow-wrap: break-word;             /* 现代换行 */
    white-space: normal;                    /* 正常空白 */
    min-width: 0;                           /* 允许收缩 */
}

/* 内容区内标题 */
.content h2 {
    margin: 0 0 16px 0;                     /* 底部间距 */
    padding: 14px 16px;                     /* 内边距 */
    font-size: 17px;                        /* 字号 */
    font-weight: 600;                       /* 字重 */
    color: var(--text);                     /* 颜色 */
    background: var(--card-bg);            /* 背景 */
    border-radius: var(--radius);           /* 圆角 */
    box-shadow: var(--shadow);              /* 阴影 */
}

/* 内容区内段落 */
.content p {
    margin: 0 0 10px 0;                     /* 底部间距 */
    padding: 14px 16px;                     /* 内边距 */
    font-size: 20px;                         /* 字号 - 再调大两个量级 */
    line-height: 1.6;                        /* 行高 */
    border-radius: var(--radius);           /* 圆角 */
    background: var(--card-bg);            /* 背景 */
    box-shadow: var(--shadow);              /* 阴影 */
    transition: all var(--transition-normal);
    color: var(--text);                     /* 颜色 */
}

.content p:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* -----------------------------------------------------------------------------
   10.2 搜索高亮（Search Highlight）
   ----------------------------------------------------------------------------- */
.search-highlight {
    background-color: rgba(255, 204, 0, 0.4);
                                           /* 黄色高亮 */
    padding: 0 2px;                         /* 内边距 */
    border-radius: 2px;                     /* 小圆角 */
}

.menu-item.highlighted {
    background-color: rgba(0, 122, 255, 0.15);
                                           /* 蓝色背景 */
    font-weight: 600;                       /* 加粗 */
    animation: pulse 1.5s infinite;          /* 脉冲动画 */
}

@keyframes pulse {
    0% { background-color: rgba(0, 122, 255, 0.15); }
    50% { background-color: rgba(0, 122, 255, 0.25); }
    100% { background-color: rgba(0, 122, 255, 0.15); }
}


/* =============================================================================
   11. 卡片组件（Card Components）
   ========================================================================== */

/* -----------------------------------------------------------------------------
   11.1 抽签卡片（Draw Card）
   ----------------------------------------------------------------------------- */
.draw-card {
    background: var(--card-bg);            /* 背景 */
    border-radius: var(--radius);           /* 圆角 */
    box-shadow: var(--shadow);              /* 阴影 */
    overflow: hidden;                       /* 溢出隐藏 */
    display: flex;                          /* 弹性盒 */
    flex-direction: column;                 /* 垂直排列 */
    min-height: 600px;                      /* 最小高度 */
}

/* -----------------------------------------------------------------------------
   11.2 问题卡片（Question Item）
   ----------------------------------------------------------------------------- */
.question-item {
    padding: 16px;                         /* 内边距 */
    margin-bottom: 12px;                    /* 底部间距 */
    background: var(--card-bg);            /* 背景 */
    border-radius: var(--radius);           /* 圆角 */
    box-shadow: var(--shadow);              /* 阴影 */
    position: relative;                     /* 相对定位 */
}

.question-item:last-child {
    margin-bottom: 0;                       /* 最后一个无底距 */
}

.question-number {
    display: inline-flex;                   /* 行内弹性盒 */
    align-items: center;                    /* 居中 */
    justify-content: center;                /* 居中 */
    background: var(--accent);             /* 主题色背景 */
    color: white;                            /* 白色文字 */
    width: 26px;                             /* 宽度 */
    height: 26px;                             /* 高度 */
    border-radius: 50%;                     /* 圆形 */
    text-align: center;                      /* 文字居中 */
    line-height: 26px;                       /* 行高=高度 */
    margin-right: 12px;                      /* 右侧间距 */
    font-weight: 600;                        /* 字重 */
    font-size: 14px;                         /* 字号 */
    flex-shrink: 0;                          /* 不收缩 */
}

.question-text {
    font-size: 20px;                         /* 字号 - 再调大两个量级 */
    line-height: 1.7;                        /* 行高 */
    color: var(--text);                     /* 颜色 */
    display: inline;                         /* 行内显示 */
}

.answer-text {
    background: rgba(139, 92, 246, 0.15);   /* 浅紫背景 */
    color: var(--purple-accent);            /* 紫色文字 */
    padding: 4px 12px;                       /* 内边距 */
    border-radius: 6px;                      /* 小圆角 */
    font-weight: 500;                        /* 字重 */
    font-size: 19px;                         /* 字号 - 再调大两个量级 */
    line-height: 1.6;                        /* 行高 */
    display: none;                            /* 默认隐藏 */
}


/* =============================================================================
   12. 选项卡组件（Tab Components）
   ========================================================================== */

/* -----------------------------------------------------------------------------
   12.1 选项卡容器（Tab）
   ----------------------------------------------------------------------------- */
.tab {
    display: flex;                          /* 弹性盒 */
    border-bottom: 0.5px solid var(--border);
                                           /* 底部分隔线 */
}

.tab button {
    flex: 1;                                /* 等宽 */
    padding: 12px 20px;                     /* 内边距 */
    background: transparent;                 /* 透明背景 */
    border: none;                           /* 无边框 */
    cursor: pointer;                        /* 指针 */
    font-size: 16px;                         /* 字号 */
    font-weight: 500;                        /* 字重 */
    color: var(--text-muted);               /* 灰色文字 */
    transition: all var(--transition-normal);
}

.tab button.active {
    color: var(--purple-accent);            /* 紫色 */
    font-weight: 600;                        /* 加粗 */
    position: relative;                     /* 相对定位 */
}

.tab button.active::after {
    content: '';                             /* 伪元素 */
    position: absolute;                      /* 绝对定位 */
    bottom: 0;                               /* 底部0 */
    left: 0;                                 /* 左侧0 */
    right: 0;                                 /* 右侧0 */
    height: 2px;                              /* 高度2px */
    background: var(--purple-accent);        /* 紫色底条 */
}

/* -----------------------------------------------------------------------------
   12.2 选项卡内容（Tab Content）
   ----------------------------------------------------------------------------- */
.tab-content {
    display: none;                          /* 默认隐藏 */
    padding: 20px;                           /* 内边距 */
    flex: 1;                                 /* 占据剩余空间 */
    flex-direction: column;                  /* 垂直排列 */
}

.tab-content.active {
    display: flex;                           /* 显示 */
}


/* =============================================================================
   13. 媒体查询（Media Queries）
   ========================================================================== */

/* -----------------------------------------------------------------------------
   13.1 平板尺寸（Tablet）- max-width: 1024px
   ----------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;             /* 改为垂直布局 */
        height: calc(100vh - var(--header-height, 52px));
        overflow: hidden;                    /* 保持溢出隐藏 */
    }

    .body {
        flex-direction: column;
        flex: 1;
        min-height: 0;
        height: 100%;                        /* 明确高度以支持百分比子元素 */
        overflow: hidden;                   /* 保持隐藏 */
    }

    .leftbar,
    .Lsidebar {
        width: 100%;                         /* 全宽 */
        height: 40%;                         /* 40%高度 */
        max-height: none;                    /* 允许高度生效 */
        overflow-y: auto;                     /* 可滚动 */
        border-right: none;                   /* 无右边框 */
        border-bottom: 0.5px solid var(--border);
                                           /* 底部分隔线 */
        flex-shrink: 0;                      /* 不收缩 */
        -webkit-overflow-scrolling: touch;   /* iOS惯性滚动 */
    }

    .resizer {
        width: 100%;                         /* 全宽 */
        height: 8px;                          /* 8px高 */
        border-left: none;                    /* 无左边框 */
        border-top: 0.5px solid var(--border);
                                           /* 顶部分隔线 */
        cursor: row-resize;                   /* 行调整光标 */
        flex-shrink: 0;                      /* 不收缩 */
    }

    .content,
    .article-content {
        flex: 1;                             /* 占据剩余空间 */
        min-height: 0;                       /* 允许收缩 */
        overflow-y: auto;                     /* 可滚动 */
    }
}

/* -----------------------------------------------------------------------------
   13.2 大手机尺寸（Large Mobile）- max-width: 768px
   ----------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .site-header {
        padding: 8px 16px;                  /* 缩小内边距 */
        padding-top: max(8px, env(safe-area-inset-top));
    }

    .header-left {
        gap: 8px;                            /* 减小间距 */
    }

    .main-body,
    .main-area {
        padding: 16px;                       /* 缩小内边距 */
    }

    .content-card {
        padding: 20px;                       /* 缩小内边距 */
    }

    main {
        font-size: 18px;                     /* 缩小字号 */
        line-height: 1.7;                    /* 调整行高 */
    }

    main p {
        padding: 14px 16px;                   /* 缩小内边距 */
    }

    select {
        font-size: 14px;                      /* 缩小字号 */
        padding: 0 32px 0 12px;               /* 调整内边距 */
        min-width: 100px;                     /* 减小最小宽度 */
    }

    .search-container-header {
        flex: 1;
        max-width: none;
        min-width: 60px;
        margin: 0 6px;
    }

    /* 问答卡片 */
    .article-title {
        font-size: 18px;                     /* 缩小标题字号 */
    }

    .question-item {
        padding: 14px;                        /* 缩小内边距 */
    }

    .question-text {
        font-size: 15px;                      /* 缩小正文字号 */
    }
}

/* -----------------------------------------------------------------------------
   13.3 小手机尺寸（Small Mobile）- max-width: 640px
   ----------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .site-header {
        padding: 8px 16px;
        padding-top: max(8px, env(safe-area-inset-top));
    }

    .body {
        margin: 0;
        flex: 1;
        min-height: 0;
        height: 100%;
    }

    .leftbar,
    .Lsidebar {
        padding: 10px;                        /* 缩小内边距 */
        height: 35%;                          /* 调整左侧栏高度 */
    }

    .content {
        padding: 16px;                        /* 缩小内边距 */
    }

    .content h2 {
        font-size: 16px;                      /* 缩小标题 */
        padding: 12px 14px;                    /* 缩小内边距 */
    }

    .content p {
        padding: 12px 14px;                   /* 缩小内边距 */
        font-size: 15px;                      /* 缩小字号 */
    }

    .search-container {
        padding: 6px 0;                        /* 缩小内边距 */
        margin-bottom: 8px;                    /* 缩小底距 */
    }

    /* 抽签页 */
    .draw-card {
        min-height: 500px;                    /* 减小最小高度 */
    }

    .tab button {
        padding: 10px 16px;                   /* 缩小内边距 */
        font-size: 15px;                      /* 缩小字号 */
    }

    .tab-content {
        padding: 16px;                        /* 缩小内边距 */
    }

    .result {
        font-size: 3rem;                      /* 缩小结果字号 */
        padding: 30px 16px;                   /* 缩小内边距 */
    }

    .number-inputs {
        gap: 8px;                             /* 减小间距 */
    }

    .number-input {
        width: 70px;                          /* 减小宽度 */
        height: 40px;                         /* 减小高度 */
    }

    .btn {
        height: 40px;                         /* 减小高度 */
        min-width: 100px;                     /* 减小最小宽度 */
        padding: 0 20px;                      /* 减小内边距 */
        font-size: 15px;                      /* 缩小字号 */
    }

    .file-label {
        height: 40px;                         /* 减小高度 */
        padding: 0 16px;                      /* 减小内边距 */
        font-size: 14px;                      /* 缩小字号 */
    }

    .history-section {
        padding: 16px;                        /* 缩小内边距 */
    }

    /* 文件存取页 */
    .file-card {
        padding: 16px;                        /* 缩小内边距 */
    }

    .upload-form {
        flex-direction: column;                /* 改为垂直布局 */
        align-items: stretch;                  /* 拉伸宽度 */
    }

    .file-input {
        min-width: auto;                       /* 最小宽度自适应 */
    }

    .file-actions {
        flex-direction: column;                /* 垂直排列 */
        align-items: stretch;                  /* 拉伸宽度 */
        gap: 6px;                              /* 减小间距 */
    }

    .action-btn {
        width: 100%;                          /* 全宽 */
    }
}

/* -----------------------------------------------------------------------------
   13.4 超小手机尺寸（Extra Small Mobile）- max-width: 480px
   ----------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .dialog {
        font-size: 15px;                      /* 缩小对话框字号 */
        max-width: 95%;                       /* 最大95%宽度 */
    }

    .contentContainer {
        padding: 12px;                         /* 缩小内边距 */
    }

    .body {
        height: 100%;
    }

    .leftbar,
    .Lsidebar {
        height: 30%;
    }

    /* 控制按钮 */
    .control-btn span:last-child {
        display: none;                         /* 隐藏文字 */
    }

    .control-btn {
        min-width: 45px;                       /* 最小宽度 */
        padding: 6px 12px;                     /* 缩小内边距 */
    }

    .control-panel {
        gap: 8px;                              /* 减小间距 */
        padding: 6px 16px;                     /* 缩小内边距 */
    }
}


/* =============================================================================
   14. 表格样式（Table Styles）
   ========================================================================== */

/* -----------------------------------------------------------------------------  14.1 表格基础样式   ----------------------------------------------------------------------------- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-family: var(--font-sans);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* 表头样式 */
table th {
    background-color: var(--accent);
    color: white;
    font-weight: 600;
    padding: 14px 16px;
    text-align: left;
    border-bottom: 2px solid var(--accent-hover);
    transition: background-color var(--transition-normal);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 表头悬停效果 */
table th:hover {
    background-color: var(--accent-hover);
}

/* 表格单元格样式 */
table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    transition: background-color var(--transition-fast);
}

/* 表格行悬停效果 */
table tbody tr:hover {
    background-color: var(--surface-hover);
}

/* 表格奇偶行样式 */
table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.015);
}

/* 深色主题奇偶行样式 */
[data-theme="dark"] table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.015);
}

/* 表格卡片样式 */
.table-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    padding: 20px;
    margin: 20px 0;
}

/* =============================================================================
   15. 工具类（Utility Classes）
   ========================================================================== */

/* -----------------------------------------------------------------------------
   15.1 隐藏类（Hidden）
   用于淡出动画后隐藏元素
   ----------------------------------------------------------------------------- */
.hidden {
    opacity: 0;                               /* 透明 */
    transition: opacity 0.3s ease, max-width 0.3s ease, margin 0.3s ease;
                                           /* 快速过渡 */
    pointer-events: none;                    /* 禁用点击 */
}

/* -----------------------------------------------------------------------------
   14.2 溢出省略（Text Ellipsis）
   用于单行文本溢出省略
   ----------------------------------------------------------------------------- */
.text-ellipsis {
    white-space: nowrap;                    /* 不换行 */
    overflow: hidden;                         /* 溢出隐藏 */
    text-overflow: ellipsis;                  /* 省略号 */
}

/* -----------------------------------------------------------------------------
   14.3 	flexbox 工具
   ----------------------------------------------------------------------------- */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-1 {
    flex: 1;
}


/* =============================================================================
   15. 对话框补充样式（Dialog Additional Styles）
   注：完整对话框样式见 dialog.css
   ========================================================================== */

/* 搜索容器（用于展开/收起） */
.search-container {
    position: sticky;                       /* 粘性定位 */
    top: 0;                                   /* 顶部0 */
    background: var(--card-bg);              /* 背景色 */
    z-index: 10;                              /* 层级 */
    display: flex;                            /* 弹性盒 */
    align-items: center;                      /* 居中 */
    width: 100%;                              /* 全宽 */
    box-sizing: border-box;                   /* 盒模型 */
    padding: 8px 0;                           /* 内边距 */
    margin-bottom: 10px;                      /* 底部分隔 */
    border-bottom: 0.5px solid var(--border); /* 底边线 */
}

#searchInput {
    flex-grow: 1;                             /* 占据剩余 */
    padding: 10px 14px;                        /* 内边距 */
    border: none;                              /* 无边框 */
    border-radius: 10px;                       /* 圆角 */
    font-size: 15px;                           /* 字号 */
    font-family: var(--font-sans);            /* 字体 */
    box-sizing: border-box;                    /* 盒模型 */
    width: 100%;                               /* 宽度100% */
    background: var(--surface-hover);          /* 背景 */
    color: var(--text);                       /* 颜色 */
    transition: background var(--transition-normal);
}

#searchInput::placeholder {
    color: var(--text-muted);                 /* 占位符灰色 */
}

#searchInput:hover {
    background: var(--surface-active);         /* 悬停变深 */
}

#searchInput:focus {
    outline: none;                             /* 清除焦点框 */
    background: var(--surface-active);         /* 焦点背景 */
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.4);
}

/* 清除搜索按钮 */
.clear-search {
    color: var(--text-muted);                 /* 灰色 */
    font-size: 20px;                          /* 字号 */
    cursor: pointer;                          /* 指针 */
    display: none;                            /* 默认隐藏 */
    position: absolute;                       /* 绝对定位 */
    right: 56px;                              /* 右偏移 */
    top: 50%;                                  /* 垂直居中 */
    transform: translateY(-50%);               /* 居中偏移 */
    transition: color var(--transition-normal);
    line-height: 1;                            /* 行高1 */
}

.clear-search:hover {
    color: var(--text);                       /* 悬停黑色 */
}
