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

/* 为老旧浏览器提供盒模型降级方案 */
.box-sizing-fallback {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

:root{
    --bg:#F0EEE6;
    --fg:#2c2c2c;
    --muted:#666;
    --table-bg:#F8F9FA;
    --border:#E3DACC;
    --accent:#BCD1CA;
    --code:#d73a49;
}

/* 为不支持CSS变量的老旧浏览器提供降级颜色值 */
.fallback-colors {
    /* 这些选择器在支持CSS变量的浏览器中不会被应用 */
}
body {
    font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--fg);
    line-height: 1.6;
    font-size: 16px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--bg);
}

/* ==================== 头部样式 ==================== */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 0 20px;
}

.main-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--fg);
    margin-bottom: 0;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.title-icon {
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

/* ==================== 导航栏样式 ==================== */
.nav-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    padding: 0;

    /* 为老旧浏览器提供Flexbox降级方案 */
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    -webkit-box-align: center;
    -ms-flex-align: center;
}

.nav-link {
    padding: 8px 20px;
    margin: 0 10px;
    background-color: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--fg);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background-color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-link:focus-visible {
    outline: 2px solid #17a2b8;
    outline-offset: 2px;
}

/* ==================== 主要内容样式 ==================== */
.main-content {
    background-color: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.section {
    margin-bottom: 0;
}

.section + .section {
    margin-top: 50px;
}

.section-title {
    font-size: 1.2rem;
    color: #2c2c2c;
    margin-bottom: 20px;
    font-weight: 600;
    border-bottom: none;
    padding-bottom: 0;
    cursor: default;
    user-select: text;
}

.collapsible-section {
    border: none;
}

/* ==================== 表格样式 ==================== */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #E3DACC;
    background-color: white;
}

.syntax-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background-color: #F8F9FA;
}

.syntax-table thead {
    background-color: #F8F9FA;
}

.syntax-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #2c2c2c;
    border-bottom: 1px solid #E3DACC;
    border-right: 1px solid #E3DACC;
    font-size: 14px;
    background-color: #F8F9FA;
}

.syntax-table th:first-child {
    width: 15%;
    min-width: 80px;
}

.syntax-table th:nth-child(2) {
    width: 45%;
}

.syntax-table th:last-child {
    width: 40%;
}

.syntax-table tbody tr {
    border-bottom: 1px solid #E3DACC;
}



.syntax-table tbody tr:last-child {
    border-bottom: none;
}

.syntax-table td {
    padding: 12px 15px;
    vertical-align: top;
    border-right: 1px solid #E3DACC;
}

.syntax-table td:last-child {
    border-right: none;
}

.syntax-table th:last-child {
    border-right: none;
}

.element-name {
    font-weight: 600;
    color: #2c2c2c;
    font-size: 14px;
    background-color: #F8F9FA;
}

.syntax-code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 8px 10px;
    border-left: 1px solid #E3DACC;
}

.syntax-code code,
.syntax-code pre {
    background-color: transparent;
    color: #d73a49;
    font-size: 13px;
    line-height: 1.4;
    display: block;
    white-space: pre-wrap;
    margin: 0;
    padding: 0;
    border: none;
    font-family: inherit;
}

.note {
    color: #666;
    font-size: 13px;
    line-height: 1.5;
}

.note strong {
    color: #2c2c2c;
    background-color: #E3DACC;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}

.note code {
    background-color: #f1f3f4;
    color: #e91e63;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
}




/* ==================== 语法注释样式 ==================== */
.note-quote {
    margin-bottom: 25px;
    padding: 20px;
    background-color: #F8F9FA;
    border-left: 4px solid #E3DACC;
    border-radius: 4px;
    font-style: normal;
}

.note-quote:last-child {
    margin-bottom: 0;
}

.note-quote p {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #2c2c2c;
}

.note-quote p:last-child {
    margin-bottom: 0;
}

.note-quote strong {
    color: #2c2c2c;
    font-weight: 600;
}


/* ==================== 非标语法样式 ==================== */
.non-standard-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.syntax-block {
    background-color: #F8F9FA;
    border: 1px solid #E3DACC;
    border-radius: 8px;
    padding: 20px;
}

.syntax-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c2c2c;
    margin-bottom: 15px;
    border-bottom: 2px solid #BCD1CA;
    padding-bottom: 8px;
}

.syntax-example {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.example-item {
    margin-bottom: 20px;
}

.example-item h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #2c2c2c;
    margin-bottom: 10px;
}

.code-block {
    background-color: white;
    border: 1px solid #E3DACC;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    overflow-x: auto;
}

.code-block code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #d73a49;
    white-space: pre-wrap;
    word-break: break-all;
}

.rendered-result {
    background-color: white;
    border: 1px solid #E3DACC;
    border-radius: 6px;
    padding: 15px;
    margin-top: 10px;
}

/* 强调内容样式 */
.important-note {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px 15px;
    border-radius: 4px;
    color: #856404;
    font-weight: 500;
}

.info-note {
    background-color: #d1ecf1;
    border-left: 4px solid #17a2b8;
    padding: 12px 15px;
    border-radius: 4px;
    color: #0c5460;
    font-weight: 500;
}

/* 折叠列表样式 */
.collapsible-details {
    border: 1px solid #E3DACC;
    border-radius: 6px;
    padding: 10px;
}

.collapsible-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #2c2c2c;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 10px;
}

.collapsible-details summary:hover {
    background-color: #E3DACC;
}

.collapsible-details ul {
    margin: 0;
    padding-left: 20px;
}

.collapsible-details li {
    margin-bottom: 5px;
    color: #2c2c2c;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .main-title {
        font-size: 1.3rem;
    }

    .title-icon {
        width: 20px;
        height: 20px;
    }

    .nav-bar {
        flex-wrap: wrap;
        gap: 20px;
    }
    
    .nav-link {
        padding: 6px 14px;
        font-size: 13px;
    }
    
    .main-content {
        padding: 0;
    }
    
    .section-title {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }
    
    .note-quote {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .note-quote p {
        font-size: 13px;
        margin-bottom: 10px;
    }
    
    .syntax-block {
        padding: 15px;
    }
    
    .syntax-subtitle {
        font-size: 1rem;
    }
    
    .code-block {
        padding: 12px;
    }
    
    .code-block code,
    .code-block pre {
        font-size: 12px;
    }
    
    .syntax-table {
        font-size: 12px;
    }
    
    .syntax-table th,
    .syntax-table td {
        padding: 8px 10px;
    }
    
    .syntax-code {
        padding: 6px 8px;
    }
    
    .syntax-code code,
    .syntax-code pre {
        font-size: 11px;
    }
    
    .note {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.2rem;
    }

    .title-icon {
        width: 18px;
        height: 18px;
    }

    .nav-bar {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-link {
        width: 100%;
        text-align: center;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .section-title {
        font-size: 1rem;
    }
    
    .note-quote {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .note-quote p {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .syntax-block {
        padding: 12px;
    }
    
    .syntax-subtitle {
        font-size: 0.9rem;
    }
    
    .code-block {
        padding: 10px;
    }
    
    .code-block code,
    .code-block pre {
        font-size: 11px;
    }
    
    .syntax-table th:first-child {
        width: 20%;
    }
    
    .syntax-table th:nth-child(2) {
        width: 40%;
    }
    
    .syntax-table th:last-child {
        width: 40%;
    }
    
    .syntax-table th,
    .syntax-table td {
        padding: 6px 8px;
    }
}

/* ==================== 滚动条样式 ==================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: #E3DACC;
}

/* ==================== 选择文本样式 ==================== */
::selection {
    background: rgba(188, 209, 202, 0.3);
    color: #2c2c2c;
}

::-moz-selection {
    background: rgba(188, 209, 202, 0.3);
    color: #2c2c2c;
}

/* ==================== 打印样式 ==================== */
@media print {
    
    .main-content {
        box-shadow: none !important;
    }
    
    
    
    .syntax-table {
        page-break-inside: auto;
    }
    
    .syntax-table thead {
        display: table-header-group;
    }
}


/* ==================== 增强：兼容与可访问性覆盖 ==================== */
*{
    scrollbar-width: thin;
    scrollbar-color: var(--accent) #f1f1f1;
}

/* 表头吸顶 */
.syntax-table thead th{
    position: sticky;
    top: 0;
    z-index: 1;
}

/* 使用变量覆盖旧色值，避免逐行改动 */
.section-title,
.element-name,
.note-quote p{
    color: var(--fg);
}
.syntax-table,
.syntax-table thead,
.element-name{
    background-color: var(--table-bg);
}
.syntax-code{
    background-color: var(--table-bg);
    border-left: 1px solid var(--border);
}
.note{
    color: var(--muted);
}
.note strong{
    color: var(--fg);
    background-color: var(--border);
}

/* 打印优化 */
@media print {
    body{
        background:#ffffff;
        color:#000000;
    }
    .header,
    .nav-bar{
        display:none !important;
    }
    .syntax-table{
        background:#ffffff;
        border-color:#cccccc;
        page-break-inside:auto;
    }
    .syntax-table thead{
        display:table-header-group;
    }
    .syntax-table th,
    .syntax-table td{
        color:#000000;
    }
}

/* 深色模式 */
@media (prefers-color-scheme: dark){
    :root{
        --bg:#121212;
        --fg:#e6e6e6;
        --muted:#aaaaaa;
        --table-bg:#1b1b1b;
        --border:#2a2a2a;
        --accent:#356a5f;
        --code:#ff7b86;
    }
    .table-container{
        border-color: var(--border);
        background-color: #151515;
    }
}

/* ==================== 页脚样式 ==================== */
.footer {
    margin-top: 80px;
    padding: 10px 0 5px 0;
    background-color: transparent;
}

.footer-content {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.footer-link {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
    margin-left: 4px;
}

.footer-link:hover {
    color: var(--fg);
}

/* ==================== 性能优化建议 ==================== */
/* 为获得最佳性能，请使用CSS压缩工具（如CSSNano或CleanCSS）压缩此文件 */
/* 压缩后可显著减小文件大小，提高加载速度 */
