/* News detail page - unified with homepage/product style */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* 与 news.css 全局规范保持一致：max-width 1200px, 左右 padding 2rem, 居中 */
:root {
    --news-detail-site-width: 1200px;
}

.news-detail-container {
    max-width: var(--news-detail-site-width) !important;
    margin: 0 auto !important;
    padding: 0 2rem !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* 新闻页面面包屑样式 - 与内容区域左对齐 */
.news-detail-container .title_t {
    background: transparent !important;
    padding: 10px 0 !important;
    border-radius: 0 !important;
    margin-bottom: 0 !important;
    font-size: 14px !important;
    color: #6c757d !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0 !important;
    width: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
}

.news-detail-container .title_t a {
    color: #007bff !important;
    text-decoration: none !important;
    transition: color 0.2s !important;
}

.news-detail-container .title_t a:hover {
    color: #0056b3 !important;
}

/* 强制覆盖全局样式 */
body .news-detail-container .title_t {
    background: transparent !important;
    padding: 10px 0 !important;
    margin: 0 !important;
    width: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

@media (max-width: 768px) {
    .news-detail-container,
    body .news-detail-container {
        padding: 0 1rem !important;
    }
    .news-detail-container .title_t,
    body .news-detail-container .title_t {
        padding: 10px 0 !important;
    }
}

.news-title-header { padding: 0; background: #fff; color: #1f2a44; }

.news-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.news-title { font-size: 28px; font-weight: 800; line-height: 1.25; margin: 6px 0 8px; }

.news-meta-line { display:block; color:#6c7a96; font-size:12px; margin-top:4px; }

/* Opinion 详情头部：头像 + 用户名 + Opinion 徽标 */
.news-opinion-head { padding: 2px 0 4px; }
.news-opinion-head .news-tags { margin-top: 10px; }
.news-opinion-head__meta { display:flex; align-items:center; gap:0.5rem; }
.news-opinion-head__avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
}
.news-opinion-head__avatar.is-broken { display: none; }
.news-opinion-head__avatar--initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #4a5b7e;
    background: #e8edf5;
    box-sizing: border-box;
}
.news-opinion-head__name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1f2a44;
}
.news-opinion-head__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: #1956ff;
    background: rgba(25, 86, 255, 0.1);
    border-radius: 50%;
    flex-shrink: 0;
}
.news-opinion-head__badge-icon { width: 13px; height: 13px; display:block; }

.news-tags { margin-top: 6px; display:flex; flex-wrap:wrap; gap:0.4rem; }
/* opinion 正文下方的产品标签 */
.news-tags--after-content { margin: 20px 0 0; padding-top: 14px; border-top: 1px solid #f1f3f4; }
/* 产品标签：与新闻列表 .feed-item__tag 视觉一致（浅灰底/蓝字/圆角，hover 反色） */
.news-tag {
    display: inline-block;
    margin: 0;
    padding: 0.25rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: #1956ff;
    background: #f5f6f8;
    border: none;
    border-radius: 4px;
    line-height: 1.4;
    text-decoration: none;
    cursor: default;
}
.news-tag:hover { background: #1956ff; color: #fff; }
a.news-tag { cursor: pointer; transition: color 0.15s ease, background 0.15s ease; }

.news-main-grid {
    display: grid !important;
    /* 内容栏 820px：17px 字号下约 88 字符/行，处于最佳阅读区间（66~90 字符）上段；
       820 + 36 gap + 300 sidebar = 1156px，1200px 容器内正好放下并居中 */
    grid-template-columns: minmax(0, 820px) 300px !important;
    gap: 36px !important;
    padding: 30px 0 !important;
    max-width: 100% !important;
    justify-content: center;
}

.news-main-grid > * {
    min-width: 0;
}

.news-content-card {
    background: #fff !important;
    border: 1px solid #e9ecef !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
    padding: 28px 32px !important;
    width: 100% !important;
}

/* ---------- 正文排版（参考 VOA 阅读体验）---------- */
.news-content {
    font-size: 17px;
    color: #1a1a1a;
    line-height: 1.9;
    letter-spacing: 0.1px;
}

/* Markdown 正文展示 */
.news-content.markdown-body { word-wrap: break-word; }
.news-content.markdown-body h1,
.news-content.markdown-body h2,
.news-content.markdown-body h3,
.news-content.markdown-body h4 { margin: 1.2em 0 0.5em; font-weight: 700; color: #141414; line-height: 1.35; }
.news-content.markdown-body h1 { font-size: 1.5em; }
.news-content.markdown-body h2 { font-size: 1.35em; border-bottom: 1px solid #e9ecef; padding-bottom: 0.3em; }
.news-content.markdown-body h3 { font-size: 1.2em; }
.news-content.markdown-body h4 { font-size: 1.1em; }
.news-content.markdown-body p { margin: 0 0 1em; }
.news-content.markdown-body p:last-child { margin-bottom: 0; }
.news-content.markdown-body strong { font-weight: 700; color: #141414; }
.news-content.markdown-body ul,
.news-content.markdown-body ol { margin: 0 0 1em; padding-left: 1.5em; }
.news-content.markdown-body li { margin: 0.25em 0; }
.news-content.markdown-body li > ul,
.news-content.markdown-body li > ol { margin: 0.25em 0; }
.news-content.markdown-body blockquote { margin: 1em 0; padding: 0.5em 0 0.5em 1em; border-left: 4px solid #e23ca9; background: #f8f9fa; color: #495057; }
.news-content.markdown-body code { padding: 0.2em 0.4em; font-size: 0.9em; background: #f1f3f4; border-radius: 4px; font-family: ui-monospace, monospace; }
.news-content.markdown-body pre { margin: 1em 0; padding: 1em; overflow-x: auto; background: #f1f3f4; border-radius: 8px; }
.news-content.markdown-body pre code { padding: 0; background: none; }
.news-content.markdown-body a { color: #007bff; text-decoration: none; }
.news-content.markdown-body a:hover { text-decoration: underline; }
.news-content.markdown-body hr { border: none; border-top: 1px solid #e9ecef; margin: 1.5em 0; }
.news-content.markdown-body .md-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1em 0;
    max-width: 100%;
}
.news-content.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 0;
    table-layout: auto;
}
.news-content.markdown-body th,
.news-content.markdown-body td {
    border: 1px solid #e9ecef;
    padding: 0.5em 0.75em;
    text-align: left;
    vertical-align: top;
}
.news-content.markdown-body th {
    background: #f8f9fa;
    font-weight: 600;
    white-space: normal;
}
.news-content.markdown-body td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.news-content.markdown-body td:first-child,
.news-content.markdown-body th:first-child {
    white-space: normal;
    min-width: 120px;
    max-width: 220px;
}
/* middle numeric-ish column stays compact when present */
.news-content.markdown-body td:nth-child(2) {
    white-space: nowrap;
    width: 1%;
}

/* when injected into table */
.news-table-header-row td.news-table-header { background: #fff; padding: 20px; }
.news-in-table .news-title { margin: 8px 0 6px; }
.news-in-table .news-tags { margin-top: 0; }

.comments-card {
  margin-top: 28px;
  border-top: 2px solid #f1f3f4;
  padding-top: 20px;
}
.comments-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.comments-card h3 { font-size: 18px; font-weight: 600; margin: 0; }
.comments-count { font-size: 16px; color: #2c3e50; font-weight: 700; }

.comment-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #eef1f6;
    border: 1px solid #e2e8f0;
    flex: 0 0 42px;
    position: relative;
    object-fit: cover;
}
.comment-avatar.is-broken { display: none; }
/* 首字母头像兜底（无 avatar 用户） */
.comment-avatar--initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 700;
    color: #4a5b7e;
    background: #e8edf5;
    box-sizing: border-box;
}
.comment-avatar.generic::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #c7cfdd;
    transform: translate(-50%, -58%);
}
.comment-avatar.generic::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 67%;
    width: 20px;
    height: 10px;
    border-radius: 10px 10px 6px 6px;
    border: 2px solid #c7cfdd;
    border-top: none;
    transform: translateX(-50%);
}

.comment-compose-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.comment-compose { margin-bottom: 0; flex: 1; }
.comment-compose textarea {
    width: 100%;
    min-height: 72px;
    resize: vertical;
    border: none;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.6;
    color: #2d3a58;
    box-sizing: border-box;
    background: #f5f6f8;
}
.comment-compose textarea:focus { outline: none; box-shadow: 0 0 0 2px rgba(13,110,253,0.16); }
.comment-compose-actions { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.compose-hint { color: #6c757d; font-size: 12px; }
#comment-submit-btn {
    border: none;
    background: #0d6efd;
    color: #fff;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
#comment-submit-btn:hover { background: #0b5ed7; }
#comment-submit-btn:disabled { background: #9cb8eb; cursor: not-allowed; }

.comment-login-required {
    border-radius: 12px;
    padding: 22px 16px;
    color: #2d3a58;
    font-size: 15px;
    background: #f5f6f8;
    text-align: center;
}
.comment-login-required.simple { display: block; }
.comment-login-link {
    text-decoration: none;
    color: #d33b32;
    font-weight: 600;
}
.comment-login-link:hover { text-decoration: underline; }

.comments-list { list-style: none; margin: 0; padding: 0; }
.comment-item { padding: 14px 0; border-bottom: 1px solid #f1f3f4; display: flex; gap: 12px; align-items: flex-start; }
.comment-item:last-child { border-bottom: none; }
.comment-main { flex: 1; min-width: 0; }
.comment-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.comment-author { font-weight: 600; color: #2c3e50; }
.comment-time { color: #98a1b2; font-size: 12px; }
.comment-status-tag {
    font-size: 11px;
    border-radius: 999px;
    padding: 2px 8px;
    font-weight: 600;
}
.comment-status-tag.pending { background: #fff4d6; color: #b7791f; }
.comment-status-tag.rejected { background: #ffe3e3; color: #c92a2a; }
.comment-text { color: #4b5568; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.comments-empty { color: #98a1b2; font-size: 13px; padding: 10px 0 0; display: none; }

.news-sidebar { 
    display: flex !important; 
    flex-direction: column !important; 
    gap: 20px !important; 
    width: 100% !important;
    overflow: visible !important;
}
.sidebar-card {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  padding: 20px;
}
.sidebar-title { font-size: 16px; font-weight: 600; margin-bottom: 10px; }

/* ---------- App 下载引导卡片（像素风 + 悬停下方展开） ---------- */

.sidebar-app-dl {
    position: relative;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #1a1a1a;
    overflow: visible;
    z-index: 20;
}
.sidebar-app-dl__banner {
    padding: 16px 16px 14px;
    background: #c8f07a;
    border: 3px solid #1a1a1a;
    box-shadow: 4px 4px 0 #1a1a1a;
    cursor: default;
    image-rendering: pixelated;
    /* 容器查询锚点：让内部字号按 banner 实际宽度自适应（见 __sub） */
    container-type: inline-size;
    container-name: appdlbanner;
}
.sidebar-app-dl__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.sidebar-app-dl__pixel-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    padding: 5px;
    background: #fffef5;
    border: 2px solid #1a1a1a;
    box-shadow: 2px 2px 0 #1a1a1a;
    box-sizing: border-box;
}
.sidebar-app-dl__pixel-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}
.sidebar-app-dl__head-text { min-width: 0; flex: 1; }
.sidebar-app-dl__title {
    font-family: "Press Start 2P", "Courier New", monospace;
    font-size: 10px;
    font-weight: 400;
    color: #1a1a1a;
    line-height: 1.7;
    letter-spacing: 0;
    word-break: break-word;
}
.sidebar-app-dl__sub {
    margin-top: 10px;
    font-family: "Courier New", Courier, monospace;
    /* 按 banner 容器实际宽度自适应字号（container query 单位 cqw）：
       260px 容器 ≈ 11.6px，300px ≈ 13.4px，320px+ 封顶 14px —— 始终单行完整显示。 */
    font-size: clamp(11px, 4.2cqw, 14px);
    font-weight: 700;
    color: #2d5016;
    line-height: 1.4;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: clip;
}
.sidebar-app-dl__hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 2px dashed #1a1a1a;
    font-family: "Courier New", Courier, monospace;
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
}
.sidebar-app-dl__hint-text { line-height: 1.35; }
.sidebar-app-dl__hint-arrow {
    font-size: 12px;
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.15s steps(2);
}
.sidebar-app-dl:hover .sidebar-app-dl__hint-arrow,
.sidebar-app-dl:focus-within .sidebar-app-dl__hint-arrow {
    transform: translateY(2px);
}

/* 悬停浮层：出现在 banner 正下方，含透明桥接区避免鼠标移入时消失 */
.sidebar-app-dl__panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0;
    padding: 16px 14px 14px;
    background: #fffef5;
    border: 3px solid #1a1a1a;
    box-shadow: 4px 4px 0 #1a1a1a;
    color: #1a1a1a;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.15s steps(3), transform 0.15s steps(3), visibility 0s linear 0.15s;
    z-index: 100;
}
.sidebar-app-dl__panel::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}
.sidebar-app-dl:hover .sidebar-app-dl__panel,
.sidebar-app-dl:focus-within .sidebar-app-dl__panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity 0.15s steps(3), transform 0.15s steps(3), visibility 0s;
}
.sidebar-app-dl__qr {
    width: 140px;
    height: 140px;
    padding: 4px;
    background: #fff;
    border: 2px solid #1a1a1a;
    box-shadow: 2px 2px 0 #1a1a1a;
    margin: 0 auto 10px;
    box-sizing: border-box;
}
.sidebar-app-dl__qr img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    image-rendering: pixelated;
}
.sidebar-app-dl__cap {
    margin: 0 0 14px;
    font-family: "Courier New", Courier, monospace;
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.4;
}
.sidebar-app-dl__stores {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sidebar-app-dl__store {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #1a1a1a;
    color: #c8f07a;
    text-decoration: none;
    border: 2px solid #1a1a1a;
    box-shadow: 2px 2px 0 #7cfc00;
    box-sizing: border-box;
    transition: transform 0.1s steps(2), box-shadow 0.1s steps(2);
}
.sidebar-app-dl__store:hover {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 #7cfc00;
    color: #c8f07a;
    text-decoration: none;
}
.sidebar-app-dl__store-ico {
    width: 22px;
    height: 22px;
    fill: currentColor;
    flex-shrink: 0;
}
.sidebar-app-dl__store-meta {
    text-align: left;
    line-height: 1.2;
    min-width: 0;
}
.sidebar-app-dl__store-action {
    font-family: "Courier New", Courier, monospace;
    font-size: 11px;
    font-weight: 700;
    color: rgba(200, 240, 122, 0.9);
    letter-spacing: 0.2px;
}
.sidebar-app-dl__store-name {
    font-family: "Courier New", Courier, monospace;
    font-size: 14px;
    font-weight: 700;
    color: #c8f07a;
    margin-top: 2px;
}

.related-news-list { list-style: none; margin: 0; padding: 0; }
.related-news-list li { padding: 10px 0; border-bottom: 1px solid #f1f3f4; }
.related-news-list li:last-child { border-bottom: none; }
.related-news-list a {
    display: block;
    color: #2c3e50;
    text-decoration: none;
    line-height: 1.45;
    word-break: break-word;
}
.related-news-list a:hover { color: #007bff; }
.related-news-list em {
    display: block;
    font-size: 12px;
    color: #6c757d;
    margin: 4px 0 0;
    font-style: normal;
}

/* 强制样式覆盖 - 桌面默认双栏布局（与上方定义一致：820px 内容 + 300px 侧栏） */
.news-detail-container .news-main-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 820px) 300px !important;
    gap: 30px !important;
    padding: 0 0 30px 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.news-detail-container .news-content-card {
    background: #fff !important;
    border: 1px solid #e9ecef !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
    padding: 28px 32px !important;
    width: 100% !important;
    min-width: 0 !important;
    display: block !important;
    box-sizing: border-box !important;
}

.news-detail-container .news-sidebar {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

/* 移动端覆盖：必须放在强制样式之后，否则 !important 双栏会覆盖 media query */
@media (max-width: 1024px) {
    .news-main-grid,
    .news-detail-container .news-main-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 0 0 24px 0 !important;
    }

    /* 移动端/平板单列布局：隐藏 App 下载引导 */
    .sidebar-app-dl {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .news-detail-container {
        overflow-x: hidden;
    }

    .news-detail-container .title_t,
    body .news-detail-container .title_t {
        padding: 8px 0 !important;
        font-size: 13px !important;
        line-height: 1.5 !important;
        white-space: normal !important;
        word-break: break-word;
    }

    .news-main-grid,
    .news-detail-container .news-main-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        padding: 0 0 20px 0 !important;
    }

    .news-content-card,
    .news-detail-container .news-content-card {
        padding: 16px !important;
        border-radius: 10px !important;
    }

    .news-title {
        font-size: 1.25rem !important;
        line-height: 1.35;
        word-break: break-word;
    }

    .news-content {
        font-size: 15px;
        line-height: 1.75;
    }

    .news-content.markdown-body {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .news-content.markdown-body .md-table-scroll table {
        min-width: 520px;
    }

    .news-content.markdown-body img {
        max-width: 100%;
        height: auto;
    }

    .news-opinion-head__meta {
        flex-wrap: wrap;
    }

    .news-opinion-head__name {
        font-size: 1rem;
        max-width: 100%;
        white-space: normal;
        word-break: break-word;
    }

    .news-tags {
        align-items: center;
        gap: 0.35rem;
    }

    .news-tag,
    a.news-tag,
    span.news-tag {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        min-height: 0 !important;
        min-width: 0 !important;
        width: auto !important;
        height: auto !important;
        padding: 0.2rem 0.55rem !important;
        font-size: 0.72rem !important;
        line-height: 1.3 !important;
        border-radius: 4px;
        vertical-align: middle;
    }

    .news-sidebar,
    .news-detail-container .news-sidebar {
        gap: 16px !important;
    }

    .sidebar-card {
        padding: 16px;
    }

    .comment-compose-row {
        gap: 10px;
    }

    .comment-compose {
        min-width: 0;
    }

    .comment-compose textarea {
        min-height: 64px;
        padding: 12px;
        font-size: 16px;
    }

    .comment-compose-actions {
        flex-direction: column;
        align-items: stretch;
    }

    #comment-submit-btn {
        width: 100%;
        text-align: center;
    }

    .comments-card {
        margin-top: 20px;
        padding-top: 16px;
    }
}

/* 移动端导航：详情页依赖 mobile-optimization.css；此处兜底防止菜单流入正文流 */
@media (max-width: 1280px) {
    .wap_top {
        position: relative;
        z-index: 1000;
    }

    .mobile-fullscreen-nav {
        position: fixed;
        inset: 0;
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    .mobile-fullscreen-nav.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .mobile-nav-overlay {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
    }

    .mobile-nav-content {
        position: absolute;
        top: 0;
        right: 0;
        width: min(280px, 85vw);
        height: 100%;
        background: #fff;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }

    .mobile-fullscreen-nav.active .mobile-nav-content {
        transform: translateX(0);
    }
}
