/* 李家湾胡氏族谱 —— 全站样式（手机 / 电脑自适应） */
:root {
  --brand: #8c2f24;
  --brand-2: #b8452f;
  --brand-soft: #f6e7e2;
  --gold: #c9a227;
  --ink: #2b2320;
  --ink-2: #5b4f47;
  --muted: #8a7f74;
  --bg: #faf6f0;
  --card: #ffffff;
  --line: #e8ded0;
  --ok: #2f7d4f;
  --warn: #b4801d;
  --danger: #b23b32;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 6px 24px rgba(74, 50, 40, .08);
  --shadow-sm: 0 2px 8px rgba(74, 50, 40, .06);
  --max: 1200px;
  --nav-h: 62px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 15px;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 { margin: 0 0 .6em; line-height: 1.3; font-weight: 700; }
h1 { font-size: clamp(20px, 3.4vw, 28px); }
h2 { font-size: clamp(18px, 2.8vw, 22px); }
h3 { font-size: clamp(16px, 2.4vw, 18px); }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.main { min-height: 60vh; padding-bottom: 72px; }

/* ---------------------------------------------------------------- 顶部导航 */
.navbar {
  position: sticky; top: 0; z-index: 60;
  background: linear-gradient(135deg, #8c2f24, #a83b28 60%, #b8452f);
  color: #fff;
  box-shadow: 0 2px 12px rgba(60, 25, 18, .22);
}
.nav-inner { display: flex; align-items: center; gap: 12px; height: var(--nav-h); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .35);
  display: grid; place-items: center; font-weight: 700; font-size: 20px; color: #ffe9c7;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 17px; letter-spacing: .5px; white-space: nowrap; }
.brand-text small { font-size: 11px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-links { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav-links a {
  color: rgba(255, 255, 255, .9); padding: 8px 12px; border-radius: 8px;
  font-size: 14px; white-space: nowrap;
}
.nav-links a:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.nav-links a.active { background: rgba(255, 255, 255, .22); color: #fff; font-weight: 600; }
.nav-links a.nav-admin { border: 1px solid rgba(255, 255, 255, .45); }
.hamburger { display: none; margin-left: auto; background: none; border: 0; padding: 8px; cursor: pointer; }
.hamburger span { display: block; width: 22px; height: 2px; background: #fff; margin: 5px 0; border-radius: 2px; transition: .2s; }

.page-head { padding: 22px 16px 6px; }
.page-head h1 { margin-bottom: 4px; }
.page-desc { color: var(--muted); font-size: 14px; margin: 0; }

/* ---------------------------------------------------------------- 通用组件 */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 14px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title h2, .card-title h3 { margin: 0; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.section { padding: 18px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; background: var(--brand); color: #fff;
  line-height: 1.4; font-family: inherit;
}
.btn:hover { background: var(--brand-2); color: #fff; }
.btn-ghost { background: #fff; color: var(--brand); border-color: var(--line); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand); }
.btn-gold { background: var(--gold); }
.btn-gold:hover { background: #d8b53a; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c94b41; }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px;
  background: var(--brand-soft); color: var(--brand); border: 1px solid #ecd3cb;
}
.badge-male { background: #e8f1fb; color: #2c5d94; border-color: #cfe0f2; }
.badge-female { background: #fdeaf2; color: #a8407a; border-color: #f5d3e4; }
.badge-ok { background: #e6f4ea; color: var(--ok); border-color: #cbe7d4; }
.badge-warn { background: #fdf3e0; color: var(--warn); border-color: #f4e2bf; }
.badge-danger { background: #fbe9e8; color: var(--danger); border-color: #f4d3d1; }
.badge-muted { background: #f1eee9; color: var(--muted); border-color: #e5ddd2; }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin: 0 16px 12px; font-size: 14px; }
.alert-success { background: #e9f6ee; color: var(--ok); border: 1px solid #cbe7d4; }
.alert-error { background: #fbeae9; color: var(--danger); border: 1px solid #f4d3d1; }
.alert-warn { background: #fdf4e3; color: var(--warn); border: 1px solid #f4e2bf; }
.main > .alert:first-child { margin-top: 16px; }

.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; font-weight: 600; }
.form-control {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
.form-control:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(184, 69, 47, .12); }
textarea.form-control { min-height: 92px; resize: vertical; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.form-inline .form-row { margin-bottom: 0; flex: 1 1 160px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
table.data th, table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.data th { background: #fbf7f2; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
table.data tr:hover td { background: #fdfaf6; }
table.data td.nowrap, table.data th.nowrap { white-space: nowrap; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-align: center; box-shadow: var(--shadow-sm);
}
.stat .num { font-size: clamp(20px, 4vw, 26px); font-weight: 700; color: var(--brand); }
.stat .lbl { font-size: 13px; color: var(--muted); }
.stat.gold .num { color: var(--gold); }

.empty { text-align: center; color: var(--muted); padding: 32px 12px; font-size: 14px; }

.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { padding: 4px 12px; border-radius: 20px; background: #fff; border: 1px solid var(--line); font-size: 13px; }
.pill.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mt-2 { margin-top: 10px; } .mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 10px; } .mb-3 { margin-bottom: 16px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------------------------------------------------------- 首页 */
.hero {
  position: relative; color: #fff; padding: 42px 0 62px;
  background:
    radial-gradient(1200px 320px at 15% -10%, rgba(255, 233, 199, .22), transparent),
    linear-gradient(135deg, #7c281f, #a83b28 55%, #8c2f24);
}
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 26px;
  background: var(--bg); border-radius: 26px 26px 0 0;
}
.hero-inner { display: grid; grid-template-columns: 1.35fr 1fr; gap: 26px; align-items: center; position: relative; z-index: 1; }
.hero h1 { font-size: clamp(24px, 5vw, 38px); letter-spacing: 3px; margin-bottom: 10px; }
.hero .slogan { font-size: clamp(14px, 2.4vw, 17px); color: #ffe9c7; letter-spacing: 2px; margin-bottom: 14px; }
.hero .intro { color: rgba(255, 255, 255, .9); font-size: 14px; max-width: 46em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.hero .btn-ghost { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .5); }
.hero .btn-ghost:hover { background: rgba(255, 255, 255, .24); color: #fff; }

.worship-box {
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 18px; padding: 20px; text-align: center; backdrop-filter: blur(4px);
}
.worship-box .label { font-size: 13px; color: #ffe9c7; letter-spacing: 2px; }
.worship-box .count { font-size: clamp(30px, 7vw, 44px); font-weight: 700; color: #fff; line-height: 1.2; }
.worship-box .unit { font-size: 13px; color: rgba(255, 255, 255, .85); }
.lamp {
  font-size: 32px; line-height: 1; display: inline-block; transform-origin: 50% 100%;
  animation: flicker 2.6s ease-in-out infinite;
}
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-2deg); opacity: 1; } 50% { transform: scale(1.08) rotate(2deg); opacity: .88; } }

.home-cards { margin-top: -34px; position: relative; z-index: 2; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.feature {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); transition: .18s;
}
.feature:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(74, 50, 40, .12); }
.feature .icon { font-size: 24px; }
.feature h3 { margin: 8px 0 4px; }
.feature p { color: var(--muted); font-size: 13px; margin: 0; }

.member-card {
  display: flex; gap: 12px; align-items: center; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}
.member-avatar {
  width: 44px; height: 44px; flex: none; border-radius: 50%; overflow: hidden;
  background: var(--brand-soft); color: var(--brand); display: grid; place-items: center;
  font-weight: 700; font-size: 17px; border: 1px solid #ecd3cb;
}
.member-avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-card .info { min-width: 0; }
.member-card .name { font-weight: 700; }
.member-card .meta { font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- 族谱树 */
.tree-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 12px;
}
.tree-toolbar .spacer { flex: 1; }
.tree-stage {
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; height: 70vh; min-height: 420px; box-shadow: var(--shadow-sm);
  background-image: radial-gradient(#efe7db 1px, transparent 1px);
  background-size: 22px 22px;
  touch-action: none;
}
.tree-canvas { transform-origin: 0 0; will-change: transform; }
.tree-canvas svg { display: block; }
.tree-legend {
  position: absolute; left: 10px; bottom: 10px; z-index: 3; background: rgba(255, 255, 255, .93);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 12px; color: var(--ink-2);
}
.tree-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.tree-zoom { position: absolute; right: 10px; bottom: 10px; z-index: 3; display: flex; flex-direction: column; gap: 6px; }
.tree-zoom button {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; font-size: 16px; cursor: pointer; color: var(--ink-2);
}
.node-box { cursor: pointer; }
.node-box rect { fill: #fff; stroke: var(--line); stroke-width: 1.2; transition: .15s; }
.node-box:hover rect { stroke: var(--brand); stroke-width: 2; }
.node-box.male rect { fill: #f4f8fd; }
.node-box.female rect { fill: #fdf4f8; }
.node-box.dead rect { fill: #f7f5f2; }
.node-box.hl rect { stroke: var(--gold); stroke-width: 2.5; filter: drop-shadow(0 0 6px rgba(201, 162, 39, .55)); }
.node-box text { font-size: 13px; fill: var(--ink); pointer-events: none; }
.node-box text.sub { font-size: 10.5px; fill: var(--muted); }
.node-box text.name { font-weight: 700; }
.link { fill: none; stroke: #cdb9a4; stroke-width: 1.4; }
.link-h { stroke: #d9a9a0; stroke-dasharray: 3 3; }
.gen-label text { font-size: 12px; fill: var(--brand); font-weight: 700; }

.member-list-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.member-list-item:last-child { border-bottom: 0; }

/* ---------------------------------------------------------------- 成员详情 */
.detail-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.detail-photo {
  width: 118px; height: 148px; flex: none; border-radius: 12px; overflow: hidden;
  background: var(--brand-soft); display: grid; place-items: center; color: var(--brand);
  font-size: 34px; font-weight: 700; border: 1px solid var(--line);
}
.detail-photo img { width: 100%; height: 100%; object-fit: cover; }
.detail-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; flex: 1 1 320px; }
.detail-meta div { font-size: 14px; }
.detail-meta b { color: var(--ink-2); font-weight: 600; margin-right: 6px; }
.rel-list { display: flex; flex-wrap: wrap; gap: 8px; }
.rel-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 20px; background: #fff; font-size: 13px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.gallery a, .gallery .ph { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #f7f2ec; }
.gallery img { width: 100%; height: 120px; object-fit: cover; }
.gallery .doc { display: flex; align-items: center; justify-content: center; height: 120px; font-size: 13px; color: var(--ink-2); text-align: center; padding: 8px; }

.timeline { padding-left: 18px; border-left: 2px solid var(--line); }
.timeline .item { position: relative; padding: 0 0 14px 12px; font-size: 14px; }
.timeline .item::before {
  content: ""; position: absolute; left: -25px; top: 8px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--brand); border: 2px solid #fff;
}

/* ---------------------------------------------------------------- 地图 */
.map-box { height: 62vh; min-height: 380px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.map-box .leaflet-popup-content { font-size: 13px; margin: 10px 12px; }
.map-box .leaflet-popup-content h4 { margin: 0 0 4px; }
.leaflet-container { font-family: inherit; }
.grave-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.pick-hint { background: #fdf4e3; border: 1px solid #f4e2bf; color: var(--warn); padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; }

/* ---------------------------------------------------------------- 分享页 */
.share-card {
  background: linear-gradient(140deg, #fff, #fdf6ef); border: 1px solid var(--line);
  border-radius: 18px; padding: 24px; text-align: center; box-shadow: var(--shadow);
}
.share-card .seal {
  width: 62px; height: 62px; margin: 0 auto 12px; border-radius: 14px; color: #fff;
  background: linear-gradient(135deg, #8c2f24, #b8452f); display: grid; place-items: center;
  font-size: 30px; font-weight: 700; letter-spacing: 2px;
}
.share-link { display: flex; gap: 8px; margin-top: 10px; }
.share-link input { flex: 1; }
.qr-box { display: inline-block; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }

/* ---------------------------------------------------------------- 后台 */
.admin-layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.admin-side {
  background: #2f2320; color: #f0e7dd; padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-side .side-brand { display: flex; align-items: center; gap: 9px; padding: 6px 8px 16px; }
.admin-side .side-brand .brand-mark { background: rgba(255, 255, 255, .14); }
.admin-side .side-brand strong { font-size: 15px; display: block; }
.admin-side .side-brand small { font-size: 11px; color: #c9b6a8; }
.admin-side nav a {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 9px;
  color: #e2d6c9; font-size: 14px; margin-bottom: 3px;
}
.admin-side nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.admin-side nav a.active { background: var(--brand); color: #fff; font-weight: 600; }
.admin-side .side-foot { margin-top: 16px; padding: 10px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: 12px; color: #b5a294; }
.admin-main { padding: 20px 22px 60px; background: var(--bg); min-width: 0; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-head h1 { margin: 0; font-size: 21px; }
.admin-mobile-bar { display: none; }
.admin-main .alert { margin: 0 0 14px; }
.admin-main .card { overflow: hidden; }
.inline-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.admin-form-grid .span-2 { grid-column: span 2; }
.admin-form-grid .span-3 { grid-column: span 3; }

/* ---------------------------------------------------------------- 底部与移动端 */
.footer { background: #2f2320; color: #cfc2b6; padding: 26px 0 18px; font-size: 13px; margin-top: 24px; }
.footer-inner { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 20px; }
.footer h3, .footer h4 { color: #fff; font-size: 15px; margin-bottom: 8px; }
.footer p { color: #b9a99c; margin: 0; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: 5px; }
.footer a { color: #d9ccc0; }
.footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .1); margin-top: 18px; padding-top: 12px; text-align: center; font-size: 12px; color: #9c8c7f; }
.tabbar { display: none; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px);
  background: rgba(43, 35, 32, .93); color: #fff; padding: 9px 18px; border-radius: 22px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .24s; z-index: 200; max-width: 84vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(30, 20, 16, .55); z-index: 150;
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 520px; max-height: 86vh;
  overflow-y: auto; padding: 20px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}
.modal h3 { margin-top: 0; }

/* 响应式 */
@media (max-width: 1024px) {
  .hero-inner { grid-template-columns: 1fr; }
  .grid-4, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-form-grid .span-3 { grid-column: span 2; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { position: fixed; left: 0; top: 0; width: 240px; z-index: 120; transform: translateX(-100%); transition: .25s; }
  .admin-side.open { transform: none; }
  .admin-mobile-bar {
    display: flex; align-items: center; gap: 10px; background: #2f2320; color: #fff;
    padding: 10px 14px; position: sticky; top: 0; z-index: 100;
  }
  .admin-mobile-bar button { background: rgba(255, 255, 255, .14); border: 0; color: #fff; font-size: 17px; border-radius: 8px; padding: 4px 10px; cursor: pointer; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  body { font-size: 15px; }
  .nav-links {
    position: fixed; top: var(--nav-h); left: 0; right: 0; background: #fff; color: var(--ink);
    flex-direction: column; align-items: stretch; padding: 8px 12px 14px; gap: 2px;
    box-shadow: 0 12px 24px rgba(60, 25, 18, .18); transform: translateY(-140%); transition: .26s;
    max-height: calc(100vh - var(--nav-h)); overflow-y: auto;
  }
  .nav-links.open { transform: none; }
  .nav-links a { color: var(--ink); padding: 11px 12px; border-radius: 9px; }
  .nav-links a:hover, .nav-links a.active { background: var(--brand-soft); color: var(--brand); }
  .nav-links a.nav-admin { border-color: var(--line); }
  .hamburger { display: block; }
  .hero { padding: 28px 0 54px; }
  .grid-2, .grid-3, .grid-4, .feature-grid, .stat-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-meta { grid-template-columns: 1fr; }
  .grave-form-grid, .admin-form-grid { grid-template-columns: 1fr; }
  .admin-form-grid .span-2, .admin-form-grid .span-3 { grid-column: span 1; }
  .main { padding-bottom: 84px; }
  .footer { padding-bottom: 76px; }
  .footer-inner { grid-template-columns: 1fr; }
  .tree-stage { height: 66vh; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -3px 14px rgba(74, 50, 40, .07);
  }
  .tabbar a {
    flex: 1; text-align: center; font-size: 11px; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 0;
  }
  .tabbar a.active { color: var(--brand); font-weight: 600; }
  .tab-icon { font-size: 18px; line-height: 1.1; }
  .modal { max-width: 100%; }
  .btn { padding: 10px 16px; }
}

@media (max-width: 380px) {
  .brand-text small { display: none; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}