﻿:root {
  --bg: #f0efe8;
  --fg: #1e2a2f;
  --panel: #f9f8f3;
  --accent: #006d77;
  --stroke: #20343a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top right, #d8ede9, var(--bg));
  color: var(--fg);
}

.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem;
}

.header h1 {
  margin: 0;
  font-size: 1.8rem;
}

.subtitle {
  margin: 0.25rem 0 0;
}

.fineprint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: #4a5b60;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.9rem 0;
  padding: 0.7rem;
  background: var(--panel);
  border: 1px solid #d4d6cb;
  border-radius: 10px;
}

.readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
  margin: 0.5rem 0 0.9rem;
}

.readout-cell {
  padding: 0.55rem 0.7rem;
  background: var(--panel);
  border: 1px solid #d4d6cb;
  border-radius: 8px;
}

.readout-label {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #5b6e72;
}

.readout-value {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 0.15rem;
  color: var(--accent);
}

.status {
  margin: 0.5rem 0 0.9rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid #c58f7b;
  background: #fff3ef;
  color: #7a2d1e;
  border-radius: 8px;
}

.civilwar {
  border-color: #c8b06e;
  background: #fff9e8;
  color: #5d4610;
}

.controls button {
  border: 1px solid #9cb4b8;
  background: #fff;
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}

#congressRange {
  width: 280px;
}

.map-panel {
  position: relative;
  background: var(--panel);
  border: 1px solid #d4d6cb;
  border-radius: 12px;
  overflow: hidden;
}

#mapSvg {
  width: 100%;
  height: auto;
  display: block;
}

.cell {
  stroke: rgb(25 35 40 / 55%);
  stroke-width: 0.8;
  fill-opacity: 0.1;
  vector-effect: non-scaling-stroke;
}

.state-outline {
  stroke: none;
  fill-opacity: 0.18;
  vector-effect: non-scaling-stroke;
}

.cd-tile {
  stroke: rgb(25 35 40 / 75%);
  stroke-width: 0.6;
  fill-opacity: 0.88;
  vector-effect: non-scaling-stroke;
  transition: fill-opacity 120ms ease;
}

.cd-tile:hover {
  fill-opacity: 1.0;
  stroke-width: 1.2;
}

.cell:hover {
  fill-opacity: 0.72;
  stroke: rgb(25 35 40 / 75%);
}

.tooltip {
  position: absolute;
  pointer-events: none;
  background: #fff;
  border: 1px solid #9cb4b8;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  max-width: 280px;
  box-shadow: 0 2px 10px rgb(0 0 0 / 12%);
}

.credit {
  margin-top: 1.2rem;
  font-size: 0.8rem;
  color: #4a5b60;
  text-align: center;
}

.credit a {
  color: var(--accent);
  text-decoration: none;
}

.credit a:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .header h1 {
    font-size: 1.35rem;
  }

  #congressRange {
    width: 100%;
    min-width: 180px;
  }
}
