:root {
  --ink: #102033;
  --ink-soft: #3d4f63;
  --paper: #f4f7fb;
  --panel: rgba(255, 255, 255, 0.96);
  --line: #c9d4e3;
  --accent: #0b6e6b;
  --accent-dark: #085654;
  --fill: #0b6e6b;
  --danger: #9b1c1c;
  --shadow: 0 10px 30px rgba(16, 32, 51, 0.14);
  --radius: 14px;
  --font: "Segoe UI", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.topbar {
  position: relative;
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.1rem;
  padding: 0.7rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  flex-direction: column;
  min-width: 12rem;
}

.brand h1 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand p {
  margin: 0.1rem 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.search {
  display: flex;
  flex: 1 1 18rem;
  max-width: 34rem;
  gap: 0.45rem;
  align-items: stretch;
}

.search input[type="search"] {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.62rem 0.8rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
}

.search input[type="search"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.search button {
  border: 0;
  border-radius: 10px;
  padding: 0.62rem 1rem;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

.search button:hover,
.search button:focus-visible {
  background: var(--accent-dark);
}

.status {
  flex: 1 1 100%;
  margin: 0;
  min-height: 1.1rem;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.status.error { color: var(--danger); }

#map {
  flex: 1;
  width: 100%;
  min-height: 20rem;
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.leaflet-popup-content {
  margin: 0.85rem 0.95rem 0.9rem;
  min-width: 14rem;
}

.pc-popup h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

.pc-popup .count {
  margin: 0.15rem 0 0.55rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.pc-popup ul {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(40vh, 18rem);
  overflow: auto;
  border-top: 1px solid var(--line);
}

.pc-popup li {
  padding: 0.32rem 0.1rem;
  border-bottom: 1px solid #e7eef5;
  font-size: 0.92rem;
}

.pc-popup li:last-child { border-bottom: 0; }

.pc-popup .empty {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.attr {
  position: absolute;
  z-index: 500;
  left: 0.55rem;
  bottom: 0.55rem;
  max-width: min(34rem, calc(100% - 7rem));
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #334;
  font-size: 0.68rem;
  line-height: 1.35;
  pointer-events: auto;
}

.attr a { color: var(--accent-dark); }

@media (max-width: 640px) {
  .topbar { padding: 0.65rem 0.75rem 0.55rem; }
  .brand h1 { font-size: 1.05rem; }
  .search { flex: 1 1 100%; max-width: none; }
  .attr { font-size: 0.62rem; }
}
