:root {
  /* 固定颜色 */
  --gold: #c3a34a;
  --gold-alpha: rgba(195, 163, 74, 0.2);
  --asia: #00ffaa; 
  --euro: #00aaff; 
  --us: #ff6600;   
  --break: #666666;
  --indicator: #ff2d55;

  /* 深色主题 (默认) */
  --bg-main: #070708;
  --bg-scaffold: rgba(255, 255, 255, 0.02);
  --text-main: #ffffff;
  --text-sub: rgba(255, 255, 255, 0.4);
  --line-color: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(0, 0, 0, 0.3);
  --sentinel-bg: rgba(234, 179, 8, 0.1);
}

body.light-theme {
  --bg-main: #ffffff;
  --bg-scaffold: rgba(0, 0, 0, 0.02);
  --text-main: #111827;
  --text-sub: rgba(17, 24, 39, 0.45);
  --line-color: rgba(0, 0, 0, 0.05);
  --glass-bg: rgba(255, 255, 255, 0.95);
  --sentinel-bg: rgba(234, 179, 8, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  touch-action: manipulation; /* 核心：禁止全局双击缩放，保留滚动/点击 */
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  transition: background-color 0.4s ease, color 0.4s ease;
  font-family: 'Inter', -apple-system, sans-serif;
  height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: auto; /* 允许滚动以支持 PWA 下拉刷新 */
  touch-action: manipulation; /* 允许平移刷新与缩放修复 */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.app-container {
  width: 100%;
  max-width: 1400px;
  height: 100%; /* 撑满视口 */
  padding: 5vh 20px; /* 使用视口高度单位 */
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* 均匀分布主体内容 */
}

/* 全屏环境光 */
.glow-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(circle at 50% 0%, rgba(195, 163, 74, 0.03) 0%, transparent 70%),
    radial-gradient(circle at 0% 100%, rgba(0, 255, 170, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

header {
  margin-bottom: 2vh;
  text-align: center;
  flex-shrink: 0;
}

header h1 {
  font-size: clamp(18px, 4vh, 24px); /* 响应式字号 */
  font-weight: 300;
  letter-spacing: 0.6em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}

.dst-indicator {
  font-size: clamp(10px, 2vh, 14px);
  color: var(--text-main);
  letter-spacing: 1px;
  font-weight: 500;
}

.ethereal-flow {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center; /* 垂直居中核心内容 */
}

.flow-scaffold {
  position: relative;
  width: 100%;
  /* 确保不产生内部溢出 */
}

/* 完美像素轴 */
.flow-ruler {
  position: relative;
  height: 40px;
  width: 100%;
  margin-bottom: 5vh;
  border-bottom: 1px solid var(--line-color);
}

.axis-tick {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-sub);
  padding-bottom: 10px;
}

.axis-tick::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  width: 1px;
  height: 6px;
  background: var(--line-color);
}

/* 市场图层 - 使用响应式间距防止重叠且适应高度 */
.market-layers {
  display: flex;
  flex-direction: column;
  gap: 7vh; /* 使用 vh 确保在更短的设备上自动收缩 */
}

.layer-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.layer-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.layer-token {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-sub);
}

.layer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-sub);
  transition: all 0.5s;
}

.layer-status {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  opacity: 0.8;
}

body.light-theme .layer-status {
  opacity: 1;
}

/* 活跃态 */
.layer-item.active .layer-dot {
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
  transform: scale(1.5);
}

.layer-item.active .layer-status {
  opacity: 1;
}

#layer-asia.active { color: var(--asia); }
#layer-euro.active { color: var(--euro); }
#layer-us.active   { color: var(--us); }

.layer-track-zone {
  height: 16px; /* 轨道本身变细，标注空间变大 */
  width: 100%;
  background: var(--bg-scaffold);
  border-radius: 0; /* 移除圆角，回归严谨时间感 */
  position: relative;
}

.flow-track {
  width: 100%;
  height: 100%;
  position: relative;
}

.session-bar {
  position: absolute;
  height: 100%;
  border-radius: 0;
  display: flex;
  align-items: center;
  /* 关键：仅过渡位置和宽度，避免与 animation 的 box-shadow/opacity 冲突导致闪烁 */
  transition: left 0.6s cubic-bezier(0.2, 1, 0.2, 1), width 0.6s cubic-bezier(0.2, 1, 0.2, 1);
}

.session-bar.asia { background: var(--asia); box-shadow: 0 0 20px rgba(0, 255, 170, 0.2); }
.session-bar.euro { background: var(--euro); box-shadow: 0 0 20px rgba(0, 170, 255, 0.2); }
.session-bar.us   { background: var(--us);   box-shadow: 0 0 20px rgba(255, 102, 0, 0.2); }

/* 停盘色块：极致纤细白色斜线 */
.session-bar.break { 
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.1) 1px,
    rgba(255, 255, 255, 0.25) 1px,
    rgba(255, 255, 255, 0.25) 2px
  );
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

/* 智能上下标注 v7 */
.label-v7 {
  position: absolute;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-main);
  pointer-events: none;
  white-space: nowrap;
}

.label-v7-start {
  top: -24px;
  left: 0;
  transform: translateX(-50%);
}

.label-v7-end {
  bottom: -24px;
  right: 0;
  transform: translateX(50%);
}

/* 停盘色块特殊淡化 */
.settle-layer .session-bar {
  border: 1px dashed rgba(255,255,255,0.1);
}

/* 灵魂指示针 v7 - 强化可见性与动效 */
.flow-indicator {
  position: absolute;
  top: -24px;
  bottom: -30px; 
  width: 1px;
  z-index: 100;
  pointer-events: none;
}

.indicator-line {
  width: 1px;
  height: 100%;
  background: var(--indicator);
  box-shadow: 0 0 12px var(--indicator);
  position: relative;
  overflow: hidden; /* 核心：防止内部扫描线超出线条本身 */
}

.indicator-line::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 1px; /* 严格等于父级宽度 */
  height: 100%;
  background: linear-gradient(to bottom, transparent, #fff, transparent);
  opacity: 0.8;
  animation: scanLine 3s infinite linear;
}

@keyframes scanLine {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

.indicator-glow {
  position: absolute;
  top: 0; left: 50%;
  height: 100%;
  width: 20px; /* 稍微收窄，更干练 */
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 50%, rgba(255, 45, 85, 0.1), transparent);
  animation: auraBreath 5s infinite ease-in-out;
}

@keyframes auraBreath {
  0%, 100% { opacity: 0.4; transform: translateX(-50%) scaleX(0.9); }
  50% { opacity: 1; transform: translateX(-50%) scaleX(1.1); }
}

.indicator-cap {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: capHover 5s infinite ease-in-out;
}

@keyframes capHover {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-2px); }
}

/* 活跃市场条 - 极致呼吸重构 (v10 - Zenith Breath) */
.layer-item.active .session-bar:not(.break) {
  background-image: none;
  background-repeat: no-repeat;
  
  /* 往返呼吸：2.5s 涨 + 2.5s 消 = 5s (12次/分钟) */
  /* 通过 alternate 确保收尾衔接是物理级丝滑的 */
  animation: zenithPulse 2.5s infinite ease-in-out alternate;
    
  will-change: opacity, box-shadow;
  transform: translateZ(0); 
  backface-visibility: hidden;
}

/* 活跃态各盘底色确定性修正 */
#layer-asia.active .session-bar.asia { background-color: var(--asia); }
#layer-euro.active .session-bar.euro { background-color: var(--euro); }
#layer-us.active   .session-bar.us   { background-color: var(--us); }

@keyframes zenithPulse {
  0% { 
    box-shadow: 0 0 10px currentColor; 
    opacity: 0.7; 
  }
  100% { 
    box-shadow: 0 0 45px currentColor; 
    opacity: 1; 
  }
}

.cap-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 900;
  color: var(--indicator);
  margin-bottom: 2px;
}

.cap-marker {
  font-size: 8px;
  background: var(--indicator);
  color: #fff;
  padding: 1px 4px;
  border-radius: 2px;
  font-weight: 900;
}

footer {
  margin-top: 0;
  padding: 4vh 0;
  border-top: 1px solid var(--line-color);
  flex-shrink: 0;
}

.clock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 154px; /* 严格按照 32px JetBrains Mono 的宽度校准(0.6em * 32px * 8) */
}

.clock-group {
  display: flex;
  justify-content: center;
  gap: 60px; /* 略微收窄，整体感更强 */
}

.clock-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 32px;
  font-weight: 200;
  color: #fff;
  white-space: nowrap;
}

.clock-label {
  width: 100%;
  font-size: 12px; /* 字体加大，视觉更充实 */
  color: #ffffff;
  text-transform: uppercase;
  margin-top: 6px;
  opacity: 0.9;
  text-align: justify;
  text-align-last: justify;
}

/* 节假日哨兵：流光提醒 */
.holiday-sentinel {
  position: sticky;
  top: 0;
  z-index: 200;
  width: 100%;
  padding: 12px;
  background: linear-gradient(90deg, transparent, var(--sentinel-bg), transparent);
  border-bottom: 1px solid rgba(234, 179, 8, 0.2);
  display: none; /* 默认隐藏 */
  align-items: center;
  justify-content: center;
  gap: 12px;
  backdrop-filter: blur(10px);
  animation: sentinelPulse 5s infinite ease-in-out alternate;
}

.holiday-sentinel.visible {
  display: flex;
}

.sentinel-icon {
  font-size: 14px;
  color: #eab308;
  filter: drop-shadow(0 0 5px #eab308);
}

.sentinel-text {
  font-size: 13px;
  color: #fff;
  letter-spacing: 1px;
  font-weight: 500;
}

.sentinel-tag {
  background: #eab308;
  color: #000;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

@keyframes sentinelPulse {
  from { opacity: 0.6; background: linear-gradient(90deg, transparent, rgba(234, 179, 8, 0.05), transparent); }
  to { opacity: 1; background: linear-gradient(90deg, transparent, var(--sentinel-bg), transparent); }
}

/* 金融日历入口：极简文字化 */
.calendar-entry-box {
  margin-top: 10px; /* 极小间距 */
  display: flex;
  justify-content: center;
}

.calendar-entry-link {
  font-size: 11px;
  color: var(--text-sub);
  text-decoration: none;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: all 0.3s ease;
}

.calendar-entry-link:hover {
  color: var(--gold);
  border-bottom-color: var(--gold);
  opacity: 1;
}

.calendar-entry-link .icon {
  display: none;
}

/* 主题切换按钮 */
.theme-switch {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-scaffold);
  border: 1px solid var(--line-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}

.theme-switch:hover {
  transform: rotate(15deg) scale(1.1);
  background: var(--gold-alpha);
  border-color: var(--gold);
}

.theme-switch svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* 浅色模式特定微调 */
body.light-theme .glow-backdrop {
  opacity: 0.3;
}
body.light-theme .clock-value {
  color: var(--text-main);
  font-weight: 300;
}
body.light-theme .clock-label {
  color: var(--text-sub);
}
