:root {
  color-scheme: dark;
  --bg: #111;
  --fg: #f5f5f5;
  --muted: #999;
  --card: #1e1e1e;
  --accent: #2e8bff;
  --ok: #3ccf6e;
  --error: #ff5c5c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, sans-serif;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

#status { flex: 1; color: var(--muted); font-size: 14px; }
#status[data-state="ok"] { color: var(--ok); }
#status[data-state="error"] { color: var(--error); }

button {
  font: inherit;
  font-size: 16px;
  padding: 10px 20px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
}
button:disabled { opacity: .5; }
#disconnect, button.secondary { background: #444; }

#gauges {
  flex: 1;
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
  grid-template-columns: 1fr 1fr;
  align-content: start;
}

/* 横向き（車載ホルダー）では列を増やす */
@media (orientation: landscape) {
  #gauges { grid-template-columns: repeat(4, 1fr); }
}

.gauge {
  background: var(--card);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.gauge .label { color: var(--muted); font-size: 14px; }
.gauge .value {
  font-size: clamp(32px, 11vmin, 96px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.gauge .unit { color: var(--muted); font-size: 14px; }
