#yh-mtl-system,
#yh-mtl-system *,
#yh-mtl-system *::before,
#yh-mtl-system *::after { box-sizing: border-box; }
#yh-mtl-system {
  container: yh-mtl-layout / inline-size;
  width: 100%; max-width: 1080px; min-width: 0;
  margin: 24px auto 0; padding: clamp(14px, 2.5vw, 28px);
  border: 1px solid #dce5ed; border-radius: 12px; background: #fff;
  font-family: 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  font-size: 14px; line-height: 1.5; color: #334155; text-align: center;
}
/* Keep host-page content-box rules from enlarging devices over model names. */
#yh-mtl-system,
#yh-mtl-system .yhmtl-node,
#yh-mtl-system .yhmtl-visual,
#yh-mtl-system .yhmtl-device {
  box-sizing: border-box !important;
}
#yh-mtl-system .yhmtl-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr) 42px minmax(0, 1fr) 42px minmax(0, 1fr);
  align-items: start; gap: 0; min-width: 0;
}
#yh-mtl-system .yhmtl-node {
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 44px 184px auto; gap: 12px;
  min-width: 0; margin: 0; padding: 0;
}
#yh-mtl-system .yhmtl-heading {
  display: flex; align-items: center; justify-content: center;
  margin: 0; padding: 0; border: 0; background: transparent;
  color: #236fa1; font-size: 15px; font-weight: 700; line-height: 1.4;
  letter-spacing: 0; overflow-wrap: anywhere;
}
#yh-mtl-system .yhmtl-visual {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-width: 0; height: 184px;
}
#yh-mtl-system .yhmtl-visual::before {
  content: ''; position: absolute; top: 50%; left: 0; right: 0;
  height: 2px; background: #64748b; transform: translateY(-50%);
}
#yh-mtl-system .yhmtl-node:first-child .yhmtl-visual::before { left: 50%; }
#yh-mtl-system .yhmtl-node:last-child .yhmtl-visual::before { right: 50%; }
#yh-mtl-system .yhmtl-models {
  margin: 0; padding: 0; font-size: 13px; font-weight: 500;
  line-height: 1.65; letter-spacing: 0; color: #334155; overflow-wrap: anywhere;
}
#yh-mtl-system .yhmtl-models span { display: block; }
#yh-mtl-system .yhmtl-muted { color: #64748b; }
#yh-mtl-system .yhmtl-wire {
  position: relative; width: 100%; height: 2px; margin: 147px 0 0;
  background: #64748b;
}
#yh-mtl-system .yhmtl-wire::before,
#yh-mtl-system .yhmtl-wire::after {
  content: ''; position: absolute; top: 50%; width: 6px; height: 6px;
  border: 1px solid #64748b; border-radius: 50%; background: #fff;
  transform: translateY(-50%);
}
#yh-mtl-system .yhmtl-wire::before { left: -2px; }
#yh-mtl-system .yhmtl-wire::after { right: -2px; }
#yh-mtl-system .yhmtl-wire-label {
  position: absolute; top: -27px; left: 50%; transform: translateX(-50%);
  padding: 2px 4px; background: #fff; color: #475569;
  font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap;
}
#yh-mtl-system .yhmtl-device {
  position: relative; z-index: 1; flex: 0 0 auto; max-width: 100%;
  border: 2px solid #64748b; background: #fafcfe;
}
#yh-mtl-system .yhmtl-smps {
  display: flex; align-items: center; justify-content: center;
  width: 112px; height: 108px; border-radius: 5px;
  color: #475569; font-size: 16px; font-weight: 600;
}
#yh-mtl-system .yhmtl-smps::before,
#yh-mtl-system .yhmtl-smps::after {
  content: ''; position: absolute; left: 14px; right: 14px; height: 5px;
  background: repeating-linear-gradient(90deg, #b6c1ce 0 3px, transparent 3px 8px);
}
#yh-mtl-system .yhmtl-smps::before { top: 12px; }
#yh-mtl-system .yhmtl-smps::after { bottom: 12px; }
#yh-mtl-system .yhmtl-controller {
  display: flex; flex-direction: column; align-items: center; gap: 13px;
  width: 118px; height: 174px; padding: 20px 12px 28px;
  border-radius: 6px; box-shadow: inset 7px 0 #e8eef4, inset -7px 0 #e8eef4;
}
#yh-mtl-system .yhmtl-leds { display: flex; justify-content: center; gap: 8px; }
#yh-mtl-system .yhmtl-leds i {
  display: block; width: 5px; height: 5px;
  border: 1px solid #64748b; border-radius: 50%; background: #dce7ef;
}
#yh-mtl-system .yhmtl-screen {
  width: 100%; height: 38px; border: 1px solid #7c909a;
  border-radius: 2px; background: #eaf3f4;
}
#yh-mtl-system .yhmtl-buttons { display: flex; gap: 7px; }
#yh-mtl-system .yhmtl-buttons i {
  display: block; width: 8px; height: 8px;
  border: 1px solid #64748b; border-radius: 50%; background: #fff;
}
#yh-mtl-system .yhmtl-terminals {
  position: absolute; left: 12px; right: 12px; bottom: 11px; height: 11px;
  border: 1px solid #64748b; border-radius: 1px;
  background: repeating-linear-gradient(90deg, #edf3f6 0 7px, #9aa9b7 7px 8px);
}
#yh-mtl-system .yhmtl-barrier {
  display: flex; align-items: center; justify-content: center;
  width: 112px; height: 138px; border-radius: 4px 4px 23px 23px;
  border-color: #236fa1; background: #f0f7fb; color: #236fa1;
  font-size: 20px; font-weight: 700; letter-spacing: 1px;
}
#yh-mtl-system .yhmtl-barrier::before,
#yh-mtl-system .yhmtl-barrier::after {
  content: ''; position: absolute; bottom: 16px; width: 13px; height: 24px;
  border: 1px solid #64748b; background: #fff;
}
#yh-mtl-system .yhmtl-barrier::before { left: -8px; transform: rotate(-20deg); }
#yh-mtl-system .yhmtl-barrier::after { right: -8px; transform: rotate(20deg); }
#yh-mtl-system .yhmtl-sensor {
  width: 96px; height: 96px; border-radius: 32px;
  background: #fff; box-shadow: inset 0 0 0 4px #f1f5f9;
}
#yh-mtl-system .yhmtl-bolt {
  position: absolute; width: 7px; height: 7px;
  border: 1px solid #64748b; border-radius: 50%; background: #e2e8f0;
}
#yh-mtl-system .yhmtl-bolt:nth-child(1) { top: 19%; left: 27%; }
#yh-mtl-system .yhmtl-bolt:nth-child(2) { top: 19%; right: 27%; }
#yh-mtl-system .yhmtl-bolt:nth-child(3) { bottom: 19%; left: 27%; }
#yh-mtl-system .yhmtl-bolt:nth-child(4) { bottom: 19%; right: 27%; }
#yh-mtl-system .yhmtl-sensor-center {
  position: absolute; top: 50%; left: 50%; width: 13px; height: 13px;
  border: 2px solid #64748b; border-radius: 50%; transform: translate(-50%, -50%);
}
#yh-mtl-system .yhmtl-sensor-center::before,
#yh-mtl-system .yhmtl-sensor-center::after {
  content: ''; position: absolute; top: 3px; width: 4px; height: 4px;
  border-radius: 50%; background: #94a3b8;
}
#yh-mtl-system .yhmtl-sensor-center::before { left: -13px; }
#yh-mtl-system .yhmtl-sensor-center::after { right: -13px; }

/* Mobile: retain readable model text and stack connected component cards. */
@media (max-width: 760px) {
  #yh-mtl-system .yhmtl-flow { display: flex; flex-direction: column; align-items: center; }
  #yh-mtl-system .yhmtl-node {
    width: 100%; max-width: 400px; padding: 14px 12px;
    grid-template-columns: 92px minmax(0, 1fr); grid-template-rows: auto auto;
    column-gap: 14px; row-gap: 6px; border: 1px solid #e1e8ed; border-radius: 9px; background: #fff;
  }
  #yh-mtl-system .yhmtl-heading { grid-column: 2; grid-row: 1; align-self: end; justify-content: flex-start; text-align: left; }
  #yh-mtl-system .yhmtl-visual { grid-column: 1; grid-row: 1 / 3; height: 140px; }
  #yh-mtl-system .yhmtl-visual::before { display: none; }
  #yh-mtl-system .yhmtl-models { grid-column: 2; grid-row: 2; align-self: start; text-align: left; font-size: 13px; }
  #yh-mtl-system .yhmtl-wire { width: 2px; height: 36px; margin: 0; flex: 0 0 36px; }
  #yh-mtl-system .yhmtl-wire::before { top: -2px; left: 50%; transform: translateX(-50%); }
  #yh-mtl-system .yhmtl-wire::after { top: auto; bottom: -2px; right: auto; left: 50%; transform: translateX(-50%); }
  #yh-mtl-system .yhmtl-wire-label { top: 50%; left: 10px; transform: translateY(-50%); }
  #yh-mtl-system .yhmtl-smps { width: 86px; height: 96px; font-size: 14px; }
  #yh-mtl-system .yhmtl-controller { width: 92px; height: 138px; padding: 15px 12px 26px; gap: 9px; }
  #yh-mtl-system .yhmtl-screen { height: 32px; }
  #yh-mtl-system .yhmtl-barrier { width: 78px; height: 110px; font-size: 18px; }
  #yh-mtl-system .yhmtl-sensor { width: 78px; height: 78px; border-radius: 27px; }
}

/* Also adapt when the website places the diagram in a narrow desktop column. */
@container yh-mtl-layout (max-width: 720px) {
  #yh-mtl-system .yhmtl-flow { display: flex; flex-direction: column; align-items: center; }
  #yh-mtl-system .yhmtl-node {
    width: 100%; max-width: 400px; padding: 14px 12px;
    grid-template-columns: 92px minmax(0, 1fr); grid-template-rows: auto auto;
    column-gap: 14px; row-gap: 6px; border: 1px solid #e1e8ed; border-radius: 9px; background: #fff;
  }
  #yh-mtl-system .yhmtl-heading { grid-column: 2; grid-row: 1; align-self: end; justify-content: flex-start; text-align: left; }
  #yh-mtl-system .yhmtl-visual { grid-column: 1; grid-row: 1 / 3; height: 140px; }
  #yh-mtl-system .yhmtl-visual::before { display: none; }
  #yh-mtl-system .yhmtl-models { grid-column: 2; grid-row: 2; align-self: start; text-align: left; font-size: 13px; }
  #yh-mtl-system .yhmtl-wire { width: 2px; height: 36px; margin: 0; flex: 0 0 36px; }
  #yh-mtl-system .yhmtl-wire::before { top: -2px; left: 50%; transform: translateX(-50%); }
  #yh-mtl-system .yhmtl-wire::after { top: auto; bottom: -2px; right: auto; left: 50%; transform: translateX(-50%); }
  #yh-mtl-system .yhmtl-wire-label { top: 50%; left: 10px; transform: translateY(-50%); }
  #yh-mtl-system .yhmtl-smps { width: 86px; height: 96px; font-size: 14px; }
  #yh-mtl-system .yhmtl-controller { width: 92px; height: 138px; padding: 15px 12px 26px; gap: 9px; }
  #yh-mtl-system .yhmtl-screen { height: 32px; }
  #yh-mtl-system .yhmtl-barrier { width: 78px; height: 110px; font-size: 18px; }
  #yh-mtl-system .yhmtl-sensor { width: 78px; height: 78px; border-radius: 27px; }
}