/* ---------- 平板 / 手机：单列 ---------- */
@media (max-width: 1000px) {
    #design-body {
        grid-template-columns: 1fr;
        grid-template-areas:
            "stats"
            "map"
            "detail"
            "right";
        gap: 12px;
    }

    .design-col-detail {
        position: static;
    }
}

@media (max-width: 900px) {
    .container.container-wide {
        padding: 0 14px;
    }

    .stat-row {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .stat-num {
        font-size: 1.25rem;
    }

    /* 触屏没有 hover，节点按钮常驻并放大 */
    .node-tools {
        opacity: 1;
    }

    .node-btn {
        width: 30px;
        height: 30px;
        font-size: 0.8125rem;
    }

    .fold {
        width: 22px;
        height: 22px;
        font-size: 0.6875rem;
    }

    /* 表格横向滑动，不撑破卡片 */
    .data-card {
        overflow-x: auto;
    }

    .data-table th,
    .data-table td {
        padding: 8px 12px;
        white-space: nowrap;
    }
}

@media (max-width: 520px) {
    .container.container-wide {
        padding: 0 12px;
    }

    .stat-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .case-grid {
        grid-template-columns: 1fr;
    }

    .tree ul {
        margin-left: 12px;
        padding-left: 12px;
    }

    .tree ul > li::before {
        left: -12px;
        width: 10px;
    }

    .tree-label {
        min-width: 0;
        max-width: 100%;
        font-size: 0.875rem;
    }

    .admin-head {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (hover: none) {
    .node-tools {
        opacity: 1;
    }
}


/* ---------- 用例详情（只读态） ---------- */
.case-view[hidden] { display: none; }

.view-title {
    margin: 4px 0 12px;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--c-heading);
    word-break: break-word;
}

.view-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.case-badge {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--c-bg-soft);
    color: var(--c-text-2);
    font-size: 0.8125rem;
    line-height: 1.7;
}

.case-badge-method { background: #eef2ff; color: #4338ca; }
.case-badge-p0 { background: #fee2e2; color: #b91c1c; }
.case-badge-p1 { background: #fef3c7; color: #92400e; }
.case-badge-p2 { background: #e0f2fe; color: #0369a1; }
.case-badge-none { background: var(--c-bg-soft); color: var(--c-faint); }

.view-section { margin-bottom: 10px; }

.view-section h4 {
    margin: 0 0 5px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--c-faint);
    letter-spacing: 0.04em;
}

.view-section p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.75;
    color: #334155;
    white-space: pre-wrap;
    word-break: break-word;
}

.view-pre {
    padding: 10px 12px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 6px;
}

.view-meta {
    display: flex;
    gap: 14px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #e5e7eb;
    font-size: 0.875rem;
    color: var(--c-faint);
}

.view-meta b { color: var(--c-text-2); font-weight: 500; }


/* ---------- 居中弹窗 ---------- */
.ui-dialog {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ui-dialog[hidden] {
    display: none;
}

.ui-dialog-mask {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.ui-dialog-box {
    position: relative;
    width: min(420px, calc(100vw - 32px));
    padding: 18px 20px 16px;
    border-radius: 10px;
    background: var(--c-surface);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}

.ui-dialog-title {
    margin-bottom: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--c-heading);
}

.ui-dialog-text {
    margin: 0 0 10px;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--c-text-2);
    white-space: pre-wrap;
    word-break: break-word;
}

.ui-dialog-input {
    width: 100%;
    margin: 4px 0 12px;
    padding: 7px 10px;
    border: 1px solid var(--c-border-strong);
    border-radius: 6px;
    font-size: 0.9375rem;
    font-family: inherit;
    outline: none;
}

.ui-dialog-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ui-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
}

/* 弹窗按钮：等宽、不撑满、字号大一档 */
.ui-dialog-actions .btn-ghost,
.ui-dialog-actions .btn-primary {
    width: auto;
    min-width: 88px;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 0.875rem;
    line-height: 1.4;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
}

.ui-dialog-actions .btn-ghost {
    border: 1px solid var(--c-border-strong);
    background: var(--c-surface);
    color: var(--c-text-2);
}

.ui-dialog-actions .btn-ghost:hover {
    background: var(--c-bg);
    border-color: #cbd5e1;
    color: #1e293b;
}

.ui-dialog-actions .btn-primary {
    border: 0;
    background: #2563eb;
    color: #fff;
    font-weight: 500;
}

.ui-dialog-actions .btn-primary:hover {
    background: #1d4ed8;
}

.ui-dialog-actions .btn-ghost:active,
.ui-dialog-actions .btn-primary:active {
    transform: translateY(1px);
}


/* ---------- 看板下拉 ---------- */
.board-picker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 8px;
}

.board-picker label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1e293b;
}

.board-picker select {
    padding: 6px 12px;
    border: 1px solid var(--c-border-strong);
    border-radius: 6px;
    background: var(--c-surface);
    color: #1e293b;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.board-picker select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}


/* 导航搜索框、系列徽章、上下篇 */
.nav-search {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 20px;
    vertical-align: middle;
}

.nav-search input {
    width: 140px;
    padding: 5px 10px;
    border: 1px solid var(--c-border-strong);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.nav-search input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.nav-search button {
    padding: 5px 14px;
    border: 1px solid #2563eb;
    border-radius: 6px;
    background: #2563eb;
    color: #fff;
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.nav-search button:hover {
    background: #1d4ed8;
}

/* 系列徽章 */
.series-badge {
    display: inline-block;
    margin-right: 12px;
    padding: 1px 9px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.75rem;
    line-height: 1.7;
}

.series-badge:hover {
    background: #e0e7ff;
}

/* 文章底部上下篇 */
.series-nav {
    display: flex;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px dashed #e5e7eb;
}

.series-nav-item {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    background: var(--c-surface);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.series-nav-item:hover {
    border-color: #c7d2fe;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.series-nav-item.is-empty {
    border: 0;
    background: none;
}

.series-nav-next {
    text-align: right;
}

.series-nav-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.75rem;
    color: var(--c-faint);
}

.series-nav-title {
    font-size: 0.9375rem;
    color: var(--c-heading);
}

/* 系列列表页 */
.series-item h2 {
    font-size: 1.0625rem;
}

@media (max-width: 640px) {
    .nav-search {
        margin: 8px 0 0;
    }

    .nav-search input {
        width: 120px;
    }

    .series-nav {
        flex-direction: row;
    }

    .series-nav-next {
        text-align: left;
    }
}


/* ---------- 页脚固定在页面底部 ---------- */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#page-content {
    flex: 1 0 auto;
}

.site-footer {
    flex-shrink: 0;
    margin-top: auto;
    padding: 18px 0;
    border-top: 1px solid var(--c-border);
    background: var(--c-surface);
    font-size: 0.8125rem;
    color: #888;
}

.site-footer .container {
    display: block;
    text-align: center;
}

.site-footer p {
    margin: 0;
}

.site-footer a {
    color: #888;
}

.site-footer a:hover {
    color: #2563eb;
}


/* ---------- 博客首页增强 ---------- */
/* 首页 hero、文章卡、侧栏列表、代码块 */
.home-hero {
    margin-bottom: 24px;
    padding: 24px 26px;
    border-radius: 10px;
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 60%, #fff 100%);
    border: 1px solid #e5e9f5;
}

.home-hero h1 {
    margin-bottom: 8px;
    font-size: 1.5rem;
    color: var(--c-heading);
}

.home-hero p {
    margin: 0 0 12px;
    color: var(--c-text-2);
    font-size: 0.9375rem;
}

.home-hero .home-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.home-hero .home-stats span {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--c-surface);
    border: 1px solid #e2e8f0;
    font-size: 0.8125rem;
    color: var(--c-text-2);
}

/* 文章卡：左侧系列色条 + 悬停反馈 */
.post-item {
    position: relative;
    border-left: 3px solid var(--accent, #e5e7eb);
    transition: box-shadow 0.15s, transform 0.15s;
}

.post-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.post-read {
    margin-right: 12px;
    color: #9ca3af;
}

.post-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 侧栏列表 */
.widget-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 0.875rem;
    border-bottom: 1px dashed #f1f5f9;
}

.widget-list li:last-child {
    border-bottom: 0;
}

.widget-list a {
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.widget-list a:hover {
    color: #2563eb;
}

.widget-count {
    margin-left: 8px;
    color: var(--c-faint);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.stat-list li span {
    color: var(--c-muted);
}

.stat-list li b {
    color: var(--c-heading);
    font-size: 0.9375rem;
}

/* 正文与代码 */
.post-body {
    max-width: 900px;
}

.post-body pre {
    margin: 16px 0;
    padding: 14px 16px;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    background: #f6f8fa;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.6;
}

.post-body code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--c-bg-soft);
    font-size: 0.875em;
}

.post-body pre code {
    padding: 0;
    background: none;
    font-size: inherit;
}

@media (max-width: 640px) {
    .home-hero {
        padding: 18px 18px;
    }

    .home-hero h1 {
        font-size: 1.25rem;
    }
}


.pager-btn {
    display: inline-block;
    min-width: 96px;
    text-align: center;
}

/* 不可用时占位但不显示，保证三个元素的相对位置不变 */
.pager-btn.is-hidden {
    visibility: hidden;
    pointer-events: none;
}

.pager-info {
    color: var(--c-faint);
    font-size: 0.8125rem;
}


/* 订单列表每页条数 */
.per-page-form {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin: 4px 0 8px;
}

.per-page-form label {
    font-size: 0.8125rem;
    color: var(--c-muted);
}

.per-page-form select {
    padding: 3px 8px;
    border: 1px solid var(--c-border-strong);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-family: inherit;
    background: var(--c-surface);
}


/* 测试设计：标题下方的操作区 */
.design-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}


/* ---------- 导入用例弹窗 ---------- */
.import-modal {
    position: fixed;
    inset: 0;
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
}

.import-modal[hidden] {
    display: none;
}

.import-box {
    width: min(520px, calc(100vw - 32px));
    padding: 18px 20px 16px;
    border-radius: 10px;
    background: var(--c-surface);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}

.import-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}

.import-tip {
    margin: 0 0 12px;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--c-muted);
}

.import-box input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    font-size: 0.8125rem;
    background: var(--c-bg);
}

.import-result {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--c-bg);
    font-size: 0.8125rem;
    color: #334155;
}

.import-result ul {
    margin: 8px 0 0 18px;
    color: #b91c1c;
}

.import-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.import-actions .btn-primary,
.import-actions .btn-ghost {
    width: auto;
}


/* ---------- 测试中心卡片扩展 ---------- */
.lab-card-owner {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--c-faint);
}

.card-del {
    margin-top: 8px;
}

.lab-card.card-add {
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: default;
}

.lab-card.card-add h2 {
    margin: 0 0 4px;
}

.lab-card.card-add input {
    padding: 6px 10px;
    border: 1px solid var(--c-border-strong);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
}

.lab-card.card-add input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.lab-card.card-add .btn-primary {
    width: auto;
}


.card-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.card-tools form {
    margin: 0;
}

.link-edit {
    font-size: 0.8125rem;
    color: #2563eb;
}

.link-edit:hover {
    text-decoration: underline;
}

.card-add-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}


/* ---------- 文章页布局：三栏、容器加宽 ---------- */
.container.container-post {
    max-width: 1400px;
}

.container-post .blog-layout {
    gap: 20px;
}

.container-post .post-nav {
    flex: 0 0 300px;
}

.container-post .sidebar {
    width: 230px;
}

/* ---------- 文章页左侧导航 ---------- */
.post-nav {
    flex: 0 0 300px;
    min-width: 0;
}

.post-nav-inner {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding-right: 6px;
    font-size: 0.8125rem;
}

.post-nav-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--c-border);
    color: var(--c-faint);
}

.post-nav-head a {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--c-heading);
}

.post-nav-group {
    margin-bottom: 14px;
}

.post-nav-title {
    margin-bottom: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--c-muted);
    letter-spacing: 0.02em;
}

.post-nav-title a {
    color: var(--c-muted);
}

.post-nav-title a:hover {
    color: #2563eb;
}

.post-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid #eef2f7;
}

.post-nav li a {
    display: block;
    padding: 3px 0 3px 10px;
    color: var(--c-text-2);
    line-height: 1.5;
    border-left: 2px solid transparent;
    margin-left: -1px;
    word-break: break-word;
}

.post-nav li a:hover {
    color: #2563eb;
    background: var(--c-bg);
}

.post-nav li a.is-active {
    color: #2563eb;
    font-weight: 600;
    border-left-color: #2563eb;
    background: #eff6ff;
}

@media (max-width: 1200px) {
    .post-nav {
        display: none;
    }

    .container.container-post {
        max-width: 1080px;
    }
}


/* 系列页也走三栏，容器同样加宽 */
.container-series {
    max-width: 1400px;
}

.post-nav-series {
    list-style: none;
    margin: 0;
    padding: 0;
}

.post-nav-series li a {
    display: block;
    padding: 5px 0 5px 10px;
    color: var(--c-text-2);
    line-height: 1.5;
    border-left: 2px solid transparent;
    margin-left: -1px;
    word-break: break-word;
}

.post-nav-series li a:hover {
    color: #2563eb;
    background: var(--c-bg);
}

.post-nav-series li a.is-active {
    color: #2563eb;
    font-weight: 600;
    border-left-color: #2563eb;
    background: #eff6ff;
}

.nav-order {
    color: var(--c-faint);
    margin-right: 4px;
}

@media (max-width: 1200px) {
    .container-series {
        max-width: 1080px;
    }
}


/* ---------- 手机端排版修正 ---------- */
@media (max-width: 900px) {
    /* 页头：标题独占一行，导航换行排列，搜索框铺满 */
    .site-header { padding: 12px 0; }
    .site-header .container {
        flex-wrap: wrap;
        align-items: flex-start;
        row-gap: 10px;
    }

    .site-title {
        width: 100%;
        font-size: 1.25rem;
    }

    nav {
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 16px;
        width: 100%;
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
    }

    nav a {
        margin-left: 0;
        font-size: 0.875rem;
        line-height: 1.8;
    }

    .nav-search {
        flex: 1 1 100%;
        margin: 4px 0 0;
    }

    .nav-search input {
        flex: 1;
        width: auto;
        min-width: 0;
    }

    /* 内容区 */
    .container { padding: 0 14px; }
    .blog-layout { padding: 16px 0; gap: 16px; }
    .post-list { padding: 0; }

    /* 文章卡片 */
    .post-item {
        padding: 16px;
        margin-bottom: 12px;
    }

    .post-item h2 {
        font-size: 1.0625rem;
        line-height: 1.5;
        overflow-wrap: anywhere;
    }

    .post-meta {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 10px;
        margin-bottom: 8px;
    }

    .post-excerpt { font-size: 0.9375rem; }

    .home-hero { padding: 18px; }

    /* 分页 */
    .pager {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }

    .pager-btn { min-width: 0; }

    /* 侧栏堆叠后不再吸顶 */
    .sidebar { width: 100%; }
}

@media (max-width: 480px) {
    .post-meta { font-size: 0.75rem; }
    .post-item h2 { font-size: 1rem; }
    .tag { font-size: 0.6875rem; padding: 2px 6px; }
    .series-badge { font-size: 0.6875rem; margin-right: 0; }
    .widget { padding: 14px; }
    .home-hero h1 { font-size: 1.125rem; }
    .pager-info { order: -1; flex: 1 1 100%; text-align: center; }
}


/* ---------- 全站移动端适配 ---------- */
@media (max-width: 768px) {
    /* 正文页 */
    .post-content {
        padding: 18px 16px;
        border-radius: 0;
    }

    .post-content h1 { font-size: 1.375rem; line-height: 1.45; }
    .post-content h2 { font-size: 1.1875rem; margin: 24px 0 10px; }
    .post-content h3 { font-size: 1.0625rem; }
    .post-content p,
    .post-content li { font-size: 0.9375rem; }
    .post-content blockquote { margin: 14px 0; padding: 10px 14px; }

    /* 正文里的宽表格：单独横向滚动，不撑破页面 */
    .post-content table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .post-content table th,
    .post-content table td {
        white-space: nowrap;
        font-size: 0.8125rem;
        padding: 6px 8px;
    }

    pre {
        padding: 12px;
        font-size: 0.78rem;
        border-radius: 6px;
    }

    /* 页头操作区：按钮换行 */
    .admin-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .admin-head-right {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .lab-title { font-size: 1.25rem; }
    .design-actions { flex-wrap: wrap; }

    /* 测试中心页头 / 母版工具条 */
    .spec-bar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 12px;
    }

    .spec-bar .spacer { display: none; }

    /* 系列上下篇 */
    .series-nav {
        flex-direction: row;
        gap: 6px;
        margin-top: 20px;
    }

    /* 空状态 */
    .empty-tip { padding: 32px 0; }

    /* 弹窗 */
    .drawer {
        width: calc(100vw - 24px);
        max-height: 88vh;
        padding: 16px;
    }

    /* 表格通用：可横向滚动 */
    .data-table { font-size: 0.8125rem; }
    .data-table th,
    .data-table td { padding: 6px 8px; }

    /* 表单按钮 */
    .btn-primary,
    .btn-ghost { font-size: 0.875rem; }
}

@media (max-width: 480px) {
    .post-content { padding: 14px 12px; }
    .post-content h1 { font-size: 1.25rem; }
    .lab-title { font-size: 1.125rem; }
    .auth-card { padding: 20px; }
    .spec-bar input[type="search"] { width: 100%; }
    .zoom span { min-width: 32px; }
}


/* ---------- 手机端页头：标题居中 + 导航两行 ---------- */
@media (max-width: 900px) {
    .site-header .container {
        flex-direction: column;
        align-items: stretch;
        row-gap: 8px;
    }

    .site-title {
        width: 100%;
        text-align: center;
    }

    nav {
        display: flex;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: center;
        gap: 0 10px;
        padding: 0 12px;
        width: 100%;
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
    }

    /* 每项取自身宽度，剩余空间均分到间隔上，视觉间距一致 */
    nav > a,
    nav > .nav-more {
        flex: 0 0 auto;
    }

    nav a {
        margin-left: 0;
        text-align: center;
        font-size: 0.8125rem;
        line-height: 1.9;
        white-space: nowrap;
    }

    /* 手机端不显示搜索框和按钮 */
    .nav-search {
        display: none;
    }
}

@media (max-width: 380px) {
    nav {
        gap: 2px 12px;
    }

    nav a {
        font-size: 0.8125rem;
    }
}

/* ---------- 手机端文章页：隐藏目录与最新文章 ---------- */
@media (max-width: 768px) {
    /* 左侧系列导航（本来 <1200 就隐藏，这里再兜一层） */
    .post-nav { display: none; }

    /* 右侧栏整体不再展示：目录、最新文章在手机上价值低且占空间 */
    .container-post .sidebar { display: none; }

    /* 其它页面（首页/归档/标签）仍保留侧栏，只去掉最新文章 */
    .latest-posts-widget { display: none; }
}


/* ---------- 手机端：系列导航折叠面板 ---------- */
.series-mobile {
    display: none;
    margin-bottom: 14px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.875rem;
}

.series-mobile summary {
    cursor: pointer;
    color: #334155;
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.series-mobile summary::-webkit-details-marker { display: none; }

.series-mobile summary::after {
    content: "▾";
    color: var(--c-faint);
    transition: transform 0.15s;
}

.series-mobile[open] summary::after { transform: rotate(180deg); }

.series-mobile-count {
    margin-left: auto;
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--c-faint);
}

.series-mobile ul {
    list-style: none;
    margin: 8px 0 0;
    padding: 8px 0 0;
    border-top: 1px solid #f1f5f9;
}

.series-mobile li a {
    display: block;
    padding: 4px 0;
    color: var(--c-text-2);
    line-height: 1.55;
    word-break: break-word;
}

.series-mobile li a.is-active {
    color: #2563eb;
    font-weight: 600;
}

@media (max-width: 1200px) {
    .series-mobile { display: block; }
}

/* ---------- 手机端：上一篇 / 下一篇按钮收小 ---------- */
@media (max-width: 768px) {
    .series-nav {
        gap: 8px;
        margin-top: 18px;
        padding-top: 14px;
    }

    .series-nav-item {
        padding: 8px 10px;
        border-radius: 6px;
    }

    .series-nav-label {
        margin-bottom: 2px;
        font-size: 0.6875rem;
    }

    .series-nav-title {
        font-size: 0.8125rem;
        line-height: 1.45;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

@media (max-width: 480px) {
    .series-nav-item { padding: 6px 9px; }
    .series-nav-title { font-size: 0.75rem; }
}


/* ---------- 手机端：全部系列卡片加宽（几乎贴边） ---------- */
@media (max-width: 768px) {
    .container.container-plain {
        padding: 0 6px;
    }

    .container-plain .blog-layout {
        padding: 12px 0;
    }

    .container-plain .post-item {
        margin-bottom: 10px;
        border-radius: 6px;
    }
}

/* ---------- 手机端：内容区强制整宽，避免卡片只占一半 ---------- */
@media (max-width: 900px) {
    .blog-layout {
        display: block;
        padding: 16px 0;
    }

    .blog-layout > main,
    .blog-layout > aside,
    .post-detail,
    .post-list,
    .post-item,
    .series-item {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .blog-layout > aside {
        margin-top: 16px;
    }
}


/* ---------- 上一篇 / 下一篇：去掉标题后保持一行 ---------- */
.series-nav {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.series-nav-item {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    padding: 10px 12px;
}

.series-nav-next { text-align: center; }

.series-nav-label {
    margin-bottom: 0;
    font-size: 0.8125rem;
    color: var(--c-text-2);
}

@media (max-width: 768px) {
    .series-nav {
        flex-direction: row;
        gap: 8px;
        margin-top: 18px;
        padding-top: 14px;
    }

    .series-nav-item { padding: 8px 10px; }
    .series-nav-label { font-size: 0.75rem; }
}

/* ---------- 上一篇 / 下一篇：强制同一行 ---------- */
.series-nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 10px;
}

.series-nav .series-nav-item {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    padding: 9px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.series-nav .series-nav-item.is-empty {
    display: block;
    visibility: hidden;
}

.series-nav .series-nav-label {
    margin-bottom: 0;
    font-size: 0.8125rem;
    color: var(--c-text-2);
}

@media (max-width: 768px) {
    .series-nav { gap: 8px; margin-top: 18px; padding-top: 14px; }
    .series-nav .series-nav-label { font-size: 0.75rem; }
}
