.rb-lab {
  --rb-ink: #e4f1ee;
  --rb-muted: #b4c9c7;
  --rb-accent: #79efd1;
  display: grid;
  gap: 10px;
  min-width: 0;
  color: var(--rb-ink);
}

.rb-guide, .rb-status {
  margin: 0;
  color: var(--rb-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.rb-view {
  container-type: inline-size;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #3a5c5a;
  border-radius: 16px;
  background: radial-gradient(ellipse at 50% 36%, #3a5854, #192f2f 75%, #152728);
  box-shadow: inset 0 1px #8bb9a93d, inset 0 -4px 10px #0c202498;
  scrollbar-color: #668b82 #172a2b;
  scrollbar-width: thin;
}

.rb-view-tools { display: none; }

.rb-scene {
  position: relative;
  display: flex;
  min-width: 660px;
  flex-direction: column;
  align-items: center;
  isolation: isolate;
  padding: 8px 20px 16px;
  background-image: radial-gradient(#a2c7ba33 0.75px, transparent 0.75px);
  background-size: 14px 14px;
  -webkit-user-select: none;
  user-select: none;
}

.rb-device {
  position: relative;
  width: min(100%, 212px);
  aspect-ratio: 1 / 2;
  flex: none;
  margin: 4px auto 12px;
  color: #f1ede0;
  font-family: system-ui, sans-serif;
}

.rb-device-art, .rb-pcb {
  position: absolute;
  inset: 0;
}

.rb-device i {
  display: block;
  font-style: normal;
}

.rb-pcb {
  inset: 12% 0 0;
  border: 1px solid #4a4d43;
  border-radius: 2px;
  background:
    repeating-linear-gradient(0deg, #ffffff04 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 46% 35%, #222622, #171916 60%, #111311);
  box-shadow: inset 0 1px #98998472, inset 0 -1px #080b0a,
    0 3px #171b16, 0 4px 1px #676b55, 0 9px 14px #08100eb8;
}

.rb-pcb::before {
  position: absolute;
  inset: 35% 13% 9%;
  background: linear-gradient(110deg, #c7a45c63, #5d664442 28%, #b89a5961 73%, #776b3c31);
  clip-path: polygon(0 7%, 13% 7%, 17% 18%, 37% 18%, 43% 27%, 69% 27%, 81% 45%,
    91% 45%, 99% 55%, 99% 57%, 90% 47%, 80% 47%, 68% 29%, 42% 29%, 36% 20%,
    16% 20%, 12% 9%, 0 9%);
  content: '';
}

.rb-usb {
  position: absolute;
  inset: 86% 33.5% -0.8%;
  border: 1px solid #a9a695;
  border-radius: 12% 12% 5% 5%;
  background: repeating-linear-gradient(0deg, #ffffff0e 0 1px, transparent 1px 3px),
    linear-gradient(90deg, #7d7d6e, #f1efda 11%, #c9c8b4 23% 72%, #f7f5e3 82%, #939584 96%);
  box-shadow: inset 0 1px #fffee8, 2px 3px 0 #111713, 3px 6px 6px #080d0db0;
}

.rb-usb::before {
  position: absolute;
  inset: -15% 4% 95%;
  border-radius: 25% 25% 2px 2px;
  background: repeating-linear-gradient(90deg, #b6ad8e 0 4%, #eee7cf 4% 7%, #3e3e32 7% 10%);
  content: '';
}

.rb-usb::after {
  position: absolute;
  inset: 17% 18% 64%;
  background: radial-gradient(ellipse at 19% 20%, #dedbc6 0 15%, #888574 24%, transparent 31%),
    radial-gradient(ellipse at 81% 20%, #e1dfcc 0 15%, #8c8a78 24%, transparent 31%);
  content: '';
}

.rb-usb b {
  position: absolute;
  inset: auto 0 0;
  height: 8%;
  border-radius: 20%;
  background: linear-gradient(#ece8d4, #55574e);
}

.rb-switch {
  position: absolute;
  bottom: 2.2%;
  width: 12%;
  height: 9.3%;
  border: 1px solid #c8bba0;
  border-radius: 3px;
  background: linear-gradient(95deg, #6c6859, #ddd8c2 21%, #a29d8a 57%, #d7d1bc 89%, #716e62);
  box-shadow: 1px 2px #0d110d, inset 1px 1px #e9e1c5;
}

.rb-switch-en { right: 16%; }
.rb-switch-io { left: 16%; }

.rb-switch b {
  position: absolute;
  inset: 28% 17%;
  border: 1px solid #151813;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 26%, #66675c, #4c4d47 34%, #191a17 86%);
  box-shadow: 0 2px 2px #474239;
}

.rb-switch small, .rb-rgb small {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  color: #ddded3;
  font-size: 0.49rem;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 1px #0c0e0a;
  transform: translateX(-50%);
  white-space: nowrap;
}

.rb-chip {
  position: absolute;
  border: 1px solid #30352e;
  border-radius: 4px;
  background: linear-gradient(147deg, #33372f, #1a1c19 52%, #111411);
  box-shadow: inset 1px 1px #595b4a99, 2px 2px 3px #0a100ca0;
}

.rb-chip::before, .rb-chip::after {
  position: absolute;
  inset: 12% auto 12% -14%;
  width: 9%;
  background: repeating-linear-gradient(0deg, #b8b7a0 0 11%, #49483d 11% 15%, transparent 15% 25%);
  content: '';
}

.rb-chip::after { inset: 12% -14% 12% auto; }
.rb-chip-uart { top: 70.5%; left: 68%; width: 11%; height: 5.6%; }
.rb-chip-power { top: 54%; left: 25%; width: 15%; height: 11.5%; }

.rb-chip-power::before {
  inset: 12% 100% 12% auto;
  width: 42%;
  background: repeating-linear-gradient(0deg, #d4d1bc 0 15%, #77766a 15% 22%, transparent 22% 38%);
}

.rb-chip-power::after {
  inset: 16% auto 31% 100%;
  width: 26%;
  background: linear-gradient(90deg, #898979, #eee9d7 66%, #878778);
}

.rb-passive, .rb-via {
  position: absolute;
  top: var(--rb-y);
  left: var(--rb-x);
  width: 3.6%;
  height: 1.05%;
  border-radius: 1px;
  background: linear-gradient(90deg, #b9b7a6 15%, #53504a 17% 25%, var(--rb-passive-fill, #807767) 28% 68%,
    #35362f 75%, #a4a292 82%);
  box-shadow: 0 1px 2px #0d100d;
  transform: translate(-50%, -50%) rotate(var(--rb-turn));
}

.rb-passive-large, .rb-passive-light, .rb-passive-dark {
  width: 10%;
  height: 2.05%;
  outline: 1px solid #a8a28d83;
  outline-offset: 1px;
}

.rb-passive-large { --rb-passive-fill: #b6943e; width: 16%; height: 2.9%; }
.rb-passive-light { --rb-passive-fill: #c3c0a0; width: 8%; height: 1.55%; }
.rb-passive-dark { --rb-passive-fill: #292c26; }

.rb-via {
  width: 1.4%;
  height: auto;
  aspect-ratio: 1;
  border: 1px solid #9d926f82;
  border-radius: 50%;
  background: #262b24;
}

.rb-rgb {
  position: absolute;
  inset: 69% 40.5% 21.5%;
  border: 1px solid #b4b2a1;
  border-radius: 8%;
  background:
    radial-gradient(circle at 50% 46%, #a49b78 0 3%, #e1e1cb 7% 34%, #c6c7b1 37%, transparent 51%),
    linear-gradient(143deg, #fcf7df, #c4c4b2);
  box-shadow: inset 1px 1px #f4f0d7, 1px 2px #656550, 2px 3px 2px #10120e;
}

.rb-module {
  position: absolute;
  inset: 0 16% 51.9%;
  border-radius: 2px 2px 3px 3px;
  background: #141816;
  box-shadow: 1px 2px 3px #090c0ac9;
}

.rb-module::before, .rb-module::after {
  position: absolute;
  inset: 26% auto 5% -1.2%;
  width: 9%;
  background: repeating-linear-gradient(0deg, #ddd2aa 0 3%, #80775b 3% 5%, transparent 5% 7.1%);
  content: '';
}

.rb-module::after { inset: 26% -1.2% 5% auto; }

.rb-module-pads {
  position: absolute;
  inset: 91.5% 15% 0;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, #bfb59a 0 5%, #786f57 5% 6.5%, transparent 6.5% 10%);
}

.rb-shield {
  position: absolute;
  inset: 25% 7% 5.5%;
  padding: 9% 6%;
  overflow: hidden;
  border: 1px solid #aaa58b;
  border-radius: 4%;
  background: repeating-linear-gradient(0deg, #ffffff17 0 1px, transparent 1px 3px),
    linear-gradient(135deg, #f0ede0, #c7c7b7 30%, #e1e0d0 63%, #abae9b 100%);
  color: #635d3e;
  text-align: center;
  box-shadow: inset 1px 1px #fcfae8, inset -2px -2px #7c7e6d, 1px 2px 3px #0e120fa1;
}

.rb-shield strong, .rb-shield span, .rb-shield small {
  display: block;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.rb-shield strong { font-size: 0.75rem; letter-spacing: 0.035em; }
.rb-shield span { margin-top: 4%; font-size: 0.54rem; }
.rb-shield small { margin-top: 6%; font-size: 0.51rem; }

.rb-shield::before, .rb-shield::after {
  position: absolute;
  bottom: 8%;
  height: 24%;
  content: '';
}

.rb-shield::before {
  left: 8%;
  width: 43%;
  opacity: 0.5;
  background: repeating-linear-gradient(#756c4a 0 10%, transparent 10% 27%);
}

.rb-shield::after {
  right: 9%;
  width: 27%;
  opacity: 0.6;
  background: repeating-conic-gradient(#82723f 0% 25%, #dcd4af 0% 50%) 0 0 / 5px 7px;
}

.rb-antenna {
  position: absolute;
  inset: 0 1.8% 74%;
  border-radius: 2px 2px 0 0;
  background: radial-gradient(circle at 74% 84%, #bdb28b 0 1.4px, transparent 2.2px),
    radial-gradient(circle at 87% 84%, #bdb28b 0 1.4px, transparent 2.2px),
    linear-gradient(132deg, #303330, #252827 61%, #181b19);
  box-shadow: inset 0 1px #565951;
}

.rb-header {
  position: absolute;
  top: 12.05%;
  bottom: 0;
  width: 19%;
  display: grid;
  grid-template-rows: repeat(19, minmax(0, 1fr));
}

.rb-header-left { left: 0; --rb-label-x: 16%; --rb-label-turn: -90deg; }
.rb-header-right { right: 0; --rb-label-x: 84%; --rb-label-turn: 90deg; }

.rb-terminal {
  position: relative;
  display: grid;
  z-index: 4;
  width: 100%;
  min-width: 0;
  min-height: 0;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: crosshair;
  touch-action: none;
}

.rb-header-pin .rb-socket {
  position: relative;
  width: 29%;
  aspect-ratio: 1;
  border: 1px solid #ada88f;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 29%, #faf8e9, #f2f0df 39%, #b0ad98 72%, #8b8976);
  box-shadow: 0 0 0 1px #0e110e, inset 0 1px #fffef2, 0 1px 1px #080c09;
}

.rb-header-pin .rb-socket::after {
  position: absolute;
  inset: 27%;
  border-radius: 50%;
  background: #4d5246;
  box-shadow: inset 0 1px #20231e, 0 1px #ece8d3;
  content: '';
}

.rb-pin-label {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.rb-header-pin .rb-pin-label {
  position: absolute;
  top: 50%;
  left: var(--rb-label-x);
  color: #e0e1d6;
  font-size: 0.56rem;
  text-shadow: 0 1px #0a0c08;
  transform: translate(-50%, -50%) rotate(var(--rb-label-turn));
}

.rb-header-common .rb-pin-label { color: #d6f4e6; }
.rb-header-power .rb-pin-label { color: #ffcfb6; }
.rb-header-ground .rb-pin-label { color: #fff2c1; }

.rb-breadboard {
  position: relative;
  width: min(100%, 820px);
  box-sizing: border-box;
  margin: 0 0 8px;
  padding: 10px 9px 8px;
  border: 1px solid #c9c7b8;
  border-radius: 11px 11px 9px 9px;
  background: repeating-linear-gradient(0deg, #beb9a511 0 1px, transparent 1px 3px),
    linear-gradient(166deg, #fffef6, #f4f1e5 76%, #e2ddcd);
  color: #706453;
  box-shadow: inset 1px 2px #fff9ee, inset -1px -1px #cbb995, 0 4px #aa9c80, 0 6px #71664f, 0 12px 14px #0f1e1ba3;
}

.rb-grid-line {
  position: relative;
  display: grid;
  grid-template-columns: minmax(21px, 0.92fr) repeat(17, minmax(0, 1fr)) minmax(21px, 0.92fr);
  justify-items: stretch;
  align-items: center;
  text-align: center;
}

.rb-grid-label, .rb-grid-symbol {
  position: relative;
  z-index: 1;
  color: #6b604e;
  font: 740 0.64rem/1 ui-monospace, Consolas, monospace;
}

.rb-grid-numbers { min-height: 15px; }
.rb-grid-strip { background: linear-gradient(90deg, transparent 4%, #fff7e0a6 4% 96%, transparent 96%); }

.rb-grid .rb-terminal { min-height: 20px; }

.rb-grid .rb-socket {
  width: 7px;
  height: 7px;
  border: 1px solid #776c54;
  border-radius: 1px;
  background: linear-gradient(140deg, #2a2b25 38%, #514735 77%, #7b6347);
  box-shadow: 0 1px 0 #fffcec, 1px 1px 0 #b7a280, inset 1px 1px 0 #2a2822;
}

.rb-grid-slot {
  position: relative;
  height: 13px;
  margin: 3px 4.6%;
  border: 1px solid #c9b894;
  border-radius: 3px;
  background: linear-gradient(#96866c, #b8a588 28%, #d7c7a8 75%, #faefd4);
  box-shadow: inset 0 1px 3px #75644f80, 0 1px #fff5e0;
}

.rb-grid-rail {
  --rb-rail: #c5223e;
  --rb-rail-edge: #a1182d;
  padding-block-start: 5px;
}

.rb-grid-minus {
  --rb-rail: #0876a6;
  --rb-rail-edge: #065881;
  padding-block: 0 5px;
}

.rb-grid-rail::before {
  position: absolute;
  inset: 2px 4.8% auto;
  height: 3px;
  border-radius: 2px;
  background: var(--rb-rail);
  box-shadow: inset 0 -1px var(--rb-rail-edge);
  pointer-events: none;
  content: '';
}

.rb-grid-minus::before { inset-block: auto 2px; }

.rb-grid-symbol {
  color: var(--rb-rail-edge);
  font-size: 0.88rem;
  font-weight: 850;
}

.rb-part-tray {
  display: flex;
  box-sizing: border-box;
  width: 100%;
  justify-content: center;
  align-items: stretch;
  gap: 8px;
  padding: 8px 10px 4px;
}

.rb-part {
  --rb-part-color: #ff423f;
  --rb-part-angle: 0deg;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: end;
  flex: 0 1 150px;
  min-width: 0;
  padding: 3px 7px 7px;
  border: 1px solid #8bb5a76b;
  border-radius: 9px;
  background: linear-gradient(150deg, #557069, #304741 90%);
  box-shadow: 0 2px #142825, inset 0 1px #c1d5bc2b;
  text-align: center;
}

.rb-part-visual {
  position: relative;
  display: grid;
  min-height: 61px;
  align-items: end;
  justify-items: center;
  grid-template-columns: repeat(var(--rb-legs), minmax(0, 1fr));
}

.rb-part-shape {
  position: absolute;
  z-index: 1;
  inset: auto 0 8px;
  margin: auto;
}

.rb-part-lead {
  width: 3px;
  height: 28px;
  border: 1px solid #5f6159;
  border-radius: 2px;
  background: linear-gradient(90deg, #807f71, #dddace 51%, #a9a69a 64%, #7b786f);
  box-shadow: 1px 2px 2px #142824a4;
  transform: rotate(14deg);
}

.rb-part-lead:last-of-type { transform: rotate(-14deg); }

.rb-part-led .rb-part-shape, .rb-part-rgb .rb-part-shape {
  display: grid;
  width: 29px;
  height: 36px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--rb-part-color) 50%, #ecc3ae);
  border-bottom-width: 4px;
  border-radius: 54% 54% 19% 19% / 51% 51% 13% 13%;
  background: radial-gradient(ellipse at 29% 24%, #ffffffad, transparent 30%),
    radial-gradient(ellipse at 60% 72%, #160b1224, transparent 55%),
    linear-gradient(125deg, color-mix(in srgb, var(--rb-part-color), #fff 41%), color-mix(in srgb, var(--rb-part-color), #1c130e 39%) 65%);
  box-shadow: inset -3px -1px 5px #2e0a0d89, 2px 5px 5px #0a211bb0;
}

.rb-part-rgb { --rb-part-color: #c9dce1; }
.rb-part-rgb .rb-part-shape { width: 33px; }

.rb-led-die {
  width: 8px;
  height: 12px;
  margin-top: 9px;
  border-radius: 2px;
  background: #fff2c0a0;
  box-shadow: 0 1px 4px #3a211a75;
}

.rb-part[data-on] .rb-part-shape {
  box-shadow: inset 0 0 9px #fff8d6, 0 0 14px 4px var(--rb-part-color), 0 0 26px 5px #ffffff44;
}

.rb-part[data-on] .rb-led-die { background: #fffcec; }

.rb-part-resistor {
  --rb-resistor-axis: 22px;
  --rb-resistor-body-height: 19px;
  --rb-resistor-lead-width: 3px;
  --rb-resistor-socket-size: 11px;
  --rb-resistor-socket-inset: 7px;
  --rb-resistor-socket-center: calc(var(--rb-resistor-socket-inset) + var(--rb-resistor-socket-size) / 2);
}

.rb-part-resistor .rb-part-shape {
  bottom: calc(var(--rb-resistor-axis) - var(--rb-resistor-body-height) / 2);
  width: min(38%, 64px);
  height: var(--rb-resistor-body-height);
  filter: drop-shadow(1px 3px 2px #142a24a6);
}

.rb-resistor-body {
  display: flex;
  height: 100%;
  justify-content: center;
  gap: 8%;
  padding-inline: 15%;
  background: radial-gradient(ellipse at 18% 38%, #fff0c973, transparent 42%),
    radial-gradient(ellipse at 83% 35%, #ffe3b04d, transparent 44%),
    linear-gradient(#92704d, #e1c698 22%, #efdcb3 42%, #d5b88a 66%, #936844);
  clip-path: polygon(0 42%, 3% 25%, 8% 11%, 14% 4%, 21% 4%, 29% 10%, 38% 16%,
    62% 16%, 71% 10%, 79% 4%, 86% 4%, 92% 11%, 97% 25%, 100% 42%,
    100% 58%, 97% 75%, 92% 89%, 86% 96%, 79% 96%, 71% 90%, 62% 84%,
    38% 84%, 29% 90%, 21% 96%, 14% 96%, 8% 89%, 3% 75%, 0 58%);
}

.rb-resistor-band {
  flex: 0 0 max(2px, 9%);
  background: linear-gradient(#2e201340, #fff6d62e 34%, transparent 51%, #20180c62), var(--rb-band-color);
}

.rb-resistor-band[data-tolerance] { margin-inline-start: 7%; }
.rb-resistor-band[data-color="black"] { --rb-band-color: #272421; }
.rb-resistor-band[data-color="brown"] { --rb-band-color: #744027; }
.rb-resistor-band[data-color="red"] { --rb-band-color: #bc3e31; }
.rb-resistor-band[data-color="orange"] { --rb-band-color: #ef812c; }
.rb-resistor-band[data-color="yellow"] { --rb-band-color: #edc644; }
.rb-resistor-band[data-color="green"] { --rb-band-color: #397647; }
.rb-resistor-band[data-color="blue"] { --rb-band-color: #326696; }
.rb-resistor-band[data-color="violet"] { --rb-band-color: #865b94; }
.rb-resistor-band[data-color="gray"] { --rb-band-color: #8d9191; }
.rb-resistor-band[data-color="white"] { --rb-band-color: #f2ede3; }
.rb-resistor-band[data-color="gold"] { background: linear-gradient(#6f5021, #d9b857 32%, #a77c24 60%, #684b1c); }
.rb-resistor-band[data-color="silver"] { background: linear-gradient(#626966, #dddeda 32%, #a1a9a5 60%, #555d59); }

.rb-part-resistor .rb-part-lead {
  position: absolute;
  bottom: calc(-1 * var(--rb-resistor-socket-center));
  left: calc(25% - var(--rb-resistor-lead-width) / 2);
  width: calc(25% + var(--rb-resistor-lead-width) / 2);
  height: calc(var(--rb-resistor-axis) + var(--rb-resistor-socket-center) + var(--rb-resistor-lead-width) / 2);
  border: solid #a6b0ad;
  border-width: var(--rb-resistor-lead-width) 0 0 var(--rb-resistor-lead-width);
  border-radius: 6px 0 0;
  background: none;
  box-shadow: none;
  filter: drop-shadow(1px 2px 1px #142824a4);
  transform: none;
}

.rb-part-resistor .rb-part-lead::before {
  position: absolute;
  inset: -2px 0 0 -2px;
  border: solid #e5ebe7;
  border-width: 1px 0 0 1px;
  border-radius: 5px 0 0;
  content: '';
}

.rb-part-resistor .rb-part-lead + .rb-part-lead {
  right: calc(25% - var(--rb-resistor-lead-width) / 2);
  left: auto;
  transform: scaleX(-1);
}

.rb-part-resistor .rb-part-pins .rb-terminal {
  align-content: start;
  padding-top: var(--rb-resistor-socket-inset);
}

.rb-part-resistor .rb-part-pins .rb-socket {
  box-sizing: border-box;
  width: var(--rb-resistor-socket-size);
  height: var(--rb-resistor-socket-size);
}

.rb-part-button .rb-part-shape {
  bottom: 11px;
  width: 37px;
  height: 29px;
  border: 1px solid #252d27;
  border-radius: 4px;
  background: radial-gradient(circle, #686a5c 0 10%, #242823 30% 42%, #d9d6bc 45% 48%, #7e8477 50% 56%, #292f29 65%);
  box-shadow: inset 0 1px #8b8b7b, 2px 4px 0 #141b16, 3px 5px 4px #092219b0;
}

.rb-part-button[data-pressed] .rb-part-shape { transform: translateY(2px); filter: brightness(1.35); }

.rb-breadboard-mounted { --rb-button-zone: 125px; }
.rb-breadboard-mounted .rb-grid { margin-right: var(--rb-button-zone); }

.rb-breadboard-mounted .rb-grid-slot::after {
  position: absolute;
  top: -1px;
  left: calc(100% - 3px);
  width: calc(var(--rb-button-zone) + 18px);
  height: calc(100% + 2px);
  border: inherit;
  border-left: 0;
  border-radius: 0 3px 3px 0;
  background: inherit;
  box-shadow: inherit;
  content: '';
}

.rb-part-mounted {
  position: absolute;
  top: 50%;
  right: 16px;
  width: calc(var(--rb-button-zone) - 15px);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: translateY(-50%);
}

.rb-part-mounted .rb-part-pins {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row;
  gap: 9px 20px;
}

.rb-part-mounted .rb-part-visual { position: absolute; inset: 0; min-height: 0; pointer-events: none; }
.rb-part-mounted .rb-part-shape { inset: 0; }

.rb-part-mounted .rb-part-lead {
  position: absolute;
  top: 30%;
  left: 31%;
  height: 22px;
  transform: rotate(-46deg);
}

.rb-part-mounted .rb-part-lead:nth-child(2) { left: 67%; transform: rotate(46deg); }
.rb-part-mounted .rb-part-lead:nth-child(3) { top: 49%; transform: rotate(46deg); }
.rb-part-mounted .rb-part-lead:nth-child(4) { top: 49%; left: 67%; transform: rotate(-46deg); }
.rb-breadboard .rb-part-mounted .rb-terminal { min-height: 41px; }
.rb-part-mounted .rb-part-label { position: absolute; inset: calc(100% + 2px) 0 auto; color: #675943; }
.rb-part-mounted .rb-part-pins .rb-pin-label { color: #5c503a; }

.rb-part-potentiometer .rb-part-shape {
  width: 40px;
  height: 38px;
  border: 1px solid #233f72;
  border-radius: 5px;
  background: linear-gradient(155deg, #588bc0, #2b598e 36%, #253c69 88%);
  box-shadow: inset 1px 1px #7ca5cb, 2px 4px 0 #172634, 2px 6px 4px #0d2221b0;
}

.rb-pot-rotor {
  position: absolute;
  inset: 17%;
  border: 2px solid #dad8c5;
  border-radius: 50%;
  background: conic-gradient(#99957c, #d2caae, #f4ebd2, #989983, #cfc7ac, #99957c);
  box-shadow: 0 1px 3px #142a39, inset 0 1px #fdf5d8;
  transform: rotate(var(--rb-part-angle));
  transition: transform 120ms ease-out;
}

.rb-pot-rotor::after {
  position: absolute;
  inset: 43% 15%;
  background: #605c4b;
  content: '';
}

.rb-part-servo .rb-part-shape {
  bottom: 8px;
  width: 49px;
  height: 29px;
  border: 1px solid #142e52;
  border-radius: 4px;
  background: linear-gradient(145deg, #4176bd, #1b4780 50%, #173462 80%);
  box-shadow: -7px 4px 0 -2px #30578d, 7px 4px 0 -2px #30578d, inset 1px 1px #8eb2e0, 2px 4px 0 #18273d;
}

.rb-servo-arm {
  position: absolute;
  inset: -6px auto auto 12px;
  width: 37px;
  height: 9px;
  border: 1px solid #a69b77;
  border-radius: 4px 6px 6px 4px;
  background: radial-gradient(circle at 5px 4px, #5d5848 0 1px, #e7d9aa 2px 4px, transparent 4.5px),
    radial-gradient(circle at 24px 4px, #8e8060 0 1px, transparent 1.5px),
    radial-gradient(circle at 31px 4px, #8e8060 0 1px, transparent 1.5px),
    #eadcb5;
  box-shadow: 1px 3px 2px #0c2033a6;
  transform: rotate(calc(var(--rb-part-angle) - 90deg));
  transform-origin: 5px 50%;
  transition: transform 180ms ease-out;
}

.rb-part-power .rb-part-shape {
  bottom: 10px;
  display: grid;
  width: 50px;
  height: 28px;
  place-items: center;
  border: 1px solid #252d2b;
  border-radius: 4px;
  background: linear-gradient(140deg, #74776b, #3c4240 31%, #292f2d);
  box-shadow: inset 1px 1px #9a9d8b, 2px 4px 0 #17201b;
}

.rb-power-mark { color: #fcd08a; font: 800 0.65rem/1 ui-monospace, monospace; }

.rb-part-pins {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: stretch;
}

.rb-part-pins .rb-terminal { align-content: center; gap: 3px; min-height: 40px; }

.rb-part-pins .rb-socket {
  width: 11px;
  height: 11px;
  border: 1px solid #a7a181;
  border-radius: 50%;
  background: var(--rb-role, linear-gradient(135deg, #d3caab, #68664e 74%));
  box-shadow: inset 1px 1px #fff8d18c, 0 1px 0 2px #243730;
}

.rb-part-pins .rb-pin-label {
  overflow: hidden;
  width: 100%;
  color: #e7f5ee;
  font-size: 0.61rem;
  text-overflow: ellipsis;
}

.rb-part [data-role="red"] { --rb-role: #e26c57; }
.rb-part [data-role="ground"] { --rb-role: #514943; }
.rb-part [data-role="green"] { --rb-role: #74d07a; }
.rb-part [data-role="blue"] { --rb-role: #70a5ef; }
.rb-part [data-role="signal"] { --rb-role: #e9b96b; }
.rb-part-lead[data-role] { background: linear-gradient(90deg, #242e2811, #f3e1c25c, #242e285b), var(--rb-role); }
.rb-part-label { color: #ebf6ef; font-size: 0.74rem; font-weight: 780; line-height: 1.2; }

.rb-wires {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.rb-terminal[data-linked] .rb-socket {
  border-color: #f7e3ae;
  background: #1c4035;
  box-shadow: 0 0 0 1px #295348, inset 0 0 0 1px #8cd5c1;
}

.rb-terminal[data-net], .rb-terminal[data-highlight] { background: #7becae40; }

.rb-terminal[data-net] .rb-socket, .rb-terminal[data-highlight] .rb-socket {
  border-color: #4bae84;
  background: #bbffd1;
  box-shadow: 0 0 7px #68d895, 0 0 0 1px #35614a;
}

.rb-terminal[data-highlight] .rb-socket { background: #ffe39d; box-shadow: 0 0 8px #f4bd66, 0 0 0 1px #8b614b; }
.rb-terminal[aria-pressed="true"], .rb-terminal[data-drag-target] { outline: 2px solid #2dad96; outline-offset: -2px; }
.rb-terminal[aria-pressed="true"] .rb-socket, .rb-terminal[data-drag-target] .rb-socket { background: #fff1a5; box-shadow: 0 0 9px #ffed8a, 0 0 0 1px #7c6840; }
.rb-terminal:focus-visible { outline: 2px solid #ecb831; outline-offset: -1px; }
.rb-scene[data-locked] .rb-terminal { cursor: default; touch-action: auto; }

@media (hover: hover) {
  .rb-terminal:not([aria-disabled="true"]):hover { outline: 1px solid #e9be55; outline-offset: -1px; }
}

.rb-quick { display: none; }

.rb-controls, .rb-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rb-tools { margin-left: auto; }

.rb-action, .rb-remove, .rb-picker {
  min-height: 38px;
  border: 1px solid #506d6b;
  border-radius: 8px;
  background: #223936;
  color: var(--rb-ink);
  font: 720 0.79rem/1.25 system-ui, sans-serif;
}

.rb-action { padding: 5px 11px; white-space: nowrap; cursor: pointer; }
.rb-action:disabled, .rb-remove:disabled { opacity: 0.56; cursor: default; }
.rb-lab :is(.rb-picker, .rb-action, .rb-remove):focus-visible { outline: 2px solid var(--rb-accent); outline-offset: 2px; }

.rb-wire-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rb-wire-list:empty { display: none; }

.rb-wire-entry {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  padding-left: 8px;
  border: 1px solid #536f6a;
  border-radius: 8px;
  background: #192c2a;
  color: var(--rb-ink);
}

.rb-wire-entry::before {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--rb-wire-color);
  content: '';
}

.rb-wire-label { font-size: 0.72rem; overflow-wrap: anywhere; }

.rb-remove {
  width: 32px;
  min-height: 32px;
  flex: none;
  border: 0;
  background: transparent;
  font-size: 1.15rem;
  cursor: pointer;
}

@media (max-width: 720px), (pointer: coarse) {
  .rb-view-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; color: var(--rb-muted); font-size: .82rem; }
  .rb-view[data-overview] { height: var(--rb-overview-height); overflow: hidden; }
  .rb-view[data-overview] .rb-scene { transform: scale(var(--rb-scale, 1)); transform-origin: top left; }
  .rb-quick {
    display: grid;
    gap: 5px;
    color: var(--rb-muted);
    font-size: 0.79rem;
    font-weight: 760;
  }

  .rb-picker { width: 100%; padding: 6px 9px; font-size: 1rem; }
  .rb-action, .rb-picker { min-height: 44px; }
  .rb-remove { width: 44px; min-height: 44px; }
  .rb-scene { min-width: 850px; }
  .rb-scene .rb-device { width: min(100%, 224px); }
  .rb-view:not([data-overview]) .rb-device { align-self: flex-start; margin-inline: 16px auto; }
  .rb-grid .rb-terminal { min-height: 30px; }
  .rb-part-pins .rb-terminal { min-height: 44px; }
}

@media (max-width: 420px) {
  .rb-controls { align-items: start; flex-direction: column; }
  .rb-tools { margin-left: 0; }
}

@media (pointer: fine) {
  @container (min-width: 990px) {
    .rb-scene {
      display: grid;
      grid-template-columns: minmax(220px, 24%) minmax(0, 1fr);
      grid-template-rows: auto 1fr;
      align-items: start;
      justify-items: center;
      gap: 0 20px;
    }

    .rb-scene > .rb-device { grid-row: 1 / span 2; align-self: center; }
    .rb-scene > .rb-breadboard { grid-column: 2; }
    .rb-scene > .rb-part-tray { grid-column: 2; padding-inline: 0; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .rb-pot-rotor, .rb-servo-arm { transition: none; }
}
