/* A dense tool panel in the manner of Blender and Rerun: neutral greys, square
   corners, hairlines, figures in monospace. One signal colour, international
   orange, marks what is selected, current or live; the data keep their own. */

:root {
  --ground: #161616;
  --panel: #202020;
  --header: #262626;
  --row-hover: #2a2a2a;
  --line: #333333;
  --line-strong: #474747;
  --text: #d8d8d8;
  --muted: #8c8c8c;
  --faint: #5f5f5f;
  --signal: #ff4f00;
  --warn: #ff6b5a;
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "Roboto Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  font: 13px/1.4 var(--sans);
  color: var(--text);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; background: var(--ground); }

body {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}
/* the panel folded away: the view takes the page */
.folded body { grid-template-columns: 0 minmax(0, 1fr); }
.folded #sidebar { visibility: hidden; }
/* in an iframe the page's own header goes; the frame around it is the host's */
.embed .brand { display: none; }

ul, dl { list-style: none; margin: 0; padding: 0; }
button { font: inherit; color: inherit; }

.count, .metric, .info dd, .step-count, .step-label, kbd { font-family: var(--mono); }

/* ---- the panel ------------------------------------------------------- */

#sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.brand {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 12px 11px;
  border-bottom: 1px solid var(--line);
}
.wordmark { font: 500 13px var(--mono); letter-spacing: 0.14em; }
.wordmark::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  background: var(--signal);
}
.tagline { font: 11px var(--mono); color: var(--muted); }

.panel { border-bottom: 1px solid var(--line); }
.panel > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 28px;
  padding: 0 12px;
  background: var(--header);
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-weight: 500;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after {
  content: "";
  margin-left: auto;
  width: 5px;
  height: 5px;
  border-right: 1px solid var(--muted);
  border-bottom: 1px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
}
.panel:not([open]) > summary::after { transform: rotate(-45deg); }
.num { font: 11px var(--mono); color: var(--faint); }

.rows { padding: 4px 0 6px; }
.rows > li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  padding: 0 12px;
}
.rows > li:hover { background: var(--row-hover); }
.count { margin-left: auto; color: var(--muted); font-size: 12px; }

/* runs: a selected run is marked by a bar of signal down its edge */
.runs > li { cursor: pointer; padding: 4px 12px 4px 10px; border-left: 2px solid transparent; }
.runs > li[aria-selected="true"] { border-left-color: var(--signal); background: var(--row-hover); }
.runs .what { display: flex; flex-direction: column; min-width: 0; }
.runs .name { font-family: var(--mono); font-size: 12.5px; }
.runs .project { color: var(--faint); font-size: 11px; font-family: var(--mono); }
.runs .name .live { margin-left: 8px; font-size: 9.5px; }
.runs .has { display: flex; gap: 2px; margin-left: auto; }
.runs .has span {
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  font: 9px var(--mono);
  color: var(--faint);
  border: 1px solid var(--line-strong);
}
.runs .has span.on { color: var(--panel); background: var(--muted); border-color: var(--muted); }
.metric { width: 44px; text-align: right; font-size: 12px; color: var(--text); }
.metric.none { color: var(--faint); }

/* layers and cameras: square checks and swatches */
.layers label { display: flex; align-items: center; gap: 8px; flex: 1; cursor: pointer; }
/* a model's layers under its name; the rows below it indented */
.layers > li.group {
  min-height: 20px;
  padding-top: 4px;
  font: 500 10.5px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.layers > li.group:hover { background: none; }
.layers > li:not(.group) { padding-left: 20px; }
input[type="checkbox"] {
  appearance: none;
  margin: 0;
  width: 12px;
  height: 12px;
  border: 1px solid var(--line-strong);
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
}
input[type="checkbox"]:checked { border-color: var(--muted); }
input[type="checkbox"]:checked::before { content: ""; width: 6px; height: 6px; background: var(--text); }
.swatch { width: 10px; height: 10px; flex: none; }
.swatch.rgb { background: conic-gradient(#d9534f, #e8c547, #5cb85c, #5bc0de, #6f6fdb, #c86dd7, #d9534f); }

.cameras .cam { font-family: var(--mono); font-size: 12.5px; }
.cameras .note { color: var(--faint); font-size: 11px; }
.cameras .keys { display: flex; gap: 3px; margin-left: auto; }
.cameras .keys button {
  width: 22px;
  height: 18px;
  padding: 0;
  font: 10px var(--mono);
  color: var(--c);
  background: transparent;
  border: 1px solid var(--line-strong);
  cursor: pointer;
}
.cameras .keys button:hover { border-color: var(--c); }
.cameras .keys .gap { width: 22px; height: 18px; border: 1px dashed var(--line); }
/* what a key is, named at once on hover, to its left */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  right: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  pointer-events: none;
  white-space: nowrap;
  font: 500 11px var(--mono);
  color: var(--text);
  background: rgba(24, 24, 24, 0.96);
  border: 1px solid var(--line-strong);
  padding: 2px 6px;
}
.cameras .keys button.on { background: var(--c); border-color: var(--c); color: var(--ground); }

.panel-toggle { position: absolute; top: 12px; right: 12px; z-index: 2; }
.folded .panel-toggle { color: var(--muted); }

.info {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 3px 10px;
  padding: 8px 12px 10px;
  font-size: 12px;
}
.info dt { color: var(--muted); }
.info dd { margin: 0; font-size: 12px; overflow-wrap: anywhere; }

/* ---- the viewport ---------------------------------------------------- */

#stage { grid-column: 2; position: relative; min-width: 0; overflow: hidden; }
/* The canvas fills the stage without sizing it, or its own size would feed back. */
#view { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

.overlay {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(24, 24, 24, 0.94);
  border: 1px solid var(--line-strong);
  padding: 6px 10px;
}

.key, kbd {
  font: 11px var(--mono);
  color: var(--text);
  background: var(--header);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  padding: 1px 6px;
}
.key { cursor: pointer; }
.key:hover { border-color: var(--muted); }

input[type="range"] {
  appearance: none;
  width: 110px;
  height: 14px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--line-strong); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--line-strong); }
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 8px;
  height: 14px;
  margin-top: -6px;
  background: var(--text);
  border: none;
}
input[type="range"]::-moz-range-thumb { width: 8px; height: 14px; background: var(--text); border: none; border-radius: 0; }

.photo-bar { top: 12px; left: 12px; flex-direction: column; align-items: stretch; gap: 6px; }
.photo-bar .line { display: flex; align-items: center; gap: 12px; }
.photo-bar .line-name { font: 11px var(--mono); color: var(--muted); padding-left: 16px; }
/* the camera under the pointer, named beside it */
.hover-label {
  position: absolute;
  pointer-events: none;
  font: 500 11px var(--mono);
  white-space: nowrap;
  background: rgba(24, 24, 24, 0.94);
  border: 1px solid var(--line-strong);
  padding: 2px 6px;
}
.hover-label .source { color: var(--muted); margin-left: 8px; }
.photo-name { font: 500 12px var(--mono); }
.photo-name::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  background: var(--signal);
}
.field { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }

/* the timeline, a step sequencer: one cell a step, the current one lit */
.timeline {
  left: 50%;
  bottom: 38px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
}
.steps { display: flex; gap: 3px; }
.steps button {
  width: 18px;
  height: 18px;
  padding: 0;
  background: var(--header);
  border: 1px solid var(--line-strong);
  cursor: pointer;
}
.steps button.done { background: #3a3a3a; }
.steps button:hover { border-color: var(--muted); }
.steps button.on { background: var(--signal); border-color: var(--signal); }
.step-count { font-size: 12px; color: var(--text); min-width: 42px; }
.step-label { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.live { font: 500 11px var(--mono); color: var(--signal); letter-spacing: 0.08em; text-transform: uppercase; }
.live::before { content: "● "; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

.statusbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 12px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}
.status { font-family: var(--mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status.error { color: var(--warn); }
.hints { margin-left: auto; white-space: nowrap; }
.hints kbd { margin: 0 3px 0 8px; padding: 0 5px; border-bottom-width: 1px; font-size: 10.5px; color: var(--muted); }

/* ---- narrow: a phone, or a small iframe ------------------------------- */

@media (max-width: 719px) {
  /* the panel opens over the view, rather than squeezing it */
  body { grid-template-columns: 0 minmax(0, 1fr); }
  #sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 3;
    width: min(288px, 82vw);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.5);
  }
  .hints, .step-label { display: none; }
  .photo-bar { right: 64px; }
  .photo-bar .line { flex-wrap: wrap; gap: 6px 12px; }
  input[type="range"] { width: 80px; }
  .timeline { bottom: 32px; gap: 8px; }
  .steps { gap: 2px; }
  .steps button { width: 14px; height: 16px; }
}
