:root {
  color-scheme: light dark;
  font-family: system-ui, sans-serif;
}

body {
  margin: 0;
  padding: 1rem;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 960px;
  margin: 0 auto;
}

.site-title {
  margin-bottom: 1rem;
}

.site-title h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #2b6cb0, #319795, #38a169);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.muted {
  opacity: 0.7;
  overflow-wrap: anywhere;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin: 1rem 0;
}

.controls label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  flex: 1 1 10rem;
}

input,
select,
button {
  font: inherit;
  padding: 0.5rem 0.6rem;
  min-height: 2.5rem;
  box-sizing: border-box;
}

#address-form {
  flex-wrap: nowrap;
}

.address-field {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
}

.address-field input[type='text'] {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding-right: 2.5rem;
}

.clear-button {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  min-height: 2rem;
  padding: 0 0.6rem;
  border: none;
  background: transparent;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
}

.clear-button[hidden] {
  display: none;
}

.clear-button:hover,
.clear-button:focus-visible {
  opacity: 1;
}

input[type='text'] {
  flex: 1 1 auto;
  min-width: 0;
}

.controls button {
  flex: 0 0 auto;
}

.error {
  color: #c53030;
}

.chart-wrapper {
  position: relative;
  height: 360px;
}

#chart {
  touch-action: pan-y;
  cursor: grab;
}

#chart.panning {
  cursor: grabbing;
}

.chart-tooltip {
  min-height: 3.5rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  visibility: hidden;
}

.chart-tooltip.visible {
  visibility: visible;
}

.chart-tooltip-title {
  font-weight: bold;
}

.chart-tooltip-swatch {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-right: 0.4em;
  border-radius: 2px;
}

#reset-period[hidden] {
  display: none;
}

.period-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 0.5rem;
}

th,
td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.3);
  white-space: nowrap;
}

.hidden-station td:not(:last-child) {
  opacity: 0.4;
  text-decoration: line-through;
}

.extreme {
  font-weight: bold;
  background: rgba(56, 161, 105, 0.25);
}

@media (max-width: 600px) {
  body {
    padding: 0.75rem;
  }

  .chart-wrapper {
    height: 260px;
  }

  th,
  td {
    padding: 0.35rem 0.4rem;
    font-size: 0.9rem;
  }

  .controls button {
    min-height: 2.75rem;
  }
}
