/* 阿乎佬木家谱 · 现代移动优先 */
:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --text: #18181b;
  --muted: #71717a;
  --border: #e4e4e7;
  --accent: #0d9488;
  --accent-dim: #0f766e;
  --accent-soft: #ccfbf1;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.06);
  --radius: 16px;
  --radius-sm: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --nav-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
}

a { color: var(--accent-dim); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶栏 */
.g-top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(135deg, #0f766e 0%, #115e59 50%, #134e4a 100%);
  color: #fff;
  padding: 14px 18px 18px;
  box-shadow: var(--shadow);
}
.g-top h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.g-top .g-sub {
  margin: 6px 0 0;
  font-size: 0.8rem;
  opacity: 0.92;
  font-weight: 450;
}

.g-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 8px;
}

/* 卡片 */
.g-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.g-card h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.g-muted { color: var(--muted); font-size: 0.875rem; }
.g-intro { font-size: 0.92rem; color: #3f3f46; line-height: 1.65; }

/* 网格入口 */
.g-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (min-width: 480px) {
  .g-grid { grid-template-columns: repeat(3, 1fr); }
}
.g-tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  text-align: center;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.g-tile:active { transform: scale(0.98); }
.g-tile span {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 6px;
}
.g-tile--wide { grid-column: 1 / -1; background: var(--accent-soft); border-color: #99f6e4; color: var(--accent-dim); }

/* 列表行 */
.g-list a.g-row, .g-row--click {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 6px;
  border-bottom: 1px solid #f4f4f5;
  color: inherit;
  text-decoration: none;
}
.g-list a.g-row:last-child { border-bottom: none; }
.g-row .g-name { font-weight: 600; }
.g-row .g-meta { font-size: 0.78rem; color: var(--muted); text-align: right; }

.g-badge {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f4f4f5;
  color: #52525b;
  margin-left: 6px;
  vertical-align: middle;
}
.g-badge--m { background: #dbeafe; color: #1d4ed8; }
.g-badge--f { background: #fce7f3; color: #be185d; }

/* 按钮 */
.g-btn {
  display: inline-block;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #fff;
  text-decoration: none;
  text-align: center;
}
.g-btn:hover { text-decoration: none; opacity: 0.95; }
.g-btn--ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

/* 底栏 */
.g-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.g-nav::-webkit-scrollbar { display: none; }
.g-nav a {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 0.62rem;
  color: var(--muted);
  padding: 4px 2px;
  text-decoration: none;
  font-weight: 500;
}
.g-nav a.on { color: var(--accent-dim); font-weight: 700; }
.g-nav .ic { display: block; font-size: 1.2rem; margin-bottom: 2px; }

/* 表单 */
.g-form label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.g-form input, .g-form select, .g-form textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  margin-bottom: 14px;
  font-family: inherit;
}
.g-form textarea { min-height: 120px; resize: vertical; }
.g-form input:focus, .g-form select:focus, .g-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* 世系节点 */
.g-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.g-tree-node {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  max-width: 280px;
  text-align: center;
  box-shadow: var(--shadow);
}
.g-tree-line { width: 2px; height: 12px; background: #d4d4d8; }
.g-tree-node--here {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* 统计 */
.g-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 420px) { .g-stat-grid { grid-template-columns: repeat(4, 1fr); } }
.g-stat {
  background: #fafafa;
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  border: 1px solid var(--border);
}
.g-stat b { display: block; font-size: 1.35rem; color: var(--accent-dim); font-weight: 800; }
.g-stat span { font-size: 0.68rem; color: var(--muted); }

/* 管理员布局 */
.a-top {
  background: #18181b;
  color: #fafafa;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.a-top h1 { margin: 0; font-size: 1rem; font-weight: 600; }
.a-top nav { margin-top: 8px; font-size: 0.8rem; }
.a-top nav a { color: #a1a1aa; margin-right: 12px; }
.a-top nav a:hover { color: #fff; }
.a-main { max-width: 900px; margin: 0 auto; padding: 16px; padding-bottom: 32px; }

.g-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.g-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  background: #f4f4f5;
}

/* 安葬地 · 导航按钮 */
.g-burial-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.g-burial-nav__btn {
  font-size: 0.8rem !important;
  padding: 10px 14px !important;
  flex: 1 1 auto;
  min-width: calc(50% - 4px);
  text-align: center;
  justify-content: center;
}
@media (min-width: 480px) {
  .g-burial-nav__btn { min-width: 140px; flex: 0 1 auto; }
}
