/* ==========================================================================
   星序 · 资讯看板 — 博物馆 / 天文台级深空视觉体系
   6 项核心美学精修：
   1. 星点常态去黑底胶囊与满屏省略号，仅高亮/选中时浮现无框雅致星标
   2. 光学亮星质感（高光纯白微核 + 柔光外晕 + 十字星芒 + 细定位弧圈）
   3. 顶部与底角彻底去厚边框盒子，实现无界悬浮感；时间线采用极淡发丝边
   4. 打破表盘均匀圆环，塑造有疏有密、带星等层次的真实星座构图
   5. 时间线缩略图常态低饱和收敛、悬停/选中全彩，日期行单边去重
   6. 冷银白高光主按钮 + 雅致宋体标题与等宽数字混排反差
   ========================================================================== */

:root {
  color-scheme: dark;

  /* 纯邃深空与轻盈炭墨玻璃（零紫色） */
  --void-deep: #040507;
  --glass-rail: rgba(9, 11, 15, 0.64);
  --glass-drawer: rgba(10, 12, 16, 0.88);
  --glass-hover: rgba(255, 255, 255, 0.055);
  --glass-active: rgba(255, 255, 255, 0.085);

  /* 高对比银白文字层级 */
  --ink-primary: #f2f5f8;
  --ink-secondary: #aab3be;
  --ink-muted: #76808c;
  --ink-faint: #4d5661;

  /* 极克制发丝线 */
  --hairline-soft: rgba(226, 234, 242, 0.07);
  --hairline: rgba(226, 234, 242, 0.12);
  --hairline-strong: rgba(226, 234, 242, 0.24);

  /* 极克制冷银点缀 */
  --accent: #9bcad8;
  --silver-cta: #eef2f6;
  --silver-cta-ink: #07090d;

  /* 离线高清混排字体栈：雅致宋体标题 + 清晰无衬线正文 + 等宽数字 */
  --font-serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* 空间尺寸 */
  --edge-gap: 20px;
  --timeline-w: 326px;
  --radius-sm: 6px;
  --radius-md: 11px;
  --radius-lg: 14px;

  --ease-cosmic: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--void-deep);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
[tabindex="-1"]:focus-visible {
  outline: 1.5px solid rgba(226, 238, 248, 0.8);
  outline-offset: 3px;
}

/* ==========================================================================
   全屏根容器与贯通黑白深空画布
   ========================================================================== */
.cosmic-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 64% 60% at 62% 45%, rgba(218, 228, 238, 0.044) 0%, rgba(10, 12, 16, 0.22) 50%, transparent 78%),
    radial-gradient(ellipse 42% 46% at 22% 84%, rgba(155, 202, 216, 0.024) 0%, transparent 72%),
    linear-gradient(162deg, #06080b 0%, #030406 54%, #07090d 100%);
}

.cosmos-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  contain: strict;
}

.cosmos-static-canvas {
  position: absolute;
  top: -48px;
  left: -48px;
  width: calc(100% + 96px);
  height: calc(100% + 96px);
  display: block;
  z-index: 1;
  will-change: transform;
}

.cosmos-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#space-back-canvas {
  z-index: 2;
}

.planet-canvas {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  display: block;
  pointer-events: none;
}

#space-front-canvas {
  z-index: 4;
}

/* ==========================================================================
   星图与缩略图主舞台
   ========================================================================== */
.cosmos-stage {
  position: absolute;
  inset: 0;
  z-index: 10;
  overflow: hidden;
}

.starfield-layer {
  position: absolute;
  inset: 0;
}

.constellation-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}

/* 更细腻的天文星座虚线 */
.constellation-edge {
  fill: none;
  stroke: var(--edge-color, #c4d0dc);
  stroke-width: 1;
  stroke-dasharray: 2.5 5.5;
  stroke-linecap: round;
  opacity: 0.25;
  transition: opacity 220ms var(--ease-cosmic), stroke-width 220ms var(--ease-cosmic);
}

.constellation-edge.is-dimmed {
  opacity: 0.06;
}

.constellation-edge.is-chain-active {
  opacity: 0.62;
  stroke-width: 1.25;
  stroke-dasharray: 3.5 5;
}

.constellation-edge.is-direct-active {
  opacity: 0.92;
  stroke-width: 1.55;
  stroke-dasharray: 4 4.5;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--edge-color, #9bcad8) 85%, #ffffff));
}

.stars-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
}

/* ==========================================================================
   光学亮星节点（无硬黑描边靶心，纯白过曝核 + 柔光外晕 + 十字星芒 + 细定位弧）
   ========================================================================== */
.star-node {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
  z-index: 2;
  transition: opacity 200ms ease;
}

.star-node.is-dimmed {
  opacity: 0.28;
}

.star-node:hover,
.star-node:focus-visible,
.star-node.is-linked,
.star-node.is-selected {
  z-index: 8;
  opacity: 1;
}

/* 星等三档：一等最新亮星 / 二等近期星 / 三等静谧星 */
.star-node.mag-1 {
  --core-size: 6.4px;
  --glow-r1: 10px;
  --glow-r2: 22px;
  --flare-len: 26px;
  --flare-opacity: 0.62;
}

.star-node.mag-2 {
  --core-size: 5.4px;
  --glow-r1: 8px;
  --glow-r2: 17px;
  --flare-len: 20px;
  --flare-opacity: 0.28;
}

.star-node.mag-3 {
  --core-size: 4.6px;
  --glow-r1: 6.5px;
  --glow-r2: 14px;
  --flare-len: 18px;
  --flare-opacity: 0;
}

/* 光学亮核与多层柔光外晕 */
.star-point {
  position: relative;
  width: var(--core-size, 5.4px);
  height: var(--core-size, 5.4px);
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #f5f9ff 58%, color-mix(in srgb, var(--star-color, #9bcad8) 65%, #ffffff) 100%);
  box-shadow:
    0 0 3px 1px rgba(255, 255, 255, 0.85),
    0 0 var(--glow-r1, 8px) 1.5px color-mix(in srgb, var(--star-color, #9bcad8) 62%, transparent),
    0 0 var(--glow-r2, 18px) 3px color-mix(in srgb, var(--star-color, #9bcad8) 26%, transparent);
  transition: transform 220ms var(--ease-cosmic), box-shadow 220ms var(--ease-cosmic);
}

/* 极纤细的四向十字衍射星芒（水平 + 垂直光针） */
.star-flare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: var(--flare-opacity, 0.28);
  transition: opacity 220ms var(--ease-cosmic), transform 220ms var(--ease-cosmic);
}

.star-flare::before,
.star-flare::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.star-flare::before {
  width: var(--flare-len, 22px);
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--star-color, #9bcad8) 55%, #ffffff) 38%,
    rgba(255, 255, 255, 0.95) 50%,
    color-mix(in srgb, var(--star-color, #9bcad8) 55%, #ffffff) 62%,
    transparent 100%
  );
}

.star-flare::after {
  width: 1px;
  height: var(--flare-len, 22px);
  background: linear-gradient(
    180deg,
    transparent 0%,
    color-mix(in srgb, var(--star-color, #9bcad8) 55%, #ffffff) 38%,
    rgba(255, 255, 255, 0.95) 50%,
    color-mix(in srgb, var(--star-color, #9bcad8) 55%, #ffffff) 62%,
    transparent 100%
  );
}

/* 悬停 / 选中时浮现的精密天文观测细环 */
.star-reticle {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--star-color, #9bcad8) 68%, rgba(255, 255, 255, 0.4));
  opacity: 0;
  transform: scale(0.72) rotate(-18deg);
  transition: opacity 220ms var(--ease-cosmic), transform 260ms var(--ease-cosmic);
  pointer-events: none;
}

.star-node:hover .star-point,
.star-node:focus-visible .star-point,
.star-node.is-linked .star-point {
  transform: scale(1.36);
  box-shadow:
    0 0 4px 1.5px #ffffff,
    0 0 14px 2.5px color-mix(in srgb, var(--star-color, #9bcad8) 88%, transparent),
    0 0 28px 5px color-mix(in srgb, var(--star-color, #9bcad8) 38%, transparent);
}

.star-node:hover .star-flare,
.star-node:focus-visible .star-flare,
.star-node.is-linked .star-flare,
.star-node.is-selected .star-flare {
  opacity: 0.95;
  transform: scale(1.25);
}

.star-node:hover .star-reticle,
.star-node:focus-visible .star-reticle,
.star-node.is-linked .star-reticle {
  opacity: 0.72;
  transform: scale(1) rotate(0deg);
}

.star-node.is-selected .star-point {
  transform: scale(1.48);
  box-shadow:
    0 0 5px 2px #ffffff,
    0 0 16px 3px color-mix(in srgb, var(--star-color, #9bcad8) 95%, transparent),
    0 0 34px 6px color-mix(in srgb, var(--star-color, #9bcad8) 44%, transparent);
}

.star-node.is-selected .star-reticle {
  opacity: 0.95;
  transform: scale(1.12) rotate(12deg);
  border-style: solid;
  border-color: color-mix(in srgb, var(--star-color, #9bcad8) 78%, #ffffff);
}

/* 星点注记：常态完全隐身（彻底去掉满屏黑胶囊与省略号），仅联动或选中时优雅淡入无框星标 */
.star-caption {
  position: absolute;
  top: calc(50% + 16px);
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 460;
  letter-spacing: 0.02em;
  line-height: 1.35;
  color: rgba(242, 246, 250, 0.94);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.9);
  background: radial-gradient(ellipse at center, rgba(6, 8, 12, 0.78) 20%, transparent 100%);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease, transform 200ms var(--ease-cosmic);
}

.star-node.is-linked .star-caption,
.star-node.is-selected .star-caption {
  opacity: 1;
}

.star-node.is-peeking .star-caption {
  opacity: 0 !important;
}

/* ==========================================================================
   鼠标悬停 / 键盘聚焦预览浮卡（缩略图 + 短标题 + 文案 + 时间）
   ========================================================================== */
.peek-card {
  position: absolute;
  z-index: 38;
  pointer-events: none;
  width: min(318px, calc(100% - 28px));
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(10, 12, 16, 0.94);
  border: 1px solid rgba(226, 234, 242, 0.16);
  border-left: 2px solid var(--star-color, var(--accent));
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.76);
}

.peek-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  margin-bottom: 8px;
}

.peek-topic {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 540;
  color: var(--star-color, var(--accent));
}

.peek-topic i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.peek-time {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

.peek-head {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.peek-thumb {
  width: 70px;
  height: 40px;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #12161c;
  display: block;
}

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

.peek-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink-primary);
}

.peek-source {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--ink-muted);
}

.peek-summary {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--hairline-soft);
  font-size: 12px;
  line-height: 1.56;
  color: #cdd5de;
}

/* ==========================================================================
   顶部无界悬浮导航（彻底取消厚边框药丸盒，靠极淡顶部暗角托底）
   ========================================================================== */
.floating-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  padding: 0 24px;
  z-index: 28;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  background: linear-gradient(to bottom, rgba(4, 5, 7, 0.84) 0%, rgba(4, 5, 7, 0.42) 65%, transparent 100%);
  pointer-events: none;
}

.topbar-brand,
.topic-nav,
.topbar-actions {
  pointer-events: auto;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-emblem {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: rgba(242, 246, 250, 0.9);
  flex: none;
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand-text h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--ink-primary);
  white-space: nowrap;
}

.brand-text h1 span {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-secondary);
  margin-left: 6px;
}

.snapshot-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  padding-left: 10px;
  border-left: 1px solid var(--hairline);
  white-space: nowrap;
}

/* 中央无框主题文字筛选（激活项以极细银线下划线点亮） */
.topic-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.topic-nav::-webkit-scrollbar {
  display: none;
}

.topic-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: color 160ms ease;
}

.topic-btn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 1.5px;
  background: var(--topic-color, var(--ink-primary));
  opacity: 0;
  transform: scaleX(0.45);
  transition: opacity 180ms ease, transform 200ms var(--ease-cosmic);
}

.topic-btn:hover {
  color: var(--ink-primary);
}

.topic-btn[aria-pressed="true"] {
  color: #ffffff;
}

.topic-btn[aria-pressed="true"]::after {
  opacity: 0.92;
  transform: scaleX(1);
}

.topic-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--topic-color, var(--accent));
  opacity: 0.65;
  flex: none;
  transition: opacity 160ms ease, box-shadow 160ms ease;
}

.topic-btn[aria-pressed="true"] .topic-dot {
  opacity: 1;
  box-shadow: 0 0 7px var(--topic-color, var(--accent));
}

.topic-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}

.topic-btn[aria-pressed="true"] .topic-count {
  color: var(--ink-secondary);
}

/* 右侧极简无框操作区 */
.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.view-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  white-space: nowrap;
  transition: color 160ms ease;
}

.view-btn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1px;
  height: 1px;
  background: rgba(242, 246, 250, 0.85);
  opacity: 0;
  transition: opacity 160ms ease;
}

.view-btn:hover {
  color: var(--ink-primary);
}

.view-btn[aria-pressed="true"] {
  color: #ffffff;
}

.view-btn[aria-pressed="true"]::after {
  opacity: 0.85;
}

.topbar-divider {
  width: 1px;
  height: 14px;
  background: var(--hairline);
}

.motion-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--hairline-soft);
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink-secondary);
  font-size: 11.5px;
  white-space: nowrap;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.motion-btn:hover {
  color: #ffffff;
  border-color: var(--hairline-strong);
  background: rgba(255, 255, 255, 0.055);
}

.motion-btn[aria-pressed="false"] {
  color: var(--ink-muted);
}

/* ==========================================================================
   左侧轻盈悬浮时间线（极淡发丝边、缩略图常态收敛、单边日期去重）
   ========================================================================== */
.floating-timeline {
  position: absolute;
  top: 72px;
  left: var(--edge-gap);
  bottom: var(--edge-gap);
  width: var(--timeline-w);
  z-index: 25;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--glass-rail);
  border: 1px solid var(--hairline-soft);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.38);
  overflow: hidden;
}

.timeline-header {
  flex: none;
  height: 42px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--hairline-soft);
}

.timeline-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.timeline-heading h2 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 560;
  letter-spacing: 0.06em;
  color: var(--ink-secondary);
}

.timeline-order {
  font-size: 10.5px;
  color: var(--ink-faint);
}

.timeline-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

.timeline-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 8px 14px 14px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 212, 224, 0.16) transparent;
}

.timeline-scroll::-webkit-scrollbar {
  width: 4px;
}

.timeline-scroll::-webkit-scrollbar-thumb {
  background: rgba(200, 212, 224, 0.18);
  border-radius: 999px;
}

.timeline-group {
  position: relative;
  padding-left: 14px;
  margin-bottom: 11px;
}

.timeline-group:last-child {
  margin-bottom: 0;
}

.timeline-group::before {
  content: "";
  position: absolute;
  left: 3.5px;
  top: 10px;
  bottom: 4px;
  width: 1px;
  background: linear-gradient(to bottom, rgba(226, 234, 242, 0.20), rgba(226, 234, 242, 0.04));
}

/* 单边日期标头：去除同行的左右重复日期 */
.timeline-date {
  position: relative;
  margin: 0 0 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 450;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.timeline-date::before {
  content: "";
  position: absolute;
  left: -13.5px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: #0a0d12;
  border: 1.2px solid rgba(226, 234, 242, 0.42);
}

.timeline-group:first-child .timeline-date {
  color: var(--ink-secondary);
}

.timeline-group:first-child .timeline-date::before {
  background: var(--ink-primary);
  border-color: var(--ink-primary);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.55);
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timeline-item {
  position: relative;
  width: 100%;
  min-height: 44px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  text-align: left;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 1.8px;
  border-radius: 2px;
  background: var(--item-color, var(--accent));
  opacity: 0;
  transition: opacity 150ms ease;
}

.timeline-item.is-linked {
  background: var(--glass-hover);
}

.timeline-item.is-linked::before {
  opacity: 0.72;
}

@media (hover: hover) and (pointer: fine) {
  .timeline-item:hover {
    background: var(--glass-hover);
  }

  .timeline-item:hover::before {
    opacity: 0.72;
  }

  .timeline-item:hover .item-short-title {
    color: #ffffff;
  }

  .timeline-item:hover .item-thumb img {
    filter: saturate(1) brightness(1) contrast(1);
    opacity: 1;
  }
}

.timeline-item.is-selected {
  background: var(--glass-active);
  border-color: rgba(226, 234, 242, 0.14);
}

.timeline-item.is-selected::before {
  opacity: 1;
}

.item-thumb {
  width: 48px;
  height: 29px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(14, 17, 22, 0.85);
  display: block;
  flex: none;
}

/* 缩略图常态轻度低饱和收敛，融入黑白深空；悬停/联动/选中瞬间全彩点亮 */
.item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.82;
  filter: saturate(0.28) brightness(0.86) contrast(1.04);
  transition: filter 220ms var(--ease-cosmic), opacity 200ms ease;
}

.timeline-item.is-linked .item-thumb img,
.timeline-item.is-selected .item-thumb img {
  opacity: 1;
  filter: saturate(1) brightness(1) contrast(1);
}

.thumb-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 560;
  color: var(--ink-secondary);
  background: rgba(255, 255, 255, 0.035);
  transition: color 180ms ease;
}

.timeline-item.is-selected .thumb-fallback,
.timeline-item.is-linked .thumb-fallback {
  color: var(--item-color, var(--ink-primary));
}

.item-short-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12.6px;
  font-weight: 440;
  line-height: 1.36;
  color: #cdd5de;
  transition: color 150ms ease;
}

.timeline-item.is-linked .item-short-title,
.timeline-item.is-selected .item-short-title {
  color: #ffffff;
}

.timeline-item.is-selected .item-short-title {
  font-weight: 520;
}

/* ==========================================================================
   悬浮缩略图总览墙（同样采用弱发丝边与胶片感过渡）
   ========================================================================== */
.gallery-layer {
  position: absolute;
  top: 72px;
  left: calc(var(--edge-gap) + var(--timeline-w) + 18px);
  right: var(--edge-gap);
  bottom: var(--edge-gap);
  z-index: 16;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  background: rgba(9, 11, 15, 0.78);
  border: 1px solid var(--hairline-soft);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.44);
  transition: bottom 220ms var(--ease-cosmic);
}

.cosmic-shell[data-drawer-open="true"] .gallery-layer {
  bottom: calc(var(--edge-gap) + 240px);
}

.gallery-header {
  flex: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--hairline-soft);
}

.gallery-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.gallery-heading h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-primary);
}

.gallery-heading span,
.gallery-meta {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.gallery-meta {
  font-family: var(--font-mono);
}

.gallery-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 13px;
  align-content: start;
  padding-right: 4px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 212, 224, 0.18) transparent;
}

.gallery-card {
  display: flex;
  flex-direction: column;
  padding: 9px;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline-soft);
  background: rgba(15, 18, 24, 0.72);
  text-align: left;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.gallery-card:hover,
.gallery-card.is-linked {
  border-color: var(--hairline-strong);
  background: rgba(22, 27, 34, 0.85);
}

.gallery-card.is-selected {
  border-color: rgba(242, 246, 250, 0.45);
  background: rgba(24, 30, 38, 0.90);
}

.gallery-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: #0e1116;
  border: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 8px;
}

.gallery-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.76) brightness(0.92);
  transition: filter 200ms ease;
}

.gallery-card:hover .gallery-cover img,
.gallery-card.is-selected .gallery-cover img {
  filter: saturate(1) brightness(1);
}

.gallery-cover .thumb-fallback {
  font-size: 18px;
}

.gallery-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.gallery-card-topic {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--card-color, var(--accent));
  font-weight: 500;
}

.gallery-card-topic i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.gallery-card-title {
  margin: 0 0 5px;
  font-size: 13px;
  font-weight: 520;
  line-height: 1.4;
  color: var(--ink-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-card-source {
  margin-top: auto;
  font-size: 11px;
  color: var(--ink-muted);
}

/* ==========================================================================
   底角无框天文图微字注记（彻底移除黑底药丸盒）
   ========================================================================== */
.floating-hud {
  position: absolute;
  left: calc(var(--edge-gap) + var(--timeline-w) + 22px);
  right: 24px;
  bottom: 20px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.cosmic-shell[data-drawer-open="true"] .floating-hud,
.cosmic-shell[data-view="gallery"] .floating-hud {
  opacity: 0;
}

.rule-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}

.rule-dash {
  width: 22px;
  height: 0;
  border-top: 1px dashed rgba(206, 220, 232, 0.62);
  flex: none;
}

.hud-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}

.hud-sep {
  color: var(--ink-faint);
}

.hud-snapshot {
  font-family: var(--font-mono);
  font-size: 10.5px;
}

/* ==========================================================================
   底部弹出抽屉式看板（精简去重、冷银白高光主按钮、雅致宋体主标题）
   ========================================================================== */
.bottom-drawer {
  position: absolute;
  left: calc(var(--edge-gap) + var(--timeline-w) + 18px);
  right: var(--edge-gap);
  bottom: var(--edge-gap);
  height: auto;
  max-height: 248px;
  z-index: 34;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--glass-drawer);
  border: 1px solid var(--hairline);
  border-top-color: rgba(232, 240, 248, 0.24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.60), 0 18px 42px rgba(0, 0, 0, 0.56);
  overflow: hidden;
  animation: drawer-rise 220ms var(--ease-cosmic);
}

@keyframes drawer-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.drawer-topbar {
  flex: none;
  min-height: 42px;
  padding: 6px 14px 6px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--hairline-soft);
}

.drawer-meta-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 11px;
  min-width: 0;
  font-size: 12px;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

.drawer-topic-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 540;
  color: var(--drawer-color, var(--accent));
  white-space: nowrap;
}

.drawer-topic-tag i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.drawer-topic-tag small {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-muted);
}

.drawer-meta-dot {
  color: var(--ink-faint);
}

.drawer-meta-source {
  color: var(--ink-primary);
  font-weight: 460;
  white-space: nowrap;
}

.drawer-meta-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.drawer-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.drawer-counter {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-muted);
  margin-right: 4px;
  font-variant-numeric: tabular-nums;
}

.drawer-nav-btn,
.drawer-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 27px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink-secondary);
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.drawer-nav-btn {
  width: 27px;
  padding: 0;
}

.drawer-close-btn {
  padding: 0 9px;
  font-size: 11.5px;
  color: var(--ink-secondary);
}

.drawer-nav-btn:hover:not(:disabled),
.drawer-close-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--hairline-strong);
  color: #ffffff;
}

.drawer-nav-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

/* 主操作按钮：克制高光冷银白，融于黑白大屏高级质感 */
.drawer-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 27px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 11.8px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--silver-cta-ink);
  background: var(--silver-cta);
  white-space: nowrap;
  transition: background-color 140ms ease, box-shadow 140ms ease;
}

.drawer-link:hover {
  background: #ffffff;
  box-shadow: 0 0 16px rgba(240, 246, 252, 0.28);
}

.drawer-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 15px 18px 16px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 212, 224, 0.22) transparent;
}

.drawer-body {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.drawer-body.no-cover {
  grid-template-columns: minmax(0, 1fr);
}

.drawer-hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: #0b0d12;
}

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

.drawer-reading {
  min-width: 0;
}

.drawer-headline {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 10px;
}

/* 抽屉主标题采用雅致宋体，形成精致人文刊物反差 */
.drawer-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: 0.015em;
  color: var(--ink-primary);
}

.drawer-title:focus {
  outline: none;
}

.drawer-orig-inline {
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.4;
}

.drawer-notes {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline-soft);
}

.drawer-notes.single-col {
  grid-template-columns: minmax(0, 1fr);
}

.drawer-note {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.64;
  color: #e0e6ed;
}

.drawer-note.is-source {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-secondary);
  white-space: pre-line;
  padding-left: 14px;
  border-left: 1px solid var(--hairline-soft);
}

.note-kicker {
  display: inline-block;
  margin-right: 8px;
  font-size: 10.5px;
  font-weight: 560;
  letter-spacing: 0.06em;
  vertical-align: 1px;
  color: var(--ink-muted);
}

.empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 13px;
}

/* ==========================================================================
   中窄桌面端（821px – 1180px）
   ========================================================================== */
@media (max-width: 1180px) and (min-width: 821px) {
  :root {
    --timeline-w: 280px;
  }

  .floating-topbar {
    padding: 0 16px;
  }

  .snapshot-meta,
  .hud-hint,
  .hud-sep {
    display: none;
  }

  .drawer-body {
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 14px;
  }

  .drawer-notes {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .drawer-note.is-source {
    padding-left: 0;
    border-left: 0;
    padding-top: 8px;
    border-top: 1px solid var(--hairline-soft);
  }
}

/* ==========================================================================
   手机端及窄屏（<= 820px）
   ========================================================================== */
@media (max-width: 820px) {
  :root {
    --edge-gap: 10px;
  }

  .floating-topbar {
    height: auto;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 6px 10px;
  }

  .topbar-brand {
    grid-column: 1;
    grid-row: 1;
    gap: 7px;
  }

  .brand-emblem {
    width: 22px;
    height: 22px;
  }

  .brand-text h1 {
    font-size: 16.5px;
    letter-spacing: 0.08em;
  }

  .brand-text h1 span {
    font-size: 11px;
    margin-left: 4px;
  }

  .snapshot-meta {
    display: none;
  }

  .topbar-actions {
    grid-column: 2;
    grid-row: 1;
    gap: 8px;
  }

  .view-switch {
    gap: 10px;
  }

  .view-btn {
    height: 26px;
    font-size: 11.5px;
    gap: 4px;
  }

  .topbar-divider {
    height: 12px;
  }

  .motion-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    justify-content: center;
  }

  .motion-text {
    display: none;
  }

  .topic-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    gap: 14px;
    padding-right: 18px;
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent 100%);
    mask-image: linear-gradient(to right, #000 88%, transparent 100%);
  }

  .topic-btn {
    height: 28px;
    font-size: 12px;
  }

  /* 手机端底部固定时间线 */
  .floating-timeline {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: auto;
    height: 33dvh;
    min-height: 240px;
    max-height: 296px;
    border-radius: 13px;
  }

  .timeline-header {
    height: 36px;
    padding: 0 12px;
  }

  .timeline-scroll {
    padding: 8px 8px 10px 12px;
  }

  .timeline-item {
    min-height: 44px;
    padding: 5px 7px;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 9px;
  }

  .item-thumb {
    width: 46px;
    height: 28px;
  }

  .item-short-title {
    font-size: 12.6px;
    -webkit-line-clamp: 1;
  }

  .floating-hud {
    left: 14px;
    right: 14px;
    bottom: calc(max(240px, 33dvh) + 18px + env(safe-area-inset-bottom, 0px));
    gap: 4px;
    flex-direction: column;
    align-items: flex-start;
  }

  .rule-note {
    font-size: 10.5px;
  }

  .rule-dash {
    width: 15px;
  }

  .hud-hint,
  .hud-sep {
    display: none;
  }

  .hud-snapshot {
    font-size: 10px;
    color: var(--ink-faint);
  }

  .gallery-layer {
    top: calc(88px + env(safe-area-inset-top, 0px));
    left: 10px;
    right: 10px;
    bottom: calc(max(240px, 33dvh) + 18px + env(safe-area-inset-bottom, 0px));
    padding: 11px 12px;
    border-radius: 13px;
  }

  .gallery-header {
    padding-bottom: 8px;
    margin-bottom: 10px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .gallery-card {
    padding: 7px;
  }

  .gallery-card-title {
    font-size: 12px;
  }

  /* 手机端抽屉弹出时隐藏底层星点文字标牌 */
  .cosmic-shell[data-drawer-open="true"] .star-caption {
    opacity: 0 !important;
  }

  .bottom-drawer {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: calc(max(240px, 33dvh) + 18px + env(safe-area-inset-bottom, 0px));
    height: auto;
    max-height: calc(100dvh - max(240px, 33dvh) - 114px);
    border-radius: 13px;
  }

  .drawer-topbar {
    padding: 6px 10px 6px 12px;
    gap: 5px 8px;
    flex-wrap: wrap;
  }

  .drawer-meta-inline {
    gap: 4px 8px;
    font-size: 11.5px;
  }

  .drawer-controls {
    width: 100%;
    justify-content: flex-end;
  }

  .drawer-counter {
    display: none;
  }

  .drawer-scroll {
    padding: 11px 13px 14px;
  }

  .drawer-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .drawer-hero {
    max-height: 132px;
  }

  .drawer-title {
    font-size: 17px;
  }

  .drawer-notes {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .drawer-note {
    font-size: 13px;
  }

  .drawer-note.is-source {
    padding-left: 0;
    border-left: 0;
    padding-top: 7px;
    border-top: 1px solid var(--hairline-soft);
    font-size: 12px;
  }
}

/* ==========================================================================
   无障碍：尊重系统减少动效偏好
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.site-admin-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding-inline: 4px;
  color: var(--ink-secondary);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}
.site-admin-link:hover, .site-admin-link:focus-visible { color: var(--ink-primary); }
@media (max-width: 400px) {
  .floating-topbar { column-gap: 6px; }
  .topbar-actions { gap: 6px; }
}
