:root {
  --ink: #f3f5f7; --dim: #a9b3bd; --panel: rgba(12, 16, 20, .72); --line: rgba(255, 255, 255, .12);
  --ok: #3ddc97; --warn: #ffb020; --bad: #ff4d4f; --accent: #6cb6ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #05070a; color: var(--ink); overflow: hidden;
  font: 14px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif; user-select: none; }
#main { position: fixed; inset: 0; width: 100vw; height: 100vh; object-fit: cover; background: #0b0f14; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  backdrop-filter: blur(10px); }
.panel.small { padding: 8px 12px; font-size: 13px; }
.eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.title { font-size: 18px; font-weight: 600; }
.big { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.dim { color: var(--dim); font-size: 12px; }
.row { display: flex; gap: 14px; align-items: center; }
kbd { font: 600 11px ui-monospace, Menlo, monospace; background: rgba(255, 255, 255, .14); border-radius: 4px;
  padding: 1px 5px; margin-right: 4px; }

#top { position: fixed; top: 16px; left: 16px; right: 16px; display: flex; justify-content: space-between;
  align-items: flex-start; gap: 16px; pointer-events: none; }
#top > * { pointer-events: auto; }
#mission { width: 330px; }
#mission ol { margin: 8px 0 0; padding: 0; list-style: none; }
#mission li { padding: 3px 0 3px 22px; position: relative; color: var(--dim); }
#mission li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 10px; height: 10px;
  border-radius: 50%; border: 2px solid var(--dim); }
#mission li.now { color: var(--ink); font-weight: 600; }
#mission li.now::before { border-color: var(--accent); background: var(--accent); }
#mission li.done::before { border-color: var(--ok); background: var(--ok); }

#phases { display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 6px; backdrop-filter: blur(10px); }
#phases button { all: unset; cursor: pointer; padding: 9px 18px; border-radius: 10px; font-weight: 600;
  color: var(--dim); }
#phases button.on { background: var(--accent); color: #04121f; }
#phases button.on kbd { background: rgba(0, 0, 0, .2); }

#link { width: 250px; text-align: right; }
#dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--warn); margin-right: 7px; }
#dot.ok { background: var(--ok); } #dot.bad { background: var(--bad); }

#safety { position: fixed; right: 16px; top: 112px; width: 290px; display: flex; flex-direction: column; gap: 10px; }
#safety .panel.warn { border-color: var(--warn); } #safety .panel.bad { border-color: var(--bad); }
.meter { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .12); margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .12s linear; }
#hits-list { margin: 8px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--dim); }
#hits-list li { display: flex; justify-content: space-between; padding: 1px 0; }
#hits-list li.live { color: var(--bad); }

#insets { position: fixed; left: 16px; bottom: 16px; display: flex; gap: 10px; }
#insets figure { margin: 0; position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  cursor: pointer; background: #0b0f14; }
#insets canvas { display: block; width: 320px; height: 180px; }
#insets figcaption { position: absolute; left: 8px; top: 6px; font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; background: rgba(0, 0, 0, .55); padding: 2px 7px; border-radius: 5px; }

#status { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 8px;
  padding: 8px 10px; }
.chip { padding: 5px 11px; border-radius: 8px; background: rgba(255, 255, 255, .08); font-weight: 600;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
#st-estop.latched { background: var(--bad); color: #fff; } #st-estop.live { background: var(--ok); color: #04121f; }
#st-slow.on { background: var(--warn); color: #201400; }

#dock { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); width: 430px; text-align: center; }
#dock.ok { border-color: var(--ok); }
.dock-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.level { position: relative; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .12); margin: 10px 0 6px; }
.level::before { content: ""; position: absolute; left: 50%; top: -3px; width: 2px; height: 14px; background: var(--ink); }
.level i { position: absolute; top: -3px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: var(--warn); left: 50%; }
#dock.ok .level i { background: var(--ok); }

#keys { position: fixed; right: 16px; bottom: 16px; width: 290px; }
#keys div { display: flex; justify-content: space-between; padding: 2px 0; }
#keys span:first-child { color: var(--dim); }

#banner { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); padding: 18px 28px;
  border-radius: 14px; background: rgba(160, 20, 24, .88); font-size: 20px; font-weight: 650; text-align: center;
  border: 1px solid rgba(255, 255, 255, .25); }
#banner.info { background: rgba(12, 16, 20, .88); }
#banner small { display: block; font-size: 14px; font-weight: 500; margin-top: 6px; color: #ffe1e1; }

#reticle { position: fixed; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border: 2px solid var(--accent); border-radius: 50%; pointer-events: none; }
#reticle::after { content: ""; position: absolute; left: 8px; top: 8px; width: 2px; height: 2px; background: var(--accent); }

/* Minimal by default: the picture, the phase, the minimap, stop state and speed. I shows the rest. */
body.minimal #mission, body.minimal #safety, body.minimal #link, body.minimal #keys,
body.minimal #insets figure[data-slot="2"], body.minimal #st-slow, body.minimal #st-arm, body.minimal #st-grip { display: none; }
body.minimal #top { justify-content: center; }
body.minimal #status { background: none; border: 0; backdrop-filter: none; }
#pad { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  opacity: .85; }
body:not(.minimal) #pad { bottom: 250px; }
#pad .caps { display: grid; grid-template-columns: repeat(3, 44px); gap: 5px; }
#pad .caps.wide { grid-template-columns: 70px 76px; }
#pad i { font-style: normal; height: 44px; border-radius: 8px; border: 1.5px solid rgba(255, 255, 255, .55);
  background: rgba(12, 16, 20, .45); display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 650; font-size: 13px; line-height: 1.1; }
#pad i small { font-size: 11px; font-weight: 500; color: var(--dim); }
#pad i.on { background: var(--accent); color: #04121f; border-color: var(--accent); }
#pad i.on small { color: #04121f; }
#pad i.stop { border-color: var(--bad); }
#pad .mouse { width: 30px; height: 44px; fill: none; stroke: rgba(255, 255, 255, .7); stroke-width: 2.5; }
#pad .hint { font-size: 11px; color: var(--dim); text-align: center; }

#gear { all: unset; position: fixed; right: 20px; top: 18px; width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); text-align: center; font-size: 20px; line-height: 40px; }
body:not(.minimal) #gear { top: auto; bottom: 20px; right: 330px; }
#pad { top: 70px; bottom: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
body:not(.minimal) #pad { top: auto; bottom: 250px; }
body.minimal #keys.show { display: block; top: 290px; bottom: auto; }
#mapzoom { position: fixed; left: 22px; bottom: 22px; display: flex; align-items: center; gap: 6px; font-size: 12px;
  background: rgba(0, 0, 0, .55); border-radius: 8px; padding: 3px 6px; }
#mapzoom button { all: unset; cursor: pointer; width: 22px; height: 22px; text-align: center; font-weight: 700; font-size: 15px;
  border-radius: 5px; background: rgba(255, 255, 255, .15); }
#pad[hidden] { display: none; }
body.minimal #keys.show { top: 262px; }
#mapzoom b { width: 8px; }
#mapzoom span { min-width: 62px; text-align: center; }
#drivemap { display: flex; gap: 6px; margin-bottom: 6px; }
#drivemap button { all: unset; cursor: pointer; padding: 5px 9px; border-radius: 7px; font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, .1); }
#drivemap button.on { background: var(--accent); color: #04121f; }
body.minimal #keys.show { top: 312px; }
#dock { top: 70px; bottom: auto; width: 400px; padding: 8px 12px; }
#dock .big { font-size: 18px; }
#dock { display: none !important; }
#st-gap.live { background: var(--ok); color: #04121f; }

/* The minimap: a round window on the floor around the robot. Its controls stay hidden until the mouse is on it. */
#insets figure.round { border-radius: 50%; width: 230px; height: 230px; border: 2px solid rgba(255, 255, 255, .5); }
#insets figure.round canvas { width: 230px; height: 230px; object-fit: cover; }
#insets figure.round figcaption { display: none; }
#mapzoom { opacity: 0; pointer-events: none; transition: opacity .15s; left: 16px; bottom: 252px; }
#insets:hover ~ #mapzoom.has, #mapzoom.has:hover { opacity: 1; pointer-events: auto; }
body.minimal #st-gap, body.minimal #st-speed { display: none !important; }
#insets figure.round, #insets figure.round canvas { width: 345px; height: 345px; }
#mapzoom { bottom: 368px; }
#insets figure.round, #insets figure.round canvas { width: 300px; height: 300px; }
#mapzoom { bottom: 323px; }
#insets figure.round, #insets figure.round canvas { width: 276px; height: 276px; }
#mapzoom { bottom: 299px; }
#insets figure:not(.round) canvas { width: 420px; height: 236px; }
