/* Robot cell programmer — page styles. Tokens on #stage and .rt-scope (light), redefined for dark;
   .rt-scope lets another page (the landing story) wear the same cards. */
#stage, .rt-scope {
  --rt-bg: #f3f4f7; --rt-grid: #e2e5ec; --rt-panel: #ffffff; --rt-line: #e1e4eb; --rt-field: #d5dae4;
  --rt-ink: #1b2130; --rt-mut: #626b7f; --rt-faint: #98a0b1;
  --rt-accent: #3654d1; --rt-accent-wash: #edf0fd; --rt-on-accent: #ffffff;
  --rt-arm: #3654d1; --rt-arm-wash: #edf0fd; --rt-arm-line: #c7d0f7;
  --rt-belt: #b45309; --rt-belt-wash: #fdf3e7; --rt-belt-line: #f1cfa4;
  --rt-camera: #0f766e; --rt-camera-wash: #e8f6f4; --rt-camera-line: #a9ddd6;
  --rt-flow: #6d3fd0; --rt-flow-wash: #f3eefd; --rt-flow-line: #d6c7f6;
  --rt-ok: #15803d; --rt-ok-wash: #e9f7ee; --rt-bad: #c62828; --rt-bad-wash: #fdecec; --rt-warn: #b45309; --rt-warn-wash: #fdf3e2;
  --rt-run: #3654d1; --rt-lane-a: #f7f8fb; --rt-lane-b: #eff1f6;
  --rt-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .07);
  --rt-cell-floor: #eef0f5; --rt-cell-pad: #ffffff; --rt-cell-stroke: #c5cbd8;
}
#stage {
  --rt-dock-h: 236px;
  display: grid; grid-template-rows: auto minmax(0, 1fr) var(--rt-dock-h); height: calc(100vh - 96px); min-height: 700px; container-type: inline-size;
  color: var(--rt-ink); font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--rt-bg);
}
@media (prefers-color-scheme: dark) {
  #stage, .rt-scope:not(.rt-light) {
    --rt-bg: #13161d; --rt-grid: #232834; --rt-panel: #1a1e27; --rt-line: #2b313e; --rt-field: #394050;
    --rt-ink: #e7eaf1; --rt-mut: #a0a8ba; --rt-faint: #6d7588;
    --rt-accent: #8ea0f5; --rt-accent-wash: #232a45; --rt-on-accent: #0f1428;
    --rt-arm: #8ea0f5; --rt-arm-wash: #20263f; --rt-arm-line: #3a4570;
    --rt-belt: #f0a752; --rt-belt-wash: #33261a; --rt-belt-line: #6a4a24;
    --rt-camera: #4fd1c0; --rt-camera-wash: #15302d; --rt-camera-line: #22574f;
    --rt-flow: #b79af5; --rt-flow-wash: #2a2240; --rt-flow-line: #4b3c78;
    --rt-ok: #4ade80; --rt-ok-wash: #15291d; --rt-bad: #f87171; --rt-bad-wash: #331a1a; --rt-warn: #fbbf24; --rt-warn-wash: #33291a;
    --rt-run: #8ea0f5; --rt-lane-a: #161a22; --rt-lane-b: #1b2029;
    --rt-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .35);
    --rt-cell-floor: #1d222c; --rt-cell-pad: #252b37; --rt-cell-stroke: #3b4353;
  }
}

/* ---- top bar --------------------------------------------------------------------- */
.rt-bar-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--rt-line); background: var(--rt-panel); }
.rt-seg { display: inline-flex; border: 1px solid var(--rt-field); border-radius: 9px; overflow: hidden; }
.rt-seg button { border: 0; background: transparent; color: var(--rt-mut); padding: 6px 14px; font: 600 12.5px system-ui, sans-serif; cursor: pointer; }
.rt-seg button[aria-selected="true"] { background: var(--rt-accent); color: var(--rt-on-accent); }
.rt-job { font-weight: 650; font-size: 14px; }
.rt-job small { display: block; font-weight: 450; color: var(--rt-mut); font-size: 11.5px; }
.rt-sp { flex: 1; }
.rt-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rt-field); background: var(--rt-panel); color: var(--rt-ink); border-radius: 8px; padding: 6px 11px; font: 600 12.5px system-ui, sans-serif; cursor: pointer; }
.rt-btn:hover { border-color: var(--rt-accent); }
.rt-btn:disabled { opacity: .45; cursor: default; }
.rt-btn.rt-primary { background: var(--rt-accent); border-color: var(--rt-accent); color: var(--rt-on-accent); }
.rt-btn.rt-stop { background: var(--rt-bad); border-color: var(--rt-bad); color: #fff; }
.rt-btn .rt-i { flex: none; }
.rt-select { border: 1px solid var(--rt-field); background: var(--rt-panel); color: var(--rt-ink); border-radius: 8px; padding: 5px 8px; font: 12.5px system-ui, sans-serif; }

/* ---- main: the 3D cell (centre) and the cell panel (right) ------------------------------ */
#stage.rt-mode-advanced { --rt-dock-h: 400px; }
.rt-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 0; }
.rt-3dwrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--rt-bg); }
.rt-3d { position: absolute; inset: 0; }
.rt-3d-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.rt-3d-canvas:active { cursor: grabbing; }
.rt-3d-off { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--rt-mut); }
.rt-hud { position: absolute; left: 14px; top: 12px; max-width: min(460px, 60%); display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.rt-hud .rt-hudrow { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 5px 10px; border-radius: 9px; background: color-mix(in srgb, var(--rt-panel) 90%, transparent); box-shadow: var(--rt-shadow); font-size: 12.5px; }
.rt-hud .rt-hudrow b { font-weight: 650; }
.rt-hud .rt-hudhint { color: var(--rt-mut); font-size: 11.5px; padding-left: 2px; }
.rt-joints { position: absolute; right: 12px; top: 12px; display: flex; gap: 8px; pointer-events: none; }
.rt-jbox { padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--rt-panel) 92%, transparent); box-shadow: var(--rt-shadow); font-size: 11.5px; min-width: 112px; }
.rt-jbox h4 { margin: 0 0 4px; font: 650 10.5px system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--rt-mut); }
.rt-jbox table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.rt-jbox td { padding: 1px 0; }
.rt-jbox td:first-child { color: var(--rt-accent); font-weight: 650; padding-right: 10px; }
.rt-jbox td:last-child { text-align: right; }
.rt-viewreset { position: absolute; left: 14px; top: 76px; padding: 4px 9px; font-size: 11.5px; }
.rt-viewreset[hidden] { display: none; }
/* the library: a drawer over the bottom of the 3D view, right above the timeline (Festo-style) */
.rt-library { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 6; padding: 8px 12px 10px; border-radius: 14px; background: color-mix(in srgb, var(--rt-panel) 96%, transparent); box-shadow: 0 6px 24px rgba(16, 24, 40, .16); border: 1px solid var(--rt-line); }
.rt-library[hidden] { display: none; }
.rt-library header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.rt-library header b { font-size: 13px; }
.rt-libhint { color: var(--rt-mut); font-size: 11.5px; }
.rt-tbx { border: 0; background: none; color: var(--rt-mut); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.rt-tbx:hover { color: var(--rt-ink); background: var(--rt-bg); }
.rt-libgroups { display: flex; gap: 18px; overflow-x: auto; padding-bottom: 2px; }
.rt-pgroup { flex: none; }
.rt-pgroup h3 { margin: 0 0 5px; font: 650 10.5px system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--rt-mut); }
.rt-pgroup .rt-plist { display: flex; gap: 6px; }
.rt-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 78px; height: 66px; padding: 4px; box-sizing: border-box; text-align: center;
  border: 1px solid var(--rt-line); border-radius: 10px; background: var(--rt-panel); cursor: grab; user-select: none; touch-action: none; }
.rt-chip:hover, .rt-chip:focus-visible { border-color: var(--k); box-shadow: var(--rt-shadow); outline: none; }
.rt-chip .rt-clabel { font-weight: 600; font-size: 11.5px; line-height: 1.15; }
.rt-chip .rt-cdur { color: var(--rt-faint); font-size: 10px; font-variant-numeric: tabular-nums; }
.rt-dragghost .rt-chip { width: 78px; }
.rt-phint { display: none; }

/* ---- the dock: library button | the timeline | run controls ----------------------------- */
.rt-dock { position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr) 132px; min-height: 0; border-top: 1px solid var(--rt-line); background: var(--rt-panel); }
.rt-dockgrip { position: absolute; left: 0; right: 0; top: -5px; height: 10px; z-index: 7; cursor: ns-resize; }
.rt-dockgrip::after { content: ''; position: absolute; left: 50%; top: 3px; width: 44px; height: 4px; margin-left: -22px; border-radius: 2px; background: var(--rt-field); }
.rt-dockgrip:hover::after { background: var(--rt-accent); }
.rt-dockl { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 14px; border-right: 1px solid var(--rt-line); }
.rt-libcap { font-size: 10.5px; font-weight: 600; color: var(--rt-mut); }
.rt-libbtn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--rt-accent); color: var(--rt-on-accent); font: 400 26px/1 system-ui, sans-serif; cursor: pointer; box-shadow: var(--rt-shadow); }
.rt-libbtn[aria-expanded="true"] { background: var(--rt-panel); color: var(--rt-accent); border: 1.5px solid var(--rt-accent); }
.rt-dockr { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border-left: 1px solid var(--rt-line); padding: 10px; }
.rt-play { width: 92px; height: 52px; border-radius: 26px; border: 0; font: 700 14px system-ui, sans-serif; cursor: pointer; box-shadow: var(--rt-shadow); }
.rt-play.rt-primary { background: var(--rt-accent); color: var(--rt-on-accent); }
.rt-play.rt-stop { background: var(--rt-bad); color: #fff; }
.rt-play:disabled { opacity: .45; cursor: default; }
.rt-runrow { display: flex; gap: 6px; }
.rt-runrow .rt-btn { padding: 5px 9px; }

.rt-wrap { position: relative; min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; }
/* a fade at the edge where the program goes on, and a slim scrollbar under it */
.rt-wrap::before, .rt-wrap::after { content: ''; position: absolute; top: 0; bottom: 34px; width: 40px; z-index: 3; pointer-events: none; opacity: 0; transition: opacity .15s; }
.rt-wrap::before { left: 0; background: linear-gradient(to left, transparent, var(--rt-panel)); }
.rt-wrap::after { right: 0; background: linear-gradient(to right, transparent, var(--rt-panel)); }
.rt-wrap.rt-more-left::before, .rt-wrap.rt-more-right::after { opacity: 1; }
.rt-hscroll { position: relative; height: 6px; margin: 0 16px 2px; border-radius: 3px; background: var(--rt-line); cursor: pointer; touch-action: none; }
.rt-hscroll[hidden] { display: none; }
.rt-hthumb { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--rt-field); cursor: grab; }
.rt-hscroll:hover .rt-hthumb, .rt-hthumb:active { background: var(--rt-faint); }
/* The timeline sits ON the dock: the dock's own surface, no grid, no frame around a canvas. */
#canvas { position: relative; overflow: hidden; height: 100%; background: var(--rt-panel); }
#canvas foreignObject { overflow: visible; }
#canvas rect.diagram-node, #canvas rect.diagram-node.selected { fill: transparent !important; stroke: transparent !important; }
.rt-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 2px 16px 8px; background: var(--rt-panel); font-size: 12px; color: var(--rt-mut); }
.rt-status .rt-stat b { color: var(--rt-ink); }
.rt-status .rt-stat b { font-variant-numeric: tabular-nums; }
.rt-probs { color: var(--rt-bad); font-weight: 600; cursor: pointer; border: 0; background: none; padding: 0; font: inherit; }
.rt-probs.rt-clean { color: var(--rt-ok); cursor: default; }

/* ---- layers over and under the diagram (carry the camera transform) ----------------- */
.rt-under, .rt-over { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; pointer-events: none; }
.rt-over { z-index: 4; }
.rt-lane { position: absolute; border-bottom: 1px solid var(--rt-line); }
.rt-lane:nth-child(odd) { background: var(--rt-lane-a); }
.rt-lane:nth-child(even) { background: var(--rt-lane-b); }
.rt-lane.rt-target { outline: 2px solid var(--rt-accent); outline-offset: -2px; }
.rt-lane.rt-refuse { outline: 2px solid var(--rt-bad); outline-offset: -2px; }
.rt-lanechip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 6px; border-radius: 7px; transform-origin: 0 0; white-space: nowrap;
  background: var(--kw); color: var(--k); border: 1px solid var(--kl); font: 600 11px system-ui, sans-serif; box-shadow: var(--rt-shadow); }
.rt-lanechip[hidden] { display: none; }
.rt-lanechip b { color: var(--rt-ink); font-weight: 650; }
.rt-lhead { position: absolute; display: flex; align-items: center; gap: 9px; padding: 0 12px; box-sizing: border-box; color: var(--rt-ink); }
.rt-lhead .rt-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--kw); color: var(--k); }
.rt-lhead b { display: block; font-size: 12.5px; }
.rt-lhead small { color: var(--rt-mut); font-size: 11px; }
.rt-ruler { position: absolute; height: 24px; }
.rt-tick { position: absolute; top: 0; height: 24px; border-left: 1px solid var(--rt-field); padding-left: 4px; font-size: 10.5px; color: var(--rt-mut); font-variant-numeric: tabular-nums; }
.rt-gap { position: absolute; height: 10px; border-radius: 5px; background: repeating-linear-gradient(135deg, var(--rt-field) 0 4px, transparent 4px 8px); opacity: .9; }
.rt-gap span { position: absolute; left: 4px; top: 11px; white-space: nowrap; font-size: 10.5px; color: var(--rt-mut); }
.rt-ghost-tail { position: absolute; border: 1.5px dashed var(--rt-flow-line); border-left: 0; border-radius: 0 10px 10px 0; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--rt-flow-wash) 80%, transparent) 0 6px, transparent 6px 12px); }
.rt-ghost-tail span { position: absolute; left: 8px; top: 6px; font-size: 11px; color: var(--rt-flow); font-weight: 600; white-space: nowrap; }
.rt-playhead { position: absolute; width: 2px; background: var(--rt-run); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rt-run) 18%, transparent); }
.rt-playhead span { position: absolute; top: -20px; left: -22px; width: 46px; text-align: center; background: var(--rt-run); color: var(--rt-on-accent); border-radius: 5px; font: 600 10.5px system-ui, sans-serif; padding: 2px 0; font-variant-numeric: tabular-nums; }
.rt-caret { position: absolute; width: 4px; border-radius: 2px; background: var(--rt-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--rt-accent) 20%, transparent); }
.rt-caret.rt-no { background: var(--rt-bad); box-shadow: 0 0 0 4px color-mix(in srgb, var(--rt-bad) 20%, transparent); }
.rt-wraptarget { position: absolute; border: 2px dashed var(--rt-flow); border-radius: 14px; }

/* ---- the drag ghost and the toast ---------------------------------------------------------- */
.rt-dragghost { position: fixed; z-index: 1000; pointer-events: none; opacity: .92; transform: rotate(-1.5deg); filter: drop-shadow(0 10px 18px rgba(16, 24, 40, .25)); }
.rt-dragghost .rt-why[hidden] { display: none; }
.rt-dragghost .rt-why { display: block; margin-top: 6px; max-width: 220px; padding: 4px 8px; border-radius: 6px; background: var(--rt-bad); color: #fff; font: 600 11.5px system-ui, sans-serif; }
.rt-toast { position: absolute; left: 50%; bottom: 58px; transform: translateX(-50%) translateY(8px); opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
  background: var(--rt-ink); color: var(--rt-panel); padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 12.5px; z-index: 20; max-width: min(520px, 90%); text-align: center; }
.rt-toast.on { opacity: 1; transform: translateX(-50%); }

/* ---- cards --------------------------------------------------------------------------- */
.rt-k-arm { --k: var(--rt-arm); --kw: var(--rt-arm-wash); --kl: var(--rt-arm-line); }
.rt-k-belt { --k: var(--rt-belt); --kw: var(--rt-belt-wash); --kl: var(--rt-belt-line); }
.rt-k-camera { --k: var(--rt-camera); --kw: var(--rt-camera-wash); --kl: var(--rt-camera-line); }
.rt-k-flow { --k: var(--rt-flow); --kw: var(--rt-flow-wash); --kl: var(--rt-flow-line); }
.rt-i { display: inline-block; flex: none; background-color: currentColor; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain; }
.rt-ic { flex: none; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--kw); color: var(--k); }
.rt-card { position: relative; box-sizing: border-box; width: 100%; height: 100%; padding: 9px 10px 8px; border-radius: 12px; background: var(--rt-panel); border: 1.5px solid var(--kl);
  border-top: 4px solid var(--k); box-shadow: var(--rt-shadow); cursor: grab; user-select: none; touch-action: none; overflow: hidden; color: var(--rt-ink);
  font: 12.5px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.rt-card:hover .rt-tools, .rt-card.rt-sel .rt-tools { opacity: 1; }
.rt-card.rt-sel { outline: 2.5px solid var(--rt-accent); outline-offset: 2px; }
.rt-card.rt-dragging { opacity: .3; }
.rt-top { display: flex; align-items: center; gap: 7px; }
.rt-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.rt-meta { position: absolute; left: 10px; bottom: 7px; font-size: 10.5px; font-weight: 600; color: var(--rt-faint); font-variant-numeric: tabular-nums; }
.rt-dur { flex: none; font-size: 10.5px; color: var(--rt-mut); font-variant-numeric: tabular-nums; background: var(--rt-bg); border-radius: 5px; padding: 1px 5px; }
.rt-sum { margin-top: 6px; color: var(--rt-mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-prob { display: flex; gap: 5px; align-items: flex-start; margin-top: 5px; font-size: 11px; line-height: 1.25; font-weight: 600; }
.rt-prob span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rt-error { border-color: var(--rt-bad); background: var(--rt-bad-wash); }
.rt-error .rt-prob { color: var(--rt-bad); }
.rt-warn { border-color: var(--rt-warn); }
.rt-warn .rt-prob { color: var(--rt-warn); }
.rt-error .rt-sum, .rt-warn .rt-sum { display: none; }
.rt-error .rt-meta, .rt-warn .rt-meta { display: none; }
.rt-tools { position: absolute; z-index: 1; right: 6px; bottom: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.rt-tb { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--rt-line); background: var(--rt-panel); color: var(--rt-mut); cursor: pointer; padding: 0; }
.rt-tb:hover { color: var(--rt-accent); border-color: var(--rt-accent); }
.rt-tb[data-act="delete"]:hover, .rt-tb[data-act="unloop"]:hover { color: var(--rt-bad); border-color: var(--rt-bad); }
.rt-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: color-mix(in srgb, var(--rt-run) 18%, transparent); }
.rt-bar span { display: block; height: 100%; background: var(--rt-run); }
.rt-running { border-color: var(--rt-run); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rt-run) 25%, transparent), var(--rt-shadow); }
.rt-done { border-color: color-mix(in srgb, var(--rt-ok) 55%, transparent); }
.rt-done .rt-ic { background: var(--rt-ok-wash); color: var(--rt-ok); }
.rt-pass { position: absolute; right: 8px; top: 30px; font-size: 10.5px; font-weight: 650; color: var(--rt-run); }
/* compact (Advanced): one row, width is time */
.rt-card.rt-compact { padding: 7px 8px 6px; border-top-width: 1.5px; border-left: 4px solid var(--k); }
.rt-compact .rt-ic { width: 22px; height: 22px; }
.rt-compact .rt-sum { margin-top: 4px; font-size: 11.5px; }
.rt-compact .rt-n { display: none; }
.rt-compact .rt-prob span { -webkit-line-clamp: 1; }
.rt-compact .rt-tools { top: 5px; bottom: auto; right: 5px; }
.rt-compact .rt-pass { top: auto; bottom: 7px; right: 8px; }
.rt-tiny { padding: 7px 4px 6px 5px; }
.rt-tiny .rt-title, .rt-tiny .rt-sum, .rt-tiny .rt-prob span, .rt-tiny .rt-tools, .rt-tiny .rt-pass { display: none; }
.rt-tiny .rt-top { flex-direction: column; align-items: flex-start; gap: 4px; }

/* ---- loop frames ----------------------------------------------------------------------- */
.rt-frame { position: relative; box-sizing: border-box; width: 100%; height: 100%; border: 2px solid var(--rt-flow-line); border-radius: 16px;
  background: color-mix(in srgb, var(--rt-flow-wash) 70%, transparent); font: 12.5px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--rt-ink); }
.rt-frame.rt-sel { border-color: var(--rt-flow); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rt-flow) 22%, transparent); }
.rt-frame.rt-error { border-color: var(--rt-bad); }
.rt-fhead { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 8px 0 12px; color: var(--rt-flow); cursor: grab; user-select: none; touch-action: none; }
.rt-fhead b { font-weight: 700; white-space: nowrap; }
.rt-fnote { color: var(--rt-mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rt-fpass { font-weight: 650; color: var(--rt-run); white-space: nowrap; }
.rt-fsp { flex: 1; }
.rt-ftot { color: var(--rt-mut); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rt-frame .rt-tb { width: 20px; height: 20px; opacity: 0; }
.rt-frame:hover .rt-tb, .rt-frame.rt-sel .rt-tb { opacity: 1; }
.rt-fprob { position: absolute; left: 12px; right: 12px; bottom: 4px; color: var(--rt-bad); font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-fdrop { position: absolute; inset: 40px 12px 30px; display: grid; place-items: center; border: 1.5px dashed var(--rt-flow-line); border-radius: 10px; color: var(--rt-flow); font-weight: 600; font-size: 12px; }
.rt-frame.rt-compact { border-radius: 12px; }
.rt-frame.rt-compact .rt-fhead { height: 24px; font-size: 11.5px; padding: 0 6px 0 8px; gap: 5px; }
.rt-frame.rt-compact .rt-fdrop { inset: 28px 6px 6px; }

/* ---- the cell panel ---------------------------------------------------------------------- */
.rt-side { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; border-left: 1px solid var(--rt-line); background: var(--rt-panel); }
.rt-side h2 { margin: 0; font: 650 12px system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--rt-mut); }
.rt-cellbox { padding: 12px 14px 8px; display: grid; gap: 8px; }
.rt-cellsvg { width: 100%; height: auto; display: block; }
.cs-floor { fill: var(--rt-cell-floor); stroke: var(--rt-cell-stroke); }
.cs-pad { fill: var(--rt-cell-pad); stroke: var(--rt-cell-stroke); }
.cs-label { font: 600 8.5px system-ui, sans-serif; fill: var(--rt-mut); }
.cs-count { font: 700 11px system-ui, sans-serif; fill: var(--rt-bad); }
.cs-item { stroke: rgba(0, 0, 0, .18); }
.cs-base, .cs-h-base { fill: #c8a27a; stroke: #8a6a48; }
.cs-insert, .cs-insertdot, .cs-h-insert { fill: #5b8def; stroke: #2f5cc0; }
.cs-lid, .cs-lidon, .cs-h-lid { fill: #9b7bd8; stroke: #6a4bb0; opacity: .92; }
.cs-h-box, .cs-done { fill: #8a68c8; stroke: #5b3f9a; }
.cs-h-none { fill: none; stroke: none; }
.cs-stampmark { fill: #e04848; }
.cs-slot { fill: none; stroke: var(--rt-cell-stroke); stroke-dasharray: 3 2; }
.cs-armbase { fill: var(--rt-panel); stroke: var(--rt-accent); stroke-width: 2.5; }
.cs-link { stroke: var(--rt-accent); stroke-width: 7; stroke-linecap: round; opacity: .85; }
.cs-fore { stroke-width: 5; }
.cs-joint { fill: var(--rt-panel); stroke: var(--rt-accent); stroke-width: 2; }
.cs-claw { stroke: var(--rt-ink); stroke-width: 2; fill: none; stroke-linecap: round; }
.cs-held { stroke-width: 1; }
.cs-beltbody { fill: #4b5262; }
.cs-beltline { stroke: #6b7385; }
.cs-flash { fill: #4fd1c0; opacity: 0; }
.rt-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 0 14px 10px; font-size: 12px; }
.rt-stats div { display: flex; flex-direction: column; }
.rt-stats small { color: var(--rt-mut); font-size: 11px; }
.rt-stats b { font-size: 15px; font-variant-numeric: tabular-nums; }
.rt-stats .rt-wide { grid-column: 1 / -1; }
.rt-logbox { flex: 1; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--rt-line); padding: 10px 14px 12px; gap: 8px; }
.rt-log { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 110px; font-size: 12px; display: flex; flex-direction: column; gap: 3px; }
.rt-log li { display: flex; gap: 8px; align-items: baseline; }
.rt-log li time { color: var(--rt-faint); font-variant-numeric: tabular-nums; flex: none; width: 46px; }
.rt-log li.rt-lerr { color: var(--rt-bad); font-weight: 600; }
.rt-log li.rt-lok { color: var(--rt-ok); font-weight: 600; }

/* ---- narrower windows (last, so they win over the rules above) ------------------------------ */
@container (max-width: 1080px) {
  .rt-main { grid-template-columns: minmax(0, 1fr) 250px; }
  .rt-joints .rt-jbox:nth-child(n + 2) { display: none; }
}
/* Phone: the 3D view, then the timeline, then the cell panel; the page scrolls. */
@container (max-width: 760px) {
  .rt-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: 340px auto; }
  .rt-side { border-left: 0; border-top: 1px solid var(--rt-line); }
  .rt-logbox { height: 220px; flex: none; }
  .rt-joints { display: none; }
  .rt-dock { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .rt-dockl { border-right: 0; padding: 8px; justify-content: flex-start; }
  .rt-dockr { flex-direction: row; border-left: 0; border-top: 1px solid var(--rt-line); }
  .rt-library { left: 6px; right: 6px; bottom: 6px; }
}
@media (max-width: 760px) {
  #stage { height: auto; min-height: 0; grid-template-rows: auto auto var(--rt-dock-h); }
  #stage .rt-main { order: 0; }
}

/* ---- a loop's way back, and the ports the connectors meet ---------------------------------- */
.rt-wb { stroke: var(--rt-flow); stroke-width: 1.8; stroke-dasharray: 6 4; }
.rt-wbh { stroke-dasharray: none; }
.rt-wayback { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; padding: 1px 8px; border-radius: 8px; background: var(--rt-panel); border: 1px solid var(--rt-flow-line);
  color: var(--rt-flow); font: 600 11px system-ui, sans-serif; }
.rt-wayback.rt-wb-compact { font-size: 10px; padding: 0 5px; }
.rt-port { fill: var(--rt-panel); stroke: var(--rt-faint); stroke-width: 1.6; }

/* ---- the landing page's live story: the 3D cell over a docked mini timeline ------------------ */
.rt-mini { position: absolute; inset: 0; display: grid; grid-template-rows: minmax(0, 1fr) 156px; overflow: hidden; border-radius: inherit;
  background: var(--rt-bg); color: var(--rt-ink); font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.rt-mini-3d { position: relative; min-height: 0; }
.rt-mini-tl { position: relative; min-height: 0; background: var(--rt-panel); border-top: 1px solid var(--rt-line); }
.rt-mini-cv { position: absolute; inset: 0; }
.rt-mini-cv foreignObject { overflow: visible; }
.rt-mini-cv rect.diagram-node, .rt-mini-cv rect.diagram-node.selected { fill: transparent !important; stroke: transparent !important; }
.rt-mini-hud { position: absolute; left: 12px; top: 10px; z-index: 3; display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 9px;
  background: color-mix(in srgb, var(--rt-panel) 90%, transparent); box-shadow: var(--rt-shadow); font-size: 12.5px; pointer-events: none; }
.rt-mini-hud b { font-weight: 650; }
.rt-mini-play { position: absolute; right: 12px; bottom: 168px; z-index: 3; border: 0; border-radius: 18px; padding: 7px 14px; cursor: pointer;
  background: var(--rt-accent); color: var(--rt-on-accent); font: 700 12.5px system-ui, sans-serif; box-shadow: var(--rt-shadow); }
.rt-mini-play[hidden] { display: none; }
