/* ============ demo: server ============
   A radar instrument for Server Survival (js/demos/server.js). The scope is canvas;
   every readout is DOM mono so it stays crisp at any DPR. The frame is 5:4 overall
   like the sibling demos; the stage takes whatever height the header leaves. */

.sv {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  aspect-ratio: 5 / 4;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  overflow: hidden;
  contain: layout paint;
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 450;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
}

/* ---- header row ---- */
.sv__bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  white-space: nowrap;
}

.sv__live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
}

.sv__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-4);
}
.sv.is-live .sv__dot {
  background: var(--signal);
  animation: sv-blink 2.4s var(--ease-in-out) infinite;
}
@keyframes sv-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.sv__hint {
  color: var(--ink-3);
  transition: color var(--d-ui) var(--ease-ui);
}
.sv__hint.is-cooling { color: var(--ink-4); }

/* ---- scope ---- */
.sv__stage {
  position: relative;
  flex: 1;
  min-height: 0;
  cursor: crosshair;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.sv__cv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---- HUD: four corner readouts ---- */
.sv__hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sv__q {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.12em;
}
.sv__q--tl { top: 12px; left: 12px; }
.sv__q--tr { top: 12px; right: 12px; align-items: flex-end; }
.sv__q--bl { bottom: 12px; left: 12px; }
.sv__q--br { bottom: 12px; right: 12px; align-items: flex-end; }

.sv__k { color: var(--ink-4); }

.sv__v {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.sv__v b { font-weight: 450; }
.sv__v.is-high { color: var(--signal); }
.sv__of { margin-left: -8px; color: var(--ink-4); }

.sv__note {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  opacity: 0;
  transform: translateX(4px);
  transition: opacity var(--d-ui) var(--ease-ui), transform var(--d-ui) var(--ease-out);
}
.sv__note.is-on { opacity: 1; transform: none; }

.sv__cells {
  display: flex;
  gap: 2px;
}
.sv__cells i {
  width: 6px;
  height: 9px;
  border: 1px solid var(--hairline-strong);
  transition: background-color var(--d-micro) var(--ease-ui), border-color var(--d-micro) var(--ease-ui);
}
.sv__cells i.is-on {
  background: var(--ink-3);
  border-color: transparent;
}

/* bearings beside the bezel; --sv-ring is the scope radius in px, set by server.js on resize */
.sv__brg {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--ink-4);
}
.sv__brg--w { right: calc(50% + var(--sv-ring, 120px) + 14px); }
.sv__brg--e { left: calc(50% + var(--sv-ring, 120px) + 14px); }

@media (prefers-reduced-motion: reduce) {
  .sv.is-live .sv__dot { animation: none; }
}
