/* 杨氏宗谱 贵州支脉系 - Styles */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700;900&family=Ma+Shan+Zheng&display=swap');

:root {
  --parchment: #F5E6C8;
  --parchment-light: #FDF6E3;
  --parchment-dark: #E8D5A8;
  --deep-red: #8B0000;
  --deep-red-light: #A52A2A;
  --gold: #C9A96E;
  --gold-light: #D4B880;
  --gold-dark: #A68B4B;
  --dark-brown: #3E2723;
  --dark-brown-light: #5D4037;
  --ink: #2C1810;
  --ink-light: #4A3728;
  --shadow: rgba(62, 39, 35, 0.15);
  --shadow-strong: rgba(62, 39, 35, 0.3);

  --gen1-color: #8B0000;
  --gen2-color: #A0522D;
  --gen3-color: #B8860B;
  --gen4-color: #2E8B57;
  --gen5-color: #4169E1;
  --gen6-color: #6A5ACD;
  --gen7-color: #8B008B;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Serif SC', 'Songti SC', 'SimSun', 'STSong', serif;
  background-color: var(--parchment);
  color: var(--ink);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(201, 169, 110, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 0, 0, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(201, 169, 110, 0.1) 0%, transparent 50%);
}

/* ===== Header / Hero ===== */
.hero {
  position: relative;
  text-align: center;
  padding: 60px 20px 40px;
  background: linear-gradient(180deg,
    rgba(139, 0, 0, 0.08) 0%,
    rgba(201, 169, 110, 0.12) 50%,
    transparent 100%);
  border-bottom: 2px solid var(--gold);
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--deep-red), transparent);
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold-dark), var(--gold), transparent);
}

.hero-ornament {
  font-size: 28px;
  color: var(--gold);
  letter-spacing: 12px;
  margin-bottom: 16px;
  opacity: 0.7;
}

.hero h1 {
  font-family: 'Ma Shan Zheng', 'Noto Serif SC', serif;
  font-size: 3.2rem;
  color: var(--deep-red);
  letter-spacing: 8px;
  margin-bottom: 8px;
  text-shadow: 1px 1px 2px rgba(139, 0, 0, 0.15);
}

.hero h2 {
  font-family: 'Ma Shan Zheng', 'Noto Serif SC', serif;
  font-size: 1.6rem;
  color: var(--gold-dark);
  letter-spacing: 12px;
  font-weight: 400;
  margin-bottom: 20px;
}

.hero-subtitle {
  font-size: 0.9rem;
  color: var(--ink-light);
  letter-spacing: 2px;
  opacity: 0.7;
}

/* ===== Navigation ===== */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, var(--parchment-dark), var(--parchment));
  border-bottom: 1px solid var(--gold);
  box-shadow: 0 2px 10px var(--shadow);
  padding: 0 20px;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 0;
}

.nav-tab {
  padding: 14px 32px;
  font-family: 'Noto Serif SC', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-light);
  cursor: pointer;
  border: none;
  background: none;
  letter-spacing: 3px;
  position: relative;
  transition: color 0.3s;
}

.nav-tab:hover {
  color: var(--deep-red);
}

.nav-tab.active {
  color: var(--deep-red);
}

.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: var(--deep-red);
  border-radius: 2px 2px 0 0;
}

/* Search Bar */
.search-bar {
  padding: 10px 16px;
  background: var(--parchment-light);
  border-bottom: 1px solid var(--parchment-dark);
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 10px 16px;
  font-size: 1rem;
  font-family: 'Noto Serif SC', serif;
  border: 2px solid var(--gold);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  outline: none;
  transition: border-color 0.3s;
}

.search-bar input:focus {
  border-color: var(--deep-red);
}

.search-bar input::placeholder {
  color: #B0A090;
}

.search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 16px;
  right: 16px;
  background: white;
  border: 1px solid var(--gold);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 16px var(--shadow-strong);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
}

.search-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #F0E8D8;
  transition: background 0.2s;
}

.search-item:hover {
  background: var(--parchment);
}

.search-item:last-child {
  border-bottom: none;
}

.search-gen {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  color: white;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}

.search-courtesy {
  font-size: 0.8rem;
  color: var(--ink-light);
}

.search-years {
  font-size: 0.75rem;
  color: #8B7355;
  margin-left: auto;
}

.search-empty {
  padding: 16px;
  text-align: center;
  color: #8B7355;
  font-size: 0.9rem;
}

/* Tree node highlight animation */
.tree-node.highlight rect {
  stroke: #FF4500 !important;
  stroke-width: 4 !important;
  animation: pulse-border 0.5s ease-in-out 3;
}

@keyframes pulse-border {
  0%, 100% { stroke-width: 4; }
  50% { stroke-width: 6; }
}

.nav-tab::before {
  content: '';
  position: absolute;
  right: 0;
  top: 30%;
  bottom: 30%;
  width: 1px;
  background: var(--gold);
  opacity: 0.4;
}

.nav-tab:last-child::before {
  display: none;
}

/* ===== Page Sections ===== */
.page-section {
  display: none;
  animation: fadeIn 0.4s ease;
}

.page-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Tree Section ===== */
#tree-section {
  position: relative;
}

.tree-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(245, 230, 200, 0.8);
  border-bottom: 1px solid rgba(201, 169, 110, 0.3);
  flex-wrap: wrap;
}

.tree-toolbar button {
  padding: 6px 16px;
  border: 1px solid var(--gold);
  background: var(--parchment-light);
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.tree-toolbar button:hover {
  background: var(--gold);
  color: white;
}

.tree-toolbar .gen-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: 12px;
}

.gen-dot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--ink-light);
}

.gen-dot span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.tree-container {
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 500px;
  overflow: hidden;
  position: relative;
  cursor: grab;
  background:
    radial-gradient(circle at 50% 50%, rgba(201, 169, 110, 0.06) 0%, transparent 70%);
}

.tree-container:active {
  cursor: grabbing;
}

.tree-container svg {
  width: 100%;
  height: 100%;
}

/* ===== Person Detail Panel ===== */
.detail-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(44, 24, 16, 0.5);
  z-index: 200;
  animation: fadeIn 0.3s ease;
}

.detail-overlay.show {
  display: flex;
  justify-content: center;
  align-items: center;
}

.detail-panel {
  background: var(--parchment-light);
  border: 2px solid var(--gold);
  border-radius: 8px;
  padding: 32px;
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 32px rgba(62, 39, 35, 0.3);
}

.detail-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 8px 8px 0 0;
}

.detail-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--gold);
  background: var(--parchment);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-light);
  transition: all 0.2s;
}

.detail-close:hover {
  background: var(--deep-red);
  color: white;
  border-color: var(--deep-red);
}

.detail-gen-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  color: white;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.detail-name {
  font-family: 'Ma Shan Zheng', 'Noto Serif SC', serif;
  font-size: 2.2rem;
  color: var(--deep-red);
  margin-bottom: 4px;
}

.detail-courtesy {
  font-size: 0.95rem;
  color: var(--gold-dark);
  margin-bottom: 16px;
}

.detail-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 16px 0;
}

.detail-field {
  margin-bottom: 12px;
}

.detail-field-label {
  font-size: 0.8rem;
  color: var(--gold-dark);
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 3px;
}

.detail-field-value {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink);
}

.detail-spouse-item {
  padding: 6px 10px;
  background: rgba(201, 169, 110, 0.1);
  border-left: 3px solid var(--gold);
  margin-bottom: 6px;
  border-radius: 0 4px 4px 0;
  font-size: 0.88rem;
}

.detail-spouse-type {
  color: var(--gold-dark);
  font-size: 0.78rem;
}

.detail-children-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.detail-child-tag {
  padding: 3px 10px;
  background: rgba(139, 0, 0, 0.08);
  border: 1px solid rgba(139, 0, 0, 0.2);
  border-radius: 12px;
  font-size: 0.82rem;
  color: var(--deep-red);
  cursor: pointer;
  transition: all 0.2s;
}

.detail-child-tag:hover {
  background: var(--deep-red);
  color: white;
}

/* ===== Overview Section ===== */
#overview-section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 20px;
}

.overview-title {
  text-align: center;
  font-family: 'Ma Shan Zheng', 'Noto Serif SC', serif;
  font-size: 1.8rem;
  color: var(--deep-red);
  margin-bottom: 32px;
  letter-spacing: 4px;
}

.lineage-card {
  background: var(--parchment-light);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px var(--shadow);
}

.lineage-card h3 {
  color: var(--deep-red);
  font-size: 1.2rem;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(201, 169, 110, 0.4);
  letter-spacing: 2px;
}

.ancestor-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  line-height: 2;
}

.ancestor-chip {
  display: inline-block;
  padding: 2px 10px;
  background: rgba(139, 0, 0, 0.06);
  border: 1px solid rgba(139, 0, 0, 0.15);
  border-radius: 4px;
  font-size: 0.9rem;
}

.ancestor-arrow {
  color: var(--gold-dark);
  font-size: 0.8rem;
}

.gen-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.gen-person-card {
  padding: 10px;
  background: white;
  border: 1px solid rgba(201, 169, 110, 0.3);
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  border-top: 3px solid var(--gold);
}

.gen-person-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
  border-top-color: var(--deep-red);
}

.gen-person-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.gen-person-years {
  font-size: 0.75rem;
  color: var(--ink-light);
  opacity: 0.7;
  margin-top: 2px;
}

/* ===== Poem Section ===== */
#poem-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

.poem-card {
  background: var(--parchment-light);
  border: 2px solid var(--gold);
  border-radius: 8px;
  padding: 40px;
  margin-bottom: 32px;
  text-align: center;
  box-shadow: 0 4px 16px var(--shadow);
  position: relative;
}

.poem-card::before,
.poem-card::after {
  content: '';
  position: absolute;
  width: 60px;
  height: 60px;
  border: 2px solid var(--gold);
  opacity: 0.3;
}

.poem-card::before {
  top: 12px;
  left: 12px;
  border-right: none;
  border-bottom: none;
}

.poem-card::after {
  bottom: 12px;
  right: 12px;
  border-left: none;
  border-top: none;
}

.poem-title {
  font-family: 'Ma Shan Zheng', 'Noto Serif SC', serif;
  font-size: 1.6rem;
  color: var(--deep-red);
  margin-bottom: 24px;
  letter-spacing: 4px;
}

.poem-text {
  font-family: 'Ma Shan Zheng', 'Noto Serif SC', serif;
  font-size: 1.5rem;
  line-height: 2.2;
  color: var(--ink);
  letter-spacing: 3px;
}

.poem-note {
  font-size: 0.85rem;
  color: var(--ink-light);
  margin-top: 20px;
  line-height: 1.8;
}

.gen-char-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.gen-char-item {
  text-align: center;
  padding: 12px 8px;
  border-radius: 8px;
  background: white;
  border: 1px solid rgba(201, 169, 110, 0.3);
}

.gen-char-char {
  font-family: 'Ma Shan Zheng', 'Noto Serif SC', serif;
  font-size: 2rem;
  font-weight: 700;
}

.gen-char-label {
  font-size: 0.7rem;
  color: var(--ink-light);
  margin-top: 4px;
}

/* ===== Chronicle Section ===== */
#chronicle-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

.timeline {
  position: relative;
  padding-left: 40px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--deep-red), var(--gold), var(--deep-red));
}

.timeline-item {
  position: relative;
  margin-bottom: 28px;
  padding: 16px 20px;
  background: var(--parchment-light);
  border: 1px solid rgba(201, 169, 110, 0.3);
  border-radius: 6px;
  box-shadow: 0 2px 6px var(--shadow);
  transition: transform 0.2s;
}

.timeline-item:hover {
  transform: translateX(4px);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -33px;
  top: 20px;
  width: 12px;
  height: 12px;
  background: var(--deep-red);
  border: 2px solid var(--gold);
  border-radius: 50%;
}

.timeline-year {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--deep-red);
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.timeline-event {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--ink);
}

/* ===== Tree Node Styles ===== */
.tree-node {
  cursor: pointer;
}

.tree-node rect {
  transition: all 0.2s;
}

.tree-node:hover rect {
  filter: brightness(0.95);
  stroke-width: 2.5;
}

.tree-node text {
  font-family: 'Noto Serif SC', serif;
  pointer-events: none;
}

.tree-link {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.5;
  opacity: 0.6;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--parchment-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gold-dark);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
    letter-spacing: 4px;
  }

  .hero h2 {
    font-size: 1.1rem;
    letter-spacing: 6px;
  }

  .hero {
    padding: 40px 16px 24px;
  }

  .nav-tab {
    padding: 10px 16px;
    font-size: 0.85rem;
    letter-spacing: 1px;
  }

  .tree-container {
    height: calc(100vh - 180px);
    min-height: 400px;
  }

  .detail-panel {
    padding: 20px 16px;
    margin: 8px;
    max-height: 90vh;
    width: 95%;
    max-width: none;
  }

  .detail-name {
    font-size: 1.8rem;
  }

  .detail-bio {
    font-size: 0.9rem;
    line-height: 1.8;
  }

  .poem-card {
    padding: 24px 16px;
  }

  .poem-text {
    font-size: 1.1rem;
    line-height: 2;
  }

  .gen-char-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .lineage-card {
    padding: 16px;
    font-size: 0.9rem;
  }

  .gen-overview-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
  }

  .tree-toolbar {
    padding: 8px 12px;
    gap: 6px;
    flex-wrap: wrap;
  }

  .tree-toolbar .gen-legend {
    margin-left: 0;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .tab-content {
    padding: 16px 12px;
  }

  .section-title {
    font-size: 1.3rem;
  }

  .chronicle-card {
    padding: 16px;
  }

  .chronicle-card p {
    font-size: 0.88rem;
    line-height: 1.8;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.5rem;
    letter-spacing: 2px;
  }

  .hero h2 {
    font-size: 0.9rem;
    letter-spacing: 3px;
  }

  .hero {
    padding: 30px 12px 20px;
  }

  .nav-inner {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }

  .nav-tab {
    padding: 8px 10px;
    font-size: 0.78rem;
    letter-spacing: 0.5px;
  }

  .tree-container {
    height: calc(100vh - 160px);
  }

  .detail-panel {
    padding: 16px 12px;
    border-radius: 6px;
    max-height: 92vh;
  }

  .detail-name {
    font-size: 1.5rem;
  }

  .detail-courtesy {
    font-size: 0.85rem;
  }

  .detail-info-grid {
    grid-template-columns: 1fr;
  }

  .gen-char-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .gen-char-grid span {
    padding: 6px 4px;
    font-size: 0.85rem;
  }

  .poem-text {
    font-size: 1rem;
    letter-spacing: 1px;
  }

  .gen-overview-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px;
  }

  .lineage-chain {
    font-size: 0.85rem;
  }

  .tree-toolbar button {
    padding: 4px 8px;
    font-size: 0.75rem;
  }
}

/* ===== Rucuan Branch Tree (入川六代支脉) ===== */
.rucuan-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 0;
}

.rucuan-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.rucuan-gen-label {
  font-size: 0.82rem;
  color: #8B7355;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.rucuan-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.rucuan-chip {
  padding: 6px 14px;
  background: #FDF6E3;
  border: 1px solid #D4C5A9;
  border-radius: 20px;
  font-size: 0.95rem;
  color: #5C4433;
  transition: all 0.2s;
}

.rucuan-chip b {
  color: #3d2817;
  font-weight: 600;
}

.rucuan-spouse {
  color: #A89080;
  font-size: 0.85rem;
  font-weight: normal;
}

.rucuan-chip.highlight {
  background: linear-gradient(135deg, #8B0000, #A52A2A);
  border-color: #5C0000;
  box-shadow: 0 2px 6px rgba(139, 0, 0, 0.3);
}

.rucuan-chip.highlight b,
.rucuan-chip.highlight .rucuan-spouse {
  color: #FDF6E3;
}

.rucuan-arrow {
  color: #B8860B;
  font-size: 1.2rem;
  line-height: 1;
  opacity: 0.7;
}

/* ===== Naming Table (入川字辈对照全表) ===== */
.naming-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.naming-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: #FFFDF8;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(139, 90, 43, 0.08);
}

.naming-table thead {
  background: linear-gradient(135deg, #8B0000, #A52A2A);
  color: #FDF6E3;
}

.naming-table th,
.naming-table td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid #E8DCC4;
}

.naming-table th {
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.05em;
}

.naming-table th small {
  font-size: 0.72rem;
  opacity: 0.85;
  font-weight: normal;
}

.naming-table td.naming-char {
  font-family: 'Noto Serif SC', 'STSong', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: #8B0000;
}

.naming-table tbody tr:hover {
  background: #FAF3E3;
}

.naming-table tbody tr.naming-row-highlight {
  background: #FDF0D5;
}

.naming-table tbody tr.naming-row-highlight td.naming-char {
  color: #5C0000;
  font-size: 1.35rem;
}

@media (max-width: 600px) {
  .naming-table {
    font-size: 0.82rem;
  }
  .naming-table th,
  .naming-table td {
    padding: 6px 4px;
  }
  .naming-table td.naming-char {
    font-size: 1.05rem;
  }
}
/* test comment */

/* ===== Ancient Lineage Table ===== */
.ancient-toggle-btn {
  background: #8B0000;
  color: #FDF6E3;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}
.ancient-toggle-btn:hover { background: #A52A2A; }
.ancient-hint {
  margin: 8px 0 12px;
  font-size: 0.88rem;
  color: #8B7355;
  line-height: 1.6;
}
.ancient-wrap.collapsed { display: none; }
.ancient-search {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 12px;
  border: 1px solid #D4C5A9;
  border-radius: 8px;
  background: #FFFDF8;
  font-size: 0.95rem;
  color: #3d2817;
  box-sizing: border-box;
}
.ancient-table-scroll {
  overflow-x: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(139, 90, 43, 0.08);
}
.ancient-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  background: #FFFDF8;
  min-width: 780px;
}
.ancient-table thead {
  background: linear-gradient(135deg, #8B0000, #A52A2A);
  color: #FDF6E3;
  position: sticky;
  top: 0;
}
.ancient-table th,
.ancient-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #E8DCC4;
  vertical-align: top;
  text-align: center;
}
.ancient-table .ancient-gen { font-weight: 600; color: #8B0000; }
.ancient-table .ancient-name { font-weight: 600; color: #3d2817; white-space: nowrap; }
.ancient-table .ancient-note { text-align: left; font-size: 0.8rem; color: #5C4433; max-width: 300px; }
.ancient-table tbody tr:hover { background: #FAF3E3; }
.ancient-table tr.ancient-row-highlight {
  background: #FDF0D5;
}
.ancient-table tr.ancient-row-highlight .ancient-gen {
  color: #5C0000;
  background: #F5E6C9;
}

/* ===== Migration Map ===== */
.migration-map {
  height: 420px;
  border-radius: 10px;
  background: #F5EED9;
  border: 1px solid #D4C5A9;
  overflow: hidden;
}
.leaflet-container {
  background: #F5EED9 !important;
  font-family: inherit;
}
.migration-marker { background: transparent !important; border: none !important; }
.migration-pin {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #8B0000, #A52A2A);
  border: 2px solid #FDF6E3;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(139, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FDF6E3;
  font-weight: 700;
  font-size: 0.85rem;
}
.migration-popup { font-size: 0.88rem; line-height: 1.6; }
.migration-popup b { color: #8B0000; font-size: 1rem; }
.migration-era { color: #8B7355; }
.migration-place { color: #3d2817; font-weight: 600; }
.migration-note { display: block; margin-top: 4px; color: #5C4433; }
.migration-legend {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}
.migration-legend-item {
  display: grid;
  grid-template-columns: 32px auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: #FFFDF8;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.88rem;
}
.migration-legend-item:hover { background: #FAF3E3; }
.migration-legend-idx {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, #8B0000, #A52A2A);
  color: #FDF6E3;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}
.migration-legend-gen { font-weight: 600; color: #3d2817; white-space: nowrap; }
.migration-legend-era { color: #8B7355; font-size: 0.82rem; white-space: nowrap; }
.migration-legend-place { color: #5C4433; text-align: right; font-size: 0.85rem; }
@media (max-width: 600px) {
  .migration-map { height: 320px; }
  .migration-legend-item { grid-template-columns: 28px auto 1fr; font-size: 0.82rem; }
  .migration-legend-era { grid-column: 2 / 4; font-size: 0.75rem; }
  .migration-legend-place { grid-column: 1 / 4; text-align: left; padding-left: 38px; }
}

/* ===== Share Link Button ===== */
.detail-share-row { margin-top: 16px; padding-top: 12px; border-top: 1px solid #E8DCC4; }
.detail-share-btn {
  background: #FDF6E3;
  border: 1px solid #D4C5A9;
  color: #8B0000;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}
.detail-share-btn:hover { background: #F5E6C9; }
.detail-share-btn:disabled { background: #E8DCC4; color: #8B7355; cursor: default; }
