:root {
    --navy: #16253f;
    --navy-soft: #1f355a;
    --bg: #f4f2ed;
    --surface: #ffffff;
    --text: #1b2a41;
    --muted: #627086;
    --border: #d3d8e2;
    --chip-bg: #edf0ff;
    --chip-text: #4e5fb2;
    --hero-curve: clamp(40px, 6vw, 72px);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16.5px;
    font-weight: 400;
    background: var(--bg);
    color: var(--text);
    line-height: 1.75;
}

h2, h3, h4 {
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0.01em;
    font-weight: 600;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.hero-shell {
    background: var(--navy);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: var(--hero-curve);
    border-bottom-right-radius: var(--hero-curve);
}

.topbar {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    color: #fff;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: transparent;
    border-radius: 8px;
    padding: 5px 14px;
    font-weight: 800;
    font-size: 24px;
    white-space: nowrap;
    letter-spacing: 0.5px;
    transition: transform 0.2s ease;
}

.logo-part1 {
    background-image: linear-gradient(90deg, #ffffff 0%, #e0e0e0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.logo-dot {
    color: #ffd700;
    font-size: 12px;
    margin: 0 2px;
    animation: sparkle 2s ease-in-out infinite;
}

.logo-part2 {
    background-image: linear-gradient(90deg, #c084fc 0%, #e879f9 50%, #f0abfc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

@keyframes sparkle {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.9);
    }
}

.logo:hover {
    transform: scale(1.02);
}

.logo:hover .logo-part1 {
    filter: brightness(1.1);
}

.logo:hover .logo-part2 {
    filter: brightness(1.1);
}

.desktop-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
}

.search {
    width: min(360px, 100%);
    background: #e6f0ee;
    border: 1px solid #cadcd8;
    border-radius: 3px;
    min-height: 36px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    color: #4c5563;
    font-size: 15px;
}

.page-title-bar {
    background: #0f1a2d;
    color: #fff;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.page-title {
    margin: 0 auto;
    text-align: center;
    padding: 5px 0;
    font-weight: 620;
    display: block;
    width: 100%;
    letter-spacing: 0.01em;
}

.page-title h1 {
    font-size: 32px;
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0.01em;
    font-weight: 600;
}

.article-main .meta a {
    color: inherit;
    text-decoration: none;
}

.breadcrumb {
    margin: 0;
    padding: 10px 0 2px;
    font-size: 14px;
    color: #b9c6da;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.breadcrumb a {
    color: #d5e2f5;
    text-decoration: none;
}

.breadcrumb span {
    opacity: 0.8;
}

.content-wrap {
    padding: 20px 0 36px;
    display: block;
}

.article-main {
    width: min(1020px, 100%);
    margin: 0 auto;
    background: transparent;
    border: 0;
    padding: 8px 4px 16px;
}

@media (min-width: 1200px) {
    .article-main {
        width: min(1120px, 100%);
    }
}

.meta {
    font-size: 15px;
    color: #6a7688;
    margin-bottom: 18px;
    border-bottom: 1px solid #d8d3c8;
    padding-bottom: 12px;
}

.meta strong {
    color: #25334d;
}

.toc-title h1 {
    margin: 0 0 8px;
    color: #2a4488;
    font-size: 26px;
    font-weight: 650;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

.toc {
    margin: 0 0 18px 18px;
    padding: 0;
    color: #4f5d77;
    font-size: 17px;
    line-height: 1.75;
}

.toc li {
    margin-bottom: 5px;
}


.ad-banner {
    margin: 16px 0 14px;
    border: 1px solid #cfd8e8;
    background: linear-gradient(120deg, #2d4a72, #7e9150);
    color: #fff;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ad-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ad-btn {
    border: 0;
    border-radius: 3px;
    padding: 5px 10px;
    font-size: 14px;
    cursor: pointer;
}

.ad-btn.primary {
    background: #4ea2ff;
    color: #fff;
}

.ad-btn.warn {
    background: #ffc24b;
    color: #4a3500;
}


.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chip {
    border: 1px solid #d8ddef;
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--chip-text);
    font-size: 14px;
    padding: 4px 10px;
    white-space: nowrap;
}

.chip a {
    color: inherit;
    text-decoration: none;
}

.related-section {
    background: #1c2636;
    padding: 22px 0 28px;
}

.related-title {
    margin: 0 0 12px;
    color: #f1f5ff;
    font-size: 34px;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-weight: 650;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.related-card {
    background: #f8fafc;
    border: 1px solid #d9dfeb;
    border-radius: 4px;
    padding: 12px;
}

.related-card h4 {
    margin: 0 0 6px;
    font-size: 17px;
    color: #2f3f55;
}

.related-card p {
    margin: 0;
    font-size: 15px;
    color: #657184;
}

footer {
    background: #eeece7;
    border-top: 1px solid #d8d4ca;
    padding: 16px 0 20px;
    color: #798193;
    font-size: 14px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-brand {
    display: grid;
    gap: 3px;
}

.footer-brand-title {
    font-size: 16px;
    font-weight: 700;
    color: #4f5c71;
}

.footer-brand-sub {
    font-size: 13px;
    color: #8c95a4;
}

@media (max-width: 920px) {
    .related-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(520px, calc(100% - 18px));
    }

    .page-title {
        font-size: 22px;
        padding: 10px 0;
    }

    .article-main {
        padding: 4px 0 10px;
    }

    .related-title {
        font-size: 28px;
    }
}

:root {
    --navy: #16253f;
    --navy-soft: #1f355a;
    --bg: #f4f2ed;
    --surface: #ffffff;
    --text: #1b2a41;
    --muted: #627086;
    --border: #d3d8e2;
    --chip-bg: #edf0ff;
    --chip-text: #4e5fb2;
    --hero-curve: clamp(40px, 6vw, 72px);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    font-weight: 400;
    background: var(--bg);
    color: var(--text);
    line-height: 1.75;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.hero-shell {
    background: var(--navy);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: var(--hero-curve);
    border-bottom-right-radius: var(--hero-curve);
}

.topbar {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    color: #fff;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: transparent;
    border-radius: 8px;
    padding: 5px 14px;
    font-weight: 800;
    font-size: 24px;
    white-space: nowrap;
    letter-spacing: 0.5px;
    transition: transform 0.2s ease;
}

.logo-part1 {
    background-image: linear-gradient(90deg, #ffffff 0%, #e0e0e0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.logo-dot {
    color: #ffd700;
    font-size: 12px;
    margin: 0 2px;
    animation: sparkle 2s ease-in-out infinite;
}

.logo-part2 {
    background-image: linear-gradient(90deg, #c084fc 0%, #e879f9 50%, #f0abfc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

@keyframes sparkle {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.9);
    }
}

.logo:hover {
    transform: scale(1.02);
}

.logo:hover .logo-part1 {
    filter: brightness(1.1);
}

.logo:hover .logo-part2 {
    filter: brightness(1.1);
}

.desktop-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
}

.search {
    width: min(360px, 100%);
    background: #e6f0ee;
    border: 1px solid #cadcd8;
    border-radius: 3px;
    min-height: 36px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    color: #4c5563;
    font-size: 15px;
}

.page-title-bar {
    background: #0f1a2d;
    color: #fff;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.page-title {
    margin: 0;
    text-align: center;
    padding: 12px 0;
    font-size: 26px;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-weight: 620;
    letter-spacing: 0.1px;
}

.article-main .meta a {
    text-decoration: none;
}

.breadcrumb {
    margin: 0;
    padding: 10px 0 2px;
    font-size: 14px;
    color: #b9c6da;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.breadcrumb a {
    color: #d5e2f5;
    text-decoration: none;
}

.breadcrumb span {
    opacity: 0.8;
}

.article-main {
    width: min(860px, 100%);
    margin: 0 auto;
    background: transparent;
    border: 0;
    padding: 8px 4px 16px;
}

.meta {
    font-size: 15px;
    color: #6a7688;
    margin-bottom: 18px;
    border-bottom: 1px solid #d8d3c8;
    padding-bottom: 12px;
}

.meta strong {
    color: #25334d;
}

.toc-title {
    margin: 0 0 8px;
    color: #2a4488;
    font-size: 24px;
    font-weight: 650;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

.toc {
    margin: 0 0 18px 18px;
    padding: 0;
    color: #4f5d77;
    font-size: 17px;
    line-height: 1.75;
}

.toc li {
    margin-bottom: 5px;
}


.ad-banner {
    margin: 16px 0 14px;
    border: 1px solid #cfd8e8;
    background: linear-gradient(120deg, #2d4a72, #7e9150);
    color: #fff;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ad-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ad-btn {
    border: 0;
    border-radius: 3px;
    padding: 5px 10px;
    font-size: 14px;
    cursor: pointer;
}

.ad-btn.primary {
    background: #4ea2ff;
    color: #fff;
}

.ad-btn.warn {
    background: #ffc24b;
    color: #4a3500;
}


.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chip {
    border: 1px solid #d8ddef;
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--chip-text);
    font-size: 14px;
    padding: 4px 10px;
    white-space: nowrap;
}

.chip a {
    color: inherit;
    text-decoration: none;
}

.related-section {
    background: #1c2636;
    padding: 22px 0 28px;
}

.related-title {
    margin: 0 0 12px;
    color: #f1f5ff;
    font-size: 34px;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-weight: 650;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.related-card {
    background: #f8fafc;
    border: 1px solid #d9dfeb;
    border-radius: 4px;
    padding: 12px;
}

.related-card h4 {
    margin: 0 0 6px;
    font-size: 17px;
    color: #2f3f55;
}

.related-card p {
    margin: 0;
    font-size: 15px;
    color: #657184;
}

footer {
    background: #eeece7;
    border-top: 1px solid #d8d4ca;
    padding: 16px 0 20px;
    color: #798193;
    font-size: 14px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-brand {
    display: grid;
    gap: 3px;
}

.footer-brand-title {
    font-size: 16px;
    font-weight: 700;
    color: #4f5c71;
}

.footer-brand-sub {
    font-size: 13px;
    color: #8c95a4;
}

@media (max-width: 920px) {
    .related-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(520px, calc(100% - 18px));
    }

    .page-title {
        font-size: 22px;
        padding: 10px 0;
    }

    .article-main {
        padding: 4px 0 10px;
    }

    .related-title {
        font-size: 28px;
    }


    /* 防止移动端横向滚动 */
    body {
        overflow-x: hidden;
    }

    /* 确保所有内容不超出容器 */
    .article-main,
    .article-content {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* 图片自适应 */
    .article-content img {
        max-width: 95%;
        height: auto;
    }

    /* 表格自适应 */
    .article-content table {
        display: block;
        overflow-x: auto;
        max-width: 100%;
    }

    /* 广告横幅在小屏幕下改为垂直布局 */
    .ad-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .ad-actions {
        width: 100%;
        justify-content: flex-start;
    }

    /* 强制长文本断行 */
    .article-content {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}


/* Mobile drawer logo styles */
.drawer-head .logo .logo-part1 {
    background-image: linear-gradient(90deg, #1b2f57 0%, #3d5a80 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.drawer-head .logo .logo-part2 {
    background-image: linear-gradient(90deg, #9333ea 0%, #c084fc 50%, #e879f9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.drawer-head .logo .logo-dot {
    color: #ff6b6b;
}


/* 文末商品条：与页面变量、meta/搜索圆角、广告按钮风格一致 */
.book-shop {
    margin: 16px 0 14px;
}

.book-shop-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 8px 12px 8px 10px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--surface);
    box-shadow: 0 1px 0 rgba(22, 37, 63, 0.05);
    text-decoration: none;
    color: var(--text);
    line-height: normal;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.book-shop-bar:hover {
    background: #faf8f4;
    border-color: #c9c4bc;
    box-shadow: 0 1px 0 rgba(22, 37, 63, 0.07);
}

.book-shop-bar:focus-visible {
    outline: 2px solid #2a4488;
    outline-offset: 2px;
}

.book-shop-thumb-wrap {
    flex: 0 0 auto;
    width: 48px;
    height: 64px;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    align-self: flex-start;
}

.book-shop-thumb {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    object-fit: cover;
    object-position: center;
    display: block;
    vertical-align: middle;
}

.book-shop-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.35;
    text-align: left;
}

.book-shop-name {
    font-size: 15px;
    font-weight: 650;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-shop-author {
    font-size: 12px;
    font-weight: 500;
    color: #6a7688;
    line-height: 1.35;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-shop-sub {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-shop-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    padding-left: 12px;
    margin-left: 4px;
    border-left: 1px solid #d8d3c8;
}

.book-shop-go {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 650;
    color: #4a3500;
    white-space: nowrap;
    border-radius: 3px;
    background: #ffc24b;
    border: 0;
    box-shadow: none;
    transition: filter 0.15s ease;
}

.book-shop-bar:hover .book-shop-go {
    filter: brightness(1.06);
}

/* 商品条嵌在 WordPress .wp-block-code > code 内时：pre/等宽/overflow 会破坏 flex 与图片高度，需强制还原 */
.wp-block-code:has(aside.book-shop),
.wp-block-code:has(aside.book-shop) code {
    overflow: visible !important;
    max-height: none !important;
}

.wp-block-code code .book-shop,
.wp-block-code code .book-shop-bar,
.wp-block-code code .book-shop-thumb-wrap,
.wp-block-code code .book-shop-text,
.wp-block-code code .book-shop-right,
.wp-block-code code .book-shop-name,
.wp-block-code code .book-shop-author,
.wp-block-code code .book-shop-sub,
.wp-block-code code .book-shop-go {
    white-space: normal !important;
}

.wp-block-code code .book-shop {
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Arial, sans-serif !important;
}

.wp-block-code code .book-shop-bar {
    line-height: normal !important;
}

.wp-block-code code .book-shop-thumb-wrap {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 0 !important;
    align-self: flex-start !important;
}

.wp-block-code code .book-shop-thumb {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
}

/* 商品条主样式在文件后部，窄屏规则须写在其后方能生效 */
@media (max-width: 640px) {
    .book-shop-bar {
        gap: 10px;
        padding: 8px 10px 8px 6px;
        min-height: 60px;
    }

    .book-shop-thumb-wrap {
        width: 42px;
        height: 56px;
    }

    .book-shop-right {
        padding-left: 10px;
        margin-left: 2px;
    }

    .book-shop-name {
        font-size: 14px;
    }

    .book-shop-author {
        font-size: 11px;
    }

    .book-shop-sub {
        font-size: 12px;
    }

    .book-shop-go {
        padding: 7px 14px;
        font-size: 13px;
        border-radius: 3px;
    }
}

