:root {
  --bg: #f6f4ef;
  --ink: #17171a;
  --soft: rgba(23, 23, 26, 0.58);
  --line: rgba(23, 23, 26, 0.1);
  --accent: #1f9d6b;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 10px 12px;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; outline: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; text-align: left; }
.live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.sd { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; width: min(348px, 100%); padding: 16px 16px 14px; border-radius: 26px; background: #ffffff; box-shadow: inset 0 0 0 1px var(--line), 0 30px 44px -30px rgba(60, 50, 30, 0.45); }
.sd__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 0 2px; }
.sd__head strong { font-size: 16px; line-height: 20px; font-weight: 740; letter-spacing: -0.01em; }
.sd__head span { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.500px; font-weight: 600; color: var(--soft); }

/* the board: the three tables are placed by hand, and the threads between them are drawn by the script from where the rows really are */
.sd__board { position: relative; height: min(236px, 58vh); }
.sd__wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.sd__wire { fill: none; stroke: rgba(23, 23, 26, 0.34); stroke-width: 1.400; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.25s ease, opacity 0.25s ease; }
.sd__flow { fill: none; stroke: var(--accent); stroke-width: 2.200; stroke-linecap: round; stroke-dasharray: 5 7; opacity: 0; }
.is-on > .sd__wire { stroke: color-mix(in srgb, var(--accent) 45%, transparent); }
.is-off > .sd__wire { opacity: 0.35; }
.sd__t { position: absolute; display: block; width: 41%; border-radius: 12px; background: #ffffff; box-shadow: inset 0 0 0 1.500px rgba(23, 23, 26, 0.16), 0 10px 14px -10px rgba(60, 50, 30, 0.5); overflow: hidden; transition: box-shadow 0.25s ease, opacity 0.25s ease; }
.sd__t--users { left: 0; top: 0; }
.sd__t--orders { right: 0; top: 24.500%; }
.sd__t--items { left: 0; bottom: 0; }
.sd__t.is-on { box-shadow: inset 0 0 0 1.500px var(--accent), 0 12px 16px -10px color-mix(in srgb, var(--accent) 60%, transparent); }
.sd__t.is-off { opacity: 0.5; }
.sd__t:focus-visible { box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--ink); }
.sd__t strong { display: block; height: 24px; padding: 0 9px; background: rgba(23, 23, 26, 0.055); font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.500px; line-height: 24px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background-color 0.25s ease, color 0.25s ease; }
.sd__t.is-on strong { background: var(--accent); color: #ffffff; }
.sd__t ul { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); }
.sd__t li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; column-gap: 5px; height: 20px; padding: 0 9px 0 7px; font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: 10.500px; line-height: 20px; white-space: nowrap; transition: background-color 0.25s ease; }
.sd__t li b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.sd__t li i { font-style: normal; color: rgba(23, 23, 26, 0.42); }
.sd__mark { display: block; width: 12px; height: 12px; color: rgba(23, 23, 26, 0.45); transition: color 0.25s ease; }
.sd__mark svg { display: block; width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.300; stroke-linecap: round; stroke-linejoin: round; }
.sd__t li.is-end { background: color-mix(in srgb, var(--accent) 14%, #ffffff); }
.sd__t li.is-end .sd__mark { color: var(--accent); }
.sd__t li.is-end b { font-weight: 700; }

.sd__info { padding: 0 2px; }
.sd__clip { display: block; height: 17px; line-height: 17px; overflow: hidden; white-space: nowrap; font-size: 12.500px; font-weight: 640; color: var(--soft); }
.sd__clip span { display: block; overflow: hidden; text-overflow: ellipsis; }

.ghost { position: absolute; left: 0; top: 0; width: 24px; height: 24px; margin: -3px 0 0 -5px; transform-origin: 20% 15%; pointer-events: none; opacity: 0; fill: #17171a; stroke: #ffffff; stroke-width: 1.300; stroke-linejoin: round; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)); z-index: 6; }

@media (max-width: 350px) { .sd { padding: 14px 13px 13px; } .sd__t { width: 42.500%; } .sd__t li { font-size: 10px; padding: 0 7px 0 6px; column-gap: 4px; } }
@media (prefers-reduced-motion: reduce) { .sd__wire, .sd__t, .sd__t strong, .sd__t li, .sd__mark { transition: none; } }
