/* 实体索引页面样式 */

/* 覆盖 body 默认样式 */
body {
    max-width: 1100px;
}

/* 统计信息 */
.index-stats {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 1em;
}

/* 实体类型定义说明框 */
.entity-type-desc {
    display: flex;
    align-items: baseline;
    gap: 0.6em;
    background: #f8f5e8;
    border-left: 4px solid #b8a86a;
    border-radius: 0 6px 6px 0;
    padding: 0.75em 1em;
    margin-bottom: 1.2em;
    flex-wrap: wrap;
}
.entity-type-desc .type-label {
    font-size: 0.85em;
    flex-shrink: 0;
}
.entity-type-desc .type-marker {
    font-family: monospace;
    font-size: 0.85em;
    color: #888;
    flex-shrink: 0;
}
.entity-type-desc p {
    margin: 0;
    color: #444;
    font-size: 0.9em;
    line-height: 1.6;
}

/* 搜索过滤框 */
.entity-filter {
    position: sticky;
    top: 0;
    background: #fdfdf8;
    padding: 10px 0;
    z-index: 100;
    border-bottom: 1px solid #e6e0c0;
    margin-bottom: 1em;
}

.entity-filter input {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid #d0c8a0;
    border-radius: 4px;
    font-size: 1em;
    font-family: "Noto Serif SC", "Source Han Serif SC", serif;
    background: #fff;
}

.entity-filter input:focus {
    outline: none;
    border-color: #8B4513;
    box-shadow: 0 0 3px rgba(139, 69, 19, 0.3);
}

/* 拼音字母导航栏 */
.pinyin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 1.5em;
    padding: 10px 0;
    border-bottom: 1px solid #e6e0c0;
}

.pinyin-letter {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    padding: 4px 10px;
    border: 1px solid #d0c8a0;
    border-radius: 4px;
    text-decoration: none;
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 600;
    font-size: 0.95em;
    color: #5a4a2a;
    background: #fffef8;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.pinyin-letter:hover {
    background-color: #f5f0e0;
    border-color: #8B4513;
    color: #8B0000;
}

.letter-count {
    font-size: 0.7em;
    font-weight: 400;
    color: #999;
}

/* 字母分节标题 */
.letter-section {
    margin-bottom: 1em;
}

.letter-heading {
    font-family: Helvetica, Arial, sans-serif;
    font-size: 1.4em;
    font-weight: 700;
    color: #8B0000;
    border-left: 5px solid #8B0000;
    padding-left: 12px;
    margin: 1.5em 0 0.5em 0;
    scroll-margin-top: 60px;
}

/* 实体条目 */
.entity-index {
    line-height: 1.8;
}

.entity-entry {
    display: flex;
    align-items: baseline;
    padding: 6px 0;
    border-bottom: 1px solid #f0ece0;
    gap: 20px;
    scroll-margin-top: 60px;
}

.entity-entry:hover {
    background-color: rgba(139, 69, 19, 0.03);
}

/* 左侧：名称 + 别名 */
.entry-left {
    flex: 0 0 140px;
    text-align: left;
}

/* 人名四列专用：规范名列 */
.entry-canonical {
    flex: 0 0 140px;
    font-size: 0.9em;
    color: #5a4a2a;
    align-self: baseline;
}
.entry-canonical .canonical-target {
    font-weight: 500;
    color: #8B4513;
}
.entry-canonical:empty::before {
    content: "—";
    color: #ddd;
}

.canonical-name {
    font-weight: 600;
    font-size: 1.05em;
}

.alias-list {
    display: block;
    font-size: 0.78em;
    color: #999;
    margin-top: 1px;
}

.entry-count {
    font-size: 0.75em;
    color: #bbb;
    margin-left: 4px;
}

/* 右侧：章节引用 */
.entry-right {
    flex: 1;
    font-size: 0.82em;
    line-height: 1.9;
    color: #555;
}

.entry-right a {
    text-decoration: none;
}

.entry-right a:hover {
    text-decoration: underline;
}

.chapter-ref-name {
    font-weight: 500;
    color: #5a4a2a;
}

.para-ref {
    color: #8B0000;
}

.para-ref:hover {
    color: #d4af37;
}

.ref-sep {
    color: #ddd;
    margin: 0 4px;
}

/* 总览页卡片网格 */
.entity-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin: 2em 0;
}

.entity-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    border: 1px solid #e6e0c0;
    border-radius: 6px;
    background: #fffef8;
    text-decoration: none;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.entity-type-card:hover {
    border-color: #d4af37;
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.12);
}

.type-label {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 8px;
}

.type-count {
    font-size: 0.9em;
    color: #666;
}

.type-total {
    font-size: 0.8em;
    color: #999;
}

/* 正文中实体链接样式 */
a.entity-link {
    text-decoration: none;
    color: inherit;
}

/* 章节标题区分 */
h2 {
    margin-top: 2em;
    margin-bottom: 0.5em;
    color: #5a4a2a;
    font-size: 1.5em;
    border-bottom: 2px solid #e6e0c0;
    padding-bottom: 0.3em;
}

.section-desc {
    color: #777;
    font-size: 0.9em;
    margin-top: -0.3em;
    margin-bottom: 1.5em;
}

/* 语义关系类型标签颜色 */
.type-label.relations {
    color: #4169E1; /* 皇家蓝 - 总览 */
}

.type-label.military {
    color: #DC143C; /* 深红色 - 军事 */
}

.type-label.penalty {
    color: #8B0000; /* 深红 - 刑罚 */
}

.type-label.political {
    color: #4682B4; /* 钢青色 - 政治 */
}

.type-label.economic {
    color: #DAA520; /* 金色 - 经济 */
}

/* 语义关系卡片特殊样式 */
.entity-type-card.relations-summary {
    border: 2px solid #4169E1;
    background: linear-gradient(135deg, #f8f9ff 0%, #fffef8 100%);
}

.entity-type-card.relations-summary:hover {
    border-color: #1E90FF;
    box-shadow: 0 3px 12px rgba(65, 105, 225, 0.2);
}

/* 动词条目样式 */
.entity-name {
    font-weight: 700;
    font-size: 1.1em;
    color: #2c1810;
}

.entity-count {
    font-size: 0.8em;
    color: #999;
    margin-left: 6px;
}

.chapter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chapter-ref {
    display: inline-block;
    padding: 2px 8px;
    background: #f5f0e0;
    border-radius: 3px;
    color: #5a4a2a;
    font-size: 0.9em;
    text-decoration: none;
    border: 1px solid #e6e0c0;
    transition: all 0.15s ease;
}

.chapter-ref:hover {
    background: #e8dfc0;
    border-color: #8B4513;
    color: #8B0000;
}

.disambiguation {
    margin-top: 6px;
    font-size: 0.85em;
    color: #888;
    font-style: italic;
}

/* 统计摘要框 */
.stats-summary {
    background: #f8f5e8;
    border: 1px solid #d0c8a0;
    border-radius: 6px;
    padding: 1.2em 1.5em;
    margin: 2em 0;
}

.stats-summary h2 {
    margin-top: 0;
    border-bottom: none;
    padding-bottom: 0;
    font-size: 1.2em;
}

.stats-summary ul {
    margin: 0.5em 0 0 1.2em;
    padding: 0;
}

.stats-summary li {
    margin: 0.3em 0;
    color: #555;
}

/* ─── 地名分类（地段）样式 ─── */

/* 中列：地段分类徽章容器（即使为空也保持固定宽度，确保右列左边对齐） */
/* 支持多标签：每个徽章独占一行 */
.entry-category {
    flex: 0 0 92px;
    width: 92px;
    text-align: left;
    align-self: baseline;
}

/* 每行一个徽章 + 右侧置信度 */
.cat-line {
    display: block;
    margin-bottom: 2px;
    white-space: nowrap;
}
/* 空容器也要占位：用不可见的 nbsp 撑出基线 */
.entry-category:empty::before {
    content: "\00a0";
    visibility: hidden;
}

/* 徽章本体 */
.place-category {
    display: inline-block;
    font-size: 0.72em;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid transparent;
    white-space: nowrap;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* 置信度 → 透明度映射（由 build 脚本写入 inline style: opacity: 0.40 + 0.60*conf）
   高置信度徽章鲜明、低置信度徽章淡化。悬停显示 "置信度 X/100（越接近 100 越可靠）" tooltip */
.place-category {
    cursor: help;   /* 视觉提示可悬停 */
}

/* 不同地段配色（沿用古朴色系） */
.place-category.cat-river    { background: #eaf4fa; color: #2f6b8e; border-color: #cfe3ef; }
.place-category.cat-mountain { background: #ecf3e4; color: #4a6b2a; border-color: #d4e3c5; }
.place-category.cat-plain    { background: #f5efd9; color: #7a6a2a; border-color: #e2d9b4; }
.place-category.cat-pass     { background: #f8ece0; color: #8b4513; border-color: #e6d3b7; }
.place-category.cat-region   { background: #f0ecf8; color: #5d4a8a; border-color: #dcd4ee; }
.place-category.cat-nation   { background: #f4e6d8; color: #8a4a2a; border-color: #e6cfb3; }
.place-category.cat-zhou     { background: #fdf0e0; color: #a0522d; border-color: #eeddc4; }
.place-category.cat-jun      { background: #fcead0; color: #8b5a2b; border-color: #e8d7b0; }
.place-category.cat-xian     { background: #fbf2d4; color: #7c6220; border-color: #ebdfb5; }
.place-category.cat-city     { background: #fef3e8; color: #8b4513; border-color: #f0dcc4; }
.place-category.cat-building { background: #f8e8e8; color: #8a3030; border-color: #eaced0; }
.place-category.cat-tomb     { background: #ebe6e0; color: #555; border-color: #d4cdc2; }
.place-category.cat-xiang    { background: #f0efe6; color: #6a5a2a; border-color: #d9d5bd; }
.place-category.cat-road     { background: #eef0f4; color: #4a5a80; border-color: #d4d9e4; }
.place-category.cat-other    { background: #f4f2ec; color: #888; border-color: #e2ddcf; }
.place-category.cat-mis      { background: #fdecea; color: #a03030; border-color: #f4c6c0; font-style: italic; }
.place-category.cat-split    { background: #fff4d6; color: #8a6020; border-color: #f0dda0; }
.place-category.cat-fiction  { background: #f0e8fa; color: #6a3a8a; border-color: #ddc8ee; font-style: italic; }

/* 官职职类配色（cat-sangong 三公 / cat-jiuqing 九卿 / ...） */
.place-category.cat-sangong    { background: #fbe4e4; color: #8b2a2a; border-color: #ecc2c2; }
.place-category.cat-jiuqing    { background: #fdebd3; color: #8a5020; border-color: #f0d3a5; }
.place-category.cat-liqing     { background: #fdf1dc; color: #8f6a2a; border-color: #edd7a8; }
.place-category.cat-junli      { background: #ede5d0; color: #6a5020; border-color: #d8ccae; }
.place-category.cat-xianli     { background: #f3efd8; color: #7a6a2a; border-color: #dbd3a0; }
.place-category.cat-military   { background: #e1e7ef; color: #3a4a6b; border-color: #c4cde0; }
.place-category.cat-jue        { background: #faf0c8; color: #846020; border-color: #e8d68c; }
.place-category.cat-wang-title { background: #ebe2f5; color: #5a3a8a; border-color: #d2c2e8; }
.place-category.cat-guju       { background: #ecefd7; color: #5a6028; border-color: #d3d8b4; }
.place-category.cat-palace     { background: #fae1ea; color: #8a4060; border-color: #ebc6d3; }
.place-category.cat-wenxue     { background: #dff0e4; color: #2f6a4a; border-color: #bfdcc6; }
.place-category.cat-shifu      { background: #ece4f0; color: #5a4a7a; border-color: #d0c4dc; }
.place-category.cat-foreign    { background: #d9ecee; color: #2f6060; border-color: #b8d8dc; }
.place-category.cat-ancient    { background: #eee4cc; color: #6a4a2a; border-color: #d8c8a8; }
.place-category.cat-jiachen    { background: #f2e7d6; color: #6a4a20; border-color: #ddcba6; }
.place-category.cat-jibie      { background: #e6eef4; color: #2a5070; border-color: #c4d4e4; }
.place-category.cat-generic    { background: #ebe8e0; color: #6a6050; border-color: #cfc9b8; }
.place-category.cat-person-mis { background: #fde8e4; color: #8a3030; border-color: #f2cabe; font-style: italic; }
.place-category.cat-identity-mis { background: #fce9f4; color: #8a3060; border-color: #f0c8dc; font-style: italic; }
.place-category.cat-shihao-mis   { background: #f6e9e2; color: #8a5020; border-color: #e8d2c0; font-style: italic; }

/* 邦国国类分类配色（上古方国/朝代/周代诸侯/秦末列国/汉诸侯王国/外邦/合称/...） */
.place-category.cat-ancient-state { background: #eee4cc; color: #6a4a2a; border-color: #d8c8a8; }
.place-category.cat-dynasty       { background: #f4dfc8; color: #7a3a10; border-color: #e6c6a0; }
.place-category.cat-zhou-vassal   { background: #fdf0e0; color: #a0522d; border-color: #eeddc4; }
.place-category.cat-qin-end       { background: #efdccc; color: #6a3a20; border-color: #dcc2a8; }
.place-category.cat-han-vassal    { background: #fbe4e4; color: #8b2a2a; border-color: #ecc2c2; }
.place-category.cat-han-marquis   { background: #fce5d4; color: #8a4520; border-color: #f0ccb0; }
.place-category.cat-collective    { background: #ede0ee; color: #5a3070; border-color: #d4c0da; }
.place-category.cat-tribe-mis     { background: #fde8e0; color: #8a3a10; border-color: #f0c8b0; font-style: italic; }
.place-category.cat-place-mis     { background: #fff0d8; color: #8a5020; border-color: #f0d8a0; font-style: italic; }

/* 人名身份分类配色（帝王/诸侯君主/后妃/宗室/将相/...） */
.place-category.cat-emperor    { background: #fdf0cc; color: #7a5010; border-color: #edda90; }
.place-category.cat-ruler      { background: #ece2f5; color: #5a3a8a; border-color: #d4c0e8; }
.place-category.cat-consort    { background: #fce8f0; color: #8a3060; border-color: #f0c8dc; }
.place-category.cat-prince     { background: #e8ecf8; color: #3a4a8a; border-color: #c4cce0; }
.place-category.cat-chancellor { background: #e4eaf4; color: #3a4a70; border-color: #c4cee0; }
.place-category.cat-strategist { background: #e0f0ec; color: #2a5e54; border-color: #b8ddd6; }
.place-category.cat-scholar    { background: #e8f0e0; color: #4a6028; border-color: #c4d8a8; }
.place-category.cat-local      { background: #ede5d8; color: #6a4a2a; border-color: #d8ccae; }
.place-category.cat-swordsman  { background: #e4e4ec; color: #3a3a5a; border-color: #c4c4d8; }
.place-category.cat-courtier   { background: #fde8d0; color: #8a5020; border-color: #f0d0a8; }
.place-category.cat-merchant   { background: #faf0c0; color: #7a6010; border-color: #e8d880; }
.place-category.cat-mythical   { background: #e8f4f0; color: #2a6050; border-color: #bcdcd4; }
.place-category.cat-retainer   { background: #f2e7d6; color: #6a4a20; border-color: #ddcba6; }
.place-category.cat-commoner   { background: #ece9e0; color: #6a6050; border-color: #d0ccb8; }
.place-category.cat-fictional  { background: #f0e8fa; color: #6a3a8a; border-color: #ddc8ee; font-style: italic; }
.place-category.cat-kin        { background: #f5e8e0; color: #7a4a20; border-color: #e6d0b8; }
.place-category.cat-outcast    { background: #e4dfda; color: #4a3a30; border-color: #c8beb0; }

/* cat-chip 开关 — 官职类 */
.cat-chip.cat-sangong          { background: #fbe4e4; color: #8b2a2a; }
.cat-chip.cat-sangong.active   { background: #8b2a2a; color: #fbe4e4; }
.cat-chip.cat-jiuqing          { background: #fdebd3; color: #8a5020; }
.cat-chip.cat-jiuqing.active   { background: #8a5020; color: #fdebd3; }
.cat-chip.cat-liqing           { background: #fdf1dc; color: #8f6a2a; }
.cat-chip.cat-liqing.active    { background: #8f6a2a; color: #fdf1dc; }
.cat-chip.cat-junli            { background: #ede5d0; color: #6a5020; }
.cat-chip.cat-junli.active     { background: #6a5020; color: #ede5d0; }
.cat-chip.cat-xianli           { background: #f3efd8; color: #7a6a2a; }
.cat-chip.cat-xianli.active    { background: #7a6a2a; color: #f3efd8; }
.cat-chip.cat-military         { background: #e1e7ef; color: #3a4a6b; }
.cat-chip.cat-military.active  { background: #3a4a6b; color: #e1e7ef; }
.cat-chip.cat-jue              { background: #faf0c8; color: #846020; }
.cat-chip.cat-jue.active       { background: #846020; color: #faf0c8; }
.cat-chip.cat-wang-title       { background: #ebe2f5; color: #5a3a8a; }
.cat-chip.cat-wang-title.active { background: #5a3a8a; color: #ebe2f5; }
.cat-chip.cat-guju             { background: #ecefd7; color: #5a6028; }
.cat-chip.cat-guju.active      { background: #5a6028; color: #ecefd7; }
.cat-chip.cat-palace           { background: #fae1ea; color: #8a4060; }
.cat-chip.cat-palace.active    { background: #8a4060; color: #fae1ea; }
.cat-chip.cat-wenxue           { background: #dff0e4; color: #2f6a4a; }
.cat-chip.cat-wenxue.active    { background: #2f6a4a; color: #dff0e4; }
.cat-chip.cat-shifu            { background: #ece4f0; color: #5a4a7a; }
.cat-chip.cat-shifu.active     { background: #5a4a7a; color: #ece4f0; }
.cat-chip.cat-foreign          { background: #d9ecee; color: #2f6060; }
.cat-chip.cat-foreign.active   { background: #2f6060; color: #d9ecee; }
.cat-chip.cat-ancient          { background: #eee4cc; color: #6a4a2a; }
.cat-chip.cat-ancient.active   { background: #6a4a2a; color: #eee4cc; }
.cat-chip.cat-jiachen          { background: #f2e7d6; color: #6a4a20; }
.cat-chip.cat-jiachen.active   { background: #6a4a20; color: #f2e7d6; }
.cat-chip.cat-jibie            { background: #e6eef4; color: #2a5070; }
.cat-chip.cat-jibie.active     { background: #2a5070; color: #e6eef4; }
.cat-chip.cat-generic          { background: #ebe8e0; color: #6a6050; }
.cat-chip.cat-generic.active   { background: #6a6050; color: #ebe8e0; }
.cat-chip.cat-person-mis       { background: #fde8e4; color: #8a3030; }
.cat-chip.cat-person-mis.active { background: #8a3030; color: #fde8e4; }
.cat-chip.cat-identity-mis       { background: #fce9f4; color: #8a3060; }
.cat-chip.cat-identity-mis.active { background: #8a3060; color: #fce9f4; }
.cat-chip.cat-shihao-mis         { background: #f6e9e2; color: #8a5020; }
.cat-chip.cat-shihao-mis.active  { background: #8a5020; color: #f6e9e2; }

/* cat-chip 开关 — 人名身份类 */
.cat-chip.cat-emperor          { background: #fdf0cc; color: #7a5010; }
.cat-chip.cat-emperor.active   { background: #7a5010; color: #fdf0cc; }
.cat-chip.cat-ruler            { background: #ece2f5; color: #5a3a8a; }
.cat-chip.cat-ruler.active     { background: #5a3a8a; color: #ece2f5; }
.cat-chip.cat-consort          { background: #fce8f0; color: #8a3060; }
.cat-chip.cat-consort.active   { background: #8a3060; color: #fce8f0; }
.cat-chip.cat-prince           { background: #e8ecf8; color: #3a4a8a; }
.cat-chip.cat-prince.active    { background: #3a4a8a; color: #e8ecf8; }
.cat-chip.cat-chancellor       { background: #e4eaf4; color: #3a4a70; }
.cat-chip.cat-chancellor.active { background: #3a4a70; color: #e4eaf4; }
.cat-chip.cat-strategist       { background: #e0f0ec; color: #2a5e54; }
.cat-chip.cat-strategist.active { background: #2a5e54; color: #e0f0ec; }
.cat-chip.cat-scholar          { background: #e8f0e0; color: #4a6028; }
.cat-chip.cat-scholar.active   { background: #4a6028; color: #e8f0e0; }
.cat-chip.cat-local            { background: #ede5d8; color: #6a4a2a; }
.cat-chip.cat-local.active     { background: #6a4a2a; color: #ede5d8; }
.cat-chip.cat-swordsman        { background: #e4e4ec; color: #3a3a5a; }
.cat-chip.cat-swordsman.active { background: #3a3a5a; color: #e4e4ec; }
.cat-chip.cat-courtier         { background: #fde8d0; color: #8a5020; }
.cat-chip.cat-courtier.active  { background: #8a5020; color: #fde8d0; }
.cat-chip.cat-merchant         { background: #faf0c0; color: #7a6010; }
.cat-chip.cat-merchant.active  { background: #7a6010; color: #faf0c0; }
.cat-chip.cat-mythical         { background: #e8f4f0; color: #2a6050; }
.cat-chip.cat-mythical.active  { background: #2a6050; color: #e8f4f0; }
.cat-chip.cat-retainer         { background: #f2e7d6; color: #6a4a20; }
.cat-chip.cat-retainer.active  { background: #6a4a20; color: #f2e7d6; }
.cat-chip.cat-commoner         { background: #ece9e0; color: #6a6050; }
.cat-chip.cat-commoner.active  { background: #6a6050; color: #ece9e0; }
.cat-chip.cat-fictional        { background: #f0e8fa; color: #6a3a8a; }
.cat-chip.cat-fictional.active { background: #6a3a8a; color: #f0e8fa; }
.cat-chip.cat-kin              { background: #f5e8e0; color: #7a4a20; }
.cat-chip.cat-kin.active       { background: #7a4a20; color: #f5e8e0; }
.cat-chip.cat-outcast          { background: #e4dfda; color: #4a3a30; }
.cat-chip.cat-outcast.active   { background: #4a3a30; color: #e4dfda; }

/* cat-chip 开关 — 邦国国类（SKILL_03k） */
.cat-chip.cat-ancient-state        { background: #eee4cc; color: #6a4a2a; }
.cat-chip.cat-ancient-state.active { background: #6a4a2a; color: #eee4cc; }
.cat-chip.cat-dynasty              { background: #f4dfc8; color: #7a3a10; }
.cat-chip.cat-dynasty.active       { background: #7a3a10; color: #f4dfc8; }
.cat-chip.cat-zhou-vassal          { background: #fdf0e0; color: #a0522d; }
.cat-chip.cat-zhou-vassal.active   { background: #a0522d; color: #fdf0e0; }
.cat-chip.cat-qin-end              { background: #efdccc; color: #6a3a20; }
.cat-chip.cat-qin-end.active       { background: #6a3a20; color: #efdccc; }
.cat-chip.cat-han-vassal           { background: #fbe4e4; color: #8b2a2a; }
.cat-chip.cat-han-vassal.active    { background: #8b2a2a; color: #fbe4e4; }
.cat-chip.cat-han-marquis          { background: #fce5d4; color: #8a4520; }
.cat-chip.cat-han-marquis.active   { background: #8a4520; color: #fce5d4; }
.cat-chip.cat-collective           { background: #ede0ee; color: #5a3070; }
.cat-chip.cat-collective.active    { background: #5a3070; color: #ede0ee; }
.cat-chip.cat-tribe-mis            { background: #fde8e0; color: #8a3a10; }
.cat-chip.cat-tribe-mis.active     { background: #8a3a10; color: #fde8e0; }
.cat-chip.cat-place-mis            { background: #fff0d8; color: #8a5020; }
.cat-chip.cat-place-mis.active     { background: #8a5020; color: #fff0d8; }

/* 分类筛选栏 */
.place-category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0.2em 0 1.2em;
    padding-bottom: 0.8em;
    border-bottom: 1px dashed #e6e0c0;
}

/*
 * 开关按钮：尺寸与下方地段徽章保持一致；每类配色与徽章同步
 *   - 弹起（默认）：徽章浅色底 + 深色字 + 淡底阴影
 *   - 按下（.active）：反色（深色底 + 浅色字）+ 内陷阴影 + 整体下移 1px
 */
.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 10px;
    border: none;
    background: #f4ecce;
    font-size: 0.78em;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: #5a4a2a;
    text-decoration: none;
    box-shadow:
        0 1px 0 rgba(90, 74, 42, 0.28),
        0 2px 3px rgba(90, 74, 42, 0.14);
    transition: transform 0.08s ease, box-shadow 0.1s ease, background 0.15s ease, color 0.15s ease;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
    top: 0;
}

.cat-chip:active:not(.active) {
    top: 1px;
    margin-bottom: 1px;
    box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.25);
}

/* 选中态：反色 + 下沉 + 内陷阴影 */
.cat-chip.active {
    top: 1px;
    margin-bottom: 1px;
    box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.35);
}

.cat-chip .cat-count {
    font-size: 0.88em;
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 700;
    opacity: 0.65;
    margin-left: 2px;
}

/* "全部" 按钮（无 cat-* 修饰类）：中性棕系 */
.cat-chip:not([class*="cat-"])        { background: #f4ecce; color: #5a4a2a; }
.cat-chip:not([class*="cat-"]).active { background: #7a3c12; color: #fff8e8; }

/* 各类配色：与下方徽章保持一致，按下时反色 */
.cat-chip.cat-river           { background: #eaf4fa; color: #2f6b8e; }
.cat-chip.cat-river.active    { background: #2f6b8e; color: #eaf4fa; }
.cat-chip.cat-mountain        { background: #ecf3e4; color: #4a6b2a; }
.cat-chip.cat-mountain.active { background: #4a6b2a; color: #ecf3e4; }
.cat-chip.cat-plain           { background: #f5efd9; color: #7a6a2a; }
.cat-chip.cat-plain.active    { background: #7a6a2a; color: #f5efd9; }
.cat-chip.cat-pass            { background: #f8ece0; color: #8b4513; }
.cat-chip.cat-pass.active     { background: #8b4513; color: #f8ece0; }
.cat-chip.cat-region          { background: #f0ecf8; color: #5d4a8a; }
.cat-chip.cat-region.active   { background: #5d4a8a; color: #f0ecf8; }
.cat-chip.cat-nation          { background: #f4e6d8; color: #8a4a2a; }
.cat-chip.cat-nation.active   { background: #8a4a2a; color: #f4e6d8; }
.cat-chip.cat-zhou            { background: #fdf0e0; color: #a0522d; }
.cat-chip.cat-zhou.active     { background: #a0522d; color: #fdf0e0; }
.cat-chip.cat-jun             { background: #fcead0; color: #8b5a2b; }
.cat-chip.cat-jun.active      { background: #8b5a2b; color: #fcead0; }
.cat-chip.cat-xian            { background: #fbf2d4; color: #7c6220; }
.cat-chip.cat-xian.active     { background: #7c6220; color: #fbf2d4; }
.cat-chip.cat-city            { background: #fef3e8; color: #8b4513; }
.cat-chip.cat-city.active     { background: #8b4513; color: #fef3e8; }
.cat-chip.cat-building        { background: #f8e8e8; color: #8a3030; }
.cat-chip.cat-building.active { background: #8a3030; color: #f8e8e8; }
.cat-chip.cat-tomb            { background: #ebe6e0; color: #555555; }
.cat-chip.cat-tomb.active     { background: #555555; color: #ebe6e0; }
.cat-chip.cat-xiang           { background: #f0efe6; color: #6a5a2a; }
.cat-chip.cat-xiang.active    { background: #6a5a2a; color: #f0efe6; }
.cat-chip.cat-road            { background: #eef0f4; color: #4a5a80; }
.cat-chip.cat-road.active     { background: #4a5a80; color: #eef0f4; }
.cat-chip.cat-other           { background: #f4f2ec; color: #888888; }
.cat-chip.cat-other.active    { background: #888888; color: #f4f2ec; }
.cat-chip.cat-mis             { background: #fdecea; color: #a03030; }
.cat-chip.cat-mis.active      { background: #a03030; color: #fdecea; }
.cat-chip.cat-split           { background: #fff4d6; color: #8a6020; }
.cat-chip.cat-split.active    { background: #8a6020; color: #fff4d6; }
.cat-chip.cat-fiction         { background: #f0e8fa; color: #6a3a8a; }
.cat-chip.cat-fiction.active  { background: #6a3a8a; color: #f0e8fa; }

/* 被分类筛选隐藏的条目 */
.entity-entry.cat-hidden {
    display: none;
}

/* ─── 移动端适配 ─── */
@media (max-width: 640px) {
    /* 名称列 + 标签列（+ 人名规范名列）合并为左侧，出处列独占右侧
       地名/官职：entry-left(行1) + entry-category(行2)
       人名：     entry-left(行1) + entry-category(行2) + entry-canonical(行3)
       grid-template-rows 声明 3 行，空行自动折叠为 0 高度，不影响地名/官职 */
    .entity-entry {
        display: grid;
        grid-template-columns: minmax(0, max-content) 1fr;
        grid-template-rows: auto auto auto;
        column-gap: 10px;
        row-gap: 0;
        align-items: start;
    }

    .entry-left {
        grid-column: 1;
        grid-row: 1;
        flex: none;
        width: auto;
        min-width: 0;
    }

    /* 地名/官职：标签在行2 */
    .entry-category {
        grid-column: 1;
        grid-row: 2;
        flex: none;
        width: auto;
        padding-top: 2px;
    }

    /* 人名专用：规范名行2，标签行3（body.person-index 覆盖上方默认值） */
    .entry-canonical {
        grid-column: 1;
        grid-row: 3;
        flex: none;
        width: auto;
        padding-top: 2px;
    }
    body.person-index .entry-canonical { grid-row: 2; }
    body.person-index .entry-category  { grid-row: 3; }

    /* 出处列跨越全部显式行（-1 = 第4条网格线）；
       地名/官职第3行为空，视觉上等同于跨2行 */
    .entry-right {
        grid-column: 2;
        grid-row: 1 / -1;
        align-self: start;
        font-size: 0.78em;
    }
}
