/* ===== 星河数据中枢 · 大屏样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-0: #030711;
  --bg-1: #071327;
  --cyan: #22d3ee;
  --cyan-bright: #67e8f9;
  --blue: #3b82f6;
  --gold: #f5c451;
  --green: #34d399;
  --red: #fb7185;
  --text: #cfe6ff;
  --text-dim: #7fa3c9;
  --panel-bg: linear-gradient(160deg, rgba(10, 28, 56, 0.88), rgba(6, 16, 34, 0.92));
  --panel-border: rgba(34, 211, 238, 0.35);
}

html, body {
  height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(37, 99, 235, 0.28), transparent 60%),
    radial-gradient(ellipse 60% 40% at 15% 110%, rgba(34, 211, 238, 0.12), transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 110%, rgba(139, 92, 246, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
}

/* ---------- 星空背景 ---------- */
.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,.8), transparent),
    radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,.6), transparent),
    radial-gradient(1.5px 1.5px at 80% 20%, rgba(165,243,255,.9), transparent),
    radial-gradient(1px 1px at 40% 85%, rgba(255,255,255,.5), transparent),
    radial-gradient(1.5px 1.5px at 90% 55%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 10% 65%, rgba(165,243,255,.7), transparent);
  background-size: 600px 600px, 500px 500px, 700px 700px, 450px 450px, 800px 800px, 550px 550px;
  animation: starDrift 120s linear infinite;
  opacity: .7;
}
@keyframes starDrift {
  from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0; }
  to   { background-position: -600px 600px, 500px -500px, -700px 700px, 450px -450px, -800px 800px, 550px -550px; }
}

/* ---------- 顶栏 ---------- */
.top-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px 6px;
  height: 64px;
  flex: 0 0 auto;
}

.top-side {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  color: var(--text-dim);
  min-width: 260px;
}
.top-side.right { justify-content: flex-end; }
.clock { color: var(--cyan-bright); font-family: Consolas, monospace; font-size: 16px; letter-spacing: 1px; }

.admin-link {
  color: var(--gold);
  border: 1px solid rgba(245, 196, 81, .5);
  padding: 3px 12px;
  font-size: 13px;
  text-decoration: none;
  border-radius: 3px;
  transition: all .25s;
  background: rgba(245, 196, 81, .08);
}
.admin-link:hover {
  background: rgba(245, 196, 81, .22);
  box-shadow: 0 0 14px rgba(245, 196, 81, .45);
}

.top-title {
  position: relative;
  flex: 1;
  text-align: center;
}
.top-title h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 6px;
  background: linear-gradient(180deg, #ffffff 10%, #7dd3fc 55%, #38bdf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 34px rgba(56, 189, 248, .55);
  animation: titleGlow 4s ease-in-out infinite;
}
@keyframes titleGlow {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(56,189,248,.45)); }
  50% { filter: drop-shadow(0 0 18px rgba(56,189,248,.85)); }
}
.corner {
  position: absolute;
  width: 26px; height: 14px;
  border-color: var(--cyan);
  border-style: solid;
  border-width: 0;
}
.c-tl { top: -6px; left: 10%; border-top-width: 2px; border-left-width: 2px; }
.c-tr { top: -6px; right: 10%; border-top-width: 2px; border-right-width: 2px; }
.c-bl { bottom: -6px; left: 10%; border-bottom-width: 2px; border-left-width: 2px; }
.c-br { bottom: -6px; right: 10%; border-bottom-width: 2px; border-right-width: 2px; }

/* ---------- 播报条 ---------- */
.ticker-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 24px 8px;
  height: 32px;
  flex: 0 0 auto;
}
.ticker-label {
  flex: 0 0 auto;
  font-size: 13px;
  color: #04101f;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
  padding: 3px 12px;
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 2px;
}
.ticker {
  flex: 1;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, .25);
  background: rgba(8, 22, 46, .6);
  border-radius: 3px;
  height: 100%;
  position: relative;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.ticker-inner {
  position: absolute;
  white-space: nowrap;
  line-height: 30px;
  font-size: 14px;
  color: var(--text);
  animation: tickerMove 40s linear infinite;
}
.ticker-inner .ti-item { margin-right: 60px; }
.ticker-inner .ti-item::before { content: "◆ "; color: var(--cyan); }
@keyframes tickerMove {
  from { transform: translateX(100vw); }
  to   { transform: translateX(-100%); }
}

/* ---------- 主网格 ---------- */
.grid {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(430px, 1.5fr) minmax(300px, 1fr);
  grid-template-rows: 168px minmax(0, 1fr);
  gap: 12px;
  padding: 0 24px 8px;
}

.g-rev    { grid-column: 1; grid-row: 1; }
.g-chan   { grid-column: 1; grid-row: 2; }
.g-kpi    { grid-column: 2; grid-row: 1; }
.g-map    { grid-column: 2; grid-row: 2; }
.g-rank   { grid-column: 3; grid-row: 1; }
.g-split  { grid-column: 3; grid-row: 2; }

/* ---------- 面板 ---------- */
.panel {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  box-shadow: inset 0 0 26px rgba(34, 211, 238, .07), 0 4px 24px rgba(0, 0, 0, .45);
  overflow: hidden;
}
.panel::before, .panel::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  border-color: var(--cyan);
  border-style: solid;
  z-index: 3;
  pointer-events: none;
}
.panel::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.panel::after  { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.panel-head {
  flex: 0 0 auto;
  padding: 8px 14px 6px;
  background: linear-gradient(90deg, rgba(34, 211, 238, .16), transparent 70%);
  border-bottom: 1px solid rgba(34, 211, 238, .18);
}
.panel-head h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--cyan-bright);
  position: relative;
  padding-left: 12px;
}
.panel-head h2::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 14px;
  background: linear-gradient(180deg, var(--cyan), var(--blue));
  border-radius: 2px;
  box-shadow: 0 0 8px var(--cyan);
}

.chart { flex: 1; min-height: 0; }

/* ---------- 数据详情弹窗 ---------- */
.detail-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 8, 20, .72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: maskIn .2s ease;
}
.detail-mask[hidden] { display: none; }
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }

.detail-modal {
  position: relative;
  width: min(680px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, rgba(10, 30, 62, .97), rgba(5, 14, 32, .98));
  border: 1px solid var(--cyan);
  border-radius: 6px;
  box-shadow: 0 0 40px rgba(34, 211, 238, .3), inset 0 0 30px rgba(34, 211, 238, .06);
  animation: modalIn .25s cubic-bezier(.2, .9, .3, 1.2);
  overflow: hidden;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.detail-modal::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--blue), var(--cyan));
  background-size: 200% 100%;
  animation: headSlide 3s linear infinite;
}
@keyframes headSlide { to { background-position: -200% 0; } }

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px 8px;
}
.detail-head h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--cyan-bright);
  position: relative;
  padding-left: 12px;
}
.detail-head h3::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 15px;
  background: linear-gradient(180deg, var(--cyan), var(--blue));
  border-radius: 2px;
  box-shadow: 0 0 8px var(--cyan);
}
.detail-close {
  width: 32px; height: 32px;
  border: 1px solid rgba(251, 113, 133, .5);
  background: rgba(251, 113, 133, .12);
  color: #fda4af;
  font-size: 15px;
  border-radius: 4px;
  cursor: pointer;
  transition: all .2s;
  flex: 0 0 auto;
}
.detail-close:hover {
  background: rgba(251, 113, 133, .3);
  box-shadow: 0 0 12px rgba(251, 113, 133, .5);
}
.detail-sub {
  padding: 0 22px 12px;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
}
.detail-body {
  padding: 4px 22px 22px;
  overflow-y: auto;
}
.detail-body::-webkit-scrollbar { width: 6px; }
.detail-body::-webkit-scrollbar-thumb { background: rgba(34, 211, 238, .35); border-radius: 3px; }

/* 弹窗内的数据行 */
.d-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  margin-bottom: 8px;
  background: rgba(12, 32, 64, .55);
  border: 1px solid rgba(59, 130, 246, .22);
  border-radius: 5px;
  font-size: 13px;
  animation: rowIn .3s ease backwards;
}
@keyframes rowIn { from { opacity: 0; transform: translateX(-8px); } }
.d-row:nth-child(1) { animation-delay: .02s; }
.d-row:nth-child(2) { animation-delay: .05s; }
.d-row:nth-child(3) { animation-delay: .08s; }
.d-row:nth-child(4) { animation-delay: .11s; }
.d-row:nth-child(5) { animation-delay: .14s; }
.d-row:nth-child(6) { animation-delay: .17s; }
.d-row:nth-child(7) { animation-delay: .2s; }
.d-row:nth-child(8) { animation-delay: .23s; }
.d-row:nth-child(9) { animation-delay: .26s; }
.d-row:nth-child(n+10) { animation-delay: .29s; }

.d-rank {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: rgba(34, 211, 238, .16);
  border: 1px solid rgba(34, 211, 238, .4);
  border-radius: 4px;
  color: var(--cyan-bright);
}
.d-rank.top { background: rgba(245, 196, 81, .2); border-color: rgba(245, 196, 81, .6); color: var(--gold); }
.d-name { flex: 1 1 auto; color: var(--text); min-width: 0; }
.d-val {
  flex: 0 0 auto;
  font-family: Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(245, 196, 81, .4);
}
.d-bar-wrap {
  flex: 1 1 120px;
  height: 6px;
  background: rgba(127, 163, 201, .16);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}
.d-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  box-shadow: 0 0 8px rgba(34, 211, 238, .6);
  border-radius: 3px;
  animation: barGrow 1s cubic-bezier(.2, .8, .3, 1) forwards;
  transform-origin: left center;
  transform: scaleX(0);
}
.d-bar.gold { background: linear-gradient(90deg, rgba(245,196,81,.5), var(--gold)); box-shadow: 0 0 8px rgba(245,196,81,.6); }
@keyframes barGrow { to { transform: scaleX(1); } }
.d-extra { flex: 0 0 auto; font-size: 11px; color: var(--text-dim); }

/* 摘要指标块 */
.d-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.d-stat {
  text-align: center;
  padding: 12px 8px;
  background: rgba(12, 32, 64, .55);
  border: 1px solid rgba(59, 130, 246, .22);
  border-radius: 5px;
}
.d-stat .s-num {
  font-family: Consolas, monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--cyan-bright);
  text-shadow: 0 0 12px rgba(34, 211, 238, .5);
}
.d-stat .s-num.gold { color: var(--gold); text-shadow: 0 0 12px rgba(245, 196, 81, .5); }
.d-stat .s-lab { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.d-note { font-size: 12px; color: var(--text-dim); line-height: 1.8; padding: 2px 2px 0; }
.d-note b { color: var(--cyan-bright); }

/* 可点击提示 */
[data-hint] { cursor: pointer; }
[data-hint]::after {
  content: "点击查看 ›";
  float: right;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 1px;
  color: rgba(207, 230, 255, .55);
  padding-left: 10px;
  transition: color .2s;
}
[data-hint]:hover::after { color: var(--cyan-bright); }
.kpi { cursor: pointer; }
.kpi:hover { border-color: rgba(34, 211, 238, .6); }
.chart { cursor: pointer; }

/* 地图面板 */
.map-head { display: flex; align-items: center; justify-content: space-between; }
.map-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-dim); }
.map-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.map-legend .lg::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
}
.map-legend .lg.hq::before { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.map-legend .lg.br::before { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }

/* 右侧上下两块 */
.panel.split .half {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel.split .half + .half { border-top: 1px dashed rgba(34, 211, 238, .25); }

/* ---------- KPI 卡片 ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 12px;
}
.kpi {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(150deg, rgba(12, 32, 64, .9), rgba(6, 18, 38, .95));
  border: 1px solid rgba(59, 130, 246, .35);
  box-shadow: inset 0 0 22px rgba(59, 130, 246, .12);
  animation: kpiFloat 6s ease-in-out infinite;
}
.kpi:nth-child(2) { animation-delay: 1s; }
.kpi:nth-child(3) { animation-delay: 2s; }
.kpi:nth-child(4) { animation-delay: 3s; }
.kpi:nth-child(5) { animation-delay: 4s; }
.kpi:nth-child(6) { animation-delay: 5s; }
@keyframes kpiFloat {
  0%, 100% { box-shadow: inset 0 0 22px rgba(59,130,246,.12), 0 0 0 rgba(34,211,238,0); }
  50%      { box-shadow: inset 0 0 26px rgba(34,211,238,.2), 0 0 18px rgba(34,211,238,.22); }
}
.kpi::after {
  content: "";
  position: absolute;
  top: -60%; left: -60%;
  width: 60%; height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.14), transparent);
  transform: rotate(25deg);
  animation: kpiShine 7s ease-in-out infinite;
}
@keyframes kpiShine {
  0%, 60% { left: -60%; }
  100% { left: 160%; }
}
.kpi .k-label {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi .k-label::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}
.kpi .k-value {
  margin-top: 4px;
  font-family: "DIN Alternate", "Segoe UI", Consolas, monospace;
  font-size: clamp(24px, 2.2vw, 34px);
  font-weight: 700;
  line-height: 1.1;
  color: #ffffff;
  text-shadow: 0 0 18px rgba(103, 232, 249, .65);
}
.kpi .k-value .k-unit { font-size: 13px; color: var(--text-dim); margin-left: 5px; font-weight: 400; }
.kpi .k-delta {
  margin-top: 3px;
  font-size: 12px;
  color: var(--green);
}
.kpi .k-delta.neg { color: var(--red); }

/* ---------- 底栏 ---------- */
.foot {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  padding: 4px 26px 8px;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1280px) {
  html, body { overflow: auto; }
  body { min-height: 100%; }
  .grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: none;
    grid-auto-rows: minmax(260px, auto);
  }
  .g-rev, .g-chan, .g-kpi, .g-map, .g-rank, .g-split {
    grid-column: auto;
    grid-row: auto;
  }
  .kpis { grid-column: 1 / -1; min-height: 220px; }
  .g-map { grid-column: 1 / -1; min-height: 480px; }
  .g-split { grid-column: 1 / -1; min-height: 560px; }
  .top-title h1 { font-size: 22px; letter-spacing: 3px; }
  .top-side { min-width: auto; }
}
@media (max-width: 760px) {
  html, body { overflow: auto; height: auto; }
  body { min-height: 100%; }
  .grid { grid-template-columns: 1fr; padding: 0 10px 8px; gap: 10px; }
  .panel, .kpi { min-height: 260px; }
  .chart { min-height: 220px; }
  .kpis { grid-column: auto; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(3, minmax(96px, auto)); gap: 10px; min-height: 0; }
  .kpi { min-height: 96px; padding: 10px 12px; animation: none; }
  .kpi .k-value { font-size: 26px; }
  .g-map { grid-column: auto; min-height: 340px; }
  .g-split { grid-column: auto; min-height: 0; }
  .g-split .half { min-height: 260px; }
  .top-bar { height: auto; padding: 8px 10px 4px; flex-wrap: wrap; gap: 6px; }
  .top-side.left { display: none; }
  .top-side.right { min-width: 0; gap: 10px; order: 2; }
  .top-title { flex: 1 0 100%; order: 1; }
  .top-title h1 { font-size: 16px; letter-spacing: 1px; }
  .ticker-wrap { margin: 4px 10px 8px; }
  .foot { padding: 4px 12px 10px; flex-direction: column; gap: 3px; align-items: center; }
  /* 管理端链接在移动端加大点击区域 */
  .admin-link { padding: 7px 14px; font-size: 13px; }
  .clock { font-size: 14px; }
}
@media (max-width: 420px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .top-title h1 { font-size: 14px; }
  .kpi .k-value { font-size: 22px; }
}
