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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  min-height: 100vh;
}

header {
  background: #1a365d;
  color: white;
  padding: 1.5rem 1rem;
  text-align: center;
}

header h1 {
  font-size: 2rem;
  font-weight: 800;
}

.subtitle {
  opacity: 0.85;
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

main {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
}

#map-view {
  max-width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  padding: 0 1rem;
}

@media (min-width: 1000px) {
  #map-view {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
  }
}

#map {
  height: 60vh;
  min-height: 300px;
  max-height: 600px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  z-index: 1;
}

@media (max-width: 640px) {
  #map {
    height: 70vh;
    max-height: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  #map-view {
    padding: 0;
  }

  .stat-num {
    font-size: 1.1rem;
  }

  .stats {
    gap: 0.35rem;
  }
}

.global-ticker {
  background: white;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  border: 1px solid #e2e8f0;
  margin-bottom: 0.5rem;
}

.ticker-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.ticker-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #1a365d;
}

.ticker-summary {
  font-size: 0.75rem;
  color: #718096;
  font-weight: 600;
}

.ticker-empty {
  font-size: 0.85rem;
  color: #a0aec0;
  text-align: center;
  padding: 1rem 0;
}

.ticker-progress {
  height: 6px;
  background: #f56565;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.ticker-progress-green {
  height: 100%;
  background: #48bb78;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.gt-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 80px;
}

.gt-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.gt-bar-wrap {
  width: 100%;
  height: 64px;
  display: flex;
  align-items: flex-end;
}

.gt-bar {
  width: 100%;
  border-radius: 2px 2px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 4px;
  transition: height 0.3s ease;
}

.gt-bar-empty {
  width: 100%;
  height: 1px;
  background: #e2e8f0;
}

.gt-green {
  background: #48bb78;
}

.gt-red {
  background: #f56565;
}

.gt-label {
  font-size: 0.55rem;
  color: #a0aec0;
  margin-top: 2px;
}

.gt-legend {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.gt-legend-item {
  font-size: 0.7rem;
  color: #718096;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.gt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.gt-dot-green {
  background: #48bb78;
}

.gt-dot-red {
  background: #f56565;
}

.stats {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  overflow-x: auto;
}

.stat {
  flex: 1;
  min-width: 0;
  background: white;
  border-radius: 8px;
  padding: 0.6rem 0.25rem;
  text-align: center;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.stat:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.stat.stat-active {
  border-color: #1a365d;
  box-shadow: 0 2px 8px rgba(26, 54, 93, 0.15);
}

.stat-num {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
}

.stat-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  color: #718096;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.stat-plowed {
  color: #22543d;
}

.stat-not-plowed {
  color: #822727;
}

.stat-unknown {
  color: #4a5568;
}

.view-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 0.5rem;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #1a365d;
}

.toggle-btn {
  flex: 1;
  padding: 0.5rem;
  border: none;
  background: white;
  color: #1a365d;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.toggle-btn.active {
  background: #1a365d;
  color: white;
}

.search-container {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 0.5rem 0;
  background: #f0f2f5;
}

#search {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  border: 2px solid #cbd5e0;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

#search:focus {
  border-color: #1a365d;
}

#street-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.street-card {
  background: white;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: box-shadow 0.15s;
  border: 1px solid #e2e8f0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.street-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.street-card:active {
  background: #f7fafc;
}

.street-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.street-name {
  font-weight: 600;
  font-size: 1rem;
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-plowed {
  background: #c6f6d5;
  color: #22543d;
}

.status-not_plowed {
  background: #fed7d7;
  color: #822727;
}

.status-unknown {
  background: #e2e8f0;
  color: #4a5568;
}

.street-meta {
  font-size: 0.8rem;
  color: #718096;
  margin-top: 0.25rem;
}

.street-actions {
  display: none;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
  gap: 0.5rem;
}

.street-card.expanded .street-actions {
  display: flex;
}

.vote-btn {
  flex: 1;
  padding: 0.6rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.vote-btn:hover {
  opacity: 0.85;
}

.vote-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.vote-plowed {
  background: #48bb78;
  color: white;
}

.vote-not-plowed {
  background: #f56565;
  color: white;
}

.vote-counts {
  font-size: 0.8rem;
  color: #718096;
  text-align: center;
  margin-top: 0.5rem;
}

.vote-feedback {
  text-align: center;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  font-weight: 600;
}

.vote-feedback.success {
  color: #2f855a;
}

.vote-feedback.error {
  color: #c53030;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: #718096;
}

.timeline-container {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
}

.timeline-loading,
.timeline-empty {
  font-size: 0.8rem;
  color: #a0aec0;
  text-align: center;
  padding: 0.5rem 0;
}

.tl-title {
  font-size: 0.75rem;
  color: #718096;
  font-weight: 600;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.tl-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 60px;
}

.tl-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.tl-bar-wrap {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: flex-end;
}

.tl-bar {
  width: 100%;
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 4px;
}

.tl-bar-green {
  background: #48bb78;
}

.tl-bar-red {
  background: #f56565;
}

.tl-label {
  font-size: 0.55rem;
  color: #a0aec0;
  margin-top: 2px;
}

.how-it-works {
  background: white;
  border-radius: 8px;
  padding: 1.25rem;
  border: 1px solid #e2e8f0;
}

.how-it-works h2 {
  font-size: 1rem;
  color: #1a365d;
  margin-bottom: 0.75rem;
}

.hiw-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hiw-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.hiw-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: #1a365d;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.hiw-note {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
  font-size: 0.8rem;
  color: #a0aec0;
  text-align: center;
}

footer {
  max-width: 600px;
  margin: 2rem auto 1rem;
  padding: 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: #a0aec0;
  line-height: 1.5;
}

footer a {
  color: #718096;
  text-decoration: underline;
}
