 .timeline-container {
  position: relative;
  width: 1000px;
  height: 1200px;
  overflow: hidden;
  background: #fff;
  top: 25px;
}
.timeline_x {
  max-width: 100%;
  height: auto;
  aspect-ratio: 5 / 6;
}


.timeline-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; 
  border-top: 2px solid black;
}

#layer-history {
  z-index: 1;
}
#layer-grid {
  z-index: 2;
}
#layer-migration {
  z-index: 3;
}
#layer-events {
  z-index: 4;
}
#layer-ui {
  z-index: 5;

  pointer-events: auto; 
  cursor: crosshair;
}
.tooltip {
  position: absolute;
  z-index: 10;

  background: #222;
  color: #fff;

  padding: 6px 10px;
  border-radius: 4px;

  font-size: 12px;
  pointer-events: none;

  display: none;
}
.header_canvas{
display: flex;
  justify-content: space-between;
width: 1250px;
  position: relative;
  top: 30px;
  border-top: 2px solid black;

}
.filters{
margin-top: 15px;

}

canvas {
  image-rendering: auto;
}
.layout {
  display: flex;
  align-items: flex-start;
}
.panel-body{
position: relative;
  width: 650px;
  height: 1325px;
  overflow-y: auto;
}
.side-panel{
display: flex;
  flex-direction: column;
}

.panel-view{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

}
#panel-event {
  opacity: 0;
  transition: opacity 0.5s;
}

#panel-event.active {
  opacity: 1;
  z-index: 10;
  
}
.event-section {
  margin-top: 14px;
}

.section-title {
  font-weight: bold;
  margin-bottom: 6px;
}

.event-participants li {
  margin-bottom: 4px;
}

.event-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-direction: column;
}

.event-date {
  color: #888;
  font-size: 14px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  margin-right: 6px;
}

.category {
  background: #eee;
}

.type {
  background: #ddd;
}

#panel-map {
  opacity: 0;
  transition: opacity 0.5s;
}

#panel-map.active {
  opacity: 1;
   z-index: 9;
 width: 100%;
  height: 100%;
}

#panel-pers {
  opacity: 0;
  transition: opacity 0.5s;
}

#panel-pers.active {
  opacity: 1;
   z-index: 8;
}

.side-panel {
  width: 650px;
  overflow: auto;
  transition: width 0.25s ease;
  background: #f7f6f2;
  border-left: 1px solid #ddd;
  position: relative;
  top: -35px;
  left: 20px;
}
.side-panel.open {
  width: 340px;
}

.panel-content {
  padding: 16px;
  font-size: 16px;
  line-height: 1.5;
  text-align: justify;
}
#cy {
z-index: 1;
  height: 650px;
  width: 560px;
  border-color: #737168;
  border-style: double;
  background-color: beige;
  display: block;
}
.chron-data{
margin-left: 25px;
  padding-top: 30px;
margin-left: 25px;
  padding-top: 30px;
  font-size: 15px;
}
.panel-tab {
  display: none;
  padding: 12px;
}

.panel-tab.active {
  display: block;
}

#filter{
display: flex;
    justify-content: start;
    align-items: center;

}
.life-years {
  color: #666;
  font-size: 0.9em;
}

.person-summary {
  margin: 10px 0;
  line-height: 1.4;
}

.person-facts {
  padding-left: 16px;
  font-size: 0.9em;
}

.timeline-summary {
  margin-top: 10px;
  font-size: 0.9em;
  background: #f7f7f7;
  padding: 8px;
}

.person-relations {
  margin-top: 10px;
  font-size: 0.9em;
}

.person-links {
  margin-top: 12px;
}
 
  .tag {
  padding-left: 12px;
  
  }

.chron-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 2rem;
  font-size: 14px;
  line-height: 1.45;
  background: #fff;
  border: 1px solid #ddd;
}


.chron-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;

  padding: 10px 8px;
  text-align: left;
  vertical-align: bottom;

  font-size: 13px;
  font-weight: 600;
  color: #333;

  background: #f7f7f7;
  border-bottom: 2px solid #ccc;
  border-right: 1px solid #e5e5e5;

  white-space: nowrap;
}

.chron-table thead th:last-child {
  border-right: none;
}


.chron-table td {
  padding: 8px 8px;

  border-bottom: 1px solid #eee;
}


.chron-table tbody tr:nth-child(even) {
  background: #fafafa;
}


.chron-table tbody tr:hover {
  background: #fffbe6;
  cursor: pointer;
}


.chron-table tbody tr.selected {
  background: #fff3cd;
  box-shadow: inset 3px 0 0 #f39c12;
  font-weight: 500;
}


.chron-table td:first-child {
  width: 90px;
  white-space: nowrap;
  color: #666;
  font-family: monospace;
  font-size: 13px;
}


.chron-table td:nth-child(2) {
  min-width: 260px;
  font-weight: 500;
}


.chron-table td:nth-child(3) {
  min-width: 120px;
  color: #555;
}


.chron-table td:nth-child(4) {
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}


.chron-table td:nth-child(5),
.chron-table td:nth-child(6),
.chron-table td:nth-child(7) {
  font-size: 13px;
  color: #555;
}


.chron-table td:empty::before {
  content: "—";
  color: #bbb;
}


.chron-table-wrapper {
  overflow-x: auto;
  margin: 1rem 0 2rem;
  border: 1px solid #ddd;
  border-radius: 8px;
}


.chron-table-wrapper .chron-table {
  margin: 0;
  border: none;
}


details {
  margin: 1rem 0 2rem;
}

details summary {
  cursor: pointer;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 0.75rem;
  outline: none;
}

details summary:hover {
  color: #1a5276;
}
.activity-cell {
  min-width: 180px;
  line-height: 1.4;
}

.activity-group,
.activity-tag {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.activity-group {
  background: color-mix(in srgb, var(--tag-color) 15%, white);
  color: var(--tag-color);
  border: 1px solid color-mix(in srgb, var(--tag-color) 35%, white);
}

.activity-tag {
  background: color-mix(in srgb, var(--tag-color) 8%, white);
  color: var(--tag-color);
}

.person-analysis {
  margin-top: 20px;
  padding: 14px 16px;
  background: #f9fafb;
  border-left: 4px solid #4b5563;
  border-radius: 8px;
}

.person-analysis h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.person-analysis p {
  margin: 0 0 10px;
  line-height: 1.6;
}

.person-analysis ul {
  margin: 0;
  padding-left: 18px;
}

.person-analysis li {
  margin-bottom: 4px;
}

/* ==========================================================
   PANEL-PERS (панель "Персона")
   ========================================================== */

#panel-pers {
  font-family: Arial, Helvetica, sans-serif;
  color: #222;
  line-height: 1.55;
  background: #ffffff;
}

#panel-pers .panel-content {
  max-width: 100%;
  padding: 16px 18px 24px;
}

/* ==========================================================
   Заголовок
   ========================================================== */

#person-name {
  margin: 0 0 6px;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 700;
  color: #1f2937;
}

.life-years {
  margin: 0;
  font-size: 16px;
  color: #6b7280;
  font-weight: 600;
}

.role {
  margin: 6px 0 14px;
  font-size: 15px;
  color: #374151;
  font-style: italic;
}

/* ==========================================================
   Краткое описание
   ========================================================== */

.person-summary {
  margin: 0 0 18px;
  padding: 12px 14px;
  background: #f9fafb;
  border-left: 4px solid #9ca3af;
  border-radius: 6px;
  font-size: 15px;
  color: #374151;
}

/* ==========================================================
   Общие заголовки секций
   ========================================================== */

#panel-pers h3 {
  margin: 24px 0 10px;
  padding-bottom: 6px;
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  border-bottom: 1px solid #e5e7eb;
}

/* ==========================================================
   Списки фактов
   ========================================================== */

.person-facts,
.person-migration {
  margin: 0 0 14px;
  padding-left: 22px;
}

.person-facts li,
.person-migration li {
  margin-bottom: 6px;
  color: #374151;
}

.person-facts b,
.person-migration b {
  color: #111827;
}

/* ==========================================================
   Список мест проживания
   ========================================================== */

#person-migration {
  columns: 2;
  column-gap: 30px;
}

#person-migration li {
  break-inside: avoid;
}

/* ==========================================================
   Блок "Хронология жизни"
   ========================================================== */

.timeline-summary {
  margin-top: 22px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.timeline-summary h3 {
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.timeline-summary p {
  margin: 6px 0;
  font-size: 14px;
}

.timeline-summary b {
  color: #374151;
}

.timeline-summary span {
  font-weight: 600;
  color: #111827;
}

/* ==========================================================
   Семейные связи
   ========================================================== */

.person-relations {
  margin-top: 24px;
}

.person-relations p {
  margin: 8px 0;
}

.person-relations b {
  display: inline-block;
  min-width: 90px;
  color: #374151;
}

.person-relations span {
  color: #111827;
}

/* ==========================================================
   Список детей
   ========================================================== */

#person-children.person-facts {
  margin-top: 6px;
}

#person-children li {
  margin-bottom: 5px;
}

/* ==========================================================
   Аналитический блок
   ========================================================== */

.person-analysis {
  margin-top: 24px;
  padding: 14px 16px;
  background: #f9fafb;
  border-left: 4px solid #4b5563;
  border-radius: 8px;
}

.person-analysis p {
  margin: 0 0 10px;
}

.analysis-stats {
  margin: 0;
  padding-left: 20px;
}

.analysis-stats li {
  margin-bottom: 4px;
}

/* ==========================================================
   Теги активности
   ========================================================== */

.activity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.activity-tag {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  background: #f3f4f6;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
}

/* ==========================================================
   Навигационные ссылки
   ========================================================== */

.person-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.person-links a {
  display: inline-block;
  padding: 6px 12px;
  font-size: 13px;
  color: #1f2937;
  text-decoration: none;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.person-links a:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
}

/* ==========================================================
   Исторический контекст
   ========================================================== */

.person-context {
  margin-top: 24px;
  padding: 12px 14px;
  background: #fefce8;
  border-left: 4px solid #eab308;
  border-radius: 6px;
  color: #444;
}

/* ==========================================================
   Адаптивность
   ========================================================== */

@media (max-width: 768px) {
  #panel-pers .panel-content {
    padding: 12px;
  }

  #person-name {
    font-size: 24px;
  }

  #panel-pers h3 {
    font-size: 17px;
  }

  #person-migration {
    columns: 1;
  }

  .person-relations b {
    min-width: auto;
    display: block;
    margin-bottom: 2px;
  }

  .person-links {
    gap: 6px;
  }

  .person-links a {
    font-size: 12px;
    padding: 5px 10px;
  }
}

 Адаптация для мобильных устройств 
@media (max-width: 768px) {
  .chron-table {
    font-size: 13px;
  }

  .chron-table th,
  .chron-table td {
    padding: 6px 6px;
  }

  .chron-table td:nth-child(2) {
    min-width: 220px;
  }

  .chron-table td:nth-child(5),
  .chron-table td:nth-child(6),
  .chron-table td:nth-child(7) {
    min-width: 120px;
  }
}
#event-sources {
  margin-top: 10px;
}

.source-item {
  margin-bottom: 14px;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.source-head {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 4px;
}
.source-relation {
font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 4px;

}
.source-title {
  font-weight: 600;
  color: #111827;

  margin-bottom: 4px;
}

.source-meta {
  font-size: 13px;
  color: #6b7280;
}

.source-quote {
  margin-top: 8px;
  padding-left: 10px;
  border-left: 3px solid #d1d5db;
  font-style: italic;
  color: #374151;
}
.source-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  font-size: 15px;
}
.quote-block {
  margin: 14px 0;
  padding: 12px 14px;
  background: #f9fafb;
  border-left: 4px solid #9ca3af;
  border-radius: 6px;
}

.quote-text {
  font-style: italic;
  color: #374151;
  line-height: 1.3;
}

.quote-source {
  margin-top: 8px;
  font-size: 13px;
  color: #6b7280;
}
.chron-sources {
  margin-top: 40px;
  padding: 18px 20px;

  background: #ffffff;

  border-top: 2px solid #e5e7eb;
}

.chron-sources h2 {
  margin-bottom: 12px;

  font-size: 26px;
}

.sources-description {
  margin-bottom: 24px;

  color: #4b5563;

  line-height: 1.6;
}

.source-group {
  margin-bottom: 28px;
}

.source-group h3 {
  margin-bottom: 12px;

  font-size: 18px;

  color: #1f2937;
}

.source-list {
  margin: 0;
  padding-left: 20px;
}

.source-item {
  margin-bottom: 10px;

  line-height: 1.5;
}

.source-item a {
  color: #1d4ed8;

  text-decoration: none;
}

.source-item a:hover {
  text-decoration: underline;
}

.source-meta {
  display: inline-block;

  margin-left: 8px;

  color: #6b7280;

  font-size: 13px;
}