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

html, body { height: 100% }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
  background: #0b1219;
  color: #e6eef7;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.wrap { display: flex; flex-direction: column; height: 100% }

/* ---------- 顶栏 ---------- */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 20px;
  background: linear-gradient(180deg, #101c27, #0d1721);
  border-bottom: 1px solid #1d2f40;
  flex-wrap: wrap;
}
.brand h1 { font-size: 17px; font-weight: 700; letter-spacing: .5px }
.brand p { font-size: 12px; color: #6f869b; margin-top: 3px }

.views { display: flex; gap: 6px; flex-wrap: wrap }
.views button {
  font: inherit; font-size: 13px;
  padding: 7px 14px; border-radius: 7px; cursor: pointer;
  color: #a8bccf; background: #16242f; border: 1px solid #24384a;
  transition: .18s;
}
.views button:hover { background: #1d3040; color: #fff }
.views button.on { background: #2b7fb8; border-color: #3f9ad4; color: #fff }
#btn-reset { color: #7f95a8 }

/* ---------- 舞台 ---------- */
#stage { position: relative; flex: 1; min-height: 0 }
#stage canvas { display: block; outline: none; cursor: grab; touch-action: none }
#stage canvas.hot { cursor: pointer }
#stage canvas:active { cursor: grabbing }

/* ---------- 悬停提示 ---------- */
#tip {
  position: absolute; left: 0; top: 0; pointer-events: none; opacity: 0;
  transition: opacity .12s;
  background: rgba(8,14,20,.94); border: 1px solid #2d4459;
  border-radius: 8px; padding: 8px 11px; white-space: nowrap; z-index: 6;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
#tip b { display: block; font-size: 14px; color: #fff }
#tip span { display: block; font-size: 11.5px; color: #8fa8bd; margin-top: 2px }

/* ---------- 点击卡片 ---------- */
.card {
  position: absolute; right: 18px; bottom: 78px; width: 268px; z-index: 7;
  background: rgba(13,23,33,.95); border: 1px solid #263d52;
  border-radius: 12px; padding: 15px 16px;
  box-shadow: 0 14px 40px rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
}
.card.hidden { display: none }
#card-close {
  position: absolute; right: 8px; top: 6px; border: 0; background: none;
  color: #6d8397; font-size: 20px; cursor: pointer; line-height: 1;
}
#card-close:hover { color: #fff }
.tag {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px;
}
.card-h h3 { font-size: 18px; margin-top: 8px; color: #fff }
.card-p { font-size: 12px; line-height: 1.7; color: #8ea4b8; margin-top: 9px }

/* ---------- 左侧面板 ---------- */
.panel {
  position: absolute; left: 18px; top: 18px; z-index: 5;
  display: flex; flex-direction: column; gap: 10px;
}
.filters, .toggles { display: flex; flex-direction: column; gap: 5px; }
.filters {
  background: rgba(13,23,33,.9); border: 1px solid #223648;
  border-radius: 11px; padding: 9px; backdrop-filter: blur(8px);
}
.filters button, .toggles button {
  font: inherit; font-size: 13px; text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 11px; border-radius: 7px;
  color: #a4b9cb; background: transparent; border: 1px solid transparent;
  transition: .16s;
}
.filters button:hover { background: #172836; color: #fff }
.filters button.on { background: #1b3345; border-color: #2f5773; color: #fff }
.sw { width: 11px; height: 11px; border-radius: 3px; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.35) }

.toggles button {
  background: rgba(13,23,33,.9); border: 1px solid #223648; justify-content: center;
  backdrop-filter: blur(8px);
}
.toggles button:hover { color: #fff; border-color: #2f5773 }
.toggles button.on { background: #1b3345; border-color: #2f5773; color: #fff }

/* ---------- 图例 ---------- */
.legend {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 11px 20px;
  background: linear-gradient(0deg, #0b1219, rgba(11,18,25,.72));
  border-top: 1px solid #16232f;
  font-size: 12.5px; color: #b3c6d6;
}
.legend span { display: flex; align-items: center; gap: 6px }
.legend i { width: 15px; height: 9px; border-radius: 2px; display: inline-block }
.legend .hint { margin-left: auto; color: #5d7488; font-size: 11.5px }

/* ---------- 窄屏 ---------- */
@media (max-width: 720px) {
  .bar { padding: 10px 12px }
  .brand h1 { font-size: 15px }
  .brand p { display: none }
  .panel { left: 10px; top: 10px }
  .filters { padding: 6px }
  .filters button, .toggles button { font-size: 12px; padding: 5px 8px }
  .card { right: 10px; bottom: 96px; width: 220px }
  .legend { gap: 10px; font-size: 11px; padding: 8px 10px }
  .legend .hint { display: none }
}
