:root {
  --blue: #009ee3; --ink: #f2f7fa; --dim: #9db0bc; --glass: rgba(14, 22, 30, .55);
  --line: rgba(255, 255, 255, .14); --ok: #4fd08a; --watch: #f0b23c; --alarm: #ff5a4f;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --blur: blur(18px) saturate(1.5); --shadow: 0 8px 28px rgba(0, 0, 0, .28);
  --hud: 0px; /* width the Argus panel takes on the right */
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100dvh; overflow: hidden; background: #0a1016; color: var(--ink);
  font: 13px/1.35 Inter, -apple-system, "Segoe UI", system-ui, sans-serif; overscroll-behavior: none; }
#view { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; touch-action: none; }
#ui { position: fixed; inset: 0; display: grid; pointer-events: none; padding: 14px; gap: 12px;
  grid-template: "top top" auto "tel ." 1fr "bot ." auto / minmax(0, auto) 1fr; }
#ui > * { pointer-events: auto; }
.card { background: var(--glass); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
button { font: inherit; color: var(--ink); cursor: pointer; border: 0; background: none; }

/* top: identity, state, current task */
#top { grid-area: top; display: flex; align-items: center; gap: 8px; min-width: 0; padding-right: var(--hud); pointer-events: none; }
#top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 9px; padding: 8px 14px; border-radius: 999px; background: var(--glass);
  border: 1px solid var(--line); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); white-space: nowrap; box-shadow: var(--shadow); }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: #ffc400; box-shadow: 0 0 0 3px rgba(255, 196, 0, .25); }
.brand b { font-weight: 650; letter-spacing: .01em; } .brand span { color: var(--dim); }
.chip { font: 600 11px/1 var(--mono); letter-spacing: .06em; padding: 8px 11px; border-radius: 999px; white-space: nowrap;
  background: rgba(0, 158, 227, .22); border: 1px solid rgba(0, 158, 227, .6); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.chip.auto { background: rgba(79, 208, 138, .2); border-color: rgba(79, 208, 138, .65); }
.chip.ai { background: var(--glass); border-color: var(--line); color: var(--dim); cursor: help; }
.chip.ai.live { color: var(--watch); border-color: rgba(240, 178, 60, .6); }
#task { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; padding: 7px 13px;
  border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
#task:empty { display: none; }

/* bottom dock */
#dock { position: fixed; left: calc((100vw - var(--hud)) / 2); bottom: 16px; transform: translateX(-50%); display: flex; align-items: stretch; gap: 2px;
  padding: 6px; border-radius: 22px; background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); transition: left .25s; }
#dock button { display: grid; justify-items: center; gap: 4px; min-width: 66px; padding: 8px 10px 7px; border-radius: 16px;
  font-size: 11px; font-weight: 500; color: var(--dim); transition: background .15s, color .15s, transform .1s; white-space: nowrap; }
#dock svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#dock button:hover { background: rgba(255, 255, 255, .1); color: var(--ink); }
#dock button:active { transform: scale(.96); }
#dock button.on { background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(0, 158, 227, .45); }
#dock #btn-auto svg { fill: currentColor; stroke: none; }
#dock .sep { width: 1px; margin: 8px 5px; background: var(--line); }

/* telemetry */
#telemetry { grid-area: tel; align-self: start; width: 226px; padding: 13px 14px; }
#telemetry label { color: var(--dim); } #telemetry output { font-family: var(--mono); font-size: 12px; text-align: right; }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: center; margin-bottom: 9px; }
.bar { height: 6px; background: rgba(255, 255, 255, .14); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 80%; background: var(--ok); border-radius: 3px; }
.grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; }

/* robot camera picture and map */
#bottom { grid-area: bot; display: flex; gap: 12px; align-items: flex-end; }
/* the camera picture is drawn on the 3D canvas underneath, so nothing may blur or tint it */
#pip { background: none; backdrop-filter: none; -webkit-backdrop-filter: none; width: 336px; overflow: hidden; border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow); transition: width .35s; }
#pip.focus { width: 470px; border-color: rgba(53, 200, 255, .8); }
.pip-head { display: flex; gap: 8px; align-items: center; font: 11px var(--mono); color: var(--dim); background: rgba(10, 16, 22, .86); padding: 7px 10px; }
.pip-head span:first-child { flex: 1; color: var(--ink); }
.pip-head button { padding: 3px 9px; font: 600 10px var(--mono); border-radius: 999px; background: rgba(255, 255, 255, .1); }
.pip-head button.on { background: var(--blue); }
#pip-view { aspect-ratio: 16 / 9; position: relative; overflow: hidden; }
#reticle { position: absolute; inset: 0; display: none; }
#reticle.on { display: block; }
#reticle i { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px; border: 1.5px solid #35c8ff;
  border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .45); animation: lock 1.2s ease-in-out infinite; }
#reticle i::before, #reticle i::after { content: ""; position: absolute; background: #35c8ff; }
#reticle i::before { left: 50%; top: -10px; bottom: -10px; width: 1px; }
#reticle i::after { top: 50%; left: -10px; right: -10px; height: 1px; }
@keyframes lock { 50% { transform: scale(.86); } }
#reticle-text { position: absolute; left: 8px; bottom: 6px; font: 11px var(--mono); text-shadow: 0 1px 2px #000; }
#pip-read { font: 11px var(--mono); min-height: 28px; padding: 7px 10px; background: rgba(10, 16, 22, .86); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pip-read.watch { color: var(--watch); } #pip-read.alarm { color: var(--alarm); } #pip-read.ok { color: var(--ok); }
#map { width: 220px; height: 160px; cursor: crosshair; }

/* tag that sticks to the asset being inspected */
#tag { position: fixed; left: 0; top: 0; width: 260px; padding: 10px 12px 12px; border-radius: 14px; pointer-events: none; overflow: hidden;
  background: rgba(10, 18, 26, .72); border: 1px solid rgba(53, 200, 255, .7); box-shadow: var(--shadow);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); display: grid; gap: 2px; }
#tag[hidden] { display: none; }
#tag b { font: 600 10.5px var(--mono); letter-spacing: .05em; text-transform: uppercase; color: #35c8ff; }
#tag span { font-size: 12.5px; } #tag span + span { color: var(--dim); font-size: 12px; }
#tag em { font: normal 12px var(--mono); margin-top: 4px; }
#tag i { position: absolute; left: 0; bottom: 0; height: 3px; background: #35c8ff; transition: width .2s linear; }
#tag[data-sev="info"] { border-color: var(--ok); } #tag[data-sev="info"] b { color: var(--ok); } #tag[data-sev="info"] i { background: var(--ok); }
#tag[data-sev="watch"] { border-color: var(--watch); } #tag[data-sev="watch"] b { color: var(--watch); } #tag[data-sev="watch"] i { background: var(--watch); }
#tag[data-sev="alarm"] { border-color: var(--alarm); } #tag[data-sev="alarm"] b { color: var(--alarm); } #tag[data-sev="alarm"] i { background: var(--alarm); }

#toast { position: fixed; left: calc((100vw - var(--hud)) / 2); top: 64px; transform: translateX(-50%); font-size: 12.5px;
  padding: 9px 15px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  opacity: 0; transition: opacity .25s; pointer-events: none; max-width: min(90vw, 620px); text-align: center; }
#toast.on { opacity: 1; } #toast.alarm { border-color: var(--alarm); } #toast.watch { border-color: var(--watch); }

#help { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 18px 22px;
  width: min(92vw, 430px); max-height: 80dvh; overflow: auto; }
#help h3 { margin: 0 0 10px; font-size: 14px; }
#help dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 16px; margin: 0; }
#help dt { font: 12px var(--mono); color: #35c8ff; } #help dd { margin: 0; }

#loading { position: fixed; inset: 0; background: #0a1016; display: grid; place-content: center; gap: 8px;
  text-align: center; transition: opacity .6s; }
#loading b { letter-spacing: .4em; font-size: 22px; } #loading span { color: var(--dim); font-family: var(--mono); }
#loading.done { opacity: 0; pointer-events: none; }

#stick { display: none; position: fixed; left: 18px; bottom: 96px; width: 112px; height: 112px; border-radius: 50%;
  background: var(--glass); border: 1px solid var(--line); touch-action: none; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
#stick i { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px; border-radius: 50%;
  background: rgba(0, 158, 227, .6); border: 1px solid var(--blue); }

@media (min-width: 761px) { body.hud-open { --hud: 356px; } }
@media (max-width: 1500px) and (min-width: 761px) { #bottom { padding-bottom: 86px; } }
@media (max-width: 760px), (pointer: coarse) {
  .brand span, #map, #task, #tag { display: none !important; }
  #ui { padding: 8px; gap: 8px; }
  #telemetry { width: 164px; padding: 9px 10px; font-size: 11px; }
  #bottom { grid-column: 1 / -1; justify-content: flex-end; padding-bottom: 74px; }
  #pip, #pip.focus { width: 190px; }
  #stick { display: block; }
  #dock { left: 50%; bottom: 8px; width: calc(100vw - 16px); justify-content: space-between; padding: 4px; border-radius: 18px; }
  #dock button { min-width: 0; flex: 1; padding: 7px 2px 6px; font-size: 9.5px; } #dock .sep { display: none; }
  body.hud-open #bottom, body.hud-open #stick, body.hud-open #dock { display: none; }
}

#pip.focus + #map { display: none; }

#btn-sound .cross { display: none; } #btn-sound.muted .cross { display: inline; } #btn-sound.muted .waves { display: none; }
#dock #btn-sound.muted { background: rgba(255, 90, 79, .22); color: var(--alarm); box-shadow: none; }
