:root {
  color-scheme: dark;
  --bg: #101418;
  --panel: #17212b;
  --panel-2: #1e2b36;
  --text: #f4f7fa;
  --muted: #b6c2cc;
  --line: #314453;
  --accent: #26c6da;
  --warn: #ffb74d;
  --danger: #ef5350;
  --ok: #66bb6a;
}

* {
  box-sizing: border-box;
}

html,
body,
.app {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
}

.map {
  min-height: 100%;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 14px;
  background: var(--bg);
  border-left: 1px solid var(--line);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  letter-spacing: 0;
}

h2,
.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 700;
}

button.active,
#tokenButton {
  background: var(--accent);
  color: var(--bg);
}

#connectionState {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.current,
.chart-section,
.station-list {
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.station-name {
  font-size: 18px;
  font-weight: 800;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.metric-row > div {
  border-radius: 6px;
  background: var(--panel-2);
  padding: 10px;
}

.metric-row strong {
  display: inline-block;
  margin-top: 4px;
  font-size: 34px;
  line-height: 1;
}

.unit {
  color: var(--muted);
  font-weight: 700;
}

.meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.history-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

canvas {
  display: block;
  width: 100%;
  height: 160px;
  margin-top: 8px;
}

.station-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-top: 8px;
  border-radius: 6px;
  padding: 10px;
  background: var(--panel-2);
  cursor: pointer;
}

.station-item.selected {
  outline: 2px solid var(--accent);
}

.station-item .name {
  font-weight: 800;
}

.station-item .sub {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  align-self: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
}

.badge.online {
  background: var(--ok);
  color: var(--bg);
}

.badge.stale {
  background: var(--warn);
  color: var(--bg);
}

.badge.offline {
  background: var(--danger);
  color: var(--bg);
}

.wind-marker {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(16, 20, 24, 0.84);
  border: 2px solid var(--accent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.wind-marker.stale {
  border-color: var(--warn);
}

.wind-marker.offline {
  border-color: var(--danger);
  opacity: 0.72;
}

.wind-marker .arrow {
  position: absolute;
  left: 25px;
  top: 7px;
  width: 4px;
  height: 31px;
  border-radius: 3px;
  background: var(--accent);
  transform-origin: 50% 20px;
}

.wind-marker .arrow::before {
  content: "";
  position: absolute;
  left: -7px;
  top: -4px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 13px solid var(--accent);
}

.wind-marker .speed {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 55vh 45vh;
  }

  .panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
