:root {
  color: #111;
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  background: #fff;
  color: #111;
}

button,
select,
input { font: inherit; }

main {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 22px 24px 28px;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid #111;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -.035em;
}

header p,
footer,
.selection-note {
  color: #666;
}

header p {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  white-space: nowrap;
}

.summary {
  margin: 0;
  padding: 11px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.race-summary {
  margin: 0;
  padding: 0 0 10px;
  border-bottom: 1px solid #bbb;
  color: #555;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 48px;
  padding: 8px 0;
}

fieldset {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  float: left;
  margin-right: 12px;
  padding: 0;
  font-size: 13px;
}

fieldset label,
.picker {
  font-size: 13px;
  white-space: nowrap;
}

input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0 4px 0 0;
  accent-color: #111;
  vertical-align: -2px;
}

button,
select {
  border: 1px solid #111;
  border-radius: 0;
  background: #fff;
  color: #111;
}

button {
  padding: 6px 10px;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  background: #111;
  color: #fff;
}

.picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

select {
  width: min(320px, 36vw);
  padding: 5px 28px 5px 7px;
}

.map-wrap {
  position: relative;
  border: 1px solid #111;
}

#network-map {
  width: 100%;
  height: clamp(480px, 67vh, 760px);
  background: #eee;
}

#map-loading {
  position: absolute;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.leaflet-container {
  font-family: Arial, Helvetica, sans-serif;
  cursor: grab;
}

.leaflet-control-zoom a,
.leaflet-bar,
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border-radius: 0 !important;
  box-shadow: none !important;
}

.leaflet-bar { border: 1px solid #111 !important; }
.leaflet-bar a { border-bottom-color: #aaa !important; }
.leaflet-control-attribution { font-size: 10px; }

.node-marker {
  display: flex !important;
  align-items: center;
  width: auto !important;
  min-width: 42px;
  height: 26px !important;
  margin: -13px 0 0 -21px !important;
  border: 2px solid #111;
  background: #fff;
  color: #111;
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
}

.node-marker .marker-kind {
  display: grid;
  place-items: center;
  align-self: stretch;
  min-width: 20px;
  border-right: 1px solid #111;
}

.node-marker .marker-wins {
  padding: 0 5px;
  font-weight: 700;
}

.node-marker.execution { border-radius: 13px; }
.node-marker.rpc { border-style: dashed; }
.node-marker.ingress {
  background: #111;
  color: #fff;
}
.node-marker.ingress .marker-kind { border-right-color: #fff; }
.node-marker.relay {
  background: #e8f3ff;
  border-style: double;
  border-width: 3px;
}

.node-cluster {
  display: grid !important;
  place-items: center;
  width: auto !important;
  min-width: 58px;
  height: 34px !important;
  margin: -17px 0 0 -29px !important;
  padding: 0 6px;
  border: 2px solid #111;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
}

.leaflet-popup-content {
  margin: 12px 14px;
  line-height: 1.4;
}

.leaflet-popup-content strong {
  display: block;
  margin-bottom: 3px;
}

.leaflet-popup-content span {
  color: #555;
  font-size: 12px;
}

.selection {
  padding: 12px 0 4px;
  border-bottom: 1px solid #111;
}

.selection > p:first-child {
  margin: 0 0 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.selection dl {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
}

.selection dt {
  margin-bottom: 3px;
  color: #666;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.selection dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

#selection-note {
  margin: 10px 0 0;
  color: #666;
  font-size: 12px;
}

footer {
  margin-top: 10px;
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 800px) {
  main { padding: 16px 12px 22px; }
  header { display: block; }
  header p { margin-top: 7px; white-space: normal; }
  .controls { align-items: flex-start; flex-wrap: wrap; gap: 10px 16px; }
  fieldset { flex-wrap: wrap; gap: 8px 12px; width: 100%; }
  legend { width: 100%; margin: 0; }
  .picker { width: 100%; margin-left: 0; }
  .picker select { flex: 1; width: auto; min-width: 0; }
  #network-map { height: 58vh; min-height: 420px; }
  .selection dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .selection dl { grid-template-columns: 1fr; gap: 10px; }
}
