:root {
  --bg: #eef2ef;
  --bg-2: #e4ebe5;
  --surface: #ffffff;
  --ink: #132019;
  --ink-soft: #4d5f55;
  --ink-faint: #7a8b82;
  --line: #d5dfd8;
  --line-strong: #c3d0c7;
  --accent: #1b7d54;
  --accent-2: #146344;
  --accent-soft: #e3f4eb;
  --accent-glow: rgba(27, 125, 84, 0.18);
  --header: #10231a;
  --header-ink: #e8f4ed;
  --header-muted: #9bb5a6;
  --danger: #b55242;
  --warn: #b7812c;
  --chart: #1b7d54;
  --chart-fill: rgba(27, 125, 84, 0.16);
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 35, 26, 0.05), 0 10px 28px rgba(16, 35, 26, 0.05);
  --font: "DM Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  letter-spacing: -0.01em;
}
button, [role="button"] { cursor: pointer; }
a { color: inherit; }

.app-header {
  background: var(--header);
  color: var(--header-ink);
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--header-ink);
  flex-shrink: 0;
}
.mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(160deg, #2ea56e, #146344);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.1; }
.brand-name span { display: block; font-weight: 500; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--header-muted); }

.site-switch {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--header-ink);
  border-radius: 10px;
  padding: 8px 12px;
  font: 500 13px var(--font);
}
.header-spacer { flex: 1; }

.range-bar { display: flex; gap: 4px; flex-wrap: wrap; }
.range-bar button, .icon-btn {
  background: transparent;
  border: 0;
  color: var(--header-muted);
  font: 500 12.5px var(--font);
  padding: 7px 10px;
  border-radius: 8px;
}
.range-bar button:hover, .icon-btn:hover { background: rgba(255,255,255,0.07); color: var(--header-ink); }
.range-bar button.active {
  background: var(--accent);
  color: #fff;
}
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; color: var(--header-ink); text-decoration: none; }
.custom-dates { display: none; gap: 6px; align-items: center; }
.custom-dates.open { display: flex; }
.custom-dates input {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--header-ink);
  border-radius: 8px;
  padding: 6px 8px;
  font: 500 12px var(--mono);
}

.wrap { max-width: 1240px; margin: 0 auto; padding: 22px; }

.live-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}
.pulse {
  width: 9px; height: 9px; border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34,197,94,0.6);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.55); }
  70% { box-shadow: 0 0 0 10px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.live-count { font-weight: 650; font-size: 14px; }
.live-count b { font-variant-numeric: tabular-nums; }
.live-meta { color: var(--ink-soft); font-size: 13px; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 22px; margin-left: auto; }
.spark i {
  width: 3px; background: var(--accent); opacity: 0.35; border-radius: 1px; display: block;
  min-height: 2px;
}
.spark i.on { opacity: 1; }

.metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
.metric {
  padding: 16px 18px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  border-right: 1px solid var(--line);
  color: var(--ink);
  position: relative;
}
.metric:last-child { border-right: 0; }
.metric:hover { background: #f7faf8; }
.metric.active { background: var(--accent-soft); }
.metric.active::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--accent);
}
.metric .k { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.metric .v { font-size: 26px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.metric .d { font-size: 12px; margin-top: 4px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.metric .d.up { color: var(--accent-2); }
.metric .d.down { color: var(--danger); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card h3 {
  margin: 0;
  padding: 14px 16px 10px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.chart-card { padding: 8px 8px 4px; margin-bottom: 16px; }
.chart-svg { width: 100%; height: 248px; display: block; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .area { fill: var(--chart-fill); }
.chart-svg .line { fill: none; stroke: var(--chart); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .dot { fill: var(--chart); }
.chart-svg .axis { fill: var(--ink-faint); font: 500 10px var(--font); }
.tip {
  position: absolute;
  pointer-events: none;
  background: var(--header);
  color: var(--header-ink);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  display: none;
  z-index: 5;
  white-space: nowrap;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.rows { padding: 0 8px 10px; }
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 8px;
  position: relative;
}
.row:hover { background: #f6f9f7; }
.row .bar {
  position: absolute; left: 8px; top: 4px; bottom: 4px;
  background: var(--accent-soft);
  border-radius: 6px;
  z-index: 0;
}
.row .name, .row .n {
  position: relative; z-index: 1;
  font-size: 13.5px;
}
.row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.row .n { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: 12.5px; font-family: var(--mono); }
.empty { padding: 18px; color: var(--ink-faint); font-size: 13px; }

.map-wrap { display: grid; grid-template-columns: 1.15fr 0.85fr; min-height: 280px; }
.world {
  position: relative;
  margin: 8px 12px 16px;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(27,125,84,0.08), transparent 55%),
    linear-gradient(#dce8e1, #cfdcd4);
  border-radius: 12px;
  overflow: hidden;
  min-height: 250px;
}
.world svg { width: 100%; height: 100%; display: block; }
.world .land { fill: #b7c9bd; stroke: #9aaf9f; stroke-width: 0.6; }
.world .dot {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 1.2;
  opacity: 0.92;
}
.world-list { border-left: 1px solid var(--line); }

.footer-note {
  color: var(--ink-faint);
  font-size: 12px;
  padding: 8px 4px 32px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.footer-note a { color: var(--accent-2); text-decoration: none; font-weight: 600; }

.settings-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; }
.panel { padding: 20px 22px 24px; }
.panel h2 { margin: 0 0 6px; font-size: 20px; }
.panel p { color: var(--ink-soft); font-size: 14px; line-height: 1.55; }
.snippet {
  background: #10231a;
  color: #d7efe3;
  border-radius: 12px;
  padding: 14px 16px;
  font: 500 12.5px/1.55 var(--mono);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.copy-btn {
  margin-top: 10px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  font: 600 13px var(--font);
}
.copy-btn:hover { background: var(--accent-2); }
.kv { display: grid; gap: 10px; margin-top: 8px; }
.kv div {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.kv span { color: var(--ink-soft); }

@media (max-width: 980px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .metric:nth-child(3) { border-right: 0; }
  .grid-2, .map-wrap, .settings-grid { grid-template-columns: 1fr; }
  .world-list { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; padding: 12px 14px; }
  .wrap { padding: 14px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { border-bottom: 1px solid var(--line); }
  .metric .v { font-size: 22px; }
  .range-bar { width: 100%; }
  .header-spacer { display: none; }
}
