/* ==========================================================================
   app.css - 应用主样式
   仅中间弹窗与必要UI，无侧边栏/按钮/控制面板
   ========================================================================== */

/* 加载提示层 */
#loading-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease;
  font-family: 'Segoe UI', sans-serif;
  letter-spacing: 0.15em;
}

#loading-layer.hidden {
  opacity: 0;
  pointer-events: none;
}

#loading-title {
  font-size: clamp(1.2rem, 3vw, 2.4rem);
  color: #c8a0ff;
  text-shadow: 0 0 20px rgba(180, 120, 255, 0.8);
  margin-bottom: 1rem;
}

#loading-tip {
  font-size: clamp(0.7rem, 1.5vw, 0.9rem);
  color: #888;
}

/* ========== 右上角标题 ========== */
#page-title {
  position: fixed;
  top: 14px;
  right: 20px;
  z-index: 300;
  margin: 0;
  padding: 0;
  font-family: 'Noto Serif SC', 'Songti SC', 'STSong', 'SimSun', serif;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #e8d0ff;
  text-shadow: 0 0 14px rgba(180, 120, 255, 0.6), 0 0 40px rgba(120, 60, 200, 0.25);
  pointer-events: none;
  user-select: none;
  opacity: 0.92;
}

@media (max-width: 640px) {
  #page-title {
    font-size: 1rem;
    top: 18px;
    right: 12px;
    letter-spacing: 0.08em;
  }
}

/* ========== 顶部栏：水平 flex 排列三个按钮 ========== */
#top-left-bar {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;       /* 整条不挡点击 */
}
#top-left-bar > button {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 10px;
  background: rgba(12, 8, 28, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(140, 100, 220, 0.35);
  color: #c8a0ff;
  font-size: 1.2rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, color 0.18s, transform 0.18s;
  box-shadow: 0 0 18px rgba(120, 60, 200, 0.2);
  outline: none;
}
#top-left-bar > button:hover {
  background: rgba(140, 100, 220, 0.28);
  color: #fff;
  transform: scale(1.05);
}
#top-left-bar > button:active {
  transform: scale(0.94);
}

/* ★ SVG 图标继承按钮颜色，自动居中 */
#top-left-bar > button > svg {
  display: block;
  flex-shrink: 0;
}

/* 操作说明：两列网格排列 */
.about-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}
.ctrl-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(140, 100, 220, 0.08);
  border: 1px solid rgba(140, 100, 220, 0.12);
}
.ctrl-key {
  font-size: 0.82rem;
  color: #e0d0ff;
  font-weight: 500;
}
.ctrl-desc {
  font-size: 0.74rem;
  color: #999;
}

/* 关于弹窗 — 音乐来源链接区域 */
.about-music .about-link {
  gap: 10px;
}

/* ---------- 关于弹窗 ---------- */
#about-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#about-overlay.visible {
  display: flex;
  opacity: 1;
}

#about-modal {
  position: relative;
  width: min(880px, 94vw);        /* 更宽——一屏展示 */
  max-height: 90vh;               /* 稍微留出呼吸空间 */
  overflow-y: hidden;             /* 桌面端禁止滚动 */
  padding: 1.6rem 2.2rem 1.4rem;  /* 减少上下 padding */
  border-radius: 18px;
  background: rgba(10, 6, 28, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(140, 100, 220, 0.4);
  box-shadow: 0 0 80px rgba(120, 60, 200, 0.35);
  transform: scale(0.92);
  transition: transform 0.3s ease;
}
#about-overlay.visible #about-modal {
  transform: scale(1);
}

#about-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-size: 0.9rem;
}
#about-close:hover {
  background: rgba(255, 80, 80, 0.3);
  color: #fff;
}

.about-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #e8d0ff;
  margin: 0 0 0.6rem;
  text-align: center;
  letter-spacing: 0.05em;
  text-shadow: 0 0 20px rgba(180, 120, 255, 0.5);
}

.about-intro {
  line-height: 1.65;
  font-size: 0.84rem;
  color: #bbb;
  margin-bottom: 0.9rem;
}

.about-section {
  margin-bottom: 0.85rem;          /* 更紧凑 */
}
.about-section h3 {
  font-size: 0.92rem;
  color: #c8a0ff;
  margin: 0 0 0.6rem;
  font-weight: 600;
}

.about-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.about-badge {
  padding: 3px 10px;
  border-radius: 14px;
  background: rgba(140, 100, 220, 0.15);
  border: 1px solid rgba(140, 100, 220, 0.25);
  font-size: 0.76rem;
  color: #c8a0ff;
}

.about-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.about-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(140, 100, 220, 0.1);
  border: 1px solid rgba(140, 100, 220, 0.2);
  color: #c8a0ff;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.about-link:hover {
  background: rgba(140, 100, 220, 0.25);
  color: #fff;
}

.about-license {
  display: flex;
  align-items: center;
}
.license-badge {
  padding: 4px 14px;
  border-radius: 6px;
  background: rgba(100, 200, 100, 0.15);
  border: 1px solid rgba(100, 200, 100, 0.3);
  color: #80d080;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.about-disclaimer {
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(140, 100, 220, 0.15);
  font-size: 0.78rem;
  line-height: 1.6;
  color: #aaa;
  background: rgba(255, 180, 50, 0.04);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(255, 180, 50, 0.18);
}
.about-disclaimer strong {
  color: #ffb74d;
}
.about-disclaimer p {
  margin: 0;
}

/* 桌面端完美隐藏滚动条（不影响布局） */
#about-modal::-webkit-scrollbar { width: 0; height: 0; background: transparent; }
#about-modal { scrollbar-width: none; }

/* ─────────────────────────────────────────────────────────────────────────
   移动端：允许弹窗滚动 + 更紧凑布局
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  #about-modal {
    width: 96vw;
    max-height: 92vh;
    overflow-y: auto;             /* 手机端开放滚动 */
    padding: 1rem 1rem 0.8rem;
  }
  .about-controls {
    grid-template-columns: 1fr;   /* 操作说明单列 */
  }
  .about-intro { font-size: 0.78rem; }
  .about-section { margin-bottom: 0.65rem; }
}

/* ---------- 居中信息卡片 ---------- */
#info-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 200;
  width: min(480px, 92vw);
  max-height: 80vh;
  padding: 2rem 2rem 1.5rem;
  border-radius: 16px;
  background: rgba(8, 8, 24, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(140, 100, 220, 0.35);
  box-shadow: 0 0 60px rgba(120, 60, 200, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  overflow: hidden;
}

#info-card.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

/* 卡片内部滚动条 */
#info-card .card-inner {
  max-height: calc(80vh - 4rem);
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 100, 220, 0.5) transparent;
}

#info-card .card-inner::-webkit-scrollbar {
  width: 4px;
}
#info-card .card-inner::-webkit-scrollbar-thumb {
  background: rgba(140, 100, 220, 0.5);
  border-radius: 4px;
}

/* 卡片关闭按钮 */
#info-card .card-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  line-height: 1;
  font-size: 1rem;
}
#info-card .card-close:hover {
  background: rgba(255, 80, 80, 0.3);
  color: #fff;
}

/* 卡片标题 */
#info-card .card-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #e8d0ff;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(140, 100, 220, 0.25);
  padding-bottom: 0.6rem;
}

/* 标签徽章 */
#info-card .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 1rem;
}
#info-card .card-tag {
  padding: 2px 10px;
  border-radius: 20px;
  background: rgba(140, 100, 220, 0.2);
  font-size: 0.75rem;
  color: #c8a0ff;
  border: 1px solid rgba(140, 100, 220, 0.3);
}

/* 描述文本 */
#info-card .card-text {
  line-height: 1.7;
  font-size: 0.92rem;
  color: #ccc;
  margin-bottom: 1rem;
}

/* 关联人物列表 */
#info-card .relation-title {
  font-size: 0.95rem;
  color: #c8a0ff;
  margin: 1rem 0 0.4rem;
  font-weight: 600;
}
#info-card .relation-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 0.88rem;
  border-bottom: 1px dashed rgba(140, 100, 220, 0.12);
}
#info-card .relation-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
#info-card .relation-type {
  color: #999;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ---------- 左上角树形筛选面板（位于顶部按钮栏下方） ---------- */
#tree-filter-panel {
  position: fixed;
  top: 66px;
  left: 14px;
  z-index: 290;
  font-family: 'Segoe UI', 'PingFang SC', sans-serif;
}

/* 面板主体 */
#tree-filter-body {
  width: 320px;
  max-height: calc(100vh - 120px);
  display: none;
  flex-direction: column;
  background: rgba(10, 6, 24, 0.92);
  backdrop-filter: blur(18px);
  border-radius: 14px;
  border: 1px solid rgba(140, 100, 220, 0.3);
  box-shadow: 0 0 40px rgba(80, 40, 160, 0.3);
  overflow: hidden;
}
#tree-filter-panel.expanded #tree-filter-body {
  display: flex;
}

/* 面板头部 */
.tf-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(140, 100, 220, 0.2);
}
.tf-header h3 {
  font-size: 0.95rem;
  color: #e8d0ff;
  margin: 0 0 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.tf-header h3 i {
  margin-right: 6px;
  color: #c8a0ff;
}

/* 搜索框 */
.tf-search {
  position: relative;
  margin-bottom: 10px;
}
.tf-search i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
  font-size: 0.8rem;
}
.tf-search input {
  width: 100%;
  padding: 7px 12px 7px 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(140, 100, 220, 0.2);
  color: #ddd;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.tf-search input:focus {
  border-color: rgba(140, 100, 220, 0.6);
}
.tf-search input::placeholder {
  color: #666;
}

/* 操作按钮 */
.tf-actions {
  display: flex;
  gap: 6px;
}
.tf-btn {
  flex: 1;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(140, 100, 220, 0.15);
  border: 1px solid rgba(140, 100, 220, 0.25);
  color: #c8a0ff;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s;
}
.tf-btn:hover {
  background: rgba(140, 100, 220, 0.3);
}

/* 树形滚动区域 */
#tf-tree-root {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 100, 220, 0.4) transparent;
}
#tf-tree-root::-webkit-scrollbar {
  width: 5px;
}
#tf-tree-root::-webkit-scrollbar-thumb {
  background: rgba(140, 100, 220, 0.4);
  border-radius: 4px;
}

/* 节点通用 */
.tf-node {
  user-select: none;
}
.tf-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
}
.tf-label:hover {
  background: rgba(140, 100, 220, 0.08);
}
.tf-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #a87fff;
  cursor: pointer;
  flex-shrink: 0;
}
.tf-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}
.tf-name {
  font-size: 0.84rem;
  color: #ddd;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tf-period {
  font-size: 0.72rem;
  color: #888;
  margin-left: 4px;
}
.tf-birth {
  font-size: 0.7rem;
  color: #777;
  white-space: nowrap;
}
.tf-count {
  font-size: 0.68rem;
  color: #999;
  background: rgba(140, 100, 220, 0.2);
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
}

/* 恒星行 —— flex 让 twisty 与 label 同一行并排 */
.tf-star-row {
  display: flex;
  align-items: center;
  gap: 0;
}
.tf-star-row .tf-label {
  font-weight: 500;
  flex: 1;
  min-width: 0;          /* 允许 flex 子项收缩 */
}
.tf-star-row .tf-name {
  color: #e0d0ff;
  font-weight: 600;
}

/* 折叠按钮 —— 小方块 20×20，圆角，hover 变色 */
.tf-twisty {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 2px;
  border: 1px solid rgba(140, 100, 220, 0.2);
  border-radius: 4px;
  background: rgba(140, 100, 220, 0.06);
  color: #888;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.2s;
  outline: none;
  padding: 0;
  line-height: 1;
}
.tf-twisty:hover {
  background: rgba(140, 100, 220, 0.2);
  color: #c8a0ff;
  border-color: rgba(140, 100, 220, 0.4);
}
.tf-twisty:active {
  background: rgba(140, 100, 220, 0.3);
}
/* expanded (容器展开)  → ▼ 朝下 —— 提示"点击可收起" */
.tf-twisty.expanded i {
  transform: rotate(90deg);
}
/* collapsed (容器收起) → ▶ 朝右 —— 提示"点击可展开" */
.tf-twisty:not(.expanded) i {
  transform: rotate(0deg);
}
.tf-twisty i {
  transition: transform 0.2s ease;
}

/* 行星子容器 */
.tf-planet-container {
  padding-left: 32px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.tf-planet-container.collapsed {
  max-height: 0 !important;
}
.tf-node--planet .tf-label {
  padding: 3px 14px;
}
.tf-node--planet .tf-name {
  font-size: 0.8rem;
  color: #bbb;
}
.tf-node--planet:hover .tf-name {
  color: #fff;
}

/* 黑洞节点 */
.tf-node--blackhole .tf-label {
  background: rgba(106, 27, 154, 0.1);
}
.tf-node--blackhole .tf-name {
  color: #d0a0ff;
  font-weight: 600;
}

/* 空结果 */
.tf-empty {
  text-align: center;
  padding: 20px;
  color: #888;
  font-size: 0.82rem;
}

/* ---------- 悬浮提示 ---------- */
#hover-tip {
  position: fixed;
  z-index: 150;
  pointer-events: none;
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(10, 10, 30, 0.88);
  border: 1px solid rgba(140, 100, 220, 0.4);
  font-size: 0.82rem;
  color: #e0d0ff;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
  box-shadow: 0 0 20px rgba(120, 60, 200, 0.3);
}
#hover-tip.visible {
  opacity: 1;
}
