body {
  margin: 0;
  color: #1f2933;
  background: #f5f7fa;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px;
  background: #ffffff;
  border-bottom: 1px solid #d9e2ec;
}

.btn-blue,
.btn-orange,
.county-select,
.map-search input,
.map-search button,
.zoom-controls button {
  min-height: 38px;
  border-radius: 4px;
  border: 1px solid transparent;
  padding: 8px 12px;
  font-size: 14px;
}

.btn-blue,
.btn-orange {
  color: #ffffff;
  text-decoration: none;
}

.btn-blue {
  background: #3b6ea5;
}

.btn-blue:hover {
  background: #325d8c;
}

.btn-orange {
  background: #d98c4e;
}

.btn-orange:hover {
  background: #bf773f;
}

.county-select {
  color: #1f2933;
  background: #ffffff;
  border-color: #bcccdc;
}

.map-search,
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.map-search input {
  width: min(220px, 52vw);
  color: #1f2933;
  background: #ffffff;
  border-color: #bcccdc;
  text-transform: uppercase;
}

.map-search button,
.zoom-controls button {
  color: #1f2933;
  background: #ffffff;
  border-color: #bcccdc;
  cursor: pointer;
}

.map-search button:hover,
.zoom-controls button:hover {
  background: #f0f4f8;
}

.map-header {
  max-width: 1180px;
  margin: 18px auto 10px;
  padding: 0 14px;
}

.map-header h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.map-header p {
  margin: 0;
  color: #52606d;
}

.map-hint {
  max-width: 1180px;
  margin: 8px auto 0;
  padding: 10px 14px;
  color: #334e68;
  background: #ffffff;
  border-top: 1px solid #d9e2ec;
  border-bottom: 1px solid #d9e2ec;
}

.map-message {
  max-width: 1180px;
  min-height: 24px;
  margin: 8px auto 0;
  padding: 0 14px;
  color: #334e68;
  font-weight: 600;
}

.map-message:empty {
  display: none;
}

.map-stage {
  overflow: auto;
  padding: 12px;
  display: grid;
  justify-content: center;
  align-items: start;
}

.map-stage.is-scrollable {
  justify-content: start;
}

.grid-container {
  --map-tile-size: 72px;
  display: grid;
  gap: 0;
  width: max-content;
  min-width: 0;
}

.grid-item,
.empty {
  width: var(--map-tile-size);
  height: var(--map-tile-size);
  aspect-ratio: 1 / 1;
}

.grid-item {
  position: relative;
  overflow: hidden;
  appearance: none;
  padding: 0;
  border: 0;
  background: #d9e2ec;
  box-shadow: inset 0 0 0 1px rgba(31, 41, 51, 0.18);
  cursor: pointer;
  font: inherit;
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.empty {
  background: transparent;
  pointer-events: none;
}

.overlay,
.missing-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.overlay {
  color: #ffffff;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 2;
}

.grid-item:hover .overlay,
.grid-item:focus-visible .overlay,
.grid-item.is-highlighted .overlay {
  opacity: 1;
}

.overlay span {
  padding: 4px;
  font-size: 14px;
}

.missing-label {
  z-index: 1;
  color: #334e68;
  background: repeating-linear-gradient(
    -45deg,
    #eef2f7,
    #eef2f7 8px,
    #d9e2ec 8px,
    #d9e2ec 16px
  );
  font-size: 12px;
  line-height: 1.25;
  padding: 8px;
}

.empty-state {
  max-width: 760px;
  margin: 28px auto;
  padding: 18px;
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 4px;
}

.grid-item.is-highlighted {
  outline: 4px solid #d98c4e;
  outline-offset: -4px;
  z-index: 3;
}

@media (max-width: 720px) {
  .top-bar {
    justify-content: stretch;
  }

  .btn-blue,
  .county-select,
  .map-search,
  .zoom-controls {
    width: 100%;
  }

  .map-search input {
    flex: 1 1 auto;
    width: 100%;
  }

  .map-search button {
    flex: 0 0 auto;
  }

  .zoom-controls {
    justify-content: center;
  }
}
