/* ========== 全局重置 & 基础 ========== */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
body {
    font-family: 'Microsoft Yahei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #f6f6f6;
    color: #555;
    line-height: 1.42857143;
    margin: 0;
}
img {
    max-width: 100%;
    vertical-align: middle;
}
a {
    color: #666;
    text-decoration: none;
    transition: color 0.25s, background-color 0.25s;
}
a:hover,
a:focus {
    color: #45B6F7;
    text-decoration: none;
    outline: 0;
}
.container {
    position: relative;
    margin: 0 auto;
    max-width: 1200px;
    padding: 0 15px;
}
@media (max-width: 1240px) {
    .container { margin: 0 15px; }
}
@media (max-width: 640px) {
    .container { margin: 0; }
}

/* ========== 头部 & 导航 ========== */
.header {
    position: relative;
    background-color: #fff;
    padding: 55px 0 20px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.logo {
    float: left;
    margin: 0;
    overflow: hidden;
}
.logo a {
    height: 32px;
    display: block;
    font-size: 0;
    color: #555;
}
.logo img {
    vertical-align: top;
    max-height: 32px;
    display: block;
    margin-bottom: 32px;
}
.brand {
    font-size: 14px;
    float: left;
    line-height: 15px;
    color: #bbb;
    padding-left: 10px;
    border-left: 2px solid #eaeaea;
    margin-left: 10px;
    height: 30px;
    overflow: hidden;
}
.site-navbar {
    float: right;
    font-size: 18px;
    margin-top: 4px;
    margin-right: -15px;
    list-style: none;
    padding-left: 0;
}
.site-navbar li {
    position: relative;
    float: left;
}
.site-navbar a {
    display: block;
    padding: 0 15px;
    color: #666;
}
.site-navbar li:hover > a,
.site-navbar a:hover {
    color: #45B6F7;
}
.site-navbar .fa {
    width: 18px;
}

/* ========== 面包屑 ========== */
.breadcrumbs {
    padding: 15px 0;
    font-size: 12px;
    background-color: #fff;
    margin-bottom: 15px;
    margin-top: -15px;
    border-bottom: 1px solid #EBEBEB;
    color: #999;
}

/* ========== 主布局（两栏） ========== */
.content-wrap {
    width: 100%;
    float: left;
}
.content {
    position: relative;
    min-height: 500px;
    margin-right: 380px;
    margin-bottom: 15px;
    background-color: #fff;
    border: 1px solid #eaeaea;
    border-radius: 4px;
    padding: 0 20px;
}
.sidebar {
    float: left;
    margin-left: -360px;
    width: 360px;
    position: relative;
}

/* ========== 文章内容页样式 ========== */
.article-header {
    margin-bottom: 20px;
    padding: 25px 0;
    border-bottom: 1px solid #eee;
    text-align: center;
}
.article-title {
    margin-top: 0;
    font-size: 26px;
    line-height: 36px;
    color: #555;
}
.article-meta {
    font-size: 12px;
    color: #999;
}
.article-meta .item {
    margin-right: 20px;
}
.article-content {
    font-size: 15px;
    line-height: 25px;
    word-wrap: break-word;
}
.article-content p {
    margin-bottom: 20px;
}
.article-content h2,
.article-content h3 {
    font-weight: 700;
    margin: 20px 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.article-content h2 { font-size: 18px; }
.article-content h3 { font-size: 16px; border-bottom: none; }
.article-content img {
    max-width: 100%;
    height: auto;
    margin: 10px auto;
    display: block;
}
.article-content ul,
.article-content ol {
    margin: 0 0 20px 30px;
}
.article-content a {
    color: #45B6F7;
    text-decoration: underline;
}
.article-content a:hover { color: #FF5E52; }

/* 版权/标签 */
.post-copyright {
    background-color: #eee;
    font-size: 12px;
    padding: 8px 30px;
    border-radius: 2px;
    color: #aaa;
    text-align: center;
    margin-bottom: 18px;
    clear: both;
}
.post-copyright:hover {
    background-color: #45B6F7;
    color: #fff;
}
.article-tags {
    margin: 30px 0;
    text-align: center;
}
.article-tags a {
    display: inline-block;
    padding: 4px 7px 3px;
    margin: 0 4px 4px 0;
    color: #fff;
    font-size: 12px;
    background-color: #45B6F7;
    opacity: 0.85;
}
.article-tags a:hover { opacity: 1; }

/* 相关推荐（桌面版保留样式，但移动端将覆盖） */
.relates {
    margin-top: 30px;
    margin-bottom: 20px;
}
.relates .title h3 {
    font-size: 18px;
    border-left: 4px solid #45B6F7;
    padding-left: 12px;
    margin-bottom: 15px;
    font-weight: 600;
    color: #333;
}
.relates ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.relates li {
    position: relative;
    padding: 10px 0 10px 20px;
    border-bottom: 1px dashed #eaeaea;
    transition: all 0.2s;
}
.relates li:before {
    content: "●";
    position: absolute;
    left: 0;
    top: 10px;
    color: #45B6F7;
    font-size: 12px;
    transition: transform 0.2s;
}
.relates li:hover {
    transform: translateX(3px);
    border-bottom-color: #d0d0d0;
}
.relates li:hover:before {
    color: #FF5E52;
}
.relates li a {
    display: block;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}
.relates li a:hover {
    color: #45B6F7;
}

/* ========== 列表页样式（分类标题、文章列表） ========== */
.catleader {
    background-color: #fff;
    border-bottom: 1px solid #eaeaea;
    padding: 15px 0;
    margin-bottom: 10px;
}
.catleader h1 {
    font-size: 22px;
    margin: 0;
    padding: 0;
    line-height: 1;
    border-left: 5px solid #45B6F7;
    padding-left: 10px;
}

/* 文章列表项（excerpt） */
.excerpt {
    border-bottom: 1px solid #eaeaea;
    padding: 20px 20px 20px 255px;
    overflow: hidden;
    background-color: #fff;
    margin-bottom: -1px;
    position: relative;
}
.excerpt .focus {
    float: left;
    margin-left: -235px;
    width: 220px;
}
.excerpt .thumb {
    width: 220px;
    height: 150px;
    background-color: #f4f4f4;
    display: block;
    object-fit: cover;
    border-radius: 4px;
}
.excerpt h2 {
    font-size: 18px;
    line-height: 1.4;
    margin-top: 0;
    margin-bottom: 8px;
    font-weight: 700;
}
.excerpt h2 a { color: #555; }
.excerpt h2 a:hover { color: #45B6F7; }
.excerpt .meta {
    color: #999;
    font-size: 12px;
    margin-bottom: 10px;
}
.excerpt .meta .fa { margin-right: 4px; }
.excerpt .note {
    font-size: 13px;
    color: #777;
    line-height: 1.5;
    margin-bottom: 0;
}

/* 分页 */
.pagination {
    margin: 20px 0;
    text-align: center;
    display: block;
}
.pagination ul {
    display: inline-block;
    padding-left: 0;
    margin: 0;
}
.pagination ul > li {
    display: inline;
}
.pagination ul > li > a,
.pagination ul > li > span {
    margin: 0 2px;
    float: left;
    padding: 5px 12px;
    background-color: #ddd;
    color: #666;
    border-radius: 2px;
}
.pagination ul > .active > span {
    background-color: #45B6F7;
    color: #fff;
}
.pagination ul > li > a:hover {
    background-color: #ccc;
}

/* ========== 侧边栏公共组件 ========== */
.widget {
    clear: both;
    margin-bottom: 15px;
    background-color: #fff;
    border-radius: 4px;
    border: 1px solid #eaeaea;
    overflow: hidden;
}
.widget h3 {
    font-size: 18px;
    color: #666;
    border-bottom: 1px solid #eaeaea;
    background-color: #fbfbfb;
    margin: 0;
    padding: 11px 15px 10px;
}
.textwidget {
    padding: 15px;
    color: #777;
}
/* 自定义文本组件中的列表（热门文章） */
.widget_text .textwidget ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.widget_text .textwidget li {
    position: relative;
    padding: 8px 0 8px 18px;
    border-bottom: 1px dotted #f0f0f0;
    font-size: 13px;
}
.widget_text .textwidget li:before {
    content: "›";
    position: absolute;
    left: 2px;
    top: 8px;
    color: #bbb;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s;
}
.widget_text .textwidget li:hover {
    background-color: #fafafa;
}
.widget_text .textwidget li:hover:before {
    color: #45B6F7;
    left: 5px;
}
.widget_text .textwidget li a {
    display: inline-block;
    color: #666;
    transition: color 0.2s;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.widget_text .textwidget li a:hover {
    color: #45B6F7;
    text-decoration: underline;
}

/* 代金券/推广卡片 */
.widget_ui_textasb a {
    display: block;
    padding: 0 15px 15px;
    border: 1px solid #eaeaea;
    background-color: #fff;
    border-radius: 4px;
    font-size: 12px;
}
.widget_ui_textasb a h2 {
    font-size: 20px;
    font-weight: 400;
    margin-top: 14px;
}
.widget_ui_textasb a strong {
    display: inline-block;
    padding: 4px 15px;
    color: #fff;
    font-size: 14px;
    font-weight: 400;
    background-color: #FF5E52;
}

/* 图片广告组件 */
.widget_ui_asb img {
    display: block;
    width: 100%;
}

/* 标签云 */
.widget_tags .items {
    overflow: hidden;
    padding: 15px 0 12px 15px;
}
.widget_tags .items a {
    color: #999;
    background-color: #f6f6f6;
    float: left;
    width: 31.3333%;
    margin: 0 1% 1% 0;
    padding: 0 8px;
    font-size: 12px;
    height: 29px;
    line-height: 29px;
    overflow: hidden;
}
.widget_tags .items a:hover {
    color: #fff;
    background-color: #45B6F7;
}

/* ========== 广告条（文章内） ========== */
.asb-post {
    background: #fffcef;
    border: 1px solid #ffbb76;
    border-radius: 2px;
    color: #db7c22;
    font-size: 14px;
    margin: 10px 0 20px;
    padding: 5px 10px;
    text-align: center;
}

/* ========== 目录（如有需要） ========== */
.lwptoc {
    margin: 32px 0;
}
.lwptoc_i {
    padding: 14px 18px 18px;
    background: #fafafa;
    color: #333;
    display: inline-block;
    width: auto;
    border-radius: 4px;
}
.lwptoc_header {
    margin-bottom: 6px;
}
.lwptoc_toggle {
    white-space: nowrap;
    margin-left: 4px;
    font-size: 80%;
}
.lwptoc_itemWrap {
    margin: 0;
    padding: 0;
    list-style: none;
}
.lwptoc_item {
    margin-top: 4px;
}
.lwptoc_item a {
    color: #3175e4;
}

/* ========== 底部 ========== */
.footer {
    clear: both;
    padding: 40px 30px;
    font-size: 12px;
    text-align: center;
    color: #999;
    background-color: #fff;
    border-top: 1px solid #eaeaea;
    margin-top: 15px;
}
.footer a { color: #999; }
.footer a:hover { color: #666; }

/* ========== 辅助类 ========== */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

.code-block {
    display: block;
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 16px 20px;
    margin: 1em 0;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    tab-size: 4;
    -moz-tab-size: 4;
}
.code-block code {
    background: transparent;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    white-space: inherit;
}
@media (prefers-color-scheme: dark) {
    .code-block {
        background-color: #2d2d2d;
        border-color: #444;
        color: #f0f0f0;
    }
}

/* ========== 移动端重写（严格适配所有手机屏幕） ========== */

/* 平板竖屏及以下（宽度 ≤ 1024px）：侧边栏不隐藏，改为下方显示，彻底消除错位 */
@media (max-width: 1024px) {
    /* 重置内容区，消除浮动和相对定位 */
    .content-wrap,
    .content {
        position: static !important;
        overflow: visible !important;
        transform: none !important;
        float: none !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 12px !important;
    }
    .content {
        margin-bottom: 15px !important;
        background-color: #fff;
        border: 1px solid #eaeaea;
        border-radius: 4px;
    }
    /* 重置侧边栏，消除浮动和负边距 */
    .sidebar {
        position: static !important;
        float: none !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 20px;
        padding: 0 12px;
    }
    /* 确保相关推荐区域完全重置，点击正常 */
    .relates,
    .relates * {
        position: static !important;
        transform: none !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
    }
    .relates li:before,
    .relates li:after {
        display: none !important;
    }
    .relates li a {
        display: block !important;
        padding: 12px 0 !important;
    }
}

/* 手机横屏、竖屏（≤ 768px）：优化触控和布局细节 */
@media (max-width: 768px) {
    body {
        padding-top: 0;
    }
    .header {
        position: relative;
        padding: 15px 0 !important;
        height: auto;
        text-align: center;
    }
    .logo {
        float: none;
        text-align: center;
        max-width: 100%;
        margin-bottom: 10px;
    }
    .logo a {
        margin: 0 auto;
        height: auto;
        font-size: 20px;
        line-height: 1.2;
        display: inline-block;
    }
    .logo img {
        display: inline-block;
        margin-bottom: 8px;
        max-height: 40px;
    }
    .brand {
        display: block;
        float: none;
        border-left: 0;
        margin: 0 0 10px;
        padding-left: 0;
        text-align: center;
        height: auto;
        font-size: 12px;
    }
    .site-navbar {
        float: none;
        margin: 10px 0 0;
        text-align: center;
        font-size: 16px;
    }
    .site-navbar li {
        float: none;
        display: inline-block;
        margin: 0 2px;
    }
    .site-navbar a {
        padding: 8px 12px;
        font-size: 14px;
        display: inline-block;
    }
    .breadcrumbs {
        margin-top: 0;
        padding: 10px 15px;
        margin-bottom: 10px;
    }
    /* 内容区在手机端无需额外 padding，已在平板级统一处理 */
    .article-title {
        font-size: 22px;
        line-height: 1.3;
    }
    .catleader h1 {
        font-size: 18px;
    }

    /* 文章列表修复 */
    .excerpt {
        padding: 12px 135px 12px 12px;
        margin-bottom: 8px;
        border-bottom: 1px solid #eaeaea;
        position: relative;
    }
    .excerpt .focus {
        float: right;
        margin-right: -125px;
        width: 110px;
        margin-left: 0;
        pointer-events: none;
    }
    .excerpt .focus a {
        pointer-events: auto;
    }
    .excerpt .thumb {
        width: 110px;
        height: 75px;
        display: block;
    }
    .excerpt h2 {
        font-size: 16px;
        margin-bottom: 5px;
        position: relative;
        z-index: 1;
    }
    .excerpt h2 a {
        display: inline-block;
    }
    .excerpt .note {
        display: none;
    }
    .excerpt .meta .fa {
        display: inline-block;
        margin-right: 2px;
    }

    /* 侧边栏组件 */
    .sidebar {
        margin-top: 15px;
    }
    .widget {
        margin-bottom: 12px;
    }
    .widget h3 {
        font-size: 16px;
        padding: 10px 12px;
    }
    .textwidget {
        padding: 10px;
    }
    .widget_text .textwidget li a {
        white-space: normal;
        line-height: 1.4;
        display: block;
        padding: 4px 0;
    }
    .widget_tags .items a {
        width: 48%;
        margin-right: 2%;
        font-size: 12px;
        height: 34px;
        line-height: 34px;
        text-align: center;
        display: inline-block;
    }

    /* 分页按钮增大触控区域 */
    .pagination ul > li > a,
    .pagination ul > li > span {
        padding: 8px 14px;
        margin: 0 3px;
        display: inline-block;
    }
    .footer {
        padding: 25px 15px;
        font-size: 11px;
    }
    .code-block {
        font-size: 13px;
        padding: 12px 15px;
        overflow-x: auto;
    }
}

/* 小屏手机（≤480px） */
@media (max-width: 480px) {
    .site-navbar a {
        padding: 6px 8px;
        font-size: 13px;
    }
    .excerpt {
        padding-right: 115px;
    }
    .excerpt .focus {
        margin-right: -105px;
        width: 95px;
    }
    .excerpt .thumb {
        width: 95px;
        height: 65px;
    }
    .excerpt h2 {
        font-size: 15px;
    }
    .article-title {
        font-size: 20px;
    }
    .widget_tags .items a {
        width: 100%;
        margin-right: 0;
    }
}

/* 极端窄屏（≤360px） */
@media (max-width: 360px) {
    .excerpt {
        padding-right: 95px;
    }
    .excerpt .focus {
        margin-right: -85px;
        width: 80px;
    }
    .excerpt .thumb {
        width: 80px;
        height: 55px;
    }
    .excerpt h2 {
        font-size: 14px;
    }
    .site-navbar a {
        padding: 5px 6px;
        font-size: 12px;
    }
}

/* 移动端全局触控优化 */
@media (hover: none) and (pointer: coarse) {
    a, button, [role="button"], .pagination a, .relates a, .widget a {
        touch-action: manipulation;
    }
    .relates li:before,
    .widget_text .textwidget li:before {
        pointer-events: none;
    }
}