:root {
  --primary: #8B2323;
  --primary-light: #B83A3A;
  --primary-dark: #611818;
  --bg: #F4F6F8;
  --card: #FFFFFF;
  --text: #1F2937;
  --text-2: #4B5563;
  --text-3: #6B7280;
  --border: #E5E7EB;
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
body { padding-bottom: calc(72px + var(--safe-bottom)); }
#app { max-width: 600px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; }
@media (min-width: 640px){
  body { background: linear-gradient(160deg, #e6ecf3 0%, #f1f5f9 100%); }
  #app { box-shadow: 0 0 60px rgba(17,24,39,0.10); }
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; border: none; background: none; cursor: pointer; }

/* Header */
.header { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: #fff; padding: 22px 16px 28px; position: relative; overflow: hidden; }
.header::before { content: ''; position: absolute; right: -50px; top: -50px; width: 180px; height: 180px; background: rgba(255,255,255,0.08); border-radius: 50%; }
.header-top { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.logo { width: 52px; height: 52px; border-radius: 50%; background: #fff; padding: 4px; box-shadow: 0 2px 10px rgba(0,0,0,0.15); flex-shrink: 0; }
.logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
.header-text h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.header-text p { margin: 4px 0 0; font-size: 13px; opacity: 0.92; }
.header-motto { margin-top: 14px; font-size: 14px; opacity: 0.9; position: relative; z-index: 1; }

/* Search bar */
.search-wrap { position: relative; z-index: 2; margin: -22px 16px 18px; }
.search-box { display: flex; align-items: center; background: var(--card); border-radius: 30px; box-shadow: var(--shadow); padding: 10px 14px; border: 1px solid var(--border); }
.search-box svg { color: var(--text-3); flex-shrink: 0; }
.search-box input { flex: 1; border: none; outline: none; font-size: 15px; margin: 0 10px; background: transparent; color: var(--text); }
.search-box button { background: var(--primary); color: #fff; font-size: 13px; padding: 7px 16px; border-radius: 20px; font-weight: 500; }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 16px 18px; }
.tag { background: #fff; border: 1px solid var(--border); color: var(--text-2); font-size: 12px; padding: 5px 11px; border-radius: 20px; }
.tag-hot { border-color: rgba(139,35,35,0.25); background: rgba(139,35,35,0.06); color: var(--primary-dark); }

/* Section title */
.section-title { font-size: 17px; font-weight: 700; margin: 22px 16px 12px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ''; width: 4px; height: 18px; background: var(--primary); border-radius: 2px; }
.section-subtitle { font-size: 12px; color: var(--text-3); margin: -8px 16px 12px; }

/* Category grid */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 16px 18px; }
.cat-item { background: var(--card); border-radius: var(--radius-sm); padding: 12px 6px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid var(--border); }
.cat-icon { width: 40px; height: 40px; margin: 0 auto 6px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; background: rgba(139,35,35,0.08); }
.cat-item h3 { margin: 0; font-size: 13px; font-weight: 600; }
.cat-item p { margin: 2px 0 0; font-size: 10px; color: var(--text-3); line-height: 1.3; }

/* Hot cards */
.hot-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 16px 18px; }
.hot-card { background: var(--card); border-radius: var(--radius-sm); overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.05); border: 1px solid var(--border); display: flex; flex-direction: column; }
.hot-card-img { height: 86px; background: linear-gradient(135deg, var(--primary-light), var(--primary)); position: relative; }
.hot-card-img img { width: 100%; height: 100%; object-fit: cover; }
.hot-card-icon { position: absolute; right: 8px; bottom: -14px; width: 32px; height: 32px; background: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; box-shadow: var(--shadow); }
.hot-card-body { padding: 18px 12px 12px; flex: 1; }
.hot-card-body h4 { margin: 0; font-size: 14px; font-weight: 700; }
.hot-card-body p { margin: 4px 0 0; font-size: 11px; color: var(--text-3); line-height: 1.4; }
.hot-card.no-img .hot-card-img { background: linear-gradient(135deg, #c24141, #8B2323); }

/* Quick links */
.quick-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 16px 18px; }
.quick-link { background: var(--card); border-radius: var(--radius-sm); padding: 12px 6px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid var(--border); }
.quick-link .icon { font-size: 24px; margin-bottom: 4px; }
.quick-link span { font-size: 12px; color: var(--text-2); }

/* Page header */
.page-header { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: #fff; padding: 14px 16px 18px; position: sticky; top: 0; z-index: 50; }
.page-header-top { display: flex; align-items: center; gap: 12px; }
.page-header-top button { color: #fff; display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.15); }
.page-header h2 { margin: 0; font-size: 18px; font-weight: 700; }
.page-header p { margin: 4px 0 0 46px; font-size: 12px; opacity: 0.9; }

/* Section blocks */
.page-body { padding: 14px 16px 24px; }
.intro-card { background: var(--card); border-radius: var(--radius-sm); padding: 14px; font-size: 14px; color: var(--text-2); box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid var(--border); margin-bottom: 14px; }

/* Grid cards */
.grid-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.grid-card { background: var(--card); border-radius: var(--radius-sm); padding: 14px 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid var(--border); }
.grid-card .g-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 8px; }
.grid-card-img { width: 100%; height: 84px; border-radius: var(--radius-xs); overflow: hidden; margin-bottom: 8px; }
.grid-card-img img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.grid-card h4 { margin: 0; font-size: 14px; font-weight: 700; }
.grid-card p { margin: 6px 0 0; font-size: 12px; color: var(--text-3); line-height: 1.45; }

/* List cards */
.list-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.list-card { background: var(--card); border-radius: var(--radius-sm); padding: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid var(--border); }
.list-card-top { display: flex; gap: 12px; }
.list-card-img { width: 72px; height: 72px; border-radius: var(--radius-xs); object-fit: cover; flex-shrink: 0; background: var(--bg); }
.list-card-head { flex: 1; }
.list-card-head .l-icon { font-size: 22px; }
.list-card-head h4 { margin: 4px 0 0; font-size: 15px; font-weight: 700; }
.list-card-head .subtitle { margin: 4px 0 0; font-size: 12px; color: var(--text-3); }
.list-card ul { margin: 10px 0 0; padding-left: 18px; font-size: 13px; color: var(--text-2); }
.list-card li { margin-bottom: 5px; line-height: 1.5; }
.list-card li:last-child { margin-bottom: 0; }

/* Tips */
.tips-card { background: #fffbf0; border: 1px solid #fde68a; border-radius: var(--radius-sm); padding: 14px; margin-bottom: 14px; }
.tips-card h4 { margin: 0 0 10px; font-size: 14px; color: #92400e; display: flex; align-items: center; gap: 6px; }
.tips-card ul { margin: 0; padding-left: 18px; font-size: 13px; color: #78350f; }
.tips-card li { margin-bottom: 5px; line-height: 1.5; }

/* Table */
.simple-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius-sm); overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid var(--border); margin-bottom: 14px; font-size: 13px; }
.simple-table th { background: rgba(139,35,35,0.08); color: var(--primary-dark); padding: 10px; text-align: left; font-weight: 600; }
.simple-table td { padding: 10px; border-top: 1px solid var(--border); color: var(--text-2); }
.simple-table tr:nth-child(even) td { background: #fafafa; }

/* Timeline */
.timeline { background: var(--card); border-radius: var(--radius-sm); padding: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid var(--border); margin-bottom: 14px; }
.timeline-item { display: flex; gap: 12px; position: relative; padding-bottom: 12px; }
.timeline-item:not(:last-child)::before { content: ''; position: absolute; left: 7px; top: 22px; bottom: 0; width: 2px; background: var(--border); }
.timeline-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 4px; }
.timeline-date { font-size: 12px; color: var(--primary); font-weight: 600; }
.timeline-title { font-size: 14px; color: var(--text); font-weight: 600; }

/* Wechat list */
.wechat-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.wechat-item { background: var(--card); border-radius: var(--radius-sm); padding: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.wechat-icon { width: 44px; height: 44px; border-radius: 10px; background: linear-gradient(135deg, #07c160, #10b981); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.wechat-info h4 { margin: 0; font-size: 15px; font-weight: 700; }
.wechat-info p { margin: 4px 0 0; font-size: 12px; color: var(--text-3); line-height: 1.4; }
.wechat-badge { margin-left: auto; background: #fee2e2; color: #991b1b; font-size: 11px; padding: 3px 8px; border-radius: 10px; font-weight: 600; }

/* Map */
.map-card { background: var(--card); border-radius: var(--radius-sm); overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid var(--border); margin-bottom: 14px; }
.map-card img { width: 100%; cursor: zoom-in; }
.map-card .caption { padding: 12px; font-size: 13px; color: var(--text-2); }

/* Hero image */
.hero-image { position: relative; border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.hero-image img { width: 100%; }
.hero-overlay { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(to top, rgba(0,0,0,0.7), transparent); padding: 18px 14px 14px; color: #fff; }
.hero-overlay h4 { margin: 0; font-size: 16px; }
.hero-overlay p { margin: 4px 0 0; font-size: 12px; opacity: 0.9; }

/* People grid */
.people-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.people-card { background: var(--card); border-radius: var(--radius-sm); padding: 14px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid var(--border); }
.people-card .p-icon { font-size: 28px; margin-bottom: 6px; }
.people-card h4 { margin: 0; font-size: 15px; }
.people-card .role { font-size: 12px; color: var(--primary); margin-top: 2px; font-weight: 600; }
.people-card .for { font-size: 12px; color: var(--text-3); margin-top: 6px; line-height: 1.4; }

/* Rules list */
.rules-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.rule-group { margin-bottom: 18px; }
.rule-group-title { font-size: 14px; font-weight: 700; color: var(--primary-dark); margin: 14px 0 10px; padding-left: 10px; border-left: 3px solid var(--primary); }
.rule-item { background: var(--card); border-radius: var(--radius-sm); padding: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid var(--border); }
.rule-item h4 { margin: 0; font-size: 15px; font-weight: 700; color: var(--primary-dark); }
.rule-item p { margin: 6px 0 0; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.rule-meta { display: flex; gap: 8px; margin-top: 10px; }
.rule-meta span { font-size: 11px; padding: 3px 8px; border-radius: 10px; background: rgba(139,35,35,0.08); color: var(--primary-dark); }

/* Modal */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.78); z-index: 100; align-items: center; justify-content: center; padding: 14px; }
.modal.active { display: flex; }
.modal-box { background: var(--card); width: 100%; max-width: 640px; max-height: 88vh; border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.modal-back { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; color: var(--text); border-radius: 50%; }
.modal-title { flex: 1; text-align: center; font-weight: 700; font-size: 16px; margin: 0 -34px 0 0; }
.modal-body { padding: 16px; overflow-y: auto; flex: 1; }
.modal-card { background: #fff; border-radius: var(--radius-sm); padding: 16px; border: 1px solid var(--border); }
.modal-card h3 { margin: 0 0 12px; color: var(--primary-dark); font-size: 17px; }
.modal-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.modal-tab { padding: 7px 14px; border-radius: 20px; font-size: 13px; background: var(--bg); color: var(--text-2); }
.modal-tab.active { background: var(--primary); color: #fff; }
.rule-detail { white-space: pre-wrap; font-size: 14px; color: var(--text-2); line-height: 1.85; max-height: 52vh; overflow-y: auto; }
.page-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.page-grid img { width: 100%; border-radius: var(--radius-xs); cursor: zoom-in; }
.page-grid .pg-item { background: var(--bg); border-radius: var(--radius-xs); padding: 6px; text-align: center; }
.page-grid .pg-label { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.modal-src { font-size: 11px; color: var(--text-3); margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }

/* Image modal */
.img-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 110; align-items: center; justify-content: center; }
.img-modal.active { display: flex; }
.img-modal img { max-width: 96%; max-height: 90vh; border-radius: var(--radius-xs); }
.img-modal-close { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; background: rgba(255,255,255,0.12); border-radius: 50%; display: flex; align-items: center; justify-content: center; }

/* Category sheet */
.cat-sheet { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; }
.cat-sheet.active { display: block; }
.cat-sheet-box { position: absolute; left: 50%; bottom: 0; width: 100%; max-width: 600px; transform: translateX(-50%) translateY(100%); transition: transform .25s ease; background: var(--card); border-radius: var(--radius) var(--radius) 0 0; padding: 16px 16px calc(20px + var(--safe-bottom)); max-height: 72vh; overflow-y: auto; }
.cat-sheet.active .cat-sheet-box { transform: translateX(-50%) translateY(0); }
.cat-sheet-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 16px; margin-bottom: 12px; }
.cat-sheet-head button { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; color: var(--text-2); }

/* Search result */
.search-page { padding: 16px; }
.search-input-wrap { position: sticky; top: 0; background: var(--bg); padding: 8px 0 12px; z-index: 10; }
.search-input-box { display: flex; align-items: center; background: var(--card); border-radius: 30px; padding: 10px 14px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.search-input-box input { flex: 1; border: none; outline: none; font-size: 15px; margin-left: 10px; background: transparent; }
.result-item { background: var(--card); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid var(--border); border-left: 4px solid var(--primary); }
.result-item h4 { margin: 0; font-size: 15px; }
.result-item p { margin: 6px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.result-item .meta { margin-top: 8px; font-size: 11px; color: var(--text-3); }
.empty-tip { text-align: center; color: var(--text-3); padding: 40px 20px; }

/* Bottom nav */
.bottom-nav { position: fixed; left: 50%; bottom: 0; width: 100%; max-width: 600px; transform: translateX(-50%); background: #fff; border-top: 1px solid var(--border); display: flex; justify-content: space-around; align-items: center; padding: 8px 0 calc(8px + var(--safe-bottom)); z-index: 60; }
.nav-item { flex: 1; text-align: center; color: var(--text-3); font-size: 11px; padding: 4px 0; }
.nav-item.active { color: var(--primary); }
.nav-item .icon { font-size: 22px; display: block; margin-bottom: 2px; }

/* Utility */
.highlight { background: #fef08a; padding: 0 2px; border-radius: 3px; }
.src-note { font-size: 11px; color: var(--text-3); margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--border); }
.footer { text-align: center; font-size: 11px; color: var(--text-3); padding: 20px 16px 10px; }
.contact-bar { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: var(--radius-sm); padding: 14px; margin: 0 16px 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid var(--border); }
.contact-bar:active { background: #fafafa; }
.contact-icon { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #07c160, #10b981); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.contact-info { flex: 1; }
.contact-title { font-size: 13px; color: var(--text-2); font-weight: 600; }
.contact-id { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.contact-id span { color: var(--primary); font-weight: 700; }
.contact-arrow { font-size: 22px; color: var(--text-3); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: rgba(20,20,22,0.92); color: #fff; font-size: 13px; padding: 10px 18px; border-radius: 22px; z-index: 9999; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: 82%; text-align: center; line-height: 1.4; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Rules tree */
.rules-tree { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px 4px; margin-bottom: 16px; }
.tree-title { font-size: 14px; font-weight: 700; color: var(--primary-dark); display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.tree-sub { font-size: 11px; font-weight: 400; color: var(--text-3); }
.tree-branch { border-top: 1px solid var(--border); }
.tree-head { display: flex; align-items: center; gap: 8px; padding: 11px 2px; cursor: pointer; }
.tree-caret { width: 16px; color: var(--primary); font-size: 12px; flex-shrink: 0; transition: transform .2s; }
.tree-branch-label { flex: 1; font-size: 14px; font-weight: 600; color: var(--text); }
.tree-count { font-size: 11px; color: var(--text-3); background: var(--bg); padding: 2px 8px; border-radius: 10px; }
.tree-body { padding: 0 0 4px 22px; }
.tree-leaf { display: flex; align-items: center; gap: 8px; padding: 9px 4px; font-size: 13px; color: var(--text-2); border-top: 1px dashed var(--border); cursor: pointer; }
.tree-leaf:first-child { border-top: none; }
.tree-leaf:active { color: var(--primary); }
.tree-leaf-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); opacity: .5; flex-shrink: 0; }
