:root {
  --bg: #f3f6f2;
  --bg-deep: #dfe8e2;
  --ink: #14201e;
  --ink-soft: #5a6661;
  --accent: #9b3328;
  --accent-soft: #c96f4a;
  --teal: #1f746b;
  --blue: #386b96;
  --gold: #a97820;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(29, 47, 43, 0.12);
  --shadow: 0 18px 44px rgba(23, 38, 34, 0.1);
  --radius: 14px;
  --page-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #fbfcfa 0%, var(--bg) 58%, var(--bg-deep) 100%);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

body.layout-narrow {
  --page-width: 760px;
}

body.layout-medium {
  --page-width: 920px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(31, 116, 107, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(31, 116, 107, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, black 0%, transparent 92%);
}

a {
  color: inherit;
  text-decoration: none;
}

.page-glow {
  display: none;
}

.build-badge {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 44;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(31, 116, 107, 0.18);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 20px rgba(20, 32, 30, 0.12);
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  pointer-events: none;
  user-select: none;
}

.build-badge strong {
  color: var(--accent);
  font-weight: 700;
}

.hero {
  padding: 24px 20px 10px;
}

.hero-inner,
.shell {
  width: min(var(--page-width), calc(100vw - 32px));
  margin: 0 auto;
}

.hero-inner {
  padding: 18px 20px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero-inner::after {
  display: none;
}

.hero-inner > * {
  position: relative;
  z-index: 1;
}

.eyebrow,
.section-kicker,
.record-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
  color: var(--accent);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero-main,
.section-head,
.record-head,
.detail-hero,
.form-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.hero h1,
.panel h2,
.panel h3,
.panel h4 {
  margin: 0;
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

.hero h1 {
  margin-top: 16px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.05;
}

.hero-subtitle {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.6;
}

.muted,
.excerpt {
  color: var(--ink-soft);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  min-height: 52px;
  padding: 8px 12px 8px 8px;
  border-radius: 16px;
  border: 1px solid rgba(31, 116, 107, 0.16);
  background: rgba(249, 252, 250, 0.86);
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

a.site-brand:hover,
a.site-brand:focus-visible {
  background: rgba(255, 252, 247, 0.98);
  border-color: rgba(31, 116, 107, 0.34);
  box-shadow: 0 8px 18px rgba(31, 116, 107, 0.12);
  transform: translateY(-1px);
}

.site-brand:focus-visible,
.top-nav a:focus-visible,
.account-link:focus-visible,
.button-link:focus-visible,
.search-form button:focus-visible,
.page-link:focus-visible {
  outline: 3px solid rgba(40, 92, 84, 0.34);
  outline-offset: 3px;
}

.site-brand-current {
  cursor: default;
}

.brand-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  color: #fff;
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 20px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.site-brand strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
}

.top-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px;
  border-radius: 16px;
  background: rgba(244, 248, 245, 0.88);
  border: 1px solid var(--line);
}

.top-nav a,
.button-link,
.search-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid rgba(31, 116, 107, 0.18);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
  text-decoration: none;
  min-height: 44px;
  font-weight: 500;
  line-height: 1.2;
}

.top-nav a {
  min-width: 92px;
  white-space: nowrap;
}

.top-nav a:hover,
.button-link:hover,
.search-form button:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 116, 107, 0.45);
  background: #fff;
  box-shadow: 0 6px 14px rgba(31, 116, 107, 0.11);
}

.top-nav a.active {
  background: var(--teal);
  color: #fff;
  border-color: rgba(31, 116, 107, 0.7);
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(31, 116, 107, 0.22);
}

.top-nav a.active:hover {
  background: #1a665e;
  box-shadow: 0 10px 22px rgba(31, 116, 107, 0.28);
}

body.layout-narrow .hero-main,
body.layout-medium .hero-main {
  flex-direction: column;
}

body.layout-narrow .top-nav,
body.layout-medium .top-nav {
  width: 100%;
}

body.layout-narrow .top-nav a {
  flex: 1 1 calc(33.333% - 8px);
  min-width: 0;
}

body.layout-medium .top-nav a {
  flex: 1 1 auto;
}

body.layout-narrow .hero h1 {
  font-size: clamp(30px, 6vw, 46px);
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.account-form {
  display: flex;
  margin: 0;
}

.account-link,
.account-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
}

button.account-link {
  cursor: pointer;
}

.account-link:hover,
.account-link.active {
  border-color: rgba(155, 51, 40, 0.3);
  color: var(--accent);
  background: #fff;
}

.account-link.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.account-link.primary:hover,
.account-link.primary.active {
  background: #84291f;
  color: #fff;
}

.account-chip {
  color: var(--teal);
  background: rgba(31, 116, 107, 0.08);
}

.shell {
  padding: 12px 0 52px;
}

.panel,
.record-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel {
  padding: 24px;
}

.intro-panel {
  display: grid;
  gap: 22px;
}

.product-overview-panel {
  display: grid;
  gap: 22px;
}

.product-overview-head h2 {
  max-width: 620px;
  font-size: clamp(26px, 3.5vw, 40px);
  line-height: 1.16;
}

.product-overview-head .muted {
  max-width: 680px;
  margin: 12px 0 0;
  line-height: 1.7;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.service-card {
  display: grid;
  gap: 8px;
  min-height: 136px;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.service-card:hover,
.service-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(31, 116, 107, 0.35);
  box-shadow: 0 12px 24px rgba(31, 116, 107, 0.12);
}

.service-card span {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(31, 116, 107, 0.1);
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.service-card strong {
  font-size: 20px;
}

.service-card em {
  color: var(--ink-soft);
  font-style: normal;
  line-height: 1.55;
}

.stat-grid,
.card-grid,
.grid.two-col,
.card-list {
  display: grid;
  gap: 18px;
}

.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
}

.stat-card {
  padding: 18px;
  border-radius: 14px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--teal);
  opacity: 0.78;
}

.stat-card span {
  display: block;
  color: var(--ink-soft);
  font-size: 14px;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: clamp(26px, 3.8vw, 38px);
}
.stat-card.ok {
  background: rgba(46, 125, 110, 0.08);
  border-color: rgba(46, 125, 110, 0.25);
}
.stat-card.ok::before { background: #2e7d6e; }
.stat-card.ok strong { color: #2e7d6e; }
.stat-card.warn {
  background: rgba(196, 108, 20, 0.08);
  border-color: rgba(196, 108, 20, 0.25);
}
.stat-card.warn::before { background: var(--gold); }
.stat-card.warn strong { color: #b86a1a; }
.stat-card.info {
  background: rgba(80, 120, 160, 0.08);
  border-color: rgba(80, 120, 160, 0.25);
}
.stat-card.info::before { background: var(--blue); }
.stat-card.info strong { color: #4a7a9e; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 0 6px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.page-link {
  padding: 6px 14px;
  border-radius: 10px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  transition: background 120ms ease;
}
.page-link:hover {
  background: var(--line);
}
.page-link.disabled {
  opacity: 0.45;
  pointer-events: none;
}
.page-info {
  font-size: 14px;
  color: var(--ink-soft);
}

/* Filter form */
.filter-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-form select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 14px;
}
.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.filter-check input {
  margin: 0;
}

/* Match navigation in lineage chart */
.match-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.match-nav-btn {
  padding: 5px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms ease;
}
.match-nav-btn:hover {
  background: var(--line);
}

/* Breadcrumb */
.breadcrumb-row {
  padding: 10px 0 4px;
  margin-bottom: -8px;
}
.breadcrumb-link {
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 120ms ease;
}
.breadcrumb-link:hover {
  color: var(--ink);
}

.grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.grid.two-col.wide-left {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  margin-top: 18px;
}

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  margin-top: 18px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.compact-list {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.mini-card,
.source-card,
.record-card {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
}

.mini-card {
  display: grid;
  gap: 8px;
}

.mini-card strong,
.record-card h3,
.source-card h3 {
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 21px;
}

.mini-card span,
.mini-card em,
.record-chip,
.alias-pill {
  font-size: 13px;
}

.record-chip,
.alias-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(155, 51, 40, 0.08);
  color: var(--accent);
}

.warn {
  background: rgba(199, 109, 75, 0.14);
}

.image-chip,
.inline-flag,
.thumbnail-flag {
  background: rgba(40, 92, 84, 0.12);
  color: #285c54;
}

.record-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.list-panel {
  margin-top: 18px;
  padding: 14px;
}

.list-table {
  display: grid;
  gap: 10px;
}

.list-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1.35fr) minmax(0, 1.2fr) minmax(0, 1fr) 140px;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.list-head-row {
  background: rgba(31, 116, 107, 0.07);
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 0.06em;
}

.person-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.person-primary strong {
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 20px;
}

.list-link {
  margin-top: 0;
}

.card-thumbnail {
  position: relative;
  margin: 14px 0 12px;
}

.card-thumbnail img {
  width: 100%;
  max-height: 170px;
  object-fit: cover;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.95);
}

.thumbnail-flag {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.inline-flag {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  color: var(--accent);
  font-weight: 650;
}

button.button-link {
  appearance: none;
  font: inherit;
  cursor: pointer;
}

.button-link.secondary {
  margin-top: 0;
}

.image-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.image-toggle-button {
  margin-top: 0;
}

.search-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.search-form input {
  min-width: min(320px, 70vw);
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  font: inherit;
}

.search-form input:focus,
.search-form select:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.question-block input:focus,
.question-block select:focus,
.question-block textarea:focus,
.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
  outline: 3px solid rgba(31, 116, 107, 0.18);
  border-color: rgba(31, 116, 107, 0.42);
}

.search-form button {
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}

.alias-block,
.tag-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.person-hero-media {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.person-bio-summary {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.person-hero-media img,
.entry-snippet img {
  width: 100%;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.95);
}

.person-hero-media img {
  max-height: 340px;
  object-fit: cover;
}

.entry-snippet {
  margin-top: 2px;
}

.relation-block + .relation-block,
.source-list,
.page-entry-list {
  margin-top: 18px;
}

.relation-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 250, 243, 0.92);
  border: 1px solid var(--line);
  margin-top: 10px;
}

.source-card,
.source-meta {
  display: grid;
  gap: 10px;
}

.source-meta {
  grid-template-columns: repeat(auto-fit, minmax(120px, max-content));
  align-items: center;
}

.text-flow {
  line-height: 1.9;
}

.text-flow p {
  margin: 0;
}

.text-flow p + p {
  margin-top: 0.9em;
}

.text-block {
  padding: 16px;
  border-radius: 18px;
  background: rgba(244, 237, 226, 0.8);
  border: 1px solid rgba(70, 56, 42, 0.09);
  line-height: 1.85;
  word-break: break-word;
}

.large-text {
  max-height: 400px;
  overflow: auto;
}

.image-stack {
  display: grid;
  gap: 16px;
}

.image-stack img {
  width: 100%;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.lineage-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  margin-top: 18px;
  align-items: start;
}

.chart-showcase {
  display: grid;
  gap: 14px;
}

.chart-feature-card,
.lineage-card-large {
  display: grid;
  gap: 10px;
  text-decoration: none;
}

.chart-feature-card {
  padding: 20px 22px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.chart-feature-card:hover,
.chart-feature-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(31, 116, 107, 0.35);
  box-shadow: 0 12px 24px rgba(31, 116, 107, 0.12);
}

.chart-feature-card strong,
.lineage-card-large h3 {
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 24px;
}

.lineage-card-large {
  padding: 24px;
  min-height: 240px;
  background: rgba(255, 255, 255, 0.9);
}

.lineage-map-panel,
.lineage-side-panel {
  min-width: 0;
}

.lineage-side-panel {
  position: sticky;
  top: 16px;
}

.lineage-search {
  align-items: center;
}

.lineage-canvas {
  --lineage-base-width: 1280px;
  margin-top: 18px;
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    radial-gradient(ellipse at top, rgba(143,45,30,0.06), transparent 60%),
    linear-gradient(180deg, #fbf6ec 0%, #f4ecdb 100%);
  height: min(78vh, 940px);
  cursor: grab;
  user-select: none;
  touch-action: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(70,56,42,0.06);
}

.lineage-canvas.grabbing { cursor: grabbing; }

.lineage-viewport {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.lineage-canvas .lineage-clean-svg,
.lineage-canvas .lineage-paper-svg {
  display: block;
}

.lineage-canvas .lineage-clean-svg {
  width: 1280px;
  height: auto;
}

.lineage-canvas[data-mode="clean"] .lineage-paper-svg { display: none; }
.lineage-canvas[data-mode="paper"] .lineage-clean-svg { display: none; }

.lineage-canvas .lineage-paper-svg {
  width: 1280px;
  height: auto;
  aspect-ratio: 1489 / 2020;
}

.lineage-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255, 252, 247, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(143, 45, 30, 0.1);
}

.zoom-cluster {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(70, 56, 42, 0.06);
  border: 1px solid rgba(70, 56, 42, 0.08);
}

.zoom-btn {
  appearance: none;
  border: 0;
  background: #fff;
  color: var(--accent);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(70,56,42,0.12);
  transition: transform 120ms ease, background 120ms ease, color 120ms ease;
}

.zoom-btn:hover { background: rgba(143,45,30,0.08); transform: translateY(-1px); }
.zoom-btn:active { transform: translateY(0); }

.zoom-btn.ghost {
  width: auto;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  box-shadow: none;
  color: var(--ink-soft);
}
.zoom-btn.ghost:hover { background: rgba(143,45,30,0.06); color: var(--accent); }

.zoom-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  font-weight: 500;
}

.lineage-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(143, 45, 30, 0.16);
  background: rgba(255, 250, 244, 0.82);
  color: var(--accent);
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  transition: background 140ms ease, border-color 140ms ease;
}
.lineage-toggle:hover { background: rgba(255, 244, 230, 0.95); }

.toggle-mark {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: rgba(70, 56, 42, 0.18);
  position: relative;
  transition: background 160ms ease;
}
.toggle-mark::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 4px rgba(62, 42, 26, 0.18);
  transition: transform 160ms ease;
}
.lineage-toggle input:checked + .toggle-mark { background: rgba(40, 92, 84, 0.6); }
.lineage-toggle input:checked + .toggle-mark::after { transform: translateX(14px); }

.hide-on-narrow { font-size: 12px; }
@media (max-width: 760px) { .hide-on-narrow { display: none; } }

.lineage-hint {
  position: absolute;
  bottom: 12px;
  right: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(40, 30, 20, 0.62);
  color: #fdf6e8;
  font-size: 12px;
  pointer-events: none;
  opacity: 1;
  transition: opacity 380ms ease;
}
.lineage-hint.faded { opacity: 0; }

.lineage-minimap {
  position: absolute;
  right: 14px;
  bottom: 14px;
  /* width & height set via inline style per-chart; fallback: */
  width: 150px;
  height: min(380px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 250, 242, 0.9);
  border: 1px solid rgba(70, 56, 42, 0.16);
  box-shadow: 0 10px 30px rgba(48, 35, 22, 0.18);
  cursor: grab;
  touch-action: none;
  z-index: 10;
  transition: opacity 160ms ease, transform 160ms ease;
}
.lineage-minimap.grabbing { cursor: grabbing; }
.lineage-minimap[data-disabled="true"] {
  opacity: 0.42;
  pointer-events: none;
}
.lineage-minimap-svg {
  display: block;
  width: 100%;
  height: 100%;
}
.lineage-minimap-ruler {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 22px;
  background: rgba(255, 250, 242, 0.92);
  border-left: 1px solid rgba(70, 56, 42, 0.1);
  pointer-events: none;
  z-index: 2;
}
.pcard-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 16px;
  color: rgba(70, 56, 42, 0.6);
  font-size: 14px;
}
.pcard-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(143, 45, 30, 0.2);
  border-top-color: rgba(143, 45, 30, 0.85);
  border-radius: 50%;
  animation: pcard-spin 0.7s linear infinite;
}
@keyframes pcard-spin {
  to { transform: rotate(360deg); }
}
.minimap-ruler-tick {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 14px;
  margin-top: -7px;
}
.minimap-ruler-tick::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 4px;
  height: 1px;
  background: rgba(70, 56, 42, 0.3);
  transform: translateY(-50%);
}
.minimap-ruler-label {
  font-size: 9px;
  line-height: 1;
  color: rgba(70, 56, 42, 0.65);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.lineage-minimap-bg { fill: #fffaf0; }
.lineage-minimap-band { fill: rgba(143, 45, 30, 0.055); }
.lineage-minimap-band.alt { fill: rgba(40, 92, 84, 0.06); }
.lineage-minimap-edge {
  display: none;
}
.lineage-minimap-node {
  fill: rgba(143, 45, 30, 0.5);
  stroke: none;
  shape-rendering: crispEdges;
}
.lineage-minimap-node.is-match { fill: rgba(46, 125, 110, 0.78); }
.lineage-minimap-node.is-selected { fill: rgba(143, 45, 30, 0.95); }
.lineage-minimap-view {
  fill: rgba(255, 255, 255, 0.24);
  stroke: rgba(143, 45, 30, 0.95);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}
.minimap-drag-rect {
  position: absolute;
  border: 2px dashed rgba(143, 45, 30, 0.85);
  background: rgba(143, 45, 30, 0.12);
  border-radius: 4px;
  pointer-events: none;
  z-index: 10;
}

/* ========= Generation bands ========= */
.gen-band-rect {
  fill: url(#bandFill);
  stroke: rgba(143, 45, 30, 0.16);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}
.gen-band.alt .gen-band-rect {
  fill: rgba(40, 92, 84, 0.04);
  stroke: rgba(40, 92, 84, 0.18);
}
.gen-band-axis {
  stroke: rgba(143, 45, 30, 0.12);
  stroke-width: 1;
  stroke-dasharray: 1 5;
}
.gen-band-tab-bg {
  fill: #fff;
  stroke: rgba(143, 45, 30, 0.32);
  stroke-width: 1.2;
  filter: drop-shadow(0 2px 4px rgba(70,56,42,0.12));
}
.gen-band.alt .gen-band-tab-bg {
  stroke: rgba(40, 92, 84, 0.45);
}
.gen-band-tab-label {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 15px;
  font-weight: 600;
  fill: var(--accent);
}
.gen-band.alt .gen-band-tab-label { fill: #285c54; }
.gen-band-tab-meta {
  font-size: 10px;
  fill: var(--ink-soft);
  letter-spacing: 0.4px;
}
.gen-band-watermark {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 48px;
  fill: rgba(143, 45, 30, 0.09);
  font-weight: 700;
  pointer-events: none;
  user-select: none;
}

/* ========= Edges ========= */
.lineage-edge.clean {
  fill: none;
  stroke: rgba(120, 86, 54, 0.55);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 160ms ease, stroke-width 160ms ease;
}
.lineage-edge.clean.active {
  stroke: var(--accent);
  stroke-width: 2.2;
}
.lineage-edge.paper {
  fill: none;
  stroke: rgba(88, 61, 36, 0.52);
  stroke-width: 0.14;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

/* ========= Clean-mode nodes ========= */
.lineage-node-link {
  cursor: pointer;
  outline: none;
}
.node-card {
  fill: #fffaf0;
  stroke: rgba(143, 45, 30, 0.34);
  stroke-width: 1.2;
  filter: url(#nodeShadow);
  transition: fill 160ms ease, stroke 160ms ease, stroke-width 160ms ease, transform 160ms ease;
}
.node-glyph {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 17px;
  fill: var(--ink);
  font-weight: 500;
}
.node-glyph.compact { font-size: 12px; }
.node-spouse-bg {
  fill: #fff5e6;
  stroke: rgba(143, 45, 30, 0.28);
  stroke-width: 0.9;
  stroke-dasharray: 2 2;
}
.node-spouse-cap {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 9px;
  fill: rgba(143, 45, 30, 0.72);
  letter-spacing: 0.5px;
}
.node-spouse-glyph {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 11px;
  fill: var(--ink-soft);
  font-weight: 500;
}
.lineage-node-link:hover .node-spouse-bg,
.lineage-node-link.is-selected .node-spouse-bg {
  fill: #ffead0;
  stroke: rgba(143, 45, 30, 0.55);
}
.lineage-node-link:hover .node-card {
  fill: #fff5e0;
  stroke: var(--accent);
  stroke-width: 1.8;
}
.lineage-node-link.is-match .node-card {
  fill: #e7f5ee;
  stroke: #2e7d6e;
  stroke-width: 1.6;
}
.lineage-node-link.is-match .node-glyph { fill: #1c4f47; }
.lineage-node-link.is-selected .node-card {
  fill: #fff1d6;
  stroke: var(--accent);
  stroke-width: 2.4;
}
.lineage-node-link.is-selected .node-glyph { fill: var(--accent); font-weight: 600; }
.lineage-node-link.node-listed_child .node-card { fill: rgba(255, 252, 247, 0.7); }
.lineage-node-link.node-listed_child .node-glyph { font-size: 14px; }

/* ========= Paper-mode nodes (legacy overlay) ========= */
.lineage-paper-bg { fill: rgba(255, 252, 247, 0.98); }
.lineage-paper-image { opacity: 0.34; }

.generation-guide {
  stroke: rgba(70, 56, 42, 0.11);
  stroke-width: 0.08;
  stroke-dasharray: 0.7 0.7;
  vector-effect: non-scaling-stroke;
}
.generation-label {
  fill: rgba(143, 45, 30, 0.58);
  font-size: 1.45px;
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
}

.lineage-svg-link { color: inherit; }
.lineage-svg-node {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2px 0.12px;
  border-radius: 0.45px;
  border: 0.12px solid rgba(143, 45, 30, 0.32);
  background: rgba(255, 250, 241, 0.92);
  color: var(--ink);
  font-size: 1.25px;
  line-height: 1.05;
  text-align: center;
  writing-mode: vertical-rl;
  box-shadow: 0 0.28px 0.65px rgba(62, 42, 26, 0.08);
  overflow: hidden;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.lineage-svg-link:hover .lineage-svg-node,
.lineage-svg-link.is-selected .lineage-svg-node {
  transform: scale(1.08);
  border-color: rgba(143, 45, 30, 0.75);
  background: rgba(255, 242, 222, 0.96);
}
.lineage-svg-link.is-match .lineage-svg-node {
  border-color: rgba(40, 92, 84, 0.78);
  background: rgba(232, 248, 241, 0.92);
  color: #285c54;
}
.lineage-svg-link.node-listed_child .lineage-svg-node {
  font-size: 1.1px;
  background: rgba(255, 252, 247, 0.66);
}

.lineage-actions {
  margin-top: 12px;
}

.lineage-result-list {
  max-height: 380px;
  overflow: auto;
}

.chain-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.chain-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 243, 0.9);
}

.chain-item span {
  color: var(--ink-soft);
  font-size: 12px;
}

.chain-item strong {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 18px;
}

.chain-item.current {
  border-color: rgba(143, 45, 30, 0.45);
  background: rgba(143, 45, 30, 0.08);
}

.compact-chain {
  max-height: 420px;
  overflow: auto;
}

.link-arrow {
  color: var(--accent);
}

.empty-state {
  text-align: center;
}

.rise {
  opacity: 0;
  transform: translateY(22px);
  animation: rise-in 520ms ease forwards;
}

.delay-1 {
  animation-delay: 100ms;
}

.delay-2 {
  animation-delay: 180ms;
}

.delay-3 {
  animation-delay: 260ms;
}

@keyframes rise-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .stat-grid,
  .grid.two-col,
  .grid.two-col.wide-left,
  .lineage-layout {
    grid-template-columns: 1fr;
  }

  .hero-inner {
    padding: 20px;
  }

  .hero h1 {
    font-size: clamp(34px, 6.2vw, 52px);
  }

  .lineage-side-panel {
    position: static;
  }

  .hero-main,
  .section-head,
  .record-head,
  .detail-hero,
  .form-head {
    flex-direction: column;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .top-nav {
    width: 100%;
  }

  .top-nav a {
    flex: 1 1 calc(50% - 8px);
  }
}

@media (max-width: 680px) {
  .hero {
    padding: 18px 12px 6px;
  }

  .hero-inner,
  .shell {
    width: min(var(--page-width), calc(100vw - 20px));
  }

  .hero-inner,
  .panel,
  .record-card {
    border-radius: 14px;
  }

  .hero-inner {
    padding: 18px;
  }

  .site-brand {
    min-height: 48px;
  }

  .top-nav {
    gap: 6px;
    padding: 6px;
    border-radius: 14px;
  }

  .top-nav a {
    min-width: 0;
    min-height: 46px;
    padding: 11px 10px;
    font-size: 14px;
  }

  .account-link,
  .account-chip {
    flex: 1 1 auto;
  }

  .panel,
  .record-card,
  .source-card,
  .mini-card {
    padding: 16px;
  }

  .search-form input {
    min-width: 100%;
  }

  .lineage-canvas {
    --lineage-base-width: 980px;
    height: min(75vh, 820px);
  }

  .lineage-canvas .lineage-clean-svg,
  .lineage-canvas .lineage-paper-svg {
    width: 980px;
  }

  .lineage-minimap {
    width: 130px;
    height: min(320px, calc(100% - 28px));
    right: 10px;
    bottom: 10px;
  }

  .node-glyph {
    font-size: 15px;
  }
}
/* ===== Person Card Modal ===== */
body.pcard-open { overflow: hidden; }

.pcard-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  animation: pcard-fade-in 200ms ease;
}
.pcard-modal[hidden] { display: none; }

.pcard-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(40, 28, 18, 0.55);
  backdrop-filter: blur(4px);
}

.pcard-modal-shell {
  position: relative;
  width: min(820px, 100%);
  max-height: calc(100vh - 64px);
  background: linear-gradient(180deg, #fffaf0 0%, #faf3e3 100%);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(40, 28, 18, 0.4), 0 0 0 1px rgba(143, 45, 30, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pcard-rise 220ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes pcard-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pcard-rise {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.pcard-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(70, 56, 42, 0.08);
  border: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  z-index: 2;
  transition: background 140ms ease, transform 140ms ease;
}
.pcard-modal-close:hover { background: rgba(143, 45, 30, 0.18); transform: rotate(90deg); }

.pcard-modal-stack {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 60px 0 22px;
  font-size: 12px;
  color: var(--ink-soft);
  min-height: 0;
}
.pcard-modal-stack:empty { padding: 0; }
.pcard-crumb {
  appearance: none;
  border: 0;
  background: rgba(70, 56, 42, 0.08);
  color: var(--ink-soft);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.pcard-crumb.current { background: rgba(143, 45, 30, 0.16); color: var(--accent); cursor: default; }
.pcard-crumb-sep { color: rgba(70, 56, 42, 0.4); }

.pcard-modal-body {
  overflow: auto;
  padding: 22px 72px 28px 26px;
  flex: 1;
}

.pcard-loading {
  text-align: center;
  padding: 60px 0;
  color: var(--ink-soft);
}

.pcard {
  display: grid;
  gap: 16px;
}

.pcard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-right: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(143, 45, 30, 0.12);
}
.pcard-head h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 26px;
  margin: 4px 0 6px;
  color: var(--accent);
}
.pcard-head-actions { flex-shrink: 0; }

.alias-block.compact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.alias-pill small {
  margin-left: 6px;
  font-size: 10px;
  opacity: 0.7;
}

.pcard-hero {
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 252, 247, 0.8);
  border: 1px solid rgba(143, 45, 30, 0.12);
}
.pcard-hero img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}

.pcard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.pcard-rel {
  background: rgba(255, 250, 240, 0.9);
  border: 1px solid rgba(143, 45, 30, 0.1);
  border-radius: 14px;
  padding: 12px 14px;
}
.pcard-rel h4 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.pcard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
}
.pcard-list li {
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: 15px;
}
.pcard-list a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed rgba(143, 45, 30, 0.4);
  transition: color 120ms ease, border-color 120ms ease;
}
.pcard-list a:hover { color: #5a1a0f; border-color: var(--accent); }

.pcard-section h4 {
  margin: 4px 0 8px;
  color: var(--accent);
  font-size: 14px;
}

.pcard-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pcard-intro {
  border: 1px solid rgba(143, 45, 30, 0.12);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 252, 247, 0.78);
}
.pcard-bio-list { display: grid; gap: 10px; }
.pcard-bio { display: grid; gap: 6px; }

.pcard-entries { display: grid; gap: 10px; }
.pcard-entry {
  border: 1px solid rgba(143, 45, 30, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 252, 247, 0.7);
}
.pcard-entry-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--ink-soft);
  align-items: center;
}
.pcard-entry-snippet img {
  display: block;
  width: 100%;
  margin-top: 8px;
  border-radius: 8px;
}
.pcard-entry-text {
  margin-top: 8px;
  max-height: 170px;
  overflow: auto;
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(255, 250, 240, 0.76);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.7;
}
.pcard-intro-text {
  margin-top: 0;
  max-height: 240px;
  background: rgba(255, 250, 240, 0.9);
}
.muted.small { font-size: 12px; margin: 4px 0 0; }
.button-link.block { display: block; text-align: center; }

@media (max-width: 640px) {
  .pcard-grid { grid-template-columns: 1fr; }
  .pcard-modal-shell { max-height: calc(100vh - 32px); border-radius: 16px; }
  .pcard-head { flex-direction: column; }
}

@media (max-width: 900px) {
  .list-row {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .list-head-row {
    display: none;
  }
}

/* node has-card cursor hint */
.lineage-node-link.has-card { cursor: pointer; }
.lineage-node-link.has-card .node-card { stroke-dasharray: none; }

/* ===== Grave feature cards on homepage ===== */
.accent-grave { background: linear-gradient(135deg, #f5f0e8, #e8ddd0); }
.accent-grave strong { color: #5c3a21; }

.grave-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.grave-feature-card {
  display: block;
  background: #faf7f2;
  border: 1px solid #e8ddd0;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}
.grave-feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(92,58,33,0.10);
}
.grave-feature-card .grave-thumb {
  height: 90px;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid #e8ddd0;
}
.grave-feature-card strong {
  display: block;
  font-size: 13px;
  color: #3e2716;
  padding: 8px 10px 2px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grave-feature-card span {
  display: block;
  font-size: 11px;
  color: #7a6a5a;
  padding: 0 10px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Grave Modal ===== */
.gmodal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gmodal[hidden] { display: none; }
.gmodal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30,20,10,0.55);
  backdrop-filter: blur(4px);
}
.gmodal-shell {
  position: relative;
  background: #faf7f2;
  border: 1px solid #d8c8b0;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(30,20,10,0.25);
  max-width: 900px;
  width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.gmodal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.9);
  color: #5c3a21;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gmodal-close:hover { background: #fff; }
.gmodal-img-wrap {
  flex: 1 1 auto;
  min-height: 0;
  background: #1a1410;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.gmodal-img-wrap img {
  max-width: 100%;
  max-height: 55vh;
  object-fit: contain;
}
.gmodal-body {
  padding: 18px 22px 22px;
  background: #faf7f2;
  flex-shrink: 0;
}
.gmodal-body h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #3e2716;
}
.gmodal-body .gmodal-loc {
  margin: 0 0 6px;
  font-size: 14px;
  color: #6b5b4f;
}
.gmodal-body .gmodal-desc {
  margin: 0 0 10px;
  font-size: 13px;
  color: #7a6a5a;
  line-height: 1.5;
}
.gmodal-body .gmeta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: #a09080;
}

@media (max-width: 680px) {
  .grave-showcase { grid-template-columns: repeat(2, 1fr); }
  .gmodal-shell { max-height: calc(100vh - 20px); border-radius: 12px; }
  .gmodal-img-wrap img { max-height: 40vh; }
  .gmodal-body { padding: 14px 16px 18px; }
  .gmodal-body h3 { font-size: 16px; }
}

/* User registration, questionnaires, and admin */
.narrow-panel {
  width: min(760px, 100%);
  margin: 0 auto;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.alert {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.92);
  color: var(--ink);
}

.alert.success {
  background: rgba(46, 125, 110, 0.1);
  border-color: rgba(46, 125, 110, 0.28);
  color: #235f55;
}

.alert.error {
  background: rgba(143, 45, 30, 0.08);
  border-color: rgba(143, 45, 30, 0.26);
  color: var(--accent);
}

.code-panel {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(31, 116, 107, 0.18);
  background: rgba(31, 116, 107, 0.08);
  overflow-x: auto;
}

.code-panel code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
}

.form-stack {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.form-grid {
  margin-top: 0;
}

.grid.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.form-field {
  display: grid;
  gap: 8px;
  color: var(--ink);
}

.form-field > span,
.question-block legend {
  font-weight: 650;
}

.form-field input,
.form-field select,
.form-field textarea,
.question-block input[type="text"],
.question-block input[type="date"],
.question-block select,
.question-block textarea,
.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font: inherit;
}

.form-field textarea,
.question-block textarea,
.admin-form textarea {
  resize: vertical;
  line-height: 1.6;
}

.form-field em,
.form-error {
  color: var(--accent);
  font-style: normal;
  font-size: 13px;
}

.has-error input,
.has-error select,
.has-error textarea,
.question-block.has-error {
  border-color: rgba(143, 45, 30, 0.5);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.choice-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.choice-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  line-height: 1.35;
}

.choice-card input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
}

.inline-choice {
  width: fit-content;
}

.primary-action {
  width: fit-content;
  border-color: rgba(31, 116, 107, 0.48);
  background: var(--teal);
  color: #fff;
  box-shadow: 0 8px 18px rgba(31, 116, 107, 0.2);
}

.primary-action:hover {
  color: #fff;
}

.action-row,
.row-actions,
.compact-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.compact-actions .button-link,
.row-actions .button-link {
  margin-top: 0;
}

.survey-grid {
  align-items: stretch;
}

.survey-card {
  display: grid;
  gap: 10px;
}

.survey-card .link-arrow {
  color: var(--accent);
  font-weight: 650;
}

.survey-form-panel {
  width: min(920px, 100%);
  margin: 0 auto;
}

.question-form {
  gap: 20px;
}

.question-block {
  min-width: 0;
  margin: 0;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.question-block legend {
  padding: 0 8px;
}

.question-help {
  margin: 4px 0 14px;
  color: var(--ink-soft);
}

.required-mark {
  color: var(--accent);
  margin-left: 4px;
}

.profile-stats .stat-card strong {
  font-size: 22px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.admin-list-table .list-row {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) 120px;
}

.admin-questionnaire-table .list-row {
  grid-template-columns: 100px minmax(0, 1.4fr) minmax(0, 0.8fr) minmax(0, 1fr) 180px;
}

.admin-response-table .list-row {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) 90px 120px;
}

.admin-response-table em {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-style: normal;
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.status-pill.published {
  background: rgba(46, 125, 110, 0.12);
  border-color: rgba(46, 125, 110, 0.28);
  color: #235f55;
}

.status-pill.draft {
  background: rgba(80, 120, 160, 0.1);
  border-color: rgba(80, 120, 160, 0.25);
  color: #3f6e90;
}

.status-pill.archived {
  background: rgba(70, 56, 42, 0.08);
  color: var(--ink-soft);
}

.admin-form {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.admin-inline-check {
  align-self: end;
  margin-top: 0;
}

.admin-question-stack,
.answer-stack {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.admin-question-card,
.answer-card {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.admin-question-card.inactive {
  opacity: 0.62;
}

.compact-head {
  align-items: center;
}

.danger-form {
  margin-top: 12px;
}

.answer-card h3 {
  margin: 6px 0 8px;
  font-size: 18px;
}

.answer-card p:last-child {
  margin-bottom: 0;
  white-space: pre-wrap;
}

.admin-summary-panel,
.response-summary-panel {
  margin-top: 18px;
}

.summary-note-grid,
.questionnaire-summary-grid,
.tag-summary-grid,
.user-summary-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.summary-note-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.summary-note {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(31, 116, 107, 0.18);
  background: rgba(31, 116, 107, 0.08);
  color: var(--teal);
  line-height: 1.6;
}

.questionnaire-summary-grid,
.user-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.summary-card,
.user-summary-card,
.followup-card,
.summary-block {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.summary-card {
  display: grid;
  gap: 8px;
}

.summary-card strong,
.user-summary-card strong,
.followup-card strong {
  font-size: 18px;
}

.summary-card em,
.summary-card small,
.user-summary-card span,
.user-summary-card em,
.followup-card span {
  color: var(--ink-soft);
  font-style: normal;
}

.admin-summary-grid {
  align-items: start;
}

.tag-summary-grid {
  grid-template-columns: 1fr;
}

.tag-summary-group {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.tag-summary-group:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.tag-summary-group h4,
.summary-block h4 {
  margin: 0 0 10px;
  font-size: 17px;
}

.compact-chip-list {
  margin-top: 10px;
  gap: 8px;
}

.followup-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.user-summary-card .compact-head {
  gap: 10px;
}

.user-summary-card .compact-head > div {
  display: grid;
  gap: 4px;
}

.response-insight-grid {
  margin-top: 18px;
  align-items: start;
}

.answer-rollup + .answer-rollup,
.text-answer-quote + .text-answer-quote {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.answer-rollup strong {
  display: block;
  line-height: 1.5;
}

.text-answer-quote {
  margin: 0;
  padding: 0;
}

.text-answer-quote p {
  margin: 0 0 8px;
  color: var(--ink);
  line-height: 1.7;
  white-space: pre-wrap;
}

.text-answer-quote footer {
  color: var(--ink-soft);
  font-size: 13px;
}

@media (max-width: 960px) {
  .grid.three-col,
  .admin-list-table .list-row,
  .admin-questionnaire-table .list-row,
  .admin-response-table .list-row {
    grid-template-columns: 1fr;
  }

  .admin-questionnaire-table .list-head-row,
  .admin-response-table .list-head-row,
  .admin-list-table .list-head-row {
    display: none;
  }
}

@media (max-width: 680px) {
  .choice-grid,
  .choice-grid.compact {
    grid-template-columns: 1fr;
  }

  .primary-action,
  .action-row .button-link {
    width: 100%;
  }

  .inline-choice {
    width: 100%;
  }
}

/* ===== 首页 M1：AI 商会秘书对话区 ===== */
.concierge-panel {
  display: grid;
  gap: 18px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.95) 0%, rgba(241, 237, 228, 0.92) 100%);
  border: 1px solid rgba(155, 51, 40, 0.16);
}

.concierge-head h2 {
  margin: 6px 0 6px;
  font-size: clamp(24px, 3.2vw, 36px);
  line-height: 1.2;
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", serif;
  color: var(--ink);
}

.concierge-head .muted {
  margin: 0;
  line-height: 1.7;
}

.concierge-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(23, 38, 34, 0.06);
}

.concierge-avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-family: "Source Han Serif SC", "Noto Serif SC", serif;
}

.concierge-field {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--ink);
  padding: 8px 4px;
  font-family: inherit;
}

.concierge-field::placeholder {
  color: var(--ink-soft);
  opacity: 0.75;
}

.concierge-send {
  flex: none;
  border: none;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  font-family: inherit;
  transition: background 160ms ease, transform 160ms ease;
}

.concierge-send:hover,
.concierge-send:focus-visible {
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.concierge-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.concierge-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(31, 116, 107, 0.08);
  border: 1px solid rgba(31, 116, 107, 0.18);
  color: var(--teal);
  font-size: 13px;
  font-weight: 600;
  transition: background 160ms ease, transform 160ms ease;
}

.concierge-chips .chip:hover,
.concierge-chips .chip:focus-visible {
  background: rgba(31, 116, 107, 0.14);
  transform: translateY(-1px);
}

/* ===== 首页 M1：宗亲互帮墙 ===== */
.match-wall-panel {
  display: grid;
  gap: 18px;
}

.match-wall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.match-card {
  display: grid;
  gap: 10px;
  padding: 18px 18px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.match-card:hover {
  transform: translateY(-2px);
  border-color: rgba(169, 120, 32, 0.4);
  box-shadow: 0 12px 24px rgba(169, 120, 32, 0.12);
}

.match-pair {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  color: var(--ink);
}

.match-pair strong {
  font-weight: 700;
}

.match-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(31, 116, 107, 0.1);
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
}

.match-arrow {
  color: var(--gold);
  font-weight: 700;
  margin: 0 4px;
}

.match-quote {
  margin: 0;
  color: var(--accent);
  font-size: 15px;
  line-height: 1.55;
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", serif;
}

/* ===== 首页 M1：服务卡 "即将开放" 角标 ===== */
.service-card {
  position: relative;
}

.service-card-soon {
  opacity: 0.96;
}

.soon-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(169, 120, 32, 0.14);
  color: var(--gold);
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* ===== 首页 M1：管理员折叠区 ===== */
.admin-stats-panel summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  padding: 4px 0;
}

.admin-stats-panel summary::-webkit-details-marker {
  display: none;
}

.admin-stats-panel summary strong {
  font-size: 18px;
}

.admin-stats-panel summary em {
  font-style: normal;
  font-size: 12px;
}

.admin-stats-panel[open] summary em::after {
  content: " · 收起";
}

.admin-stats-panel .stat-grid {
  margin-top: 16px;
}

/* ===== M2 通用：表单字段 / 行 / chip 选择 ===== */
.field {
  display: grid;
  gap: 6px;
  margin: 14px 0;
}

.field > span {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
}

.field input[type="text"],
.field input[type="tel"],
.field input[type="search"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(31, 116, 107, 0.55);
  box-shadow: 0 0 0 3px rgba(31, 116, 107, 0.12);
}

.field textarea {
  resize: vertical;
  min-height: 90px;
}

.form-row {
  display: grid;
  gap: 14px;
}

.form-row.two-col {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.chip-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}

.chip-check {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.chip-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip-check > span {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.chip-check:hover > span {
  border-color: rgba(31, 116, 107, 0.4);
  transform: translateY(-1px);
}

.chip-check input:checked + span {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  font-weight: 600;
}

.chip-check input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(31, 116, 107, 0.25);
}

/* ===== Onboarding：对话气泡 + 步骤 ===== */
.onboarding-panel {
  display: grid;
  gap: 18px;
}

.onboarding-head h2 {
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(22px, 2.8vw, 30px);
  margin: 6px 0 8px;
  line-height: 1.25;
}

.step-track {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.step-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
}

.step-dot > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(20, 32, 30, 0.08);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.step-dot.is-current {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(155, 51, 40, 0.06);
}

.step-dot.is-current > span {
  background: var(--accent);
  color: #fff;
}

.step-dot.is-done {
  color: var(--teal);
  border-color: rgba(31, 116, 107, 0.4);
}

.step-dot.is-done > span {
  background: var(--teal);
  color: #fff;
}

.onboarding-form .step {
  display: none;
}

.onboarding-form .step.is-current {
  display: block;
  animation: fade-in 240ms ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.bubble {
  border-radius: 14px;
  padding: 12px 16px;
  margin: 8px 0 10px;
  max-width: 720px;
  line-height: 1.6;
}

.bubble p {
  margin: 0 0 4px;
}

.bubble p:last-child {
  margin-bottom: 0;
}

.bubble-ai {
  background: rgba(241, 237, 228, 0.85);
  border: 1px solid rgba(155, 51, 40, 0.12);
  color: var(--ink);
}

.step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.onboarding-foot {
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  margin-top: 18px;
}

.onboarding-thanks-panel {
  text-align: left;
  display: grid;
  gap: 12px;
}

.onboarding-thanks-panel h2 {
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", serif;
}

/* ===== Match 页面 ===== */
.match-hero-panel h2 {
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(24px, 3.2vw, 34px);
  margin: 6px 0 10px;
}

.need-form {
  display: grid;
  gap: 16px;
}

.need-fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px 16px;
  background: rgba(255, 255, 255, 0.7);
  margin: 0;
}

.need-fieldset legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.need-card {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
}

.need-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.need-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(31, 116, 107, 0.1);
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
}

.need-industry {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
}

.need-desc {
  margin: 0;
  color: var(--ink);
  line-height: 1.6;
  font-size: 14.5px;
}

.need-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-right: 4px;
}

.need-status-open { background: rgba(169, 120, 32, 0.15); color: var(--gold); }
.need-status-matching { background: rgba(56, 107, 150, 0.15); color: var(--blue); }
.need-status-introduced { background: rgba(31, 116, 107, 0.15); color: var(--teal); }
.need-status-closed { background: rgba(20, 32, 30, 0.1); color: var(--ink-soft); }

/* ===== M3：家族传承 / 资料囊 / 我的家 ===== */

/* 个人中心 hero */
.me-hero-panel .section-head { gap: 18px; }

.me-completion {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 160px;
}
.completion-num {
  font-family: "Source Han Serif SC", "Noto Serif SC", serif;
  font-size: 30px;
  color: var(--accent);
  line-height: 1;
}
.completion-num small {
  font-size: 14px;
  color: var(--ink-soft);
  margin-left: 2px;
}
.completion-label {
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
}
.completion-bar {
  width: 160px;
  height: 6px;
  border-radius: 999px;
  background: rgba(20, 32, 30, 0.08);
  overflow: hidden;
}
.completion-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 999px;
  transition: width .4s ease;
}

.me-todo {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.me-todo .record-chip {
  cursor: pointer;
  background: rgba(155, 51, 40, 0.08);
  color: var(--accent);
  border-color: rgba(155, 51, 40, 0.18);
}
.me-todo .record-chip:hover {
  background: rgba(155, 51, 40, 0.14);
}

/* /me 卡片网格 */
.me-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 760px) {
  .me-grid { grid-template-columns: 1fr; }
  .me-completion { align-items: flex-start; }
}
.me-card .action-row { margin-top: 14px; }

.legacy-mini-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.legacy-mini {
  display: inline-flex;
  flex-direction: column;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  min-width: 100px;
}
.legacy-mini strong { font-size: 14px; color: var(--ink); }
.legacy-mini em {
  font-style: normal;
  font-size: 12px;
  color: var(--accent);
  margin-top: 2px;
}
.legacy-mini .muted { font-size: 11px; margin-top: 2px; }

/* 家族传承吊线图 */
.legacy-hero-panel { padding-bottom: 24px; }

.legacy-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 4px;
}
.legacy-self {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 24px;
  background: linear-gradient(180deg, #fdf6ec, #f6ead4);
  border: 1px solid rgba(169, 120, 32, 0.35);
  border-radius: 14px;
  box-shadow: var(--shadow);
  min-width: 220px;
  text-align: center;
}
.legacy-self strong {
  font-family: "Source Han Serif SC", "Noto Serif SC", serif;
  font-size: 22px;
  color: var(--ink);
  margin-top: 4px;
}
.legacy-seal {
  display: inline-block;
  padding: 2px 10px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.1em;
}
.legacy-meta {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.legacy-stem {
  width: 2px;
  height: 36px;
  background: var(--line);
}
.legacy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
  position: relative;
  padding-top: 12px;
  width: 100%;
}
.legacy-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12.5%;
  right: 12.5%;
  height: 2px;
  background: var(--line);
}
.legacy-child {
  position: relative;
  width: 220px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(20, 32, 30, 0.04);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.legacy-child::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 12px;
  background: var(--line);
}
.legacy-child.is-blood { border-top: 3px solid var(--accent); }
.legacy-child.is-trustee {
  border-top: 3px solid var(--teal);
  background: linear-gradient(180deg, rgba(31, 116, 107, 0.04), var(--panel));
}
.legacy-child header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.legacy-child header strong {
  font-family: "Source Han Serif SC", "Noto Serif SC", serif;
  font-size: 18px;
  color: var(--ink);
}
.legacy-relation {
  font-size: 12px;
  color: var(--ink-soft);
  background: rgba(20, 32, 30, 0.05);
  padding: 2px 8px;
  border-radius: 999px;
}
.legacy-text {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.55;
  margin: 0;
}
.legacy-delete {
  font-size: 12px;
  color: var(--ink-soft);
  align-self: flex-end;
  background: none;
  border: none;
  padding: 4px 0;
  cursor: pointer;
}
.legacy-delete:hover { color: var(--accent); }

@media (max-width: 760px) {
  .legacy-row::before { display: none; }
  .legacy-child::before { display: none; }
  .legacy-child { width: 100%; }
}

.legacy-form .field select,
.legacy-form .field input[type="number"],
.legacy-form .field input[type="text"],
.legacy-form .field textarea {
  width: 100%;
}

/* 资料囊 */
.upload-form .field input[type="file"] {
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(20, 32, 30, 0.02);
  cursor: pointer;
  width: 100%;
}
.upload-form .field input[type="file"]:hover {
  border-color: var(--accent);
  background: rgba(155, 51, 40, 0.04);
}

.upload-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.upload-card {
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.upload-card header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.upload-card header time {
  margin-left: auto;
  font-size: 12px;
}
.upload-name {
  margin: 0;
  font-size: 14px;
  word-break: break-all;
}
.upload-name a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.upload-name a:hover { text-decoration: underline; }
.upload-note {
  margin: 0;
  padding: 8px 10px;
  background: rgba(20, 32, 30, 0.03);
  border-left: 3px solid var(--line);
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
}

/* ===== M4：移动端深度适配 + PWA 底部 Tab ===== */

/* 底部 Tab：默认隐藏，仅 ≤720px 显示，固定在屏幕底部 */
.bottom-tabbar {
  display: none;
}

@media (max-width: 720px) {
  .build-badge {
    left: 12px;
    bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    z-index: 60;
    padding: 7px 10px;
    font-size: 10px;
  }

  .bottom-tabbar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(140%) blur(12px);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(20, 32, 30, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px 6px;
    min-height: 56px;
    color: var(--ink-soft);
    font-size: 11px;
    text-decoration: none;
    line-height: 1.1;
  }
  .tab-icon {
    font-size: 22px;
    line-height: 1;
  }
  .tab-label {
    font-size: 11px;
    letter-spacing: 0.02em;
  }
  .tab-item.active {
    color: var(--accent);
    font-weight: 700;
  }
  .tab-item.active .tab-icon {
    transform: translateY(-1px);
  }
  .tab-item-cta .tab-icon {
    color: var(--accent);
  }

  /* main 给底部 tab 留位 */
  .shell {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0));
  }

  /* 顶部导航在小屏隐藏（让位给底部 tab） */
  .top-nav {
    display: none;
  }

  /* hero 收紧 */
  .hero {
    padding: 12px 12px 6px;
  }
  .hero-inner {
    padding: 14px 14px 16px;
    border-radius: 16px;
    width: calc(100vw - 24px);
  }
  .hero h1 {
    margin-top: 10px;
    font-size: clamp(24px, 8vw, 32px);
  }
  .hero-subtitle {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.5;
  }
  .hero-main {
    flex-direction: column;
    gap: 8px;
  }

  /* topbar：brand + 账号操作 收紧成两行 */
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .site-brand {
    min-height: 44px;
    padding: 6px 10px 6px 6px;
    gap: 8px;
  }
  .brand-seal {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }
  .site-brand strong {
    font-size: 14px;
  }
  .eyebrow {
    font-size: 10px;
  }
  .account-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 6px;
  }
  .account-link,
  .account-chip {
    padding: 8px 12px;
    min-height: 38px;
    font-size: 13px;
    border-radius: 10px;
  }
  .shell {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* 主容器手机宽度 */
@media (max-width: 720px) {
  .hero-inner,
  .shell {
    width: calc(100vw - 24px);
  }

  .panel {
    padding: 16px 14px;
    border-radius: 14px;
  }
  .panel h2 { font-size: 22px; }
  .panel h3 { font-size: 18px; }

  .section-head,
  .detail-hero,
  .form-head,
  .record-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .section-head .tag-row,
  .detail-hero .tag-row {
    flex-wrap: wrap;
  }

  /* 服务卡 / 卡墙：移动端 1 列 */
  .service-grid,
  .match-wall {
    grid-template-columns: 1fr !important;
  }

  /* grid two-col / lineage-layout：移动端 1 列 */
  .grid.two-col,
  .grid.lineage-layout {
    grid-template-columns: 1fr !important;
  }

  /* 表单字段触屏 */
  .field input,
  .field select,
  .field textarea,
  .form-row input,
  .form-row select,
  .search-form input,
  .search-form button {
    min-height: 44px;
    font-size: 16px; /* 防止 iOS 自动缩放 */
  }
  .form-row.two-col {
    grid-template-columns: 1fr;
  }

  /* chip-checks 触屏更大 */
  .chip-check span {
    padding: 10px 14px;
    font-size: 14px;
  }
  .chip-checks {
    gap: 8px;
  }

  /* concierge 输入框移动端：上下排布 */
  .concierge-input {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .concierge-avatar {
    align-self: flex-start;
  }
  .concierge-field {
    width: 100%;
  }
  .concierge-send {
    width: 100%;
    min-height: 44px;
  }
  .concierge-chips {
    flex-wrap: wrap;
  }

  /* match-card 横向变垂直 */
  .match-pair {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
  .match-arrow {
    transform: rotate(90deg);
  }

  /* admin stats grid 自适应 */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* 步骤进度条小屏紧凑 */
  .step-track {
    gap: 6px;
    padding: 0 4px;
    overflow-x: auto;
  }
  .step-dot {
    flex: 0 0 auto;
    font-size: 11px;
    padding: 4px 8px;
  }

  /* 闪现消息位置上调避开底部 tab */
  .flash-stack {
    bottom: auto;
  }

  /* legacy tree 小屏单列 */
  .legacy-self {
    min-width: 0;
    width: 100%;
  }

  /* upload-list 单列 */
  .upload-list {
    grid-template-columns: 1fr;
  }

  /* lineage 吊线图工具条换行 */
  .lineage-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* 隐藏管理员折叠面板的内部 padding 避免溢出 */
  .admin-stats-panel {
    overflow-x: auto;
  }
}

/* 触屏 active 反馈 */
@media (hover: none) {
  .tab-item:active {
    background: rgba(155, 51, 40, 0.08);
  }
  .button-link:active,
  .top-nav a:active,
  .service-card:active {
    transform: scale(0.98);
  }
}

/* 安装到主屏后（standalone）顶部留出状态栏 */
@media all and (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top, 0);
  }
}

/* ===== M4-5：撮合 / 资料囊 后台工作台样式 ===== */
.chip-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink-soft);
  font-size: 13px;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.chip-filter:hover {
  border-color: rgba(31, 116, 107, 0.34);
  color: var(--ink);
}
.chip-filter.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  font-weight: 600;
}

.match-admin-list,
.upload-admin-list {
  display: grid;
  gap: 16px;
}

.match-admin-card,
.upload-admin-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  border-left: 4px solid var(--ink-soft);
}
.match-admin-card.status-open,
.upload-admin-card.status-pending_review {
  border-left-color: var(--accent);
  background: rgba(255, 248, 246, 0.96);
}
.match-admin-card.status-matching {
  border-left-color: var(--gold);
}
.match-admin-card.status-introduced,
.upload-admin-card.status-reviewed {
  border-left-color: var(--teal);
}
.match-admin-card.status-closed,
.upload-admin-card.status-archived {
  border-left-color: var(--ink-soft);
  opacity: 0.78;
}
.upload-admin-card.status-rejected {
  border-left-color: #b94545;
  opacity: 0.85;
}

.match-admin-head,
.upload-admin-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.match-admin-industry {
  margin: 0;
  font-size: 16px;
}
.match-admin-desc {
  margin: 0;
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.55;
}

.match-admin-contact {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.match-admin-contact strong {
  display: block;
  font-size: 15px;
  margin-top: 2px;
}

.match-admin-actions,
.upload-admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 6px;
}
.upload-admin-status-form {
  display: contents;
}

.button-link.small {
  padding: 6px 12px;
  min-height: 36px;
  font-size: 13px;
}

.status-pill.status-open,
.status-pill.status-pending_review {
  background: rgba(155, 51, 40, 0.12);
  color: var(--accent);
}
.status-pill.status-matching {
  background: rgba(169, 120, 32, 0.16);
  color: var(--gold);
}
.status-pill.status-introduced,
.status-pill.status-reviewed {
  background: rgba(31, 116, 107, 0.14);
  color: var(--teal);
}
.status-pill.status-closed,
.status-pill.status-archived {
  background: rgba(20, 32, 30, 0.08);
  color: var(--ink-soft);
}
.status-pill.status-rejected {
  background: rgba(185, 69, 69, 0.14);
  color: #b94545;
}

@media (max-width: 720px) {
  .match-admin-contact {
    flex-direction: column;
    gap: 8px;
  }
}

/* ===== 吊线图体验增强（搜索 / 动画 / tooltip / 快捷键） ===== */

/* 搜索框 + 清除按钮 */
.lineage-search-field {
  position: relative;
  flex: 1 1 240px;
  min-width: 200px;
}
.lineage-search-field input[type="search"] {
  width: 100%;
  padding-right: 34px;
  border-radius: 999px;
  border: 1px solid rgba(143, 45, 30, 0.18);
  background: #fffaf0;
  padding-left: 14px;
  height: 38px;
  font-size: 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.lineage-search-field input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(143, 45, 30, 0.12);
}
.lineage-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 0;
  background: rgba(70, 56, 42, 0.08);
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lineage-search-clear:hover { background: rgba(143, 45, 30, 0.18); color: var(--accent); }

.lineage-search-submit {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: #fffaf0;
  height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.lineage-search-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(143, 45, 30, 0.22); }

.lineage-match-chip {
  font-variant-numeric: tabular-nums;
  background: rgba(46, 125, 110, 0.12);
  color: #1c4f47;
}

.match-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(70, 56, 42, 0.06);
  border: 1px solid rgba(70, 56, 42, 0.08);
}
.match-nav-btn {
  appearance: none;
  border: 0;
  background: #fff;
  color: var(--accent);
  width: 32px;
  height: 30px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
  box-shadow: 0 1px 3px rgba(70,56,42,0.10);
}
.match-nav-btn:hover { background: rgba(143, 45, 30, 0.10); transform: translateY(-1px); }
.match-pos {
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  padding: 0 6px;
  min-width: 38px;
  text-align: center;
}

/* viewport 平移过渡（拖拽时禁用） */
.lineage-viewport { transition: transform 280ms cubic-bezier(0.22, 0.61, 0.36, 1); }
.lineage-canvas.grabbing .lineage-viewport,
.lineage-canvas.no-anim .lineage-viewport { transition: none !important; }

/* 节点入场淡入 */
@keyframes nodeFadeIn {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
.lineage-node-link {
  animation: nodeFadeIn 360ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
  transform-box: fill-box;
  transform-origin: center;
}
.lineage-edge.clean { animation: nodeFadeIn 420ms ease both; animation-delay: 80ms; }

/* 客户端实时搜索匹配 — 视觉同 .is-match */
.lineage-node-link.is-match-live .node-card {
  fill: #e7f5ee;
  stroke: #2e7d6e;
  stroke-width: 1.6;
}
.lineage-node-link.is-match-live .node-glyph { fill: #1c4f47; }

/* 搜索时的灰化效果 */
.lineage-node-link.is-dim { opacity: 0.22; transition: opacity 200ms ease; }
.lineage-node-link.is-dim .node-card { filter: none; }

/* 当前聚焦的匹配 — 脉冲光环 */
@keyframes matchPulse {
  0%   { stroke-opacity: 0.85; stroke-width: 2.6; }
  50%  { stroke-opacity: 0.35; stroke-width: 6; }
  100% { stroke-opacity: 0.85; stroke-width: 2.6; }
}
.lineage-node-link.is-current-match .node-card {
  stroke: #d97706;
  stroke-width: 2.6;
  fill: #fff4d6;
  animation: matchPulse 1.6s ease-in-out infinite;
}
.lineage-node-link.is-current-match .node-glyph {
  fill: #8a4a06;
  font-weight: 700;
}

/* hover tooltip */
.lineage-tip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  pointer-events: none;
  background: rgba(38, 28, 18, 0.94);
  color: #fbf6ec;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(6px);
  max-width: 240px;
  transition: opacity 140ms ease;
}
.lineage-tip[hidden] { display: none; }
.lineage-tip .tip-title { font-weight: 700; font-size: 14px; color: #fff5e0; }
.lineage-tip .tip-meta { color: rgba(255, 245, 224, 0.72); font-size: 11.5px; margin-top: 2px; }
.lineage-tip .tip-spouse { color: rgba(255, 245, 224, 0.85); margin-top: 4px; }
.lineage-tip .tip-hint { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,245,224,0.16); color: rgba(255,245,224,0.55); font-size: 11px; }

/* 世代条带 hover 高亮 */
.gen-band-tab .gen-band-tab-bg {
  transition: fill 140ms ease, stroke 140ms ease;
}
.gen-band-tab:hover .gen-band-tab-bg {
  fill: rgba(143, 45, 30, 0.16);
  stroke: var(--accent);
}

/* 帮助快捷键面板 */
.lineage-shortcut-help {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  background: rgba(255, 252, 247, 0.98);
  border: 1px solid rgba(143, 45, 30, 0.18);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(70, 56, 42, 0.18);
  min-width: 240px;
  animation: nodeFadeIn 220ms ease both;
}
.lineage-shortcut-help .shortcut-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--accent);
}
.lineage-shortcut-help .shortcut-close {
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 18px;
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1;
}
.lineage-shortcut-help .shortcut-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
}
.lineage-shortcut-help kbd {
  display: inline-block;
  background: rgba(70, 56, 42, 0.08);
  border: 1px solid rgba(70, 56, 42, 0.14);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: "SF Mono", Menlo, monospace;
  color: var(--ink);
  margin-right: 4px;
}
.lineage-help-btn { font-size: 12px !important; }

/* hint fade */
.lineage-canvas .hint.faded { opacity: 0; transition: opacity 600ms ease; pointer-events: none; }

@media (max-width: 720px) {
  .lineage-shortcut-help { right: 8px; bottom: 8px; left: 8px; min-width: 0; }
  .hide-on-narrow { display: none; }
  .lineage-search-field { flex-basis: 100%; }
}

/* ===== 祖先链路径高亮（选中或聚焦节点时） ===== */
.lineage-edge.clean.is-on-path {
  stroke: #d97706;
  stroke-width: 2.4;
  filter: drop-shadow(0 0 4px rgba(217, 119, 6, 0.45));
  animation: pathFlow 1.6s ease-in-out infinite;
}
@keyframes pathFlow {
  0%, 100% { stroke-opacity: 0.85; }
  50% { stroke-opacity: 0.45; }
}
.lineage-node-link.is-on-path:not(.is-current-match):not(.is-selected) .node-card {
  stroke: rgba(217, 119, 6, 0.78);
  stroke-width: 1.8;
}
.lineage-node-link.is-on-path:not(.is-current-match):not(.is-selected) .node-glyph {
  fill: #8a4a06;
}
/* 搜索时即使 dim 也保留路径高亮的可见性 */
.lineage-node-link.is-on-path.is-dim { opacity: 0.85; }


/* ===== 寻根问祖 子模块导航卡片 ===== */
.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.explore-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,250,244,0.95), rgba(255,245,224,0.7));
  border: 1px solid rgba(143,45,30,0.14);
  color: var(--ink);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.explore-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(143,45,30,0.14);
  border-color: var(--accent);
}
.explore-card .explore-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(143,45,30,0.10);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  font-family: "Iowan Old Style", "Songti SC", serif;
}
.explore-card .explore-text { display: flex; flex-direction: column; min-width: 0; }
.explore-card strong { font-size: 14.5px; color: var(--ink); }
.explore-card em {
  font-style: normal;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}

