.motor-starter-scene {
  min-height: 360px;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 1px solid #1e5269;
  border-radius: 18px;
  color: #eafaff;
  background:
    radial-gradient(circle at 72% 24%, rgba(36, 203, 242, 0.12), transparent 34%),
    linear-gradient(145deg, #071c2a, #03101a 72%);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06), 0 18px 36px rgba(0, 27, 43, 0.2);
}

.motor-scene-heading {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(81, 175, 205, 0.24);
  background: linear-gradient(90deg, rgba(10, 44, 62, 0.98), rgba(4, 25, 38, 0.93));
}

.motor-scene-heading > div:first-child {
  display: grid;
  gap: 3px;
}

.motor-scene-heading span {
  color: #6fcde4;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.motor-scene-heading strong {
  color: #f0fbff;
  font-size: 0.82rem;
  letter-spacing: 0.035em;
}

.motor-scene-chip {
  min-width: 126px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(136, 167, 178, 0.4);
  border-radius: 999px;
  color: #9db2ba;
  background: rgba(5, 18, 27, 0.72);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.09em;
}

.motor-scene-chip i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #758993;
  box-shadow: 0 0 0 4px rgba(117, 137, 147, 0.12);
}

.motor-scene-chip.is-on {
  border-color: rgba(63, 231, 151, 0.58);
  color: #b9ffda;
  background: rgba(8, 73, 48, 0.35);
}

.motor-scene-chip.is-on i {
  background: #3fe797;
  box-shadow: 0 0 0 4px rgba(63, 231, 151, 0.14), 0 0 15px #3fe797;
}

.motor-starter-scene > svg {
  width: 100%;
  max-height: 440px;
  display: block;
  background: linear-gradient(180deg, #092335, #061825);
}

.motor-cabinet-bg {
  fill: #04131e;
  stroke: #12384d;
  stroke-width: 2;
}

.motor-cabinet-panel {
  fill: url("#motor-panel-gradient");
  stroke: rgba(84, 153, 181, 0.58);
  stroke-width: 1.5;
}

.motor-section-title {
  fill: #bfefff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.2px;
}

.motor-device-shell {
  fill: #18303d;
  stroke: #5f7b89;
  stroke-width: 2;
}

.motor-device-face {
  fill: #d7e5eb;
  stroke: #718d99;
  stroke-width: 1.5;
}

.motor-device-code {
  fill: #f7fcff;
  font-size: 15px;
  font-weight: 950;
}

.motor-device-label {
  fill: #aac4ce;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.8px;
}

.motor-device-detail {
  fill: none;
  stroke: #7d939d;
  stroke-width: 4;
  stroke-linecap: round;
}

.motor-phase {
  stroke: #10232d;
  stroke-width: 1.5;
}

.motor-phase.phase-r { fill: #e85d5d; }
.motor-phase.phase-s { fill: #e7cb54; }
.motor-phase.phase-t { fill: #55a7df; }

.motor-cable {
  fill: none;
  stroke: #5d747f;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke 180ms ease, filter 180ms ease;
}

.motor-energy-path.energized .motor-cable {
  stroke-dasharray: 9 7;
  animation: motor-current-flow 0.7s linear infinite;
  filter: drop-shadow(0 0 4px currentColor);
}

.motor-energy-path.energized .motor-cable.phase-r { stroke: #ff6e6e; color: #ff6e6e; }
.motor-energy-path.energized .motor-cable.phase-s { stroke: #ffe56d; color: #ffe56d; }
.motor-energy-path.energized .motor-cable.phase-t { stroke: #62c7ff; color: #62c7ff; }

.motor-contact,
.motor-contact-blade {
  fill: none;
  stroke: #435c68;
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke 160ms ease, transform 160ms ease;
}

.motor-contact-blade {
  transform-box: fill-box;
  transform-origin: bottom center;
}

.motor-coil {
  fill: #738b96;
  stroke: #425864;
  stroke-width: 2;
  transition: fill 160ms ease, filter 160ms ease;
}

.motor-coil-mark {
  fill: none;
  stroke: #193441;
  stroke-width: 3;
}

.motor-starter-scene.running .motor-coil {
  fill: #f1bd32;
  filter: drop-shadow(0 0 8px rgba(255, 206, 71, 0.95));
}

.motor-starter-scene.running .motor-main-contacts .motor-contact,
.motor-starter-scene.running .motor-main-contacts .motor-contact-blade {
  stroke: #46e5a0;
}

.motor-starter-scene.running .motor-contact-blade {
  transform: rotate(22deg) translateY(-2px);
}

.motor-overload-dial {
  fill: #264556;
  stroke: #7ea6b8;
  stroke-width: 3;
}

.motor-overload-pointer {
  stroke: #f6c545;
  stroke-width: 3;
  stroke-linecap: round;
}

.motor-trip-window {
  fill: #164732;
  stroke: #50c78a;
}

.motor-trip-text {
  fill: #a9f5ce;
  font-size: 7px;
  font-weight: 900;
}

.motor-rear-cover {
  fill: #1f4153;
  stroke: #6e94a5;
  stroke-width: 2;
}

.motor-body {
  stroke: #8ab1c2;
  stroke-width: 2.5;
  transition: filter 180ms ease;
}

.motor-front-cover {
  fill: #294f61;
  stroke: #86aebe;
  stroke-width: 2.5;
}

.motor-cooling-fins path {
  fill: none;
  stroke: rgba(8, 31, 44, 0.68);
  stroke-width: 5;
  stroke-linecap: round;
}

.motor-terminal-box {
  fill: #183747;
  stroke: #7ba3b4;
  stroke-width: 2;
}

.motor-terminal {
  fill: #d3b54a;
  stroke: #5b4c18;
}

.motor-nameplate {
  fill: #d9e4e8;
  stroke: #607781;
}

.motor-nameplate-text {
  fill: #153343;
  font-size: 8px;
  font-weight: 900;
}

.motor-foot { fill: #163546; }

.motor-shaft {
  stroke: #c6d9e0;
  stroke-width: 1;
}

.motor-fan-ring {
  fill: rgba(10, 33, 45, 0.46);
  stroke: #779aa8;
  stroke-width: 3;
}

.motor-fan-hub { fill: #d0e2e8; }
.motor-fan-blades { fill: #4f788a; }

.motor-rotor {
  transform-box: fill-box;
  transform-origin: center;
}

.motor-starter-scene.running .motor-rotor {
  animation: motor-rotor-spin 0.42s linear infinite;
}

.motor-starter-scene.running .motor-body {
  filter: drop-shadow(0 0 11px rgba(51, 207, 240, 0.55));
}

.motor-airflow path {
  fill: none;
  stroke: #4ddaf2;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 6 8;
  opacity: 0;
}

.motor-starter-scene.running .motor-airflow path {
  opacity: 0.72;
  animation: motor-airflow 0.8s linear infinite;
}

.motor-command-strip > rect {
  fill: rgba(3, 19, 29, 0.9);
  stroke: #27536a;
}

.motor-command-light {
  fill: #536974;
  stroke: #8399a3;
  stroke-width: 2;
}

.motor-command-light.start.active {
  fill: #3ee58f;
  filter: drop-shadow(0 0 6px #3ee58f);
}

.motor-command-light.stop.active,
.motor-command-light.emergency.active {
  fill: #ff6262;
  filter: drop-shadow(0 0 6px #ff6262);
}

.motor-command-text {
  fill: #d5e8ef;
  font-size: 11px;
  font-weight: 850;
}

.motor-rpm {
  fill: #54e8ff;
  font-size: 15px;
  font-weight: 950;
}

.motor-rpm-label {
  fill: #7295a4;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.8px;
}

.motor-state-strip {
  min-height: 62px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 10px 16px;
  border-top: 1px solid rgba(83, 150, 175, 0.25);
  background: rgba(4, 22, 33, 0.96);
}

.motor-state-beacon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #738791;
  box-shadow: 0 0 0 5px rgba(115, 135, 145, 0.12);
}

.motor-state-strip > div:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.motor-state-strip strong {
  color: #f0fbff;
  font-size: 0.72rem;
}

.motor-state-strip small {
  overflow: hidden;
  color: #82a2af;
  font-size: 0.6rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.motor-state-strip.is-running .motor-state-beacon {
  background: #3fe797;
  box-shadow: 0 0 0 5px rgba(63, 231, 151, 0.13), 0 0 18px #3fe797;
}

.motor-state-strip.is-fault .motor-state-beacon {
  background: #ff5d5d;
  box-shadow: 0 0 0 5px rgba(255, 93, 93, 0.14), 0 0 18px #ff5d5d;
}

.motor-state-flow {
  display: flex;
  align-items: center;
  gap: 6px;
}

.motor-state-flow span {
  min-width: 31px;
  padding: 4px 6px;
  border: 1px solid #315468;
  border-radius: 6px;
  color: #a6c1cc;
  background: #0a2738;
  font-size: 0.55rem;
  font-weight: 900;
  text-align: center;
}

.motor-state-flow i {
  width: 13px;
  height: 2px;
  background: #466675;
}

.motor-state-strip.is-running .motor-state-flow i {
  background: #3fe797;
  box-shadow: 0 0 6px rgba(63, 231, 151, 0.7);
}

@keyframes motor-current-flow {
  to { stroke-dashoffset: -32; }
}

@keyframes motor-rotor-spin {
  to { transform: rotate(360deg); }
}

@keyframes motor-airflow {
  to { stroke-dashoffset: -28; }
}

@media (max-width: 760px) {
  .motor-starter-scene {
    min-height: 0;
    border-radius: 14px;
  }

  .motor-scene-heading {
    min-height: 52px;
    padding: 8px 10px;
  }

  .motor-scene-heading strong {
    font-size: 0.7rem;
  }

  .motor-scene-chip {
    min-width: auto;
    padding: 6px 8px;
    font-size: 0.5rem;
  }

  .motor-starter-scene > svg {
    min-height: 250px;
  }

  .motor-state-strip {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 9px 11px;
  }

  .motor-state-flow {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .motor-energy-path.energized .motor-cable,
  .motor-starter-scene.running .motor-rotor,
  .motor-starter-scene.running .motor-airflow path {
    animation: none;
  }
}

/* Painel HMI funcional: hierarquia limpa, quatro estágios e estado localizado. */
.motor-starter-scene {
  min-height: 0;
  background: #061724;
  box-shadow: 0 18px 42px rgba(0, 24, 38, 0.24);
}

.motor-starter-scene > svg {
  max-height: none;
  aspect-ratio: 760 / 300;
  background: #081d2b;
}

.motor-hmi-background {
  stroke: #234d61;
  stroke-width: 1.5;
}

.motor-hmi-floor-line {
  fill: none;
  stroke: rgba(118, 174, 195, 0.2);
  stroke-width: 1;
}

.motor-hmi-device > rect:first-child {
  fill: #102c3c;
  stroke: #42697b;
  stroke-width: 1.5;
}

.motor-hmi-face {
  fill: #d9e7ec;
  stroke: #7193a0;
  stroke-width: 1.5;
}

.motor-hmi-code {
  fill: #f3fbfe;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.7px;
}

.motor-hmi-label {
  fill: #7db6ca;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1.1px;
}

.motor-hmi-ok {
  fill: #73d6ac;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.7px;
}

.motor-hmi-switch {
  fill: none;
  stroke: #315565;
  stroke-width: 7;
  stroke-linecap: round;
}

.motor-hmi-contacts path {
  fill: none;
  stroke: #496978;
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke 160ms ease, transform 160ms ease;
}

.motor-hmi-blades {
  transform-box: fill-box;
  transform-origin: bottom center;
}

.motor-hmi-coil {
  fill: #718994;
  stroke: #3e5d6b;
  transition: fill 160ms ease, filter 160ms ease;
}

.motor-hmi-coil-text {
  fill: #172f3a;
  font-size: 7px;
  font-weight: 900;
}

.motor-starter-scene.running .motor-hmi-contacts path {
  stroke: #43e49c;
}

.motor-starter-scene.running .motor-hmi-blades {
  transform: rotate(18deg) translateY(-1px);
}

.motor-starter-scene.running .motor-hmi-coil {
  fill: #f4c546;
  filter: drop-shadow(0 0 6px rgba(244, 197, 70, 0.86));
}

.motor-hmi-protection {
  fill: #18513a;
  stroke: #48c989;
}

.motor-hmi-protection-text {
  fill: #b5f8d5;
  font-size: 6px;
  font-weight: 900;
}

.motor-energy-path .motor-cable {
  stroke-width: 4;
}

.motor-hmi-machine .motor-body {
  stroke: #8db5c6;
  stroke-width: 2;
}

.motor-hmi-machine .motor-rear-cover,
.motor-hmi-machine .motor-front-cover {
  stroke-width: 2;
}

.motor-hmi-machine .motor-terminal-box {
  fill: #173849;
}

.motor-hmi-machine .motor-nameplate {
  fill: #dce8ec;
}

.motor-hmi-machine .motor-foot {
  fill: #143445;
}

.motor-hmi-machine .motor-shaft {
  fill: #b7ccd5;
  stroke: #d7e6eb;
}

.motor-hmi-legend text {
  fill: #799ba9;
  font-size: 9px;
  font-weight: 800;
}

.motor-hmi-legend circle {
  stroke: #071822;
  stroke-width: 1.5;
}

.motor-hmi-legend .legend-r { fill: #e85d5d; }
.motor-hmi-legend .legend-s { fill: #e7cb54; }
.motor-hmi-legend .legend-t { fill: #55a7df; }
.motor-hmi-legend .motor-rpm { fill: #59e6ff; font-size: 14px; }

.motor-state-strip {
  min-height: 66px;
  grid-template-columns: auto minmax(150px, 1fr) auto auto;
  gap: 12px;
}

.motor-command-summary {
  display: flex;
  gap: 6px;
}

.motor-command-summary span {
  min-width: 54px;
  padding: 5px 7px;
  border: 1px solid #315468;
  border-radius: 7px;
  color: #7795a2;
  background: #0a2738;
  font-size: 0.5rem;
  font-weight: 900;
  text-align: center;
}

.motor-command-summary .start.active {
  border-color: #3fe797;
  color: #c4ffe0;
  background: rgba(24, 105, 70, 0.56);
}

.motor-command-summary .stop.active {
  border-color: #ff6969;
  color: #ffd0d0;
  background: rgba(125, 35, 43, 0.58);
}

.scenario-events {
  min-height: 2rem;
}

@media (max-width: 760px) {
  .motor-starter-scene > svg {
    min-height: 0;
    aspect-ratio: 760 / 300;
  }

  .motor-state-strip {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .motor-state-flow {
    display: none;
  }

  .motor-command-summary span {
    min-width: 46px;
    padding-inline: 5px;
  }
}

@media (max-width: 480px) {
  .motor-scene-heading span {
    display: none;
  }

  .motor-scene-chip {
    font-size: 0.48rem;
  }

  .motor-command-summary {
    display: none;
  }

  .motor-state-strip {
    grid-template-columns: auto minmax(0, 1fr);
  }
}
