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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #1a1a1a;
  background: #fff;
}

a {
  color: #006d2c;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
header {
  padding: 2.5rem 0 1.5rem;
  text-align: center;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: #666;
  font-size: 1.125rem;
}

/* Toolbar */
#toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0.75rem;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

#toolbar label {
  font-size: 0.875rem;
  color: #666;
}

#toolbar select {
  padding: 0.4rem 0.6rem;
  font-size: 0.875rem;
  font-family: inherit;
  border: 1px solid #ddd;
  border-radius: 0.375rem;
  background: #fff;
  cursor: pointer;
  margin-right: 4px;
}

#toolbar button {
  padding: 0.4rem 0.875rem;
  font-size: 0.875rem;
  font-family: inherit;
  border: 1px solid #ddd;
  border-radius: 0.375rem;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s;
  color: #333;
}

#toolbar button:hover {
  background: #f5f5f5;
}

/* Map container */
#map-container {
  width: 100%;
  aspect-ratio: 1 / 1.5;
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 0.5rem;
}

#map-container .loading {
  color: #999;
  font-size: 0.875rem;
}

#map-container svg {
  display: block;
  max-width: 100%;
  height: auto;
  cursor: grab;
}

#map-container svg:active {
  cursor: grabbing;
}

/* Zoom controls */
#zoom-controls {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: #ccc;
  border-radius: 0.375rem;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

#zoom-controls button {
  width: 32px;
  height: 32px;
  border: none;
  background: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: #333;
  padding: 0;
  font-family: inherit;
}

#zoom-controls button:hover {
  background: #f0f0f0;
}

.zoom-hint {
  text-align: center;
  color: #999;
  font-size: 0.75rem;
  margin-bottom: 2rem;
  display: none;
}

@media (max-width: 640px) {
  .zoom-hint {
    display: block;
  }
}

/* SVG labels */
#labels text {
  cursor: default;
}

/* Explainer cards */
.explainer-section {
  display: grid;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

@media (min-width: 640px) {
  .explainer-section {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 0.5rem;
  padding: 1.25rem;
}

.card h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #1a1a1a;
}

.card p {
  font-size: 0.875rem;
  color: #666;
  line-height: 1.5;
}

/* Understanding the rates */
.rate-info {
  border-top: 1px solid #e5e5e5;
  padding-top: 2rem;
  margin-bottom: 2.5rem;
}

.rate-info h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.rate-info ul {
  list-style: none;
  padding: 0;
}

.rate-info li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
  font-size: 1rem;
  color: #333;
}

.rate-info li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 0.5rem;
  height: 0.5rem;
  background: #006d2c;
  border-radius: 50%;
}

/* Tax components */
.components {
  margin-bottom: 2.5rem;
}

.components h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.components ul {
  padding-left: 1.25rem;
}

.components li {
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
  color: #333;
  line-height: 1.6;
}

/* Footer */
footer {
  border-top: 1px solid #e5e5e5;
  padding: 2rem 0;
  text-align: center;
  color: #666;
  font-size: 0.875rem;
}

/* Tooltip */
.tooltip {
  position: absolute;
  pointer-events: none;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0;
  font-size: 12px;
  font-family: "Gill Sans", Arial, Helvetica, sans-serif;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transition: opacity 0.15s;
  max-width: 250px;
  line-height: 1.4;
  overflow: hidden;
  z-index: 100;
}

.tooltip.visible {
  opacity: 1;
}

.tooltip .tooltip-header {
  padding: 6px 10px;
  background: #f7f7f7;
  border-bottom: 1px solid #e0e0e0;
}

.tooltip .town-name {
  font-weight: bold;
  font-size: 13px;
  font-variant: small-caps;
}

.tooltip .county-name {
  font-size: 11px;
  color: #888;
  margin-top: 1px;
}

.tooltip .rate-table {
  width: 100%;
  border-collapse: collapse;
  padding: 0;
  font-size: 12px;
}

.tooltip .rate-table td {
  padding: 2px 10px;
}

.tooltip .rate-table td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #333;
}

.tooltip .rate-table td:first-child {
  color: #666;
}

.tooltip .rate-table tr.total {
  border-top: 1px solid #e0e0e0;
}

.tooltip .rate-table tr.total td {
  padding-top: 4px;
  padding-bottom: 5px;
  font-weight: bold;
  color: #222;
}
