:root {
  --bg-1: #040813;
  --bg-2: #07111f;
  --panel: rgba(8, 15, 31, 0.78);
  --panel-border: rgba(146, 176, 255, 0.18);
  --text: #ebf3ff;
  --muted: #9eb1d8;
  --blackgold: #f6b24b;
  --platinum: #86ecff;
  --accent: #6f8cff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(29, 59, 112, 0.45), transparent 32%),
    radial-gradient(circle at 80% 0%, rgba(13, 102, 126, 0.24), transparent 28%),
    linear-gradient(180deg, #040712 0%, #02050d 55%, #010309 100%);
}

.app-shell {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 16px;
  padding: 18px 24px 8px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #7d90c8;
  letter-spacing: 0.36em;
  font-size: 10px;
}

h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.subtitle:empty {
  display: none;
}

.tool-btn {
  min-width: 92px;
  height: 38px;
  border: 1px solid rgba(161, 188, 255, 0.22);
  border-radius: 12px;
  background: rgba(16, 29, 58, 0.72);
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.tool-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(161, 188, 255, 0.46);
  background: rgba(27, 45, 85, 0.86);
}

.icon-btn {
  min-width: 0;
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
}

.tool-icon {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
}

.tool-icon-refresh::before,
.tool-icon-refresh::after,
.tool-icon-rotate::before,
.tool-icon-rotate::after {
  content: "";
  position: absolute;
}

.tool-icon-refresh::before {
  inset: 1px;
  border: 2px solid rgba(221, 235, 255, 0.92);
  border-right-color: transparent;
  border-radius: 999px;
}

.tool-icon-refresh::after {
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-left: 5px solid rgba(221, 235, 255, 0.92);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transform: rotate(18deg);
}

.tool-icon-rotate::before,
.tool-icon-rotate::after {
  top: 2px;
  bottom: 2px;
  width: 3px;
  border-radius: 999px;
  background: rgba(221, 235, 255, 0.92);
}

.tool-icon-rotate::before {
  left: 4px;
}

.tool-icon-rotate::after {
  right: 4px;
}

.icon-btn.active-rotate .tool-icon-rotate::before {
  left: 6px;
  width: 0;
  height: 0;
  top: 2px;
  bottom: auto;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid rgba(221, 235, 255, 0.92);
  background: transparent;
}

.icon-btn.active-rotate .tool-icon-rotate::after {
  display: none;
}

.globe-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.globe-container {
  position: absolute;
  inset: 0;
}

.overlay-panel {
  position: absolute;
  z-index: 9;
}

.overlay-top-left {
  top: 24px;
  left: 24px;
  width: 290px;
  max-width: calc(100vw - 48px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 11;
}

.overlay-bottom-right {
  right: 28px;
  bottom: 24px;
  width: min(580px, calc(100vw - 56px));
}

.panel-card {
  backdrop-filter: blur(12px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

.totals-card {
  width: 100%;
  max-width: none;
}

.panel-title {
  color: #dfe7ff;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.legend-item,
.hint-line,
.meta-line {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.legend-card {
  padding: 14px 22px;
  overflow: hidden;
}

.legend-card .legend-item {
  margin-bottom: 0;
  gap: 10px;
  font-size: 13px;
  flex: 0 0 auto;
}

.legend-hint {
  color: #8ea4d6;
  min-width: 0;
  flex: 0 1 auto;
  justify-content: flex-start;
  text-align: left;
  margin-left: 4px;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: inline-block;
  box-shadow: 0 0 16px currentColor;
}

#legendBlackgold {
  color: var(--blackgold);
  background: var(--blackgold);
}

#legendPlatinum {
  color: var(--platinum);
  background: var(--platinum);
}

.panel-divider {
  height: 1px;
  margin: 12px 0;
  background: linear-gradient(90deg, transparent, rgba(170, 190, 255, 0.2), transparent);
}

.totals-grid {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 5px;
}

.total-box {
  border-radius: 11px;
  width: 80px;
  min-height: 64px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  grid-template-rows: auto auto;
  place-items: center;
  align-content: center;
  gap: 4px;
  text-align: center;
}

.total-blackgold {
  box-shadow: inset 0 0 0 1px rgba(246, 178, 75, 0.08);
}

.total-platinum {
  box-shadow: inset 0 0 0 1px rgba(134, 236, 255, 0.08);
}

.total-online {
  box-shadow: inset 0 0 0 1px rgba(120, 235, 170, 0.12);
  background: rgba(65, 164, 112, 0.08);
}

.total-online .total-label {
  color: #9ef0c0;
}

.total-online .total-value {
  color: #9ef0c0;
}

.total-label {
  width: 100%;
  font-size: 9px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.1;
  white-space: nowrap;
  text-align: center;
  justify-self: center;
  align-self: center;
}

.total-value {
  margin-top: 0;
  width: 100%;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  justify-self: center;
  align-self: center;
}

.total-blackgold .total-value {
  color: var(--blackgold);
}

.total-platinum .total-value {
  color: var(--platinum);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 12px;
  backdrop-filter: blur(10px);
  background: rgba(12, 25, 53, 0.84);
  border: 1px solid rgba(167, 192, 255, 0.2);
  color: #d9e4ff;
}

.status-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-divider {
  width: 1px;
  align-self: stretch;
  background: rgba(167, 192, 255, 0.2);
}

.status-text {
  min-width: 0;
  white-space: nowrap;
}

.status-badge.loading {
  color: #f7d28c;
}

.status-badge.ok {
  color: #95f0b8;
}

.status-badge.error {
  color: #ffb2c0;
}

.globe-tooltip {
  min-width: 200px;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(6, 12, 24, 0.92);
  border: 1px solid rgba(161, 188, 255, 0.22);
  color: #edf3ff;
  font-size: 12px;
  line-height: 1.65;
}

.globe-tooltip .tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-weight: 700;
}

.globe-tooltip .tag::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

@media (max-width: 820px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .overlay-top-left,
  .overlay-bottom-right {
    position: static;
    transform: none;
    width: auto;
    margin: 0 16px 10px;
  }

  .globe-stage {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: auto;
  }

  .globe-container {
    position: relative;
    min-height: 58vh;
  }

  .legend-row {
    flex-wrap: wrap;
    white-space: normal;
  }

  .totals-grid {
    justify-content: flex-start;
  }

  .status-badge {
    max-width: none;
  }
}
