:root {
  color-scheme: dark;
  --bg: #0b1220;
  --panel: #111b2d;
  --panel-2: #162338;
  --text: #e5eefb;
  --muted: #9bb0cc;
  --accent: #66b2ff;
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #15223a 0%, var(--bg) 55%);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 12, 21, 0.7);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  margin: 0;
  font-size: 1.4rem;
}

.subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.controls {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 0.5rem;
}

.range-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.range-buttons button {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.range-buttons button.active {
  background: var(--accent);
  color: #04121f;
  border-color: transparent;
  font-weight: 700;
}

.status {
  font-size: 0.9rem;
  color: var(--muted);
}

.forecast-view {
  min-height: 100vh;
}

.forecast-topbar {
  align-items: center;
}

.forecast-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: end;
  gap: 0.5rem;
}

select,
button,
.nav-link {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0.45rem 0.7rem;
  font: inherit;
  text-decoration: none;
}

button,
.nav-link {
  cursor: pointer;
}

.nav-link {
  background: var(--accent);
  color: #04121f;
  font-weight: 700;
}

.forecast-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
}

.forecast-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.forecast-hero h2 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
}

.forecast-icon {
  font-size: 3.5rem;
  min-width: 4rem;
  text-align: center;
  width: 8.8125rem;
  height: 8.8125rem;
  background-repeat: no-repeat;
  background-size: contain;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.8rem;
}

.forecast-grid .card {
  padding: 1rem;
}

.forecast-grid .card-value {
  font-size: 1.2rem;
}

.card-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.card-label img {
  width: 1.35rem;
  height: 1.35rem;
  object-fit: contain;
}

.forecast-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  padding: 1rem;
  margin-top: 1rem;
}

.forecast-meta > div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

body.forecast-mode #historic-view,
body.forecast-mode .historic-content,
body.forecast-mode #current-view,
body.current-mode #forecast-view,
body.current-mode #historic-view,
body.current-mode .historic-content {
  display: none;
}

body.historic-mode #forecast-view {
  display: none;
}

body.historic-mode #current-view {
  display: none;
}

body.historic-mode #historic-view {
  position: sticky;
}

.layout {
  padding: 1rem 1.25rem 1.5rem;
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.card,
.chart-card {
  background: linear-gradient(180deg, rgba(22, 35, 56, 0.95), rgba(13, 21, 35, 0.96));
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.card {
  padding: 0.9rem 1rem;
}

.card-label,
.chart-title {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.card-value {
  font-size: 0.98rem;
  word-break: break-word;
}
.card-value-block {
  font-size: 0.98rem;
  word-break: break-word;
  display: block;
}
.card-value-block-line {
  margin-bottom: 1rem;
  line-height: 0.15rem;
  font-size: 0.98rem;
  word-break: break-word;
  display: block;
}

.chart-grid {
  display: grid;
  gap: 0.8rem;
}

.chart-card {
  padding: 0.75rem;
}

.chart {
  width: 100%;
  height: 320px;
}

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    align-items: start;
  }

  .controls {
    align-items: start;
  }

  .chart {
    height: 280px;
  }
}

.mini-compass {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  position: relative;
}

  #forecast-precipitation {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Creates 2 equal columns */
    grid-template-rows: repeat(3, auto);  /* Creates 3 rows */
    gap: 8px;                             /* Optional spacing between cells */
  }

  .grid-cell {
    /* Optional styles for your content cells */
    padding: 10px;
    border: 1px solid #ccc;
  }
