* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  background: #1a0a3e;
  color: #e0d0f0;
  font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* 顶部透光渐变效果 — 深海仰望天空 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 130% 50% at 50% 0%, rgba(120,70,220,0.45) 0%, rgba(90,50,190,0.2) 35%, transparent 65%);
}

/* 粒子背景画布 */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

#screen-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  background: #1a0a3e;
}

#dashboard {
  width: 1920px;
  height: 1080px;
  display: grid;
  grid-template-rows: 86px 1fr 130px;
  transform-origin: center center;
  flex-shrink: 0;
  overflow: hidden;
}

/* 顶部标题区 */
#header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 40px;
  background: linear-gradient(180deg, rgba(45,27,105,0.6) 0%, rgba(30,15,80,0.5) 100%);
  border-bottom: 1px solid rgba(140,100,220,0.3);
  overflow: hidden;
  position: relative;
}
#year-filter {
  position: fixed;
  top: 16px;
  right: 30px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
}

#header h1 {
  font-size: 36px;
  font-weight: 600;
  background: linear-gradient(90deg, #c084fc, #e879f9, #f0abfc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 4px;
}
#year-filter select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: rgba(140,100,220,0.2);
  color: #d0c0f0;
  border: 1px solid rgba(140,100,220,0.4);
  border-radius: 4px;
  padding: 6px 28px 6px 12px;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23c084fc'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
#year-filter select:focus {
  border-color: #a855f7;
  box-shadow: 0 0 6px rgba(168,85,247,0.4);
}
#year-filter select option {
  background: #2d1b69;
  color: #e0d0f0;
  padding: 4px 8px;
}
#year-filter label {
  color: #b8a0d8;
  font-size: 15px;
}

/* 主体区域 */
#main {
  display: grid;
  grid-template-columns: 25% 50% 25%;
  gap: 10px;
  padding: 10px;
  overflow: hidden;
}

/* 面板通用 */
#panel-left, #panel-center, #panel-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.chart-box {
  flex: 1;
  background: rgba(35,20,80,0.55);
  border: 1px solid rgba(140,100,220,0.25);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chart-box h3 {
  font-size: 16px;
  color: #c084fc;
  margin-bottom: 0;
  padding-left: 8px;
  border-left: 3px solid #a855f7;
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.btn-expand {
  font-size: 18px;
  color: rgba(192,132,252,0.5);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: color 0.2s, background 0.2s;
  user-select: none;
}
.btn-expand:hover {
  color: #c084fc;
  background: rgba(168,85,247,0.15);
}
.chart-container {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

/* 底部 KPI 区 */
#footer {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 10px 40px;
  background: linear-gradient(0deg, rgba(45,27,105,0.6) 0%, rgba(30,15,80,0.5) 100%);
  border-top: 1px solid rgba(140,100,220,0.3);
}
.kpi-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.kpi-label {
  font-size: 14px;
  color: #b8a0d8;
}
.kpi-value {
  font-size: 36px;
  font-weight: 700;
  color: #c084fc;
  font-family: 'DIN', 'Roboto Mono', monospace;
}
.kpi-unit {
  font-size: 14px;
  color: #9880b8;
}

/* 暂无数据提示 */
.no-data {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #9880b8;
  font-size: 14px;
}

/* 弹窗大图 */
.chart-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: rgba(10,5,30,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  /* 不受 dashboard scale 影响 */
  transform: none !important;
}
.modal-content {
  width: 85%;
  height: 80%;
  max-width: 100vw;
  max-height: 100vh;
  background: rgba(35,20,80,0.97);
  border: 1px solid rgba(140,100,220,0.3);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(140,100,220,0.2);
}
.modal-title {
  font-size: 16px;
  color: #c084fc;
  font-weight: 600;
}
.modal-close {
  font-size: 18px;
  color: #b8a0d8;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}
.modal-close:hover {
  color: #e879f9;
  background: rgba(232,121,249,0.15);
}
.modal-body {
  flex: 1;
  min-height: 0;
  padding: 10px;
}

/* 全屏按钮 */
.btn-fullscreen {
  font-size: 20px;
  color: rgba(192,132,252,0.6);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  user-select: none;
  margin-left: 12px;
  vertical-align: middle;
}
.btn-fullscreen:hover {
  color: #e0b0ff;
  background: rgba(168,85,247,0.15);
}


/* 智慧解读按钮 */
.btn-insight {
  font-size: 14px;
  color: #e0b0ff;
  cursor: pointer;
  padding: 5px 14px;
  border-radius: 16px;
  background: rgba(168,85,247,0.2);
  border: 1px solid rgba(168,85,247,0.4);
  transition: all 0.25s;
  user-select: none;
  margin-left: 12px;
  vertical-align: middle;
  letter-spacing: 1px;
}
.btn-insight:hover {
  background: rgba(168,85,247,0.35);
  border-color: #c084fc;
  color: #fff;
}

/* 智慧解读弹窗内容 */
.insight-modal-content {
  width: 680px;
  height: 80%;
  max-width: 90vw;
}
.insight-body {
  overflow-y: auto;
  padding: 20px 28px;
  line-height: 1.85;
  font-size: 15px;
  color: #d8c8f0;
}
.insight-body::-webkit-scrollbar {
  width: 6px;
}
.insight-body::-webkit-scrollbar-thumb {
  background: rgba(168,85,247,0.3);
  border-radius: 3px;
}
.insight-section {
  margin-bottom: 20px;
}
.insight-title {
  font-size: 16px;
  font-weight: 600;
  color: #c084fc;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(140,100,220,0.2);
}
.insight-text {
  color: #d0c0f0;
  font-size: 14px;
  line-height: 1.9;
}
.insight-text b {
  color: #e879f9;
  font-weight: 600;
}
.insight-empty {
  text-align: center;
  color: #9880b8;
  padding: 40px;
}


/* ========== H5 移动端适配 ========== */
@media (max-width: 768px) {
  html, body {
    overflow: auto;
    height: auto;
  }

  body::before {
    position: absolute;
    height: 100%;
  }

  #particles-canvas {
    display: none;
  }

  #screen-wrapper {
    position: relative;
    width: 100%;
    height: auto;
    overflow: visible;
    display: block;
  }

  #dashboard {
    width: 100% !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column;
    transform: none !important;
    transform-origin: unset;
    overflow: visible;
  }

  /* 顶部标题区 */
  #header {
    flex-direction: column;
    padding: 16px 12px;
    gap: 10px;
    height: auto;
  }
  #header h1 {
    font-size: 18px;
    letter-spacing: 1px;
    text-align: center;
  }
  #year-filter {
    position: static;
    justify-content: center;
    margin: 8px auto;
  }
  #year-filter label { font-size: 13px; }
  #year-filter select { font-size: 13px; padding: 5px 24px 5px 10px; }

  .btn-insight { font-size: 12px; padding: 4px 10px; margin-left: 0; }
  .btn-fullscreen { display: none; }

  /* 主体区域 — 单列 */
  #main {
    display: flex !important;
    flex-direction: column;
    grid-template-columns: unset;
    gap: 8px;
    padding: 8px;
    overflow: visible;
  }

  #panel-left, #panel-center, #panel-right {
    gap: 8px;
    overflow: visible;
  }

  .chart-box {
    flex: none !important;
    min-height: 280px;
    overflow: visible;
  }

  .chart-container {
    min-height: 240px;
    overflow: visible;
  }

  .chart-box h3 { font-size: 14px; }
  .btn-expand { display: none; }

  /* 底部 KPI 区 */
  #footer {
    flex-wrap: wrap;
    padding: 12px;
    gap: 8px;
    justify-content: center;
  }
  .kpi-card {
    width: 30%;
    min-width: 90px;
  }
  .kpi-value { font-size: 22px; }
  .kpi-label { font-size: 12px; }
  .kpi-unit { font-size: 12px; }

  /* 弹窗适配 */
  .modal-content {
    width: 95%;
    height: 85%;
  }
  .insight-modal-content {
    width: 95%;
  }
}
