:root {
  color-scheme: dark;
  --surface: #0b1a2b;
  --panel: #0f2236;
  --line: #1d3550;
  --axis: #35536f;
  --text: #dbe8f2;
  --muted: #9ab2c6;
  --without: #cf7d14;
  --with: #2a9fd0;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  padding: 20px 24px 32px;
  max-width: 1320px;
  background-color: var(--surface);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: -1px -1px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  margin-bottom: 16px;
}

h1 { margin: 0 0 4px; font-size: 22px; font-weight: 600; letter-spacing: 0.02em; }
header p { margin: 0; color: var(--muted); max-width: 76ch; }
a { color: var(--with); }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px 16px;
  padding: 12px;
  margin-bottom: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.controls label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.controls label.check { display: flex; align-items: center; gap: 6px; font-size: 13px; padding-bottom: 7px; }

select, input[type="number"], button {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--axis);
  border-radius: 2px;
  padding: 6px 8px;
  min-height: 34px;
}

input[type="number"] { width: 84px; }
button { cursor: pointer; min-width: 84px; }
button:hover { border-color: var(--with); }
:focus-visible { outline: 2px solid var(--with); outline-offset: 1px; }
.hidden { display: none !important; }

.maps { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

figure { margin: 0; min-width: 0; }

figcaption {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  color: var(--muted);
  font-size: 13px;
}

.swatch { width: 14px; height: 3px; }
.swatch.without { background: var(--without); }
.swatch.with { background: var(--with); }

.maps canvas {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface);
  border: 1px solid var(--axis);
}

.readout { margin-top: 14px; }

dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin: 0 0 12px;
  background: var(--line);
  border: 1px solid var(--line);
}

dl > div { padding: 8px 10px; background: var(--panel); min-width: 0; }
dt { color: var(--muted); font-size: 12px; }
dd { margin: 2px 0 0; font-size: 19px; font-variant-numeric: tabular-nums; }

.chart-area { position: relative; }
.chart canvas {
  display: block;
  width: 100%;
  height: 190px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.tip {
  position: absolute;
  top: 8px;
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--axis);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

.note { color: var(--muted); margin: 10px 0 0; min-height: 1.5em; }

@media (max-width: 860px) {
  body { padding: 14px 16px 24px; }
  header { flex-direction: column; gap: 6px; }
  .maps { grid-template-columns: 1fr; }
}
