@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700;900&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #111;
  display: flex;
  font-family: 'Noto Serif SC', serif;
}

/* ===== 左侧时间轴 ===== */
.sidebar {
  width: 200px;
  min-width: 200px;
  height: 100vh;
  background: rgba(8,6,4,0.95);
  border-right: 1px solid rgba(139,90,43,0.15);
  display: flex;
  flex-direction: column;
  z-index: 200;
}

.sidebar-header {
  padding: 24px 16px 16px;
  border-bottom: 1px solid rgba(139,90,43,0.15);
}

.sidebar-title {
  font-size: 14px;
  color: rgba(189,154,100,0.5);
  letter-spacing: 6px;
  text-align: center;
}

.sidebar-dates {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar-dates::-webkit-scrollbar { width: 3px; }
.sidebar-dates::-webkit-scrollbar-thumb { background: rgba(139,90,43,0.3); border-radius: 3px; }

.date-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.date-item:hover {
  background: rgba(139,90,43,0.08);
}

.date-item.active {
  background: rgba(139,37,0,0.12);
}

.date-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(139,90,43,0.3);
  margin-right: 14px;
  flex-shrink: 0;
  transition: all 0.3s;
}

.date-item.active .date-dot {
  background: #8b2500;
  box-shadow: 0 0 8px rgba(139,37,0,0.5);
  width: 10px;
  height: 10px;
}

/* 时间轴竖线 */
.date-item::before {
  content: '';
  position: absolute;
  left: 23px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(139,90,43,0.1);
}

.date-item:first-child::before { top: 50%; }
.date-item:last-child::before { bottom: 50%; }

.date-text {
  font-size: 14px;
  color: rgba(189,154,100,0.5);
  letter-spacing: 1px;
  transition: color 0.3s;
}

.date-item.active .date-text {
  color: #e8d5b0;
  font-weight: 700;
}

.date-lunar {
  font-size: 11px;
  color: rgba(189,154,100,0.25);
  margin-top: 2px;
}

/* ===== 主内容区 ===== */
.main {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ===== 核心画布 ===== */
.canvas {
  width: 1080px;
  height: 1920px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #080604;
  overflow: hidden;
  perspective: 1200px;
  perspective-origin: 50% 50%;
  font-family: 'Noto Serif SC', serif;
  transform-origin: center center;
  box-shadow: 0 0 50px rgba(0,0,0,0.8);
}

.bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(139,90,43,0.06) 0%, transparent 70%),
    linear-gradient(180deg, #0a0806 0%, #12100c 50%, #080604 100%);
}

.grid {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg, transparent 0, transparent 80px, rgba(139,90,43,0.025) 80px, rgba(139,90,43,0.025) 81px
  );
}

/* ===== 印章 ===== */
.seal {
  position: absolute;
  top: 60px;
  right: 60px;
  width: 140px;
  height: 140px;
  border: 4px solid #8b2500;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-8deg);
  opacity: 0;
  z-index: 50;
}
.seal.show { animation: stamp 0.4s ease-out forwards; }
.seal-text {
  font-weight: 900;
  font-size: 44px;
  color: #8b2500;
  writing-mode: vertical-rl;
  letter-spacing: 6px;
  line-height: 1.3;
}

@keyframes stamp {
  0% { opacity: 0; transform: rotate(-8deg) scale(2.5); }
  60% { opacity: 0.9; transform: rotate(-8deg) scale(0.93); }
  100% { opacity: 0.85; transform: rotate(-8deg) scale(1); }
}

/* ===== 3D 舞台与场景 ===== */
.stage {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateZ(-4000px) scale(0.1);
  filter: blur(24px);
  will-change: transform, opacity, filter;
  pointer-events: none;
}

.scene.in {
  animation: zoomIn 1.8s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}
.scene.out {
  animation: zoomOut 1.5s cubic-bezier(0.5, 0, 0.8, 0.2) forwards;
}

@keyframes zoomIn {
  0% { opacity: 0; transform: translateZ(-4000px) scale(0.1); filter: blur(24px); }
  30% { opacity: 0.8; filter: blur(8px); }
  100% { opacity: 1; transform: translateZ(0) scale(1); filter: blur(0); }
}

@keyframes zoomOut {
  0% { opacity: 1; transform: translateZ(0) scale(1); filter: blur(0); }
  40% { opacity: 0.6; filter: blur(6px); }
  100% { opacity: 0; transform: translateZ(1200px) scale(3.5); filter: blur(15px); }
}

/* ===== 开场 ===== */
.intro-date { font-size: 26px; color: rgba(189,154,100,0.4); letter-spacing: 8px; margin-bottom: 24px; }
.intro-title { font-size: 120px; font-weight: 900; color: #e8d5b0; letter-spacing: 36px; text-shadow: 0 0 100px rgba(139,90,43,0.4); }
.intro-sub { font-size: 32px; color: rgba(189,154,100,0.35); letter-spacing: 16px; margin-top: 24px; }
.intro-line { width: 540px; height: 2px; background: linear-gradient(90deg, transparent, rgba(189,154,100,0.4), transparent); margin-top: 36px; }

/* ===== 新闻页 ===== */
.news-scene {
  align-items: flex-start;
  padding: 0 80px;
  justify-content: center;
}

.news-num {
  font-size: 300px;
  font-weight: 900;
  color: rgba(139,37,0,0.06);
  position: absolute;
  top: 150px;
  right: -20px;
  line-height: 0.8;
  z-index: -1;
}

.news-meta {
  display: flex;
  align-items: flex-end;
  margin-bottom: 40px;
  border-bottom: 1px solid rgba(189,154,100,0.2);
  padding-bottom: 24px;
  width: 100%;
}

.news-badge {
  font-size: 20px;
  font-weight: 700;
  padding: 6px 20px;
  letter-spacing: 4px;
  border: 2px solid;
  margin-right: 30px;
}
.badge-t1 { color: #8b2500; border-color: #8b2500; background: rgba(139,37,0,0.08); }
.badge-t15 { color: #bd9a64; border-color: #bd9a64; background: rgba(189,154,100,0.05); }

.news-src {
  font-size: 22px;
  color: rgba(189,154,100,0.4);
  letter-spacing: 3px;
  margin-bottom: 4px;
}

.news-h {
  font-size: 64px;
  font-weight: 900;
  color: #e8d5b0;
  line-height: 1.35;
  letter-spacing: 4px;
  margin-bottom: 44px;
  max-width: 95%;
  text-shadow: 0 6px 40px rgba(0,0,0,0.8);
}

.news-content { display: flex; flex-direction: column; gap: 32px; width: 100%; }

.news-points {
  font-size: 30px;
  color: #bd9a64;
  line-height: 1.8;
  letter-spacing: 2px;
  border-left: 4px solid #8b2500;
  padding-left: 30px;
}
.news-points span { display: block; margin-bottom: 8px; font-weight: 700; }

.news-abstract {
  font-size: 24px;
  color: rgba(189,154,100,0.55);
  line-height: 2.2;
  text-align: justify;
  letter-spacing: 1.5px;
  max-width: 100%;
  margin-top: 10px;
}

.news-score { position: absolute; bottom: 120px; right: 80px; text-align: right; }
.score-lbl { font-size: 18px; color: rgba(139,69,0,0.5); letter-spacing: 5px; margin-bottom: 6px; }
.score-val { font-size: 110px; font-weight: 900; color: #8b2500; line-height: 0.8; text-shadow: 0 0 40px rgba(139,37,0,0.3); }

/* ===== 结尾 ===== */
.outro-main { font-size: 44px; color: rgba(189,154,100,0.6); letter-spacing: 8px; line-height: 2.5; text-align: center; }
.outro-sm { font-size: 24px; color: rgba(189,154,100,0.25); letter-spacing: 6px; margin-top: 50px; }

/* ===== 进度条 ===== */
.prog { position: absolute; bottom: 0; left: 0; height: 6px; background: linear-gradient(90deg, #8b2500, #bd9a64); z-index: 100; width: 0; transition: width 0.4s ease; }

/* ===== 底部控制栏 ===== */
.controls {
  position: fixed;
  bottom: 0;
  left: 200px;
  right: 0;
  height: 64px;
  background: rgba(8,6,4,0.9);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(139,90,43,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  z-index: 300;
}

.ctrl-btn {
  background: none;
  border: 1px solid rgba(139,90,43,0.3);
  color: rgba(189,154,100,0.6);
  font-family: 'Noto Serif SC', serif;
  font-size: 14px;
  letter-spacing: 4px;
  padding: 8px 28px;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
}

.ctrl-btn:hover {
  background: rgba(139,37,0,0.15);
  color: #e8d5b0;
  border-color: #8b2500;
}

.ctrl-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.ctrl-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ctrl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(139,90,43,0.2);
  transition: all 0.3s;
  cursor: pointer;
}

.ctrl-dot.active {
  background: #8b2500;
  box-shadow: 0 0 6px rgba(139,37,0,0.5);
  width: 10px;
  height: 10px;
}

/* ===== 空状态 ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(189,154,100,0.3);
  font-size: 28px;
  letter-spacing: 6px;
}

/* ===== Loading ===== */
.loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: rgba(189,154,100,0.4);
  letter-spacing: 8px;
  z-index: 999;
}

.loading::after {
  content: '';
  width: 24px;
  height: 24px;
  border: 2px solid rgba(139,90,43,0.3);
  border-top-color: #8b2500;
  border-radius: 50%;
  margin-left: 16px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== 移动端适配 ===== */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 500;
  background: rgba(8,6,4,0.8);
  color: #e8d5b0;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  letter-spacing: 2px;
  cursor: pointer;
  border: 1px solid rgba(139,90,43,0.3);
  backdrop-filter: blur(4px);
}

@media (max-width: 768px) {
  .mobile-nav-toggle { display: block; }
  
  .sidebar {
    position: fixed;
    left: -250px;
    top: 0;
    bottom: 0;
    width: 250px;
    transition: left 0.3s ease;
    box-shadow: 10px 0 30px rgba(0,0,0,0.8);
  }
  
  .sidebar.show { left: 0; }
  
  .controls {
    left: 0;
    padding: 0 10px;
    gap: 10px;
    justify-content: space-between;
  }

  .ctrl-btn {
    padding: 8px 16px;
    font-size: 12px;
    letter-spacing: 1px;
  }
  
  /* 移动端降级：禁用高消耗的渲染特性，防止 Safari 内存闪退 */
  .canvas {
    box-shadow: none; /* 移除巨型阴影计算 */
  }
  
  .scene { 
    filter: none; 
    will-change: auto; /* 阻止 Safari 预分配大量显存 */
    transform: scale(0.01); /* 去掉 !important，否则动画播完会被强制覆盖缩小 */
  }
  
  .scene.in { 
    animation: zoomInMobile 1.2s cubic-bezier(0.2, 0.9, 0.3, 1) forwards; 
  }
  
  .scene.out { 
    animation: zoomOutMobile 1.2s cubic-bezier(0.5, 0, 0.8, 0.2) forwards; 
  }
}

/* 移动端专用的纯 2D 缩放动画，避开复杂的 3D 深度计算 */
@keyframes zoomInMobile {
  0% { opacity: 0; transform: scale(0.01); }
  40% { opacity: 0.8; }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes zoomOutMobile {
  0% { opacity: 1; transform: scale(1); }
  40% { opacity: 0.6; }
  100% { opacity: 0; transform: scale(2.5); }
}

/* ===== 模式选择 & 流畅版 ===== */
.mode-selector {
  position: fixed;
  inset: 0;
  background: rgba(8,6,4,0.98);
  backdrop-filter: blur(10px);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.mode-title {
  color: #e8d5b0;
  font-size: 20px;
  letter-spacing: 6px;
  margin-bottom: 40px;
  text-shadow: 0 0 20px rgba(139,90,43,0.5);
}
.mode-btns {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 80%;
  max-width: 320px;
}
.mode-btn {
  background: rgba(139,90,43,0.1);
  border: 1px solid rgba(139,90,43,0.4);
  color: #e8d5b0;
  font-family: 'Noto Serif SC', serif;
  padding: 20px;
  border-radius: 8px;
  font-size: 16px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.3s;
}
.mode-btn:active {
  background: rgba(139,37,0,0.3);
  border-color: #8b2500;
}

body.smooth-mode .scene {
  transform: scale(1) !important;
  opacity: 0 !important;
  transition: none !important;
  animation: none !important;
  filter: none !important;
}
body.smooth-mode .scene.in {
  opacity: 1 !important;
  z-index: 10;
}
body.smooth-mode .scene.out {
  opacity: 0 !important;
  z-index: 0;
}
