/* ========== 全局重置与变量 ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-light: #1c2a4a;
  --gold: #c9a84c;
  --gold-dim: #8b7a3a;
  --gold-bright: #e8c95a;
  --text-primary: #e0d8c8;
  --text-secondary: #8b7e6a;
  --text-dim: #5a5245;
  --border-color: #2a2a3e;
  --border-gold: #c9a84c;
  --shadow-dark: rgba(0,0,0,0.6);
  --transition: 0.3s ease;
}
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ========== 顶部标题栏 ========== */
header {
  background: linear-gradient(135deg, #0d1117 0%, #1a1a2e 50%, #0d1117 100%);
  border-bottom: 1px solid var(--gold-dim);
  padding: 1.5rem 2rem;
  text-align: center;
  position: relative;
}
header::before, header::after {
  content: "◆";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  font-size: 0.8rem;
  opacity: 0.6;
}
header::before { left: 2rem; }
header::after { right: 2rem; }
header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.3em;
  text-shadow: 0 0 20px rgba(201,168,76,0.3);
}
header .subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
  letter-spacing: 0.15em;
}

/* ========== Tab 导航 ========== */
nav {
  display: flex;
  justify-content: center;
  gap: 0;
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border-color);
  padding: 0;
}
.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 1rem;
  padding: 0.9rem 2.2rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  letter-spacing: 0.08em;
}
.tab-btn:hover { color: var(--gold); }
.tab-btn.active {
  color: var(--gold);
  font-weight: 600;
}
.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(201,168,76,0.5);
}

/* ========== 主内容区 ========== */
main {
  flex: 1;
  position: relative;
}
.tab-panel {
  display: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  min-height: 60vh;
}
.tab-panel.active {
  display: block;
  opacity: 1;
}

/* ========== Tab1: 序列途径全景图 ========== */
.pathway-container {
  padding: 1.5rem;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}
.pathway-grid-wrapper {
  position: relative;
  min-width: max-content;
}
/* 途径组标头行 */
.group-headers {
  display: grid;
  grid-template-columns: 3.5rem repeat(22, 7rem);
  gap: 0;
  margin-bottom: 0.5rem;
}
.group-header-cell {
  text-align: center;
  font-size: 0.75rem;
  color: var(--gold);
  padding: 0.4rem 0.3rem;
  border-bottom: 1px solid var(--gold-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-header-cell.empty { border-bottom: none; }
/* 序列等级标签列 */
.seq-label {
  width: 3.5rem;
  min-width: 3.5rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-dim);
  padding: 0.5rem 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
/* 途径名称行 */
.pathway-names-row {
  display: grid;
  grid-template-columns: 3.5rem repeat(22, 7rem);
  gap: 0;
}
.pathway-name-cell {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold);
  padding: 0.6rem 0.2rem 0.4rem;
  border-bottom: 2px solid var(--gold-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--transition);
}
.pathway-name-cell.empty { border-bottom: none; }
/* 途径缩略图行 */
.pathway-thumb-row {
  display: grid;
  grid-template-columns: 3.5rem repeat(22, 7rem);
  gap: 0;
  margin-bottom: 0.3rem;
}
.pathway-thumb-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.5rem;
}
.pathway-thumb-cell.empty { }
.pathway-thumb-cell img {
  width: 36px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--gold-dim);
  opacity: 0.85;
  transition: opacity 0.3s, transform 0.3s;
  cursor: pointer;
  background: var(--bg-card);
}
.pathway-thumb-cell img:hover {
  opacity: 1;
  transform: scale(1.8);
  z-index: 10;
  position: relative;
  box-shadow: 0 4px 20px rgba(201,168,76,0.4);
}
.pathway-grid.has-highlight .pathway-thumb-cell img { opacity: 0.2; }
.pathway-grid.has-highlight .pathway-thumb-cell.highlighted img { opacity: 1; }
/* 序列网格 */
.pathway-grid {
  display: grid;
  grid-template-columns: 3.5rem repeat(22, 7rem);
  grid-template-rows: repeat(10, 2.6rem);
  gap: 0;
}
.seq-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.78rem;
  padding: 0.2rem 0.3rem;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid rgba(42,42,62,0.5);
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, color 0.25s, opacity 0.25s;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
  background: var(--bg-card);
}
.seq-cell:hover {
  background: var(--bg-card-light);
  color: var(--gold-bright);
  z-index: 2;
}
/* 途径组分隔线 - 右侧加粗 */
.seq-cell.group-end {
  border-right: 2px solid var(--gold-dim);
}
/* hover高亮效果 */
.pathway-grid.has-highlight .seq-cell { opacity: 0.3; }
.pathway-grid.has-highlight .seq-cell.highlighted {
  opacity: 1;
  border-color: var(--gold) !important;
  background: rgba(201,168,76,0.12);
  box-shadow: inset 0 0 8px rgba(201,168,76,0.1);
}
.pathway-grid.has-highlight .pathway-name-cell { opacity: 0.3; }
.pathway-grid.has-highlight .pathway-name-cell.highlighted {
  opacity: 1;
  color: var(--gold-bright);
  text-shadow: 0 0 8px rgba(201,168,76,0.4);
}
.pathway-grid.has-highlight .group-header-cell { opacity: 0.3; }
.pathway-grid.has-highlight .group-header-cell.highlighted { opacity: 1; }

/* 浮层 */
.seq-tooltip {
  position: fixed;
  z-index: 1000;
  background: #1c2333;
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 0.8rem 1rem;
  max-width: 280px;
  box-shadow: 0 8px 30px var(--shadow-dark), 0 0 15px rgba(201,168,76,0.15);
  pointer-events: none;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.2s, transform 0.2s;
}
.seq-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.seq-tooltip .tip-title {
  color: var(--gold);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}
.seq-tooltip .tip-pathway {
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-bottom: 0.3rem;
}
.seq-tooltip .tip-desc {
  color: var(--text-primary);
  font-size: 0.8rem;
  line-height: 1.5;
}

/* ========== Tab2: 角色关系图 ========== */
.character-container {
  padding: 1rem;
  height: 70vh;
  min-height: 500px;
}
#character-chart {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: var(--bg-secondary);
}
/* 角色小传浮层 */
.char-card {
  position: fixed;
  z-index: 1000;
  background: #1c2333;
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  max-width: 300px;
  box-shadow: 0 8px 30px var(--shadow-dark), 0 0 15px rgba(201,168,76,0.15);
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.2s, transform 0.2s;
}
.char-card.visible {
  opacity: 1;
  transform: translateY(0);
}
.char-card .char-name {
  color: var(--gold);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.char-card .char-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  flex-shrink: 0;
  background: var(--bg-card);
}
.char-card .char-avatar-fallback {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--gold-dim);
}
.char-card .char-aliases {
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
}
.char-card .char-info {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-primary);
}
.char-card .char-info span {
  display: inline-block;
  margin-right: 0.8rem;
}
.char-card .char-info .label { color: var(--text-secondary); }
.char-card .char-summary {
  font-size: 0.8rem;
  color: var(--text-primary);
  line-height: 1.5;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

/* ========== Tab3: 时间轴 ========== */
/* 时间轴英雄区 */
.timeline-hero {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.2rem 2rem;
  background: linear-gradient(135deg, rgba(26,26,46,0.9) 0%, rgba(13,17,23,0.95) 100%);
  border-bottom: 1px solid var(--gold-dim);
}
.timeline-hero-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  box-shadow: 0 0 15px rgba(201,168,76,0.3);
}
.timeline-hero-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.1em;
}
.timeline-hero-path {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}
.timeline-container {
  padding: 2rem 1.5rem;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}
.timeline-container:active { cursor: grabbing; }
.timeline-wrapper {
  min-width: max-content;
  position: relative;
  padding: 2rem 0 3rem;
}
/* 时间轴线 */
.timeline-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), var(--gold), var(--gold-dim), transparent);
  border-radius: 2px;
}
.timeline-nodes {
  display: flex;
  gap: 0;
  position: relative;
  align-items: center;
  min-height: 360px;
}
.timeline-node {
  flex: 0 0 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s;
}
.timeline-node:hover { transform: scale(1.05); }
/* 上方内容（偶数）或下方内容（奇数） */
.timeline-node .node-content {
  width: 130px;
  padding: 0.6rem 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  text-align: center;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.timeline-node:hover .node-content {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(201,168,76,0.2);
}
.timeline-node .node-content.top {
  position: absolute;
  bottom: calc(50% + 22px);
}
.timeline-node .node-content.bottom {
  position: absolute;
  top: calc(50% + 22px);
}
.node-content .node-seq {
  font-size: 0.65rem;
  color: var(--gold);
  margin-bottom: 0.15rem;
}
.node-content .node-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}
.node-content .node-volume {
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
}
.node-content .node-event {
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.3;
}
.node-content .node-year {
  font-size: 0.65rem;
  color: var(--gold-dim);
  margin-top: 0.15rem;
}
/* 连接线 */
.timeline-node .node-stem {
  width: 2px;
  height: 20px;
  background: var(--gold-dim);
  position: absolute;
}
.timeline-node .node-stem.top {
  bottom: calc(50% + 2px);
}
.timeline-node .node-stem.bottom {
  top: calc(50% + 2px);
}
/* 节点圆点 */
.timeline-node .node-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--bg-primary);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  box-shadow: 0 0 6px rgba(201,168,76,0.4);
}
.timeline-node.seq-node .node-dot {
  width: 14px;
  height: 14px;
  box-shadow: 0 0 10px rgba(201,168,76,0.6);
}
/* 时间轴年份标签 */
.timeline-years {
  display: flex;
  gap: 0;
  margin-top: 0.5rem;
}
.timeline-year-label {
  flex: 0 0 140px;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ========== Tab4: 源质与神明 ========== */
.sefirot-container {
  display: flex;
  padding: 1.5rem;
  gap: 1.5rem;
  min-height: 60vh;
}
.sefirot-chart-wrap {
  flex: 1;
  min-height: 500px;
}
.sefirot-detail {
  width: 320px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.2rem;
  opacity: 0;
  transition: opacity 0.3s;
  align-self: flex-start;
  position: sticky;
  top: 1rem;
}
.sefirot-detail.visible { opacity: 1; }
.sefirot-detail .sf-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.2rem;
}
.sefirot-detail .sf-en {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
}
.sefirot-detail .sf-section {
  margin-bottom: 0.8rem;
}
.sefirot-detail .sf-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.3rem;
}
.sefirot-detail .sf-value {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.5;
}
.sefirot-detail .sf-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  margin: 0.15rem;
  border-radius: 3px;
  font-size: 0.75rem;
  background: rgba(201,168,76,0.12);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
}

/* ========== Tab5: 势力版图 ========== */
.faction-container {
  display: flex;
  padding: 1.5rem;
  gap: 1.5rem;
  min-height: 60vh;
}
.faction-chart-wrap {
  flex: 1;
  min-height: 500px;
}
.faction-detail {
  width: 320px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.2rem;
  opacity: 0;
  transition: opacity 0.3s;
  align-self: flex-start;
  position: sticky;
  top: 1rem;
}
.faction-detail.visible { opacity: 1; }
.faction-detail .fc-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.2rem;
}
.faction-detail .fc-en {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}
.faction-detail .fc-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
}
.faction-detail .fc-section {
  margin-bottom: 0.8rem;
}
.faction-detail .fc-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.3rem;
}
.faction-detail .fc-value {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.5;
}
.faction-legend {
  display: flex;
  gap: 1.2rem;
  padding: 0.8rem 1.5rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-color);
}
.faction-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.faction-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ========== Tab6: 封印物图鉴 ========== */
.artifact-container {
  padding: 1.5rem;
}
.artifact-filters {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
  align-items: center;
}
.artifact-filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.4rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}
.artifact-filter-btn:hover { border-color: var(--gold-dim); color: var(--gold); }
.artifact-filter-btn.active {
  background: rgba(201,168,76,0.15);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}
.artifact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.artifact-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.artifact-card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.artifact-card .ac-grade-strip {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.artifact-card .ac-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  margin-top: 0.3rem;
}
.artifact-card .ac-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
}
.artifact-card .ac-grade {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
}
.artifact-card .ac-alias {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-style: italic;
}
.artifact-card .ac-pathway {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}
.artifact-card .ac-effect {
  font-size: 0.8rem;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}
.artifact-card .ac-danger {
  font-size: 0.7rem;
  color: #e74c3c;
  margin-bottom: 0.3rem;
}
.artifact-card .ac-holder {
  font-size: 0.7rem;
  color: var(--text-dim);
}
.artifact-card .ac-detail {
  display: none;
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border-color);
}
.artifact-card.expanded .ac-detail { display: block; }
.artifact-card .ac-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  padding: 0.3rem 0;
}
.artifact-card .ac-detail-label { color: var(--text-dim); }
.artifact-card .ac-detail-value { color: var(--text-primary); }

/* ========== 底部 ========== */
footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 1.2rem 2rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ========== 滚动条样式 ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* ========== 动画 ========== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.tab-panel.active { animation: fadeIn 0.4s ease; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  header h1 { font-size: 1.4rem; letter-spacing: 0.15em; }
  header::before, header::after { display: none; }
  .tab-btn { padding: 0.7rem 1rem; font-size: 0.85rem; }
  .pathway-grid { grid-template-columns: 2.5rem repeat(22, 5.5rem); grid-template-rows: repeat(10, 2.2rem); }
  .group-headers, .pathway-names-row { grid-template-columns: 2.5rem repeat(22, 5.5rem); }
  .seq-cell { font-size: 0.65rem; }
  .pathway-name-cell { font-size: 0.7rem; }
  .seq-label { width: 2.5rem; min-width: 2.5rem; font-size: 0.6rem; }
  .timeline-node { flex: 0 0 110px; }
  .timeline-node .node-content { width: 105px; }
  .timeline-node .node-content.top { bottom: calc(50% + 18px); }
  .timeline-node .node-content.bottom { top: calc(50% + 18px); }
  .character-container { height: 60vh; min-height: 400px; }
  .sefirot-container { flex-direction: column; }
  .sefirot-detail { width: 100%; position: static; }
  .faction-container { flex-direction: column; }
  .faction-detail { width: 100%; position: static; }
  .artifact-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .artifact-grid { grid-template-columns: 1fr; }
}

/* ========== Tab7: 人物百科 ========== */
.encyclopedia-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 180px);
  min-height: 500px;
}

/* 角色选择栏 */
.encyclopedia-selector {
  display: flex;
  gap: 0.6rem;
  padding: 0.8rem 1.5rem;
  overflow-x: auto;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}
.encyclopedia-selector::-webkit-scrollbar { height: 4px; }
.encyclopedia-char-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  min-width: 160px;
  position: relative;
  overflow: hidden;
}
.encyclopedia-char-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--pathway-color, var(--gold));
  opacity: 0;
  transition: opacity 0.3s;
}
.encyclopedia-char-card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-1px);
}
.encyclopedia-char-card.active {
  border-color: var(--gold);
  background: rgba(201,168,76,0.08);
}
.encyclopedia-char-card.active::before {
  opacity: 1;
}
.encyclopedia-char-avatar img,
.encyclopedia-char-avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
  flex-shrink: 0;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
}
.encyclopedia-char-card.active .encyclopedia-char-avatar img,
.encyclopedia-char-card.active .encyclopedia-char-avatar-fallback {
  border-color: var(--gold);
}
.encyclopedia-char-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.encyclopedia-char-sub {
  font-size: 0.7rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* 百科主区域 */
.encyclopedia-content {
  flex: 1;
  overflow: hidden;
}
.encyclopedia-main {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* 左侧边栏 */
.encyclopedia-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 1rem;
}
.encyclopedia-sidebar::-webkit-scrollbar { width: 4px; }

/* 信息卡 */
.encyclopedia-infocard {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.infocard-header {
  padding: 1rem;
  text-align: center;
  position: relative;
}
.infocard-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.6) 100%);
}
.infocard-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,0.3);
  position: relative;
  z-index: 1;
  margin-bottom: 0.5rem;
}
.infocard-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.infocard-sub {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.8);
  position: relative;
  z-index: 1;
}
.infocard-body {
  padding: 0.8rem;
}
.infocard-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(42,42,62,0.5);
  font-size: 0.78rem;
}
.infocard-row:last-child { border-bottom: none; }
.infocard-label { color: var(--text-dim); }
.infocard-value { color: var(--text-primary); text-align: right; max-width: 65%; word-break: break-word; line-height: 1.4; }

/* 目录导航 */
.encyclopedia-toc {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.8rem;
}
.toc-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}
.encyclopedia-toc a {
  display: block;
  padding: 0.35rem 0.5rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-decoration: none;
  border-radius: 4px;
  transition: var(--transition);
}
.encyclopedia-toc a:hover {
  color: var(--gold);
  background: rgba(201,168,76,0.08);
}
.encyclopedia-toc a.active {
  color: var(--gold);
  background: rgba(201,168,76,0.12);
  font-weight: 600;
}

/* 右侧正文 */
.encyclopedia-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
}
.encyclopedia-body::-webkit-scrollbar { width: 6px; }

/* 顶部英雄区 */
.encyclopedia-hero {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}
.encyclopedia-hero h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.5rem;
  letter-spacing: 0.1em;
}
.encyclopedia-hero-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.pathway-badge, .sequence-badge, .tarot-badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.pathway-badge {
  background: rgba(74,144,217,0.2);
  color: #6bb3ff;
}
.sequence-badge {
  background: rgba(201,168,76,0.15);
  color: var(--gold);
  border: 1px solid var(--gold-dim);
}
.tarot-badge {
  background: rgba(155,89,182,0.15);
  color: #c084e8;
}

/* 分区 */
.encyclopedia-section {
  margin-bottom: 2rem;
}
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-title::before {
  content: '◆';
  font-size: 0.6rem;
  color: var(--gold-dim);
}

/* 角色概述 */
.encyclopedia-overview p {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-primary);
}
.encyclopedia-overview strong {
  color: var(--gold-bright);
}

/* 基本信息表格 */
.encyclopedia-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.encyclopedia-info-table th,
.encyclopedia-info-table td {
  padding: 0.5rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}
.encyclopedia-info-table th {
  width: 100px;
  color: var(--text-dim);
  font-weight: 600;
  background: rgba(26,26,46,0.5);
}
.encyclopedia-info-table td {
  color: var(--text-primary);
}
.encyclopedia-info-table tr:hover th,
.encyclopedia-info-table tr:hover td {
  background: rgba(201,168,76,0.04);
}

/* 外貌特征 */
.encyclopedia-appearance {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.appearance-item {
  padding: 0.8rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}
.appearance-item:hover {
  border-color: var(--gold-dim);
}
.appearance-item.active {
  border-color: var(--gold);
  background: rgba(201,168,76,0.06);
}
.appearance-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.3rem;
}
.appearance-desc {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-primary);
}

/* 性格特点 */
.personality-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}
.personality-tag {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  background: rgba(201,168,76,0.1);
  border: 1px solid var(--gold-dim);
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--gold);
}
.personality-desc {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-primary);
}

/* 非凡途径 */
.encyclopedia-pathway {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}
.pathway-header {
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--gold);
  background: rgba(26,26,46,0.5);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pathway-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
}
.pathway-current {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.seq-history {
  padding: 0.5rem 0;
}
.seq-history-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid rgba(42,42,62,0.3);
  font-size: 0.85rem;
}
.seq-history-row:last-child { border-bottom: none; }
.seq-history-seq {
  width: 50px;
  flex-shrink: 0;
  color: var(--gold-dim);
  font-size: 0.75rem;
}
.seq-history-name {
  width: 80px;
  flex-shrink: 0;
  color: var(--gold);
  font-weight: 600;
}
.seq-history-year {
  width: 60px;
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: 0.75rem;
}
.seq-history-event {
  flex: 1;
  color: var(--text-primary);
}

/* 人物经历 */
.encyclopedia-biography {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.bio-period {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
}
.bio-period-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}
.bio-period-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold);
}
.bio-period-year {
  font-size: 0.75rem;
  color: var(--text-dim);
}
.bio-events {
  list-style: none;
  padding: 0;
}
.bio-events li {
  padding: 0.35rem 0;
  padding-left: 1.2rem;
  position: relative;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-primary);
}
.bio-events li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--gold-dim);
}

/* 人际关系 */
.encyclopedia-relationships {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}
.rel-card {
  display: flex;
  gap: 0.8rem;
  padding: 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.rel-card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.rel-avatar img,
.rel-avatar-fallback {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
  flex-shrink: 0;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
}
.rel-info {
  flex: 1;
  min-width: 0;
}
.rel-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.rel-type {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  background: rgba(201,168,76,0.12);
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  color: var(--gold);
  font-weight: 500;
}
.rel-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 持有物品 */
.encyclopedia-items {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}
.item-card {
  padding: 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}
.item-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.item-type {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  background: rgba(231,76,60,0.12);
  border: 1px solid rgba(231,76,60,0.3);
  border-radius: 3px;
  color: #e74c3c;
  font-weight: 500;
}
.item-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 经典语录 */
.encyclopedia-quotes {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.quote-card {
  padding: 1rem 1.2rem;
  background: var(--bg-card);
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
}
.quote-text {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  font-style: italic;
  margin-bottom: 0.4rem;
}
.quote-context {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* 角色趣闻 */
.encyclopedia-memes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}
.meme-card {
  padding: 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}
.meme-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.3rem;
}
.meme-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 核心能力 */
.encyclopedia-abilities {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}
.ability-card {
  padding: 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}
.ability-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.3rem;
}
.ability-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 尊名 */
.encyclopedia-honor {
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}
.honor-name {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-primary);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  font-style: italic;
}
.honor-name:last-child { border-bottom: none; }

/* ========== 响应式：人物百科 ========== */
@media (max-width: 768px) {
  .encyclopedia-main { flex-direction: column; }
  .encyclopedia-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    padding: 0.8rem;
  }
  .encyclopedia-infocard { width: 50%; margin-bottom: 0; }
  .encyclopedia-toc { width: 50%; }
  .encyclopedia-body { padding: 1rem; }
  .encyclopedia-relationships { grid-template-columns: 1fr; }
  .encyclopedia-items { grid-template-columns: 1fr; }
  .encyclopedia-memes { grid-template-columns: 1fr; }
  .encyclopedia-abilities { grid-template-columns: 1fr; }
  .seq-history-row { flex-wrap: wrap; }
  .seq-history-event { width: 100%; margin-top: 0.3rem; }
}
@media (max-width: 480px) {
  .encyclopedia-sidebar { flex-direction: column; }
  .encyclopedia-infocard { width: 100%; }
  .encyclopedia-toc { width: 100%; }
  .encyclopedia-hero h1 { font-size: 1.4rem; }
}

/* ========== Tab8: 人物图册 ========== */
.gallery-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 180px);
  min-height: 500px;
}

/* 顶部栏：角色选择 + 模式切换 */
.gallery-top-bar {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.gallery-selector {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  overflow-x: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
.gallery-selector::-webkit-scrollbar { height: 4px; }

/* 模式切换 */
.gallery-mode-switch {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.6rem 1rem;
  flex-shrink: 0;
  border-left: 1px solid var(--border-color);
}
.gallery-mode-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}
.gallery-mode-btn:first-child { border-radius: 4px 0 0 4px; }
.gallery-mode-btn:last-child { border-radius: 0 4px 4px 0; border-left: none; }
.gallery-mode-btn:hover { border-color: var(--gold-dim); color: var(--gold); }
.gallery-mode-btn.active {
  background: rgba(201,168,76,0.15);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}

.gallery-char-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  min-width: 150px;
  position: relative;
  overflow: hidden;
}
.gallery-char-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--pathway-color, var(--gold));
  opacity: 0;
  transition: opacity 0.3s;
}
.gallery-char-card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-1px);
}
.gallery-char-card.active {
  border-color: var(--gold);
  background: rgba(201,168,76,0.08);
}
.gallery-char-card.active::before { opacity: 1; }

.gallery-char-avatar img,
.gallery-char-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
  flex-shrink: 0;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold);
}
.gallery-char-card.active .gallery-char-avatar img,
.gallery-char-card.active .gallery-char-avatar-fallback {
  border-color: var(--gold);
}

.gallery-char-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.gallery-char-path {
  font-size: 0.68rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* 分类过滤栏 */
.gallery-filters {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 1.5rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-color);
  background: rgba(26,26,46,0.5);
}
.gallery-filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0.35rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}
.gallery-filter-btn:hover { border-color: var(--gold-dim); color: var(--gold); }
.gallery-filter-btn.active {
  background: rgba(201,168,76,0.15);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}

/* 图片网格 */
.gallery-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
  overflow-y: auto;
}
.gallery-grid::-webkit-scrollbar { width: 6px; }

.gallery-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}
.gallery-item-card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.gallery-item-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: var(--bg-secondary);
}
.gallery-item-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.gallery-item-card:hover .gallery-item-img-wrap img {
  transform: scale(1.05);
}

.gallery-item-category {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.2rem 0.6rem;
  background: rgba(0,0,0,0.7);
  border-radius: 4px;
  font-size: 0.7rem;
  color: var(--gold);
  backdrop-filter: blur(4px);
}

.gallery-item-info {
  padding: 0.7rem 0.9rem 0.4rem;
}
.gallery-item-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}
.gallery-item-subtitle {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.gallery-item-tags {
  padding: 0 0.9rem 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.gallery-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: rgba(201,168,76,0.1);
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  font-size: 0.68rem;
  color: var(--gold);
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ========== Lightbox ========== */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: galleryFadeIn 0.25s ease;
}
@keyframes galleryFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gallery-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
}

.gallery-lightbox-content {
  position: relative;
  display: flex;
  width: 92vw;
  max-width: 1100px;
  height: 85vh;
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.gallery-lightbox-image-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0f;
  padding: 1rem;
  min-width: 0;
}
.gallery-lightbox-image-area img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.gallery-lightbox-text-panel {
  width: 320px;
  flex-shrink: 0;
  padding: 2rem 1.5rem;
  overflow-y: auto;
  border-left: 1px solid var(--border-color);
  position: relative;
}
.gallery-lightbox-text-panel::-webkit-scrollbar { width: 4px; }

.gallery-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
  padding: 0.2rem;
}
.gallery-lightbox-close:hover { color: var(--gold); }

.gallery-lightbox-category {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(201,168,76,0.12);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  font-size: 0.72rem;
  color: var(--gold);
  margin-bottom: 0.8rem;
}

.gallery-lightbox-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.3rem;
  letter-spacing: 0.05em;
}

.gallery-lightbox-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.gallery-lightbox-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.2rem;
}

.gallery-lightbox-desc {
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.gallery-lightbox-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.gallery-nav-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}
.gallery-nav-btn:hover:not(:disabled) { border-color: var(--gold-dim); color: var(--gold); }
.gallery-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.gallery-nav-counter {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ========== 响应式：人物图册 ========== */
@media (max-width: 768px) {
  .gallery-char-card { min-width: 120px; }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.8rem;
    padding: 1rem;
  }
  .gallery-lightbox-content {
    flex-direction: column;
    width: 95vw;
    height: 90vh;
  }
  .gallery-lightbox-image-area {
    flex: 0 0 45%;
  }
  .gallery-lightbox-text-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding: 1.2rem 1rem;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    padding: 0.8rem;
  }
  .gallery-selector { padding: 0.6rem 0.8rem; }
  .gallery-filters { padding: 0.5rem 0.8rem; }
  .gallery-lightbox-text-panel { padding: 1rem 0.8rem; }
  .gallery-lightbox-title { font-size: 1.1rem; }
}

/* ========== 高光时刻 ========== */
.highlight-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.2rem;
  padding: 1.5rem;
  overflow-y: auto;
}
.highlight-grid::-webkit-scrollbar { width: 6px; }

.highlight-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  transition: var(--transition);
}
.highlight-card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* 封面区域 16:9 */
.highlight-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3e 50%, #0d1117 100%);
}
.highlight-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.highlight-cover-placeholder {
  opacity: 0.25;
  filter: blur(2px) grayscale(0.5);
}
.highlight-cover-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 4rem;
  font-weight: 700;
  color: var(--gold-dim);
  opacity: 0.3;
}

/* 播放按钮叠加层 */
.highlight-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.25);
  opacity: 0;
  transition: opacity 0.3s;
  cursor: pointer;
}
.highlight-card:hover .highlight-play-overlay { opacity: 1; }

.highlight-play-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(201,168,76,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #0d1117;
  box-shadow: 0 4px 16px rgba(201,168,76,0.4);
  transition: transform 0.2s;
}
.highlight-card:hover .highlight-play-btn { transform: scale(1.1); }

/* 信息区域 */
.highlight-info { padding: 0.8rem 1rem 0.3rem; }
.highlight-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.2rem;
  letter-spacing: 0.03em;
}
.highlight-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
}
.highlight-episode {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}

.highlight-desc {
  padding: 0 1rem;
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.highlight-play-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 1rem 0.9rem;
  padding: 0.35rem 0.8rem;
  background: rgba(201,168,76,0.1);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}
.highlight-play-link:hover {
  background: rgba(201,168,76,0.2);
  border-color: var(--gold);
}

/* 响应式：高光 */
@media (max-width: 768px) {
  .highlight-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }
  .gallery-top-bar { flex-wrap: wrap; }
  .gallery-mode-switch { border-left: none; border-top: 1px solid var(--border-color); width: 100%; justify-content: center; }
}
@media (max-width: 480px) {
  .highlight-grid { padding: 0.8rem; }
}