/* ================= 现代系统变量与重置 ================= */
:root {
        --primary: #4f46e5;
        --primary-hover: #4338ca;
        --primary-light: #e0e7ff;
        --bg-canvas: #f8fafc;
        --bg-card: #ffffff;
        --border-color: #e2e8f0;
        --text-main: #334155;
        --text-dark: #0f172a;
        --text-muted: #64748b;
        --shadow-sm:
          0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.02);
        --shadow-md:
          0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
      }

      * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
      }

      body {
        font-family:
          system-ui,
          -apple-system,
          BlinkMacSystemFont,
          "Segoe UI",
          Roboto,
          "Helvetica Neue",
          Arial,
          sans-serif;
        background-color: var(--bg-canvas);
        color: var(--text-main);
        line-height: 1.6;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
      }

      a {
        color: inherit;
        text-decoration: none;
        transition: all 0.2s ease;
      }

      /* ================= 头部导航 (毛玻璃) ================= */
      header {
        position: sticky;
        top: 0;
        z-index: 50;
        background: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid rgba(226, 232, 240, 0.8);
        box-shadow: var(--shadow-sm);
      }

      .header-container {
        max-width: 52rem;
        margin: 0 auto;
        padding: 0 1.25rem;
        height: 4rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
      }

      .logo {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 1.5rem;
        font-weight: 800;
      }

      .back-btn {
        font-size: 0.875rem;
        color: var(--primary);
        font-weight: 500;
        display: flex;
        align-items: center;
        gap: 0.25rem;
      }

      .back-btn:hover {
        color: var(--primary-hover);
        text-decoration: underline;
      }

      /* ================= 主体内容布局 ================= */
      main {
        max-width: 52rem;
        margin: 2rem auto 4rem auto;
        padding: 0 1.25rem;
      }

      article {
        background-color: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 1.25rem;
        padding: 2rem;
        box-shadow: var(--shadow-sm);
      }

      @media (min-width: 768px) {
        article {
          padding: 3rem;
        }
      }

      /* 面包屑 */
      .breadcrumbs {
        font-size: 0.75rem;
        color: var(--text-muted);
        margin-bottom: 1.5rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
      }

      .breadcrumbs a:hover {
        color: var(--primary);
        text-decoration: underline;
      }

      /* ================= 提问背景模块 (折叠卡片) ================= */
      .question-card {
        background-color: #f8fafc;
        border-left: 4px solid var(--primary);
        padding: 1.25rem;
        border-top-right-radius: 0.75rem;
        border-bottom-right-radius: 0.75rem;
        margin-bottom: 2rem;
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
      }

      .question-title-badge {
        font-size: 0.75rem;
        font-weight: 700;
        color: var(--primary);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 0.5rem;
      }

      /* 限制容器 */
      .content-outer-wrapper {
        max-height: 160px;
        overflow: hidden;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
      }

      .content-outer-wrapper.expanded {
        max-height: none;
      }

      .msg-content-body {
        white-space: pre-wrap;
        word-break: break-all;
        color: #475569;
        font-size: 0.875rem;
        line-height: 1.625;
      }

      @media (min-width: 768px) {
        .msg-content-body {
          font-size: 0.9375rem;
        }
      }

      /* 展开折叠按钮 */
      .toggle-btn {
        display: none; /* 默认不显示，由JS高度判定后决定 */
        margin: 1rem auto 0 auto;
        padding: 0.375rem 1rem;
        background-color: #ffffff;
        border: 1px solid #cbd5e1;
        border-radius: 9999px;
        color: var(--primary);
        font-size: 0.8125rem;
        font-weight: 600;
        cursor: pointer;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        transition: all 0.2s ease;
      }

      .toggle-btn:hover {
        background-color: #f1f5f9;
        border-color: #94a3b8;
        transform: translateY(-1px);
      }

      /* ================= 文章大标题及元数据 ================= */
      .article-title {
        font-size: 1.5rem;
        font-weight: 800;
        color: var(--text-dark);
        line-height: 1.3;
        margin-bottom: 1rem;
      }

      @media (min-width: 768px) {
        .article-title {
          font-size: 2.25rem;
        }
      }

      .meta-bar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 1rem;
        margin-bottom: 2rem;
        font-size: 0.75rem;
        color: var(--text-muted);
        gap: 0.75rem;
      }

      .meta-left {
        display: flex;
        gap: 1rem;
      }

      /* ================= 核心正文富文本排版 (Prose) ================= */
      .prose {
        color: var(--text-main);
        font-size: 0.9375rem;
        line-height: 1.75;
      }

      @media (min-width: 768px) {
        .prose {
          font-size: 1.0625rem;
        }
      }

      .prose p {
        margin-bottom: 1.5rem;
      }

      .prose h1,
      .prose h2,
      .prose h3,
      .prose h4 {
        color: var(--text-dark);
        font-weight: 700;
        margin-top: 2rem;
        margin-bottom: 0.75rem;
        line-height: 1.4;
      }

      .prose h2 {
        font-size: 1.4rem;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 0.375rem;
      }

      .prose code {
        background-color: #f1f5f9;
        color: #ef4444;
        padding: 0.2rem 0.4rem;
        border-radius: 0.25rem;
        font-size: 0.85em;
        font-family:
          ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      }

      .prose pre {
        background-color: #0f172a;
        color: #f8fafc;
        padding: 1.25rem;
        border-radius: 0.75rem;
        overflow-x: auto;
        margin-bottom: 1.5rem;
        font-size: 0.875rem;
        line-height: 1.5;
      }

      .prose pre code {
        background-color: transparent;
        color: inherit;
        padding: 0;
        font-size: inherit;
      }

      .prose blockquote {
        border-left: 4px solid #cbd5e1;
        padding-left: 1rem;
        color: var(--text-muted);
        font-style: italic;
        margin: 1.5rem 0;
      }

      .prose img {
        max-width: 100%;
        border-radius: 0.5rem;
        height: auto;
        margin: 1.5rem 0;
      }

      /* ================= 标签模块 ================= */
      .tags-section {
        margin-top: 2.5rem;
        padding-top: 1.5rem;
        border-top: 1px solid var(--border-color);
      }

      .tags-label {
        font-size: 0.75rem;
        color: var(--text-muted);
        margin-bottom: 0.5rem;
        font-weight: 600;
      }

      .tags-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
      }

      .tag-badge {
        font-size: 0.75rem;
        background-color: #f1f5f9;
        color: #475569;
        padding: 0.375rem 0.75rem;
        border-radius: 9999px;
        font-weight: 500;
      }

      .tag-badge:hover {
        background-color: var(--primary-light);
        color: var(--primary);
        transform: translateY(-1px);
      }

      /* ================= 页脚 ================= */
      footer {
        background-color: #ffffff;
        border-top: 1px solid var(--border-color);
        padding: 2rem 0;
        text-align: center;
        font-size: 0.75rem;
        color: var(--text-muted);
      }