/* === CSS 变量：把常用值集中管理，方便以后调整 === */
:root {
    --color-bg: #f7f8fa;
    --color-card: #ffffff;
    --color-text: #1f2937;
    --color-text-muted: #6b7280;
    --color-border: #e5e7eb;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* === 全局重置 === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    padding: 0 16px;
}

/* === 网站头部 === */
.site-header {
    max-width: 800px;
    margin: 0 auto;
    padding: 56px 0 32px;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

.site-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.site-header .subtitle {
    color: var(--color-text-muted);
    font-size: 16px;
}

/* === 主内容区 === */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 0;
}

/* === 题目卡片 === */
.problem-card {
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px 28px;
    margin-bottom: 20px;
}

.problem-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.tag-chapter {
    background-color: #dbeafe;
    color: #1e40af;
}

.tag-difficulty {
    background-color: #fef3c7;
    color: #92400e;
}

.problem-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.problem-body p {
    margin-bottom: 8px;
}

.problem-body p:last-child {
    margin-bottom: 0;
}

/* === 解析（默认收起，点开展开） === */
.problem-solution {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--color-border);
}

.problem-solution summary {
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 14px;
    user-select: none;
}

.problem-solution summary:hover {
    color: var(--color-text);
}

.problem-solution[open] summary {
    margin-bottom: 10px;
}

.problem-solution p {
    margin-bottom: 8px;
}

/* === 网站底部 === */
.site-footer {
    max-width: 800px;
    margin: 32px auto;
    padding: 24px 0;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
    border-top: 1px solid var(--color-border);
}
/* === 筛选栏 === */
.filters {
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 24px;
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 0;
}

.filter-label {
    font-size: 13px;
    color: var(--color-text-muted);
    min-width: 40px;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-family: inherit;
    font-size: 13px;
    padding: 5px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-btn:hover {
    background: #f3f4f6;
}

.filter-btn.active {
    background: #1f2937;
    border-color: #1f2937;
    color: white;
}

/* === 结果数量 === */
.results-count {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 14px;
    padding: 0 4px;
}

/* === 空状态 === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--color-text-muted);
    font-size: 15px;
}

/* === 搜索框 === */
.search-row {
    padding: 4px 0 12px;
}

.search-row input {
    width: 100%;
    font-family: inherit;
    font-size: 15px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg);
    transition: border-color 0.15s, background 0.15s;
}

.search-row input:focus {
    outline: none;
    border-color: #1f2937;
    background: white;
}

/* === 题目标题里的链接 === */
.problem-title a {
    color: inherit;
    text-decoration: none;
}

.problem-title a:hover {
    color: #3b82f6;
}

/* === 返回链接 === */
.back-link {
    display: inline-block;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 16px;
    padding: 4px 0;
}

.back-link:hover {
    color: var(--color-text);
}

/* === 详情页 === */
.problem-detail {
    padding: 32px 36px;
}

.problem-detail .problem-title {
    font-size: 22px;
    margin-bottom: 16px;
}

.problem-detail .problem-body {
    font-size: 17px;
}

.solution-detail {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.solution-detail h3 {
    font-size: 14px;
    color: var(--color-text-muted);
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.solution-detail p {
    margin-bottom: 10px;
}

.solution-detail p:last-child {
    margin-bottom: 0;
}
/* === 题目配图 === */
.problem-figure {
    margin: 16px 0;
    text-align: center;
}

.problem-figure svg {
    max-width: 100%;
    height: auto;
}

/* 几何图统一样式 */
.diagram .edge {
    stroke: #222;
    stroke-width: 2;
    fill: none;
}

.diagram .hidden {
    stroke: #222;
    stroke-width: 2;
    stroke-dasharray: 6 5;
    fill: none;
}

.diagram .dashed {
    stroke: #666;
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
    fill: none;
}

.diagram .label {
    font-size: 18px;
    font-family: "Times New Roman", serif;
    fill: #111;
}

.diagram .point {
    fill: #222;
}

/* === 题目来源徽章(作业详情里区分引用题 vs 临时题) === */
.source-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.source-ref {
    background-color: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.source-inline {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
/* === 题目配图(统一规格) === */
.problem-figure {
    margin: 18px auto;
    display: flex;
    justify-content: center;
}

.problem-figure svg {
    /* 列表卡片里的尺寸 */
    width: 100%;
    max-width: 360px;
    height: auto;
}

/* 详情页里图可以稍微大一点 */
.problem-detail .problem-figure svg {
    max-width: 460px;
}

/* === 几何图统一样式 === */
.diagram .edge {
    stroke: #1f2937;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.diagram .hidden {
    stroke: #1f2937;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 6 4;
    fill: none;
}

.diagram .dashed {
    stroke: #6b7280;
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
    fill: none;
}

.diagram .label {
    font-size: 17px;
    font-family: "Times New Roman", "Cambria Math", serif;
    font-style: italic;
    fill: #111827;
}

.diagram .label-plain {
    font-size: 14px;
    font-family: -apple-system, "PingFang SC", sans-serif;
    fill: #6b7280;
}

.diagram .point {
    fill: #111827;
}

/* 移动端字号略大,看得清 */
@media (max-width: 480px) {
    .diagram .label {
        font-size: 18px;
    }
}