* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fd3f2; }
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: #fff; }

#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.overlay, #metrics, #panel, #profile {
  position: fixed;
  background: rgba(15, 20, 30, 0.72);
  border-radius: 10px;
  backdrop-filter: blur(4px);
}

#metrics {
  top: 12px; left: 12px; right: 312px;
  display: flex; flex-wrap: wrap; gap: 4px 18px;
  padding: 8px 14px; align-items: baseline;
}
.metric { display: flex; align-items: baseline; gap: 4px; }
.metric span { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric.big span { font-size: 36px; }
.metric label { font-size: 12px; opacity: 0.75; text-transform: uppercase; }

#panel {
  top: 12px; right: 12px; width: 288px; max-height: calc(100% - 150px);
  overflow-y: auto; padding: 12px 14px; font-size: 14px;
}
#panel h1 { margin: 0 0 8px; font-size: 20px; letter-spacing: 0.5px; }
#panel hr { border: 0; border-top: 1px solid rgba(255,255,255,0.15); margin: 10px 0; }
.device { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.device button {
  flex: 0 0 150px; padding: 7px 8px; border: 0; border-radius: 6px;
  background: #e8552d; color: #fff; font-weight: 600; cursor: pointer;
}
.device button:disabled { background: #555; cursor: default; }
.device button.on { background: #2e9e5b; }
.status { font-size: 12px; opacity: 0.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.row input[type=range] { flex: 1; }
.row input[type=number] { width: 64px; }
.warn { background: #8a3b12; padding: 6px 8px; border-radius: 6px; font-size: 12px; }
.hint { font-size: 12px; opacity: 0.7; margin: 2px 0; }
#log { font-size: 11px; opacity: 0.7; white-space: pre-wrap; margin: 8px 0 0; max-height: 120px; overflow-y: auto; }

#profile { left: 12px; right: 12px; bottom: 12px; height: 110px; padding: 6px; }
#profile-canvas { width: 100%; height: 100%; display: block; }

@media (max-width: 760px) {
  #metrics { right: 12px; }
  #metrics .metric span { font-size: 20px; }
  #metrics .metric.big span { font-size: 26px; }
  #panel { top: auto; bottom: 134px; width: auto; left: 12px; max-height: 40%; }
}
.status.error { color: #ffb4a1; opacity: 1; white-space: normal; }
