:root {
  --primary-color: #0066cc;
  --primary-hover: #0052a3;
  --primary-light: rgba(0, 102, 204, 0.1);
  --active-tab-bg: rgba(0, 102, 204, 0.9);
  --inactive-tab-bg: rgba(255, 255, 255, 0.3);
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-hover: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.5);
  --shadow-color: rgba(0, 0, 0, 0.08);
  --shadow-hover: rgba(0, 0, 0, 0.15);
  --shadow-active: rgba(0, 102, 204, 0.25);
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #8e8e93;
  --accent-color: #ff6b6b;
  --success-color: #4ecdc4;
  --warning-color: #feca57;
  
  --border-radius: 16px;
  --border-radius-large: 24px;
  --animation-speed: 0.4s;
  --animation-easing: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: url('light.jpg') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow-x: hidden;
    transition: background-image 0.3s var(--animation-easing);
}

/* 全局背景遮罩 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.1) 100%);
  backdrop-filter: brightness(1) contrast(1);
  z-index: -1;
}

/* 优雅的页面加载动画 */
@keyframes pageLoad {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

body {
  animation: pageLoad 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: var(--glass-bg);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px var(--shadow-color);
  position: relative;
  z-index: 100;
}

/* 头部渐变装饰 */
/* header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  border-radius: 2px;
  opacity: 0.6;
} */

/* Logo容器和响应式Logo */
.logo-container {
  position: relative;
  display: inline-block;
}

.logo {
  height: 48px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.1));
  transition: all var(--animation-speed) var(--animation-easing);
  cursor: pointer;
  border-radius: 8px;
}

.logo:hover {
  transform: scale(1.05) rotate(1deg);
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}

/* 默认显示浅色Logo，隐藏深色Logo */
.logo-light {
  display: block;
}

.logo-dark {
  display: none;
}

/* 头部控件容器 */
.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* 主题切换按钮 */
.theme-toggle {
  position: relative;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--animation-speed) var(--animation-easing);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--text-primary);
  overflow: hidden;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
}

.theme-toggle:active {
  transform: translateY(0) scale(0.95);
}

/* 主题图标 */
.theme-icon {
  width: 20px;
  height: 20px;
  position: absolute;
  transition: all 0.3s var(--animation-easing);
  stroke: currentColor;
}

/* 默认显示太阳图标（浅色模式），隐藏月亮图标 */
.theme-icon-light {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.theme-icon-dark {
  opacity: 0;
  transform: rotate(-180deg) scale(0.3);
}

/* 按钮光泽效果 */
.theme-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.6s ease;
}

.theme-toggle:hover::before {
  left: 100%;
}

.datetime {
  text-align: right;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.3px;
  line-height: 1.4;
}

#date {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

#time {
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
    display: block;
}

main {
  flex: 1;
  padding: 40px 20px;
  box-sizing: border-box;
  position: relative;
}

/* 浮动装饰元素 */
main::before {
  content: '';
  position: absolute;
  top: 20%;
  right: 10%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(0, 102, 204, 0.03) 0%, transparent 70%);
  border-radius: 50%;
  animation: float 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  50% {
    transform: translate(-10px, -20px) rotate(180deg);
  }
}

footer {
  text-align: center;
  background: var(--glass-bg);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border-top: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-weight: bold;
  font-size: 0.9rem;
  padding: 25px 0;
  box-shadow: 0 -8px 32px var(--shadow-color);
  position: relative;
}

footer p {
  margin: 8px 0;
  transition: all 0.3s ease;
}

footer a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  padding: 2px 0;
}

footer a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  transition: width 0.3s ease;
}

footer a:hover::after {
  width: 100%;
}

footer a:hover {
  color: var(--primary-hover);
  transform: translateY(-1px);
}

/* 选项卡容器 - 极致优雅 */
.tabs-container {
  background: var(--glass-bg);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border-radius: 24px 24px 0 0;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0;
  border: 1px solid var(--glass-border);
  border-bottom: none;
  box-shadow: 0 12px 48px var(--shadow-color);
  position: relative;
  overflow: hidden;
}

/* 选项卡容器装饰 */
.tabs-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
}

.tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  padding: 16px;
  gap: 10px;
}

.tab {
  padding: 12px 28px;
  background: var(--inactive-tab-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 130px;
  text-align: center;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.3px;
}

/* 选项卡光泽效果 */
.tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.6s ease;
}

.tab:hover::before {
  left: 100%;
}

/* 选项卡激活状态指示器 */
.tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 20px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  border-radius: 2px;
  transition: transform 0.3s ease;
}

.tab:hover {
  background: var(--glass-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  border-color: rgba(255, 255, 255, 0.5);
}

.tab.active {
  background: var(--active-tab-bg);
  color: white;
  border-color: transparent;
  box-shadow: 0 8px 25px rgba(0, 102, 204, 0.35);
  transform: translateY(-2px);
}

.tab.active::after {
  transform: translateX(-50%) scaleX(1);
  background: rgba(255, 255, 255, 0.8);
}

/* 图表容器 - 极致优雅 */
#chart-container {
  background: var(--glass-bg);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border-radius: 0 0 24px 24px;
  padding: 35px 25px 25px;
  max-width: 1000px;
  margin: 0 auto 40px;
  box-sizing: border-box;
  width: 100%;
  border: 1px solid var(--glass-border);
  border-top: none;
  box-shadow: 0 12px 48px var(--shadow-color);
  position: relative;
}

#chart-container h2 {
  margin: 0 0 25px;
  font-size: 24px;
  color: var(--text-primary);
  text-align: center;
  font-weight: 700;
  letter-spacing: -0.5px;
  position: relative;
}

/* 标题装饰 */
#chart-container h2::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  border-radius: 1px;
}

#chart {
  width: 100%;
  height: 480px;
  padding: 0 10px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  margin-bottom: 15px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

#chart:hover {
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

#update-time {
  margin: 15px 0 0;
  font-size: 13px;
  color: var(--text-primary);
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* 响应式设计优化 - 移动端重新设计 */
@media (max-width: 768px) {
  /* 整体布局优化 */
  body {
    font-size: 14px;
    background-attachment: scroll; /* 移动端优化 */
  }

  header {
    padding: 1rem 1.2rem;
    flex-direction: column;
    gap: 0.8rem;
    text-align: center;
  }

  .logo {
    height: 40px;
    margin-bottom: 0.5rem;
  }

  .datetime {
    text-align: center;
    font-size: 0.8rem;
  }

  main {
    padding: 20px 10px 30px;
  }

  /* 选项卡容器移动端重设计 */
  .tabs-container {
    border-radius: 20px 20px 0 0;
    margin: 0 5px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  }

  .tabs {
    padding: 16px 12px;
    gap: 8px;
    flex-direction: column; /* 移动端垂直排列 */
  }

  .tab {
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 700;
    min-width: auto;
    width: 100%;
    border-radius: 16px;
    margin-bottom: 4px;
    position: relative;
    /* 增强触摸反馈 */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s ease;
  }

  .tab:active {
    transform: scale(0.98);
    background: var(--active-tab-bg);
    color: white;
  }

  .tab:last-child {
    margin-bottom: 0;
  }

  /* 图表容器移动端优化 */
  #chart-container {
    padding: 25px 15px 20px;
    margin: 0 5px 30px;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  }

  #chart-container h2 {
    font-size: 18px;
    margin-bottom: 20px;
    line-height: 1.3;
    word-break: keep-all;
    overflow-wrap: break-word;
  }

  /* 图表移动端专属优化 */
  #chart {
    height: 350px; /* 移动端降低高度 */
    padding: 0;
    border-radius: 12px;
    margin-bottom: 12px;
    /* 移动端滚动优化 */
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
  }

  #chart:hover {
    background: rgba(255, 255, 255, 0.4); /* 移动端减少hover效果 */
  }

  /* 移动端深色模式图表背景适配 */
  body[data-theme="dark"] #chart {
    background: rgba(28, 28, 30, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
  }

  body[data-theme="dark"] #chart:hover {
    background: rgba(28, 28, 30, 0.7);
  }
}

/* 移动端系统深色模式适配 */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
  body:not([data-theme="light"]) #chart {
    background: rgba(28, 28, 30, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
  }

  body:not([data-theme="light"]) #chart:hover {
    background: rgba(28, 28, 30, 0.7);
  }

  #update-time {
    font-size: 11px;
    margin-top: 12px;
    line-height: 1.4;
  }

  /* 浮动装饰隐藏 */
  main::before {
    display: none;
  }

  /* Footer移动端优化 */
  footer {
    padding: 20px 15px;
    font-size: 0.8rem;
  }

  footer p {
    margin: 6px 0;
  }
}

/* 小屏手机专属优化 */
@media (max-width: 480px) {
  header {
    padding: 0.8rem 1rem;
  }

  .logo {
    height: 36px;
  }

  main {
    padding: 15px 5px 25px;
  }

  .tabs-container,
  #chart-container {
    margin-left: 0;
    margin-right: 0;
    border-radius: 0;
  }

  .tabs {
    padding: 12px 8px;
  }

  .tab {
    padding: 12px 16px;
    font-size: 13px;
  }

  #chart-container {
    padding: 20px 12px 15px;
  }

  #chart-container h2 {
    font-size: 16px;
    margin-bottom: 15px;
  }

  #chart {
    height: 320px;
    border-radius: 8px;
  }

  #update-time {
    font-size: 10px;
  }

  footer {
    padding: 15px 10px;
    font-size: 0.75rem;
  }
}

/* 横屏手机优化 */
@media (max-width: 768px) and (orientation: landscape) {
  header {
    padding: 0.8rem 1.2rem;
    flex-direction: row;
    justify-content: space-between;
  }

  .logo {
    height: 32px;
    margin-bottom: 0;
  }

  .datetime {
    text-align: right;
    font-size: 0.75rem;
  }

  main {
    padding: 15px 10px 20px;
  }

  .tabs {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
  }

  .tab {
    width: auto;
    min-width: 140px;
    margin-bottom: 0;
    margin-right: 8px;
  }

  .tab:last-child {
    margin-right: 0;
  }

  #chart {
    height: 280px;
  }

  #chart-container h2 {
    font-size: 16px;
    margin-bottom: 12px;
  }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  .tab:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  }

  #chart:hover {
    background: rgba(255, 255, 255, 0.4);
    box-shadow: none;
  }

  footer a:hover {
    transform: none;
  }

  /* 增强触摸目标大小 */
  .tab {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* 优化毛玻璃效果的性能 */
@supports not (backdrop-filter: blur(25px)) {
  header,
  footer,
  .tabs-container,
  #chart-container {
    background: rgba(255, 255, 255, 0.95);
  }
}

/* 深色模式样式 */
body[data-theme="dark"] {
  --glass-bg: rgba(28, 28, 30, 0.8);
  --glass-hover: rgba(28, 28, 30, 0.9);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-primary: #f2f2f7;
  --text-secondary: #98989d;
  --text-tertiary: #636366;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --shadow-hover: rgba(0, 0, 0, 0.4);
  --inactive-tab-bg: rgba(60, 60, 67, 0.6);
  --active-tab-bg: rgba(0, 102, 204, 0.9);
  background-image: url('dark.jpg');
}

/* 深色模式图表背景 */
body[data-theme="dark"] #chart {
  background: rgba(28, 28, 30, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] #chart:hover {
  background: rgba(28, 28, 30, 0.7);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body[data-theme="dark"] .theme-toggle {
  background: rgba(28, 28, 30, 0.6);
  border-color: rgba(255, 255, 255, 0.2);
}

body[data-theme="dark"] .theme-toggle:hover {
  background: rgba(28, 28, 30, 0.8);
  border-color: rgba(255, 255, 255, 0.3);
}

/* 系统深色模式适配 */
@media (prefers-color-scheme: dark) {
  body:not([data-theme="light"]) {
    --glass-bg: rgba(28, 28, 30, 0.8);
    --glass-hover: rgba(28, 28, 30, 0.9);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f2f2f7;
    --text-secondary: #98989d;
    --text-tertiary: #636366;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.4);
    --inactive-tab-bg: rgba(60, 60, 67, 0.6);
    --active-tab-bg: rgba(0, 102, 204, 0.9);
    background-image: url('dark.jpg');
  }

  /* 系统深色模式图表背景 */
  body:not([data-theme="light"]) #chart {
    background: rgba(28, 28, 30, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
  }

  body:not([data-theme="light"]) #chart:hover {
    background: rgba(28, 28, 30, 0.7);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }

  body:not([data-theme="light"]) .theme-toggle {
    background: rgba(28, 28, 30, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
  }

  body:not([data-theme="light"]) .theme-toggle:hover {
    background: rgba(28, 28, 30, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
  }
}

/* 手动深色模式时的Logo切换 */
body[data-theme="dark"] .logo-light,
body:not([data-theme="light"]) .logo-light {
  display: none;
}

body[data-theme="dark"] .logo-dark,
body:not([data-theme="light"]) .logo-dark {
  display: block;
}

/* 手动深色模式时的图标切换 */
body[data-theme="dark"] .theme-icon-light,
body:not([data-theme="light"]) .theme-icon-light {
  opacity: 0;
  transform: rotate(180deg) scale(0.3);
}

body[data-theme="dark"] .theme-icon-dark,
body:not([data-theme="light"]) .theme-icon-dark {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* 浅色模式强制样式 */
body[data-theme="light"] {
   background-image: url('light.jpg');
 }

body[data-theme="light"] .logo-light {
  display: block;
}

body[data-theme="light"] .logo-dark {
  display: none;
}

body[data-theme="light"] .theme-icon-light {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

body[data-theme="light"] .theme-icon-dark {
  opacity: 0;
  transform: rotate(-180deg) scale(0.3);
}

/* 性能优化 */
.tab, .logo, .theme-toggle {
  will-change: transform;
}

/* 主题切换过渡动画 */
body {
  transition: background-color 0.3s var(--animation-easing),
              color 0.3s var(--animation-easing);
}

/* 确保所有元素在主题切换时平滑过渡 */
*, *::before, *::after {
  transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow;
  transition-duration: 0.3s;
  transition-timing-function: var(--animation-easing);
}

/* 避免动画元素被覆盖 */
.tab, .logo, .theme-toggle, 
.tab::before, .tab::after,
.theme-toggle::before {
  transition-property: all;
  transition-duration: var(--animation-speed);
}

/* 响应式优化：移动端隐藏主题切换按钮 */
@media (max-width: 768px) {
  .header-controls {
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
    justify-content: center;
  }

  /* 移动端隐藏主题切换按钮，简化布局 */
  .theme-toggle {
    display: none;
  }
}
