.energy-system {
  background: #f5f8f5;
}

.energy-system h2 {
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 500;
  letter-spacing: -.04em;
  line-height: 1.15;
}

.energy-system p {
  max-width: 950px;
  line-height: 1.7;
}

.energy-demo {
  margin: 30px 0;
  padding: 24px;
  border: 1px solid #dae4dc;
  border-radius: 20px;
  background: #fff;
}

.energy-system .energy-controls-hint {
  max-width: 1000px;
  margin: 0 auto 9px;
  color: #344b40;
  font-size: 14px;
  font-weight: 600;
}

.energy-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 1000px;
  gap: 10px;
  margin: 0 auto;
}

.energy-controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  min-height: 64px;
  padding: 8px;
  border: 2px solid #a6bcab;
  border-radius: 12px;
  background: #f4f8f4;
  color: #153428;
  font: 700 16px/1.15 Poppins, Arial, sans-serif;
  text-align: left;
}

.energy-controls button:hover {
  border-color: #008b22;
  background: #e7f5e8;
}

.energy-controls button[aria-pressed="true"] {
  border-color: #16422e;
  background: #16422e;
  color: #fff;
}

.energy-mode-icon {
  font: 600 25px/1 Arial, sans-serif;
}

.energy-controls small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 500;
}

.energy-scene {
  position: relative;
  max-width: 1000px;
  margin: 24px auto 14px;
  overflow: hidden;
  border-radius: 18px;
  background: #e9e6e4;
}

.energy-scene-photo {
  width: 100%;
  height: auto;
  transition: filter .35s ease;
}

.energy-demo[data-mode="night"] .energy-scene-photo {
  filter: brightness(.58) saturate(.76);
}

.energy-traces,
.energy-pins {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.energy-flow path {
  stroke: #43ed75;
  stroke-width: 3.5px;
  stroke-dasharray: 8 8;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 1px 2px #12261d);
  animation: energy-travel 1.6s linear infinite;
}

.energy-flow .flow-grid {
  stroke: #79d9ff;
}

.energy-demo[data-mode="day"] .flow-grid {
  animation-direction: alternate;
}

.energy-demo[data-mode="night"] .flow-solar,
.energy-demo[data-mode="backup"] .flow-grid {
  display: none;
}

.energy-demo[data-mode="night"] .flow-battery {
  animation-direction: reverse;
}

.energy-demo[data-mode="backup"] .energy-flow path {
  stroke: #ffdb73;
}

.energy-disconnect {
  display: none;
}

.energy-disconnect circle {
  fill: #932b2b;
}

.energy-disconnect path {
  fill: none;
  stroke: #fff;
  stroke-width: 6;
  stroke-linecap: round;
}

.energy-demo[data-mode="backup"] .energy-disconnect {
  display: block;
}

@keyframes energy-travel {
  to { stroke-dashoffset: -32; }
}

.energy-pin,
.energy-legend li span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #163a2b;
  color: #fff;
  font: 700 12px/1 Poppins, Arial, sans-serif;
}

.energy-pin {
  position: absolute;
  top: var(--pin-y);
  left: var(--pin-x);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px #fff;
}

.energy-pin > span {
  position: absolute;
  left: calc(100% + 7px);
  padding: 6px 9px;
  border-radius: 6px;
  background: #fff;
  color: #142322;
  font: 600 13px/1.2 Poppins, Arial, sans-serif;
  white-space: nowrap;
  box-shadow: 0 2px 8px #152d2526;
}

.energy-pin-inverter > span,
.energy-pin-battery > span {
  right: calc(100% + 7px);
  left: auto;
}

.energy-demo[data-mode="backup"] .energy-pin-grid {
  background: #932b2b;
}

.energy-legend {
  display: none;
}

.energy-status {
  min-height: 85px;
  padding-top: 20px;
  border-top: 1px solid #dce5df;
}

.energy-note {
  color: #53605a;
  font-size: 13px;
}

@media (max-width: 760px) {
  .energy-demo {
    padding: 14px;
  }

  .energy-system > .container > .button {
    gap: 14px;
    font-size: 13px;
  }

  .energy-status {
    font-size: 14px;
  }
}

@media (max-width: 650px) {
  .energy-scene {
    margin-top: 14px;
    border-radius: 12px;
  }

  .energy-pin > span {
    display: none;
  }

  .energy-pin,
  .energy-legend li span {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }

  .energy-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
  }

  .energy-legend li {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #142322;
    font-size: 11px;
  }
}

@media (max-width: 520px) {
  .energy-controls {
    gap: 6px;
  }

  .energy-controls button {
    flex-direction: column;
    gap: 4px;
    min-height: 64px;
    padding: 7px 3px;
    font-size: 13px;
    text-align: center;
  }

  .energy-controls small {
    display: none;
  }

  .energy-mode-icon {
    font-size: 21px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .energy-flow path { animation: none; }
  .energy-scene-photo { transition: none; }
}
