:root {
  --bg: #05070f;
  --panel: rgba(13, 20, 38, 0.72);
  --panel-border: rgba(94, 130, 255, 0.16);
  --text: #e8edff;
  --text-dim: #8fa0c8;
  --accent: #4d7cff;
  --real: #ff4757;
  --sim: #ffa502;
  --ok: #2ed573;
  --warn: #ffa502;
  --err: #ff4757;
}

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

html, body { height: 100%; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1200px 800px at 70% -10%, rgba(46, 74, 174, 0.28), transparent 60%),
    radial-gradient(900px 600px at 10% 110%, rgba(20, 42, 120, 0.22), transparent 60%),
    var(--bg);
  color: var(--text);
  overflow: hidden;
}

.hidden { display: none !important; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: linear-gradient(180deg, rgba(5, 7, 15, 0.9), rgba(5, 7, 15, 0));
  pointer-events: none;
}

.brand { display: flex; align-items: center; gap: 10px; }

.logo-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent), 0 0 30px rgba(77, 124, 255, 0.6);
  animation: breathe 2.4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.72); opacity: 0.7; }
}

.brand h1 { font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }
.brand .sub { font-size: 12px; font-weight: 400; color: var(--text-dim); margin-left: 6px; }

.topbar-right { display: flex; align-items: center; gap: 10px; pointer-events: auto; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; border: 1px solid var(--panel-border);
  background: var(--panel); backdrop-filter: blur(8px);
}

.badge.sim { color: var(--sim); border-color: rgba(255, 165, 2, 0.4); cursor: help; }
.badge.conn { color: var(--text-dim); }
.badge.site { color: #7fd8ff; border-color: rgba(127, 216, 255, 0.35); }

.site-select {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: #c9d6f2;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  outline: none;
  max-width: 220px;
  cursor: pointer;
}
.site-select option { background: #0a1024; color: #c9d6f2; }

.conn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn); transition: background 0.3s;
}
.conn-dot.live { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.conn-dot.dead { background: var(--err); }

/* ---------------- 布局 ---------------- */
.layout {
  position: relative;
  height: 100vh;
  display: grid;
  grid-template-columns: 300px 1fr 340px;
  gap: 0;
  padding-top: 52px;
}

.panel {
  z-index: 5;
  padding: 14px;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(10, 16, 32, 0.55), rgba(10, 16, 32, 0.25));
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
}

.stats-panel { border-left: none; border-top-right-radius: 12px; border-bottom-right-radius: 12px; }
.feed-panel { border-right: none; border-top-left-radius: 12px; border-bottom-left-radius: 12px; }

/* ---------------- 统计卡片 ---------------- */
.stat-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.stat-card.online { border-color: rgba(46, 213, 115, 0.35); }
.stat-label { font-size: 12px; color: var(--text-dim); }
.stat-value { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat-card.online .stat-value { color: var(--ok); }
.stat-note { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card.mini .stat-value { font-size: 20px; }
.stat-card.mini.total .stat-value { color: var(--accent); }

/* ---------------- 子块 ---------------- */
.sub-block { margin-top: 14px; }
.sub-block h2 {
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  margin-bottom: 8px; letter-spacing: 0.5px;
}
.hint-text { font-weight: 400; font-size: 11px; }

.country-list, .feed-list { list-style: none; }

.country-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; font-size: 13px;
}
.country-flag { width: 20px; text-align: center; }
.country-name { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country-bar { flex: 0 0 70px; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.07); overflow: hidden; }
.country-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #7fa6ff); border-radius: 3px; }
.country-count { width: 34px; text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; font-size: 12px; }

/* ---------------- 最近访客 ---------------- */
.online-list { list-style: none; max-height: 220px; overflow: auto; }
.online-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; font-size: 13px;
}
.online-list .online-flag { width: 22px; text-align: center; font-size: 15px; }
.online-list .online-main {
  flex: 1; min-width: 0; display: flex; gap: 6px; align-items: baseline;
  color: var(--text); white-space: nowrap; overflow: hidden;
}
.online-list .online-main b { font-weight: 600; }
.online-list .online-time { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.online-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; animation: online-blink 2.4s ease-in-out infinite; }
.online-dot.real { background: var(--real); box-shadow: 0 0 6px var(--real); }
.online-dot.sim { background: var(--sim); box-shadow: 0 0 6px var(--sim); }
@keyframes online-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.feed-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 13px;
}
.feed-list li:last-child { border-bottom: none; }
.feed-list .feed-flag { width: 22px; text-align: center; font-size: 15px; }
.feed-list .feed-main { flex: 1; min-width: 0; }
.feed-list .feed-who {
  display: flex; gap: 6px; align-items: baseline;
  color: var(--text); white-space: nowrap; overflow: hidden;
}
.feed-list .feed-who b { font-weight: 600; }
.feed-list .feed-page {
  font-size: 11px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 220px;
}
.feed-list .feed-time { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.feed-list li.leaving { opacity: 0.35; transition: opacity 0.6s; }
.feed-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.feed-dot.real { background: var(--real); box-shadow: 0 0 6px var(--real); }
.feed-dot.sim { background: var(--sim); box-shadow: 0 0 6px var(--sim); }
.tag-sim { font-size: 10px; color: var(--sim); border: 1px solid rgba(255,165,2,.4); border-radius: 4px; padding: 0 4px; }
.tag-fallback { font-size: 10px; color: var(--text-dim); border: 1px solid var(--panel-border); border-radius: 4px; padding: 0 4px; }

/* ---------------- 地球区 ---------------- */
.globe-wrap { position: relative; min-height: 0; }
#globe { position: absolute; inset: 0; }
#globe canvas { display: block; cursor: grab; }

.globe-legend {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; gap: 16px; align-items: center;
  padding: 6px 14px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--panel-border);
  backdrop-filter: blur(8px); font-size: 12px; color: var(--text-dim);
}
.globe-legend i.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.globe-legend i.real { background: var(--real); box-shadow: 0 0 6px var(--real); }
.globe-legend i.sim { background: var(--sim); box-shadow: 0 0 6px var(--sim); }
.globe-legend i.pulse { background: transparent; border: 2px solid #7fd8ff; }

.globe-hint {
  position: absolute; right: 14px; bottom: 22px;
  font-size: 11px; color: rgba(143,160,200,0.7);
}

.visit-label {
  position: absolute; z-index: 10;
  transform: translate(-50%, -130%);
  padding: 4px 10px; border-radius: 8px;
  background: rgba(8, 12, 26, 0.92);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(6px);
  font-size: 12px; color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 18px rgba(0,0,0,0.5);
  transition: opacity 0.4s;
}
.visit-label .vl-flag { margin-right: 4px; }
.visit-label .vl-sim { color: var(--sim); margin-left: 4px; font-size: 10px; }

/* 访客信息卡（点击光点弹出） */
.visitor-card {
  position: absolute; z-index: 20;
  min-width: 180px; max-width: 260px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(8, 12, 26, 0.94);
  border: 1px solid rgba(77,124,255,0.45);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
  font-size: 12px; color: var(--text);
  pointer-events: none;
}
.visitor-card .vc-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; margin-bottom: 6px;
}
.visitor-card .vc-flag { font-size: 18px; }
.visitor-card .vc-head b { font-weight: 600; }
.visitor-card .vc-meta { color: var(--text-dim); line-height: 1.6; word-break: break-all; }
.visitor-card .vc-meta .vc-page { color: #8fa3c8; }

.foot {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  text-align: center; font-size: 11px; color: rgba(143,160,200,0.45);
  padding: 8px; pointer-events: none;
}

/* ---------------- 滚动条 ---------------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(94,130,255,0.25); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: 100vh;
    padding-top: 52px;
  }
  .globe-wrap { grid-row: 1; min-height: 52vh; }
  .stats-panel, .feed-panel {
    border-radius: 0;
    border-left: none; border-right: none;
    max-height: 42vh;
  }
  body { overflow: auto; }
  .foot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .logo-dot { animation: none; }
  .visit-label { transition: none; }
  .online-dot { animation: none; }
}
