/* 历史人物双时间轴（朝代标签 + 迷你轴 + 竖向分组） */

#figure-timeline-root.figure-era,
.figure-era {
  position: relative;
  z-index: 2;
  color: #e6e6e6;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 12px 48px;
  box-sizing: border-box;
}

.figure-era__empty {
  color: #a8a8a8;
  font-size: 14px;
  padding: 24px 8px;
}

.figure-era__sticky {
  position: sticky;
  /* 吸在维度 Tab 栏下方（与故事搜索条同一套 top 算法） */
  top: calc(
    env(safe-area-inset-top, 0px) +
    var(--site-marquee-height, 0px) +
    var(--home-dim-primary-bar-h, 52px)
  );
  z-index: 7;
  padding: 10px 0 12px;
  margin: 0 -4px;
  box-sizing: border-box;
  /* 不用 backdrop-filter：WebKit 上与双 sticky 叠用易造成滚动时画面抖动 */
  background: linear-gradient(
    180deg,
    rgba(5, 7, 20, 0.98) 0%,
    rgba(5, 7, 20, 0.96) 70%,
    rgba(5, 7, 20, 0.92) 100%
  );
  border-bottom: 1px solid rgba(212, 160, 72, 0.22);
}

.figure-era__sticky-spacer {
  height: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.figure-era__sticky--affixed {
  margin-left: 0;
  margin-right: 0;
}

html.is-in-app .figure-era__sticky {
  top: 0;
}

/* PC：祖先 overflow / 全宽 breakout 常使 sticky 失效，改由 JS fixed 吸顶；未固定前保持文档流 */
@media (min-width: 992px) {
  html:not(.is-in-app) .figure-era__sticky {
    position: relative;
    top: auto;
  }
}

.figure-era__search {
  margin: 0 4px 10px;
}

.figure-era__search-bar {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.figure-era__search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(212, 160, 72, 0.18);
}

.figure-era__search-input-wrap:focus-within {
  border-color: rgba(245, 208, 106, 0.55);
  box-shadow: 0 0 0 2px rgba(212, 160, 72, 0.18);
}

.figure-era__search-type-ph {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  pointer-events: none;
  color: #888;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
}

.figure-era__search-input-wrap--type-on .figure-era__search-type-ph {
  display: flex;
}

.figure-era__search-type-ph-inner {
  overflow: hidden;
  text-overflow: ellipsis;
}

.figure-era__search-type-caret {
  width: 1px;
  height: 1em;
  margin-left: 1px;
  background: #d4b870;
  animation: figure-era-caret 1s step-end infinite;
}

@keyframes figure-era-caret {
  50% { opacity: 0; }
}

.figure-era__search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: #e6e6e6;
  font-size: 14px;
  height: 42px;
}

.figure-era__search-btn {
  flex-shrink: 0;
  appearance: none;
  border: none;
  border-radius: 14px;
  padding: 0 16px;
  background: linear-gradient(135deg, #d4a048, #f5d06a);
  color: #111;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.figure-era__search-btn:active {
  transform: scale(0.98);
}

.figure-era__search-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 12;
  max-height: 280px;
  overflow-y: auto;
  border-radius: 14px;
  background: #14182e;
  border: 1px solid rgba(212, 160, 72, 0.28);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.figure-era__search-suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: #e6e6e6;
  padding: 10px 12px;
  cursor: pointer;
}

.figure-era__search-suggest-item:last-child {
  border-bottom: none;
}

.figure-era__search-suggest-item:hover {
  background: rgba(212, 160, 72, 0.12);
}

.figure-era__search-suggest-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.figure-era__search-suggest-kind {
  display: inline-block;
  margin-right: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #111;
  background: linear-gradient(135deg, #d4a048, #f5d06a);
  vertical-align: 1px;
}

.figure-era__search-suggest-snippet {
  margin-top: 3px;
  font-size: 12px;
  color: #a8a8a8;
  line-height: 1.4;
}

.figure-era__search-hl {
  color: #ffd27a;
  font-weight: 700;
}

.figure-era__search-meta {
  margin-top: 8px;
}

.figure-era__search-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  border-radius: 999px;
  background: rgba(212, 160, 72, 0.16);
  border: 1px solid rgba(212, 160, 72, 0.35);
  color: #f0e0b0;
  font-size: 12px;
}

.figure-era__search-chip-x {
  appearance: none;
  border: none;
  background: rgba(0, 0, 0, 0.2);
  color: #f0e0b0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  line-height: 1;
  cursor: pointer;
  font-size: 14px;
}

.figure-era__search-empty {
  margin: 8px 0 0;
  font-size: 13px;
  color: #c9a86a;
}

.figure-era--searching .figure-era__group.is-search-miss {
  display: none;
}

.figure-era--searching .is-search-miss:not(.figure-era__group) {
  opacity: 0.28;
  filter: grayscale(0.35);
}

.figure-era--searching .is-search-hit {
  opacity: 1;
  filter: none;
}

.figure-era__filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 4px 10px;
}

.figure-era__filter-btn {
  appearance: none;
  border: 1px solid rgba(212, 160, 72, 0.22);
  background: rgba(255, 255, 255, 0.05);
  color: #c9c9c9;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.2s ease;
}

.figure-era__filter-btn.is-active {
  background: linear-gradient(135deg, #d4a048, #f5d06a);
  color: #111;
  border-color: #e8c76f;
  font-weight: 600;
}

.figure-era__tabs-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 0 10px;
  padding: 0 4px 2px;
}

.figure-era__tabs-wrap::-webkit-scrollbar {
  display: none;
}

.figure-era__tabs {
  display: flex;
  gap: 8px;
  width: max-content;
}

.figure-era__tab {
  flex-shrink: 0;
  appearance: none;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(212, 160, 72, 0.22);
  color: #c9c9c9;
  font-size: 13px;
  cursor: pointer;
  transition: 0.22s ease;
}

.figure-era__tab.is-active {
  background: linear-gradient(135deg, #d4a048, #f5d06a);
  color: #111;
  border-color: #e8c76f;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(212, 160, 72, 0.4);
}

.figure-era__mini {
  margin: 0 4px;
  padding: 10px 8px 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(212, 160, 72, 0.16);
  cursor: pointer;
  user-select: none;
}

.figure-era__mini-track {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: visible;
}

.figure-era__mini-seg {
  position: absolute;
  top: 3px;
  height: 12px;
  border-radius: 4px;
  opacity: 0.85;
  pointer-events: none;
}

.figure-era__mini-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(230, 230, 230, 0.28);
  transform: translateX(-50%);
  pointer-events: none;
}

.figure-era__mini-tick-lab {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #a8a8a8;
  white-space: nowrap;
}

.figure-era__mini-viewport {
  position: absolute;
  top: -2px;
  height: 22px;
  border: 2px solid #f5d06a;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(245, 208, 106, 0.45);
  background: rgba(245, 208, 106, 0.12);
  pointer-events: none;
  /* 去掉过渡，避免滚动中指示器动画加重合成层抖动 */
}

.figure-era__main {
  padding-top: 8px;
}

.figure-era__group {
  position: relative;
  padding-left: 26px;
  padding-bottom: 28px;
  scroll-margin-top: calc(
    env(safe-area-inset-top, 0px) +
    var(--site-marquee-height, 0px) +
    var(--home-dim-primary-bar-h, 52px) +
    160px
  );
}

.figure-era__group::before {
  content: "";
  position: absolute;
  /* 轴线中心 x=8（与圆点中心对齐） */
  left: 7px;
  top: 4px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(
    180deg,
    var(--era-accent, rgba(212, 160, 72, 0.9)),
    rgba(212, 160, 72, 0.08)
  );
}

.figure-era__group-title {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  color: #d4b870;
}

.figure-era__group-title::before {
  content: "";
  position: absolute;
  /* group padding-left 26 + left + r6 = 8 → left=-24 */
  left: -24px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle, #f5d06a, var(--era-accent, #d4a048));
  box-shadow:
    0 0 0 4px rgba(212, 160, 72, 0.15),
    0 0 10px rgba(212, 160, 72, 0.35);
}

.figure-era__group-name {
  letter-spacing: 0.04em;
}

.figure-era__group-range {
  font-size: 12px;
  font-weight: 500;
  color: #a8a8a8;
}

.figure-era__subtitle {
  font-size: 13px;
  color: #a8a8a8;
  margin: 0 0 6px;
  padding-left: 2px;
}

.figure-era__people {
  margin-bottom: 14px;
}

.figure-era__person-row {
  display: flex;
  gap: 8px;
  width: 100%;
  overflow: visible;
  padding: 2px 8px 2px 0;
  box-sizing: border-box;
}

/* 搜索命中落在「更多」时，才为气泡预留上方空间 */
.figure-era__person-row:has(.figure-era__more-wrap.is-has-bubble) {
  padding-top: 56px;
}

.figure-era__person {
  flex: 1 1 0;
  min-width: 0;
  max-width: 96px;
  padding: 10px 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(212, 160, 72, 0.16);
  text-align: center;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  appearance: none;
  font: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.figure-era__person:hover,
.figure-era__person:focus-visible {
  border-color: rgba(212, 160, 72, 0.55);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.figure-era__person--more {
  background: rgba(212, 160, 72, 0.12);
  border-color: rgba(212, 160, 72, 0.42);
}

.figure-era__person.is-search-hit,
.figure-era__event.is-search-hit {
  border-color: #f5d06a;
  box-shadow: 0 0 0 1px rgba(245, 208, 106, 0.55), 0 0 16px rgba(245, 208, 106, 0.25);
}

.figure-era__person.is-search-hit .figure-era__avatar {
  border-color: #f5d06a;
  box-shadow: 0 0 0 2px rgba(245, 208, 106, 0.55), 0 0 12px rgba(245, 208, 106, 0.35);
}

.figure-era__more-wrap {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 96px;
  display: flex;
  align-items: stretch;
  overflow: visible;
}

.figure-era__more-wrap > .figure-era__person--more {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
}

/* 整颗气泡浮在「更多」卡片正上方，不遮挡 100+/查看全部 */
.figure-era__search-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  top: auto;
  right: auto;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 48px;
  transform: translateX(-50%);
  text-decoration: none;
  color: #f5e6c8;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
  animation: figure-era-bubble-in 0.28s ease;
  pointer-events: auto;
}

.figure-era__search-bubble-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #f5d06a;
  box-shadow: 0 0 0 2px rgba(245, 208, 106, 0.35), 0 0 14px rgba(245, 208, 106, 0.4);
  background: #2a2a3f;
}

.figure-era__search-bubble-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.figure-era__search-bubble-badge {
  position: absolute;
  top: -4px;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #d4a048;
  color: #1a1408;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.figure-era__search-bubble-tip {
  font-size: 10px;
  line-height: 1.1;
  font-weight: 600;
  color: #f5d06a;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.figure-era__search-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: #f5d06a;
  transform: rotate(45deg);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2);
}

@keyframes figure-era-bubble-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(4px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.figure-era__chip.is-search-hit {
  border-color: #f5d06a;
  background: rgba(245, 208, 106, 0.16);
  box-shadow: 0 0 0 1px rgba(245, 208, 106, 0.45), 0 0 12px rgba(245, 208, 106, 0.28);
}

.figure-era__chip.is-search-hit .figure-era__chip-avatar {
  border-color: #f5d06a;
  box-shadow: 0 0 0 2px rgba(245, 208, 106, 0.4);
}

.figure-era__chip.is-search-hit .figure-era__chip-name {
  color: #f5d06a;
  font-weight: 700;
}

.figure-era__avatar {
  width: 48px;
  height: 48px;
  margin: 0 auto 8px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #3a3a5a, #2a2a3f);
  border: 1px solid rgba(212, 160, 72, 0.28);
}

.figure-era__avatar--more {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(212, 160, 72, 0.35), rgba(245, 208, 106, 0.2));
  border-color: rgba(245, 208, 106, 0.55);
}

.figure-era__more-plus {
  font-size: 22px;
  font-weight: 700;
  color: #f5d06a;
  line-height: 1;
}

.figure-era__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.figure-era__person-name {
  font-size: 13px;
  color: #f0f0f0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.figure-era__person-count {
  margin-top: 3px;
  font-size: 11px;
  color: #a8a8a8;
}

/* 全部人物弹层：竖向年份轴 + 横向小号头像 */
.figure-era__sheet[hidden] {
  display: none !important;
}

.figure-era__sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.figure-era__sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
}

.figure-era__sheet-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(82vh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(180deg, #14182e 0%, #0a0c18 100%);
  border: 1px solid rgba(212, 160, 72, 0.28);
  border-bottom: none;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45);
}

.figure-era__sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(212, 160, 72, 0.18);
}

.figure-era__sheet-title {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  color: #d4b870;
}

.figure-era__sheet-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #e6e6e6;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.figure-era__sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px));
}

.figure-era__year-timeline {
  position: relative;
  padding-left: 14px;
}

.figure-era__year-timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, rgba(212, 160, 72, 0.75), rgba(212, 160, 72, 0.12));
}

.figure-era__year-block {
  position: relative;
  margin-bottom: 16px;
}

.figure-era__year-label {
  position: relative;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #d4b870;
}

.figure-era__year-label::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, #f5d06a, #d4a048);
  box-shadow: 0 0 0 3px rgba(212, 160, 72, 0.18);
}

.figure-era__year-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.figure-era__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(212, 160, 72, 0.16);
  text-decoration: none;
  color: #e6e6e6;
}

.figure-era__chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #2a2a3f;
  border: 1px solid rgba(212, 160, 72, 0.25);
}

.figure-era__chip-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.figure-era__chip-name {
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 5.5em;
}

html.figure-era-sheet-open,
html.figure-era-sheet-open body {
  overflow: hidden;
}

.figure-era__event-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.figure-era__event {
  margin: 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(212, 160, 72, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.figure-era__event.is-major {
  border-color: rgba(212, 160, 72, 0.42);
  background: rgba(212, 160, 72, 0.08);
}

.figure-era__event-date {
  font-size: 12px;
  color: #d4b870;
  margin-bottom: 5px;
}

.figure-era__event-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  color: #f0f0f0;
}

.figure-era__event-desc {
  margin: 0;
  font-size: 13px;
  color: #b8b8b8;
  line-height: 1.55;
}

.figure-era__group-empty {
  color: #888;
  font-size: 13px;
}

.figure-era--people-only [data-era-block="events"],
.figure-era--events-only [data-era-block="people"] {
  display: none;
}

/* PC */
@media (min-width: 992px) {
  .figure-era {
    padding: 0 20px 64px;
  }

  .figure-era__tab {
    font-size: 14px;
    padding: 9px 18px;
  }

  .figure-era__event-grid {
    grid-template-columns: 1fr 1fr;
  }

  .figure-era__sheet {
    align-items: center;
    padding: 24px;
  }

  .figure-era__sheet-panel {
    border-radius: 20px;
    border-bottom: 1px solid rgba(212, 160, 72, 0.28);
    max-height: min(78vh, 680px);
  }
}

/* 人物面板改为竖向：外层不再横向长滚 */
.home-dim-tabs__panel--figures .figure-timeline-panel__hscroll--era,
.home-dim-tabs__panel--figures .figure-timeline-panel__hscroll {
  overflow-x: visible !important;
  overflow-y: visible !important;
  max-width: 100%;
}

.figure-era__loading,
.figure-timeline__loading.figure-era__loading {
  color: rgba(212, 184, 112, 0.9);
  text-align: center;
  padding: 48px 12px;
  font-size: 14px;
}

#home-dimension-tabs:has(#home-dim-tab-figures:checked) #figure-timeline-root {
  width: 100%;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}
