:root {
  --cat-yellow: #ffcd11;
  --cat-yellow-dark: #e0b400;
  --bg: #0f1115;
  --bg-panel: #171a21;
  --bg-elev: #1f232c;
  --border: #2a2f3a;
  --text: #f2f4f8;
  --text-dim: #9aa3b2;
  --province: #2c313c;
  --province-stroke: #11131a;
  --province-empty: #232833;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-elev));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 22px;
  box-shadow: var(--shadow);
}

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

.brand-mark {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 1px;
  color: #111;
  background: var(--cat-yellow);
  padding: 8px 12px;
  border-radius: 10px;
  box-shadow: 0 0 0 3px rgba(255, 205, 17, 0.15);
}

.brand-text h1 { font-size: 19px; font-weight: 700; line-height: 1.2; }
.brand-text p { font-size: 13px; color: var(--text-dim); margin-top: 2px; }

.stats { display: flex; gap: 12px; }

.stat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 18px;
  text-align: center;
  min-width: 96px;
}

.stat-value { display: block; font-size: 24px; font-weight: 800; color: var(--cat-yellow); }
.stat-label { display: block; font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* Content layout */
.content {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 18px;
  align-items: start;
}

.map-wrap {
  position: relative;
  background: linear-gradient(180deg, var(--bg-panel), #12151b);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.map-hint {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 8px;
}
.mobile-hint { display: none; }

.map-container {
  width: 100%;
  position: relative;
  min-height: 240px;
}

.map-container svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 14px;
}

/* Provinces */
.map-container svg path {
  fill: var(--province-empty);
  stroke: var(--province-stroke);
  stroke-width: 0.6;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill 0.15s ease, filter 0.15s ease;
}

.map-container svg g.is-active path,
.map-container svg g.is-hover path {
  filter: brightness(1.18) drop-shadow(0 0 6px rgba(255, 205, 17, 0.55));
}

.map-container svg g.is-hover path { stroke: var(--cat-yellow); stroke-width: 1; }

/* Legend */
.legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-dim);
}
.legend .scale { display: flex; align-items: center; gap: 4px; }
.legend .swatch { width: 22px; height: 12px; border-radius: 3px; border: 1px solid var(--province-stroke); }

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-elev));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.sidebar h2 { font-size: 15px; margin-bottom: 12px; }

.city-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }

.city-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.city-list li:hover, .city-list li.is-active {
  border-color: var(--cat-yellow);
  transform: translateX(2px);
}
.city-list .c-name { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.city-list .c-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.city-list .c-count {
  font-weight: 700;
  font-size: 14px;
  color: #111;
  background: var(--cat-yellow);
  padding: 2px 10px;
  border-radius: 20px;
}

/* Tooltip */
.tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: #fff;
  color: #111;
  border-radius: 10px;
  padding: 8px 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translate(-50%, -120%) scale(0.96);
  transition: opacity 0.12s ease, transform 0.12s ease;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.tooltip.visible { opacity: 1; transform: translate(-50%, -120%) scale(1); }
.tooltip::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #fff;
  border-bottom: 0;
}
.tooltip-city { font-weight: 700; font-size: 14px; }
.tooltip-count { font-size: 12px; color: #555; }
.tooltip-count strong { color: #c79400; font-size: 14px; }

/* Responsive */
@media (max-width: 920px) {
  .content { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
}

@media (max-width: 620px) {
  .app { padding: 12px; gap: 12px; }
  .topbar { padding: 14px 16px; }
  .brand-text h1 { font-size: 16px; }
  .stat { padding: 8px 14px; min-width: 80px; }
  .stat-value { font-size: 20px; }
  .desktop-hint { display: none; }
  .mobile-hint { display: inline; }
  .map-wrap { padding: 12px; }
}
