:root {
  --bg: #0f141b;
  --panel: #17202b;
  --panel2: #1e2a38;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #3b82f6;
  --line: #263341;
}
* { box-sizing: border-box; }
/* Атрибут hidden должен побеждать любые display из классов (.gate/.view = display:flex/block). */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.brand { font-weight: 700; }
.who { color: var(--muted); font-size: 13px; }

.tabs {
  display: flex; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  border: 0; background: var(--panel); color: var(--muted);
  padding: 8px 16px; border-radius: 999px; font-size: 14px; cursor: pointer;
  white-space: nowrap;
}
.tab.active { background: var(--accent); color: #fff; }

main { padding: 16px; }
.view { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.card-label { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.card-value { font-size: 28px; font-weight: 700; }

.chart-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.chart-title { color: var(--muted); font-size: 13px; margin-bottom: 12px; }

.stub { color: var(--muted); text-align: center; padding: 48px 16px; border: 1px dashed var(--line); border-radius: 14px; }

/* Гео */
.geo-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.geo-summary { color: var(--muted); font-size: 13px; }
.geo-select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.geo-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; align-items: start; }
@media (max-width: 820px) { .geo-grid { grid-template-columns: 1fr; } }
.geo-map-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.geo-zoom-ctl { display: flex; align-items: center; gap: 8px; }
.geo-zoom-ico { color: var(--muted); font-size: 16px; width: 12px; text-align: center; user-select: none; }
.geo-zoom { -webkit-appearance: none; appearance: none; width: 130px; height: 5px; border-radius: 3px; background: var(--panel2); outline: none; }
.geo-zoom::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; }
.geo-zoom::-moz-range-thumb { width: 16px; height: 16px; border: none; border-radius: 50%; background: var(--accent); cursor: pointer; }
.geo-reset { background: var(--panel2); color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 5px 12px; font-size: 12px; cursor: pointer; }
.geo-reset:hover { color: var(--text); }
.geo-map-canvas { position: relative; width: 100%; height: 460px; touch-action: none; }
@media (max-width: 820px) { .geo-map-canvas { height: 300px; } }
.geo-map-canvas canvas { width: 100% !important; height: 100% !important; }
.geo-top { display: flex; flex-direction: column; gap: 4px; }
.geo-row { display: grid; grid-template-columns: 22px 1fr auto 90px 46px; align-items: center; gap: 8px; padding: 5px 4px; font-size: 14px; }
.geo-flag { font-size: 16px; }
.geo-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.geo-count { color: var(--text); font-weight: 600; text-align: right; }
.geo-bar { background: var(--panel2); height: 6px; border-radius: 3px; overflow: hidden; }
.geo-bar-fill { display: block; height: 100%; background: var(--accent); }
.geo-pct { color: var(--muted); font-size: 12px; text-align: right; }

.gate {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px;
}
.gate-box { text-align: center; max-width: 320px; }
.gate-emoji { font-size: 44px; margin-bottom: 12px; }
.gate-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.gate-sub { color: var(--muted); font-size: 14px; line-height: 1.5; }
