/* ===== 宗族关系平台 - 全局样式 ===== */

/* --- CSS 变量 --- */
:root {
    --primary: #2B5F8A;
    --primary-light: #3A7AB5;
    --primary-dark: #1E4A6E;
    --gold: #C4A35A;
    --gold-light: #D4B86A;
    --red: #B54A4A;
    --red-light: #D46A6A;
    --bg: #F8F6F0;
    --bg-card: #FFFFFF;
    --bg-gray: #F0EEE8;
    --text: #2C2C2C;
    --text-secondary: #7A7A7A;
    --text-light: #AAAAAA;
    --border: #E8E4DC;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-lg: 16px;
    --nav-height: 64px;
    --max-width: 1200px;
}

/* --- Reset & Base --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); }
img { max-width: 100%; height: auto; }

/* --- 顶部导航 --- */
.site-header {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--nav-height);
    background: rgba(255,255,255,0.97);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
}
.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary) !important;
    white-space: nowrap;
    letter-spacing: 1px;
}
.header-search {
    position: relative;
    flex: 1;
    max-width: 400px;
}
.search-input {
    width: 100%;
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    background: var(--bg);
    outline: none;
    transition: all 0.3s;
}
.search-input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(43,95,138,0.1);
}
.search-btn {
    position: absolute;
    right: 4px; top: 4px;
    height: 32px;
    padding: 0 16px;
    border: none;
    border-radius: 16px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.search-btn:hover { background: var(--primary-light); }
.search-dropdown {
    display: none;
    position: absolute;
    top: 44px;
    left: 0; right: 0;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 320px;
    overflow-y: auto;
}
.search-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg); }
.search-item-char {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    width: 48px;
    text-align: center;
    flex-shrink: 0;
}
.search-item-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-left: 12px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}
.notif-bell {
    position: relative;
    cursor: pointer;
    padding: 6px;
    color: var(--text-secondary);
    transition: color 0.2s;
}
.notif-bell:hover { color: var(--primary); }
.notif-badge {
    position: absolute;
    top: 1px; right: 1px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    background: var(--red);
    color: #fff;
    font-size: 11px;
    line-height: 16px;
    border-radius: 8px;
    text-align: center;
}
.btn-login {
    display: inline-block;
    padding: 8px 20px;
    background: var(--primary);
    color: #fff !important;
    border-radius: 20px;
    font-size: 14px;
    transition: background 0.2s;
}
.btn-login:hover { background: var(--primary-light); }
.user-menu {
    position: relative;
    cursor: pointer;
}
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--gold);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}
.user-dropdown {
    display: none;
    position: absolute;
    top: 44px;
    right: 0;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 100;
    overflow: hidden;
}
.user-dropdown a {
    display: block;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text);
    transition: background 0.2s;
    border-bottom: 1px solid var(--border);
}
.user-dropdown a:last-child { border-bottom: none; }
.user-dropdown a:hover { background: var(--bg); color: var(--primary); }
.user-menu:hover .user-dropdown { display: block; }

.mobile-search-toggle {
    display: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-secondary);
}
.mobile-search-bar {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0; right: 0;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    z-index: 999;
    gap: 8px;
}
.mobile-search-bar input {
    flex: 1;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 19px;
    font-size: 14px;
    outline: none;
}
.mobile-search-bar button {
    height: 38px;
    padding: 0 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 19px;
    font-size: 14px;
    cursor: pointer;
}

/* --- 主体内容 --- */
.site-main {
    min-height: calc(100vh - var(--nav-height));
    padding-top: var(--nav-height);
}

/* --- 按钮通用样式 --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-light); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 36px; font-size: 16px; }

/* ===== 首页 - 百家姓 ===== */

/* 品牌横幅 */
.hero-banner {
    position: relative;
    height: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, #1E4A6E 0%, #2B5F8A 40%, #3A6B5E 100%);
    overflow: hidden;
}
.hero-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 800' opacity='0.08'%3E%3Cpath fill='%23ffffff' d='M200,200 Q300,100 400,200 Q500,300 600,200 L600,600 Q500,500 400,600 Q300,500 200,600 Z'/%3E%3C/svg%3E") center/cover;
    opacity: 0.15;
}
.hero-banner h1 {
    font-size: 46px;
    font-weight: 700;
    color: #fff;
    z-index: 1;
    letter-spacing: 4px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.hero-banner p {
    font-size: 18px;
    color: rgba(255,255,255,0.85);
    margin-top: 12px;
    z-index: 1;
    letter-spacing: 2px;
}
.hero-search {
    position: relative;
    width: 520px;
    max-width: 90%;
    margin-top: 28px;
    z-index: 1;
}
.hero-search input {
    width: 100%;
    height: 52px;
    padding: 0 60px 0 24px;
    border: none;
    border-radius: 26px;
    font-size: 16px;
    outline: none;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.hero-search button {
    position: absolute;
    right: 4px; top: 4px;
    height: 44px;
    width: 52px;
    border: none;
    border-radius: 22px;
    background: var(--gold);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}
.hero-search button:hover { background: var(--gold-light); }

/* 快速标签 */
.quick-tags {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    z-index: 1;
    flex-wrap: wrap;
    justify-content: center;
}
.quick-tag {
    padding: 6px 18px;
    border-radius: 20px;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid rgba(255,255,255,0.2);
}
.quick-tag:hover { background: rgba(255,255,255,0.25); }

/* 百家姓列表 */
.surname-section {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px 20px;
}
.surname-section h2 {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 8px;
}
.surname-section .section-desc {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}
.surname-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.surname-filters {
    display: flex;
    gap: 8px;
}
.filter-tag {
    padding: 5px 16px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    background: var(--bg-gray);
    color: var(--text-secondary);
    border: 1px solid transparent;
    transition: all 0.2s;
}
.filter-tag:hover { color: var(--primary); }
.filter-tag.active {
    background: var(--primary);
    color: #fff;
}
.surname-sort {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}
.surname-sort select {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    background: #fff;
    cursor: pointer;
}
.surname-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 10px;
}
.surname-card {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
}
.surname-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    color: var(--primary);
}
.surname-card .badge-dot {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    border-radius: 2px;
    background: var(--primary);
}
.surname-card.inactive {
    background: var(--bg-gray);
    border: 1px dashed var(--text-light);
    color: var(--text-light);
}
.surname-card.inactive:hover {
    border-color: var(--gold);
    color: var(--gold);
}
.surname-card .tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: var(--text);
    color: #fff;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 10;
}
.surname-card:hover .tooltip { display: block; }

/* 数据看板 */
.stats-bar {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px 20px 60px;
}
.stats-inner {
    display: flex;
    justify-content: center;
    gap: 80px;
    padding: 32px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.stat-item {
    text-align: center;
}
.stat-number {
    font-size: 40px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}
.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 查看更多姓氏按钮 */
.view-all-surnames {
    text-align: center;
    margin-top: 20px;
}
.view-all-surnames a {
    display: inline-block;
    padding: 10px 32px;
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.2s;
}
.view-all-surnames a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== 姓氏空间 ===== */
.surname-header {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 30px 20px;
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}
.surname-bigchar {
    font-size: 80px;
    font-weight: 700;
    color: var(--gold);
    line-height: 1;
    flex-shrink: 0;
    font-family: 'Noto Serif SC', 'STSong', serif;
}
.surname-info {
    flex: 1;
    min-width: 200px;
}
.surname-info h2 {
    font-size: 22px;
    color: var(--text);
    margin-bottom: 4px;
}
.surname-info .surname-meta {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.surname-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.surname-tabs {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: var(--nav-height);
    background: var(--bg);
    z-index: 100;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.surname-tab {
    padding: 14px 24px;
    font-size: 15px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.surname-tab:hover { color: var(--primary); }
.surname-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}
.surname-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px 20px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* 分支卡片 */
.branch-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.branch-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.25s;
    border: 1px solid var(--border);
}
.branch-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.branch-card h4 { font-size: 16px; margin-bottom: 6px; }
.branch-card .branch-meta { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.branch-card .branch-chars {
    font-size: 14px;
    color: var(--gold);
    font-weight: 500;
}
.branch-card .branch-stats {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* 待认领先祖 */
.ancestor-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}
.ancestor-card {
    flex-shrink: 0;
    width: 200px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border: 1px dashed var(--gold);
}
.ancestor-card h5 { font-size: 15px; margin-bottom: 4px; }
.ancestor-card .ancestor-meta { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }

/* 动态时间线 */
.timeline {
    position: relative;
    padding-left: 24px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 8px; top: 0; bottom: 0;
    width: 2px;
    background: var(--border);
}
.timeline-item {
    position: relative;
    padding: 0 0 20px 20px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px; top: 4px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg);
}
.timeline-item .time { font-size: 12px; color: var(--text-light); }
.timeline-item .desc { font-size: 14px; margin-top: 2px; }

/* 地理分布 */
.map-container {
    width: 100%;
    height: 400px;
    background: var(--bg-gray);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

/* ===== 族谱树 ===== */
.tree-page {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px;
}
.tree-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.tree-tool-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}
.tree-tool-btn:hover { border-color: var(--primary); color: var(--primary); }
.tree-tool-divider {
    width: 1px; height: 24px;
    background: var(--border);
    margin: 0 4px;
}
.tree-search-inline input {
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    width: 160px;
}

.tree-canvas-wrapper {
    position: relative;
    background: #FAF8F2;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    min-height: 500px;
}
.tree-canvas {
    width: 100%;
    min-height: 500px;
    position: relative;
    overflow: auto;
    padding: 40px;
}
/* 树节点 */
.tree-node {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 16px;
    background: #fff;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    min-width: 100px;
    position: relative;
}
.tree-node:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.tree-node.active-user { border-color: var(--primary); background: #F0F7FF; }
.tree-node.historical { border-color: var(--text-light); background: var(--bg-gray); }
.tree-node.pending { border-color: var(--gold); border-style: dashed; }
.tree-node .node-name { font-size: 14px; font-weight: 600; }
.tree-node .node-years { font-size: 11px; color: var(--text-secondary); }
.tree-node .node-char {
    font-size: 11px;
    color: var(--gold);
    background: rgba(196,163,90,0.1);
    padding: 1px 8px;
    border-radius: 10px;
    margin-top: 2px;
}

/* 树布局 */
.tree-level {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
    position: relative;
}
.tree-level::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    width: 2px;
    height: 20px;
    background: var(--border);
}
.tree-level:last-child::after { display: none; }
.tree-level .tree-node + .tree-node::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -20px;
    width: 20px;
    height: 2px;
    background: var(--border);
}

/* ===== 入驻流程 ===== */
.register-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 40px 20px;
}
.register-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 40px;
}
.progress-step {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    background: var(--bg-gray);
    color: var(--text-secondary);
    flex-shrink: 0;
}
.progress-step.active { background: var(--primary); color: #fff; }
.progress-step.done { background: var(--gold); color: #fff; }
.progress-line {
    width: 60px; height: 2px;
    background: var(--border);
}
.progress-line.done { background: var(--gold); }

.register-step {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: var(--shadow);
}
.register-step h3 {
    font-size: 20px;
    margin-bottom: 6px;
    color: var(--primary-dark);
}
.register-step .step-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}
.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}
.form-group input, .form-group select {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border 0.2s;
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(43,95,138,0.1);
}
.form-group .help-text {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}
.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    gap: 12px;
}
.cascade-selector {
    display: flex;
    gap: 8px;
}
.cascade-selector select { flex: 1; }

/* 匹配结果 */
.match-result {
    text-align: center;
    padding: 20px 0;
}
.match-result .match-icon {
    font-size: 64px;
    margin-bottom: 16px;
}
.match-result h4 { font-size: 20px; margin-bottom: 8px; }
.match-result p { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }
.match-tree-preview {
    background: var(--bg-gray);
    border-radius: var(--radius);
    padding: 20px;
    margin: 16px 0;
    min-height: 120px;
}
.match-candidates {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}
.match-candidate {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-gray);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}
.match-candidate:hover { border-color: var(--primary); }
.match-candidate .match-pct {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}
.match-candidate .match-detail { font-size: 13px; color: var(--text-secondary); }

/* 补充关系 */
.relatives-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin: 16px 0;
}
.relative-slot {
    aspect-ratio: 1;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: var(--text-light);
}
.relative-slot .slot-icon { font-size: 28px; margin-bottom: 4px; }
.relative-slot:hover { border-color: var(--primary); color: var(--primary); }
.relative-slot.filled {
    border-style: solid;
    background: var(--bg);
    color: var(--text);
    border-color: var(--gold);
}

/* 入驻完成 */
.profile-card-result {
    background: linear-gradient(135deg, #1E4A6E, #2B5F8A);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    margin: 16px 0;
}
.profile-card-result .pc-name { font-size: 28px; font-weight: 700; }
.profile-card-result .pc-info { font-size: 14px; opacity: 0.85; margin-top: 8px; }
.profile-card-result .pc-tree-icon {
    margin: 16px auto;
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}

/* ===== 个人档案 ===== */
.profile-page {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 30px 20px;
}
.profile-header-card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}
.profile-avatar-lg {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--gold);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    flex-shrink: 0;
    cursor: pointer;
}
.profile-info h2 { font-size: 24px; margin-bottom: 4px; }
.profile-info .profile-meta { font-size: 14px; color: var(--text-secondary); }
.profile-actions { margin-left: auto; }

.profile-section {
    margin-top: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
}
.profile-section h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--primary-dark);
}

/* 辐射状关系图 */
.relation-radar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 20px 0;
}
.relation-center {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
}
.relation-item {
    text-align: center;
    cursor: pointer;
}
.relation-item .ri-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--bg-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin: 0 auto 4px;
    border: 2px solid var(--border);
    transition: border-color 0.2s;
}
.relation-item:hover .ri-avatar { border-color: var(--primary); }
.relation-item .ri-label { font-size: 12px; color: var(--text-secondary); }
.relation-item .ri-name { font-size: 13px; font-weight: 500; }

/* 贡献记录 */
.contribution-list { }
.contribution-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}
.contribution-item:last-child { border-bottom: none; }
.contribution-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}
.contribution-icon.add { background: #E8F5E9; color: #2E7D32; }
.contribution-icon.confirm { background: #E3F2FD; color: #1565C0; }
.contribution-icon.upload { background: #F3E5F5; color: #7B1FA2; }
.contribution-desc { font-size: 14px; flex: 1; }
.contribution-time { font-size: 12px; color: var(--text-light); white-space: nowrap; }

/* ===== 姓氏报告卡 ===== */
.report-page {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 30px 20px;
}
.report-hero {
    text-align: center;
    padding: 40px 0;
}
.report-hero .report-char {
    font-size: 96px;
    font-weight: 700;
    color: var(--gold);
    font-family: 'Noto Serif SC', 'STSong', serif;
    line-height: 1.2;
}
.report-hero p {
    max-width: 600px;
    margin: 12px auto 0;
    color: var(--text-secondary);
    line-height: 1.8;
}
.report-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 24px 0;
}
.report-stat-card {
    text-align: center;
    padding: 24px 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.report-stat-card .rs-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}
.report-stat-card .rs-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .surname-grid { grid-template-columns: repeat(8, 1fr); }
}
@media (max-width: 768px) {
    .header-search { display: none; }
    .mobile-search-toggle { display: block; }
    .surname-grid { grid-template-columns: repeat(5, 1fr); }
    .surname-card { font-size: 20px; }
    .stats-inner { gap: 30px; padding: 24px 16px; }
    .stat-number { font-size: 28px; }
    .hero-banner { height: 280px; }
    .hero-banner h1 { font-size: 28px; }
    .hero-banner p { font-size: 15px; }
    .hero-search { width: 90%; }
    .branch-cards { grid-template-columns: repeat(2, 1fr); }
    .register-step { padding: 24px; }
    .profile-header-card { flex-direction: column; text-align: center; }
    .profile-actions { margin-left: 0; }
    .report-stats { grid-template-columns: repeat(2, 1fr); }
    .surname-header { flex-direction: column; text-align: center; }
    .surname-actions { justify-content: center; }
    .cascade-selector { flex-direction: column; }
}
@media (max-width: 480px) {
    .surname-grid { grid-template-columns: repeat(4, 1fr); }
    .surname-card { font-size: 18px; }
    .stats-inner { gap: 16px; flex-wrap: wrap; }
    .stats-inner .stat-item { flex: 1; min-width: 80px; }
    .branch-cards { grid-template-columns: 1fr; }
    .tree-level { gap: 20px; }
}

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

/* ===== 加载动画 ===== */
.loading-spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ===== 浮动操作按钮 (FAB) ===== */
.fab {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 300;
    box-shadow: 0 4px 16px rgba(43,95,138,0.4);
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s;
    user-select: none;
}
.fab:hover { transform: scale(1.05); box-shadow: 0 6px 24px rgba(43,95,138,0.5); }
.fab.active { transform: rotate(45deg); }
.fab-icon { transition: transform 0.3s; line-height: 1; }
.fab-menu {
    position: absolute;
    bottom: 64px;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
}
.fab-menu.show { display: flex; }
.fab-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 14px;
    color: var(--text) !important;
    transition: all 0.2s;
    white-space: nowrap;
}
.fab-item:hover { background: var(--bg); color: var(--primary) !important; }
.fab-item-icon { font-size: 18px; }

@media (max-width: 768px) {
    .fab { bottom: 20px; right: 20px; width: 48px; height: 48px; font-size: 24px; }
}

/* ===== 模态弹窗 ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.2s ease;
}
.modal-container {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.25s ease;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}
.modal-header h3 {
    font-size: 20px;
    color: var(--primary-dark);
}
.modal-close {
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}
.modal-close:hover { color: var(--text); }
.modal-body {
    padding: 20px 24px 28px;
}
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== 二维码 ===== */
.qr-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}
.qr-placeholder canvas, .qr-placeholder img {
    border-radius: 4px;
    max-width: 100%;
}
