:root {
  --green: #72ff3d;
  --orange: #ffb122;
  --blue: #29a8ff;
  --white: #eef7ff;
  --panel-border: rgba(69, 173, 255, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #010711;
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

.energy-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #010711;
}

.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  transition: filter 0.6s ease, opacity 0.6s ease;
  filter: saturate(1.06) contrast(1.03) brightness(0.95);
}

.energy-shell.day-mode .bg {
  filter: saturate(1.1) contrast(1.02) brightness(1.02);
}

.energy-shell.night-mode .bg {
  filter: saturate(1.02) contrast(1.04) brightness(0.9);
}

.overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mode-pill {
  position: absolute;
  top: calc(9.2% + 20px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(4, 18, 38, 0.78);
  border: 1px solid rgba(82, 175, 255, 0.42);
  color: #e8f5ff;
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 14px;
  text-transform: uppercase;
  box-shadow: 0 0 18px rgba(0, 122, 255, 0.18);
  transition: color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.flow-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

/* arc soare */
.sun-orbit {
  fill: none;
  stroke: rgba(255, 184, 46, 0.88);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-dasharray: 14 8;
  opacity: 0.92;
  filter: drop-shadow(0 0 8px rgba(255, 184, 46, 0.28));
}

.sun-end-dot {
  fill: #ffb82e;
  stroke: rgba(255, 230, 170, 0.9);
  stroke-width: 2;
  filter: drop-shadow(0 0 8px rgba(255, 184, 46, 0.45));
}

.sun-end-label {
  fill: #ffd98b;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 3;
  opacity: 0.95;
}

.sun-group {
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.sun-core {
  fill: #ffd96a;
  filter: url(#sunGlow);
  animation: sunPulse 2.4s ease-in-out infinite;
}

.sun-halo {
  fill: rgba(255, 193, 62, 0.16);
  stroke: rgba(255, 197, 92, 0.4);
  stroke-width: 1.5;
}

#sunTimeLabel {
  fill: #ffffff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 3;
}

.energy-shell.night-mode .sun-group {
  opacity: 0.42;
}

.energy-shell.day-mode .sun-group {
  opacity: 1;
}

@keyframes sunPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.96;
  }

  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

/* fluxuri energie */
.base-line {
  fill: none;
  stroke: rgba(172, 208, 255, 0.16);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 10 18;
}

.flow-line {
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 1 18;
  animation: flowDash 1.5s linear infinite;
  opacity: 0.96;
  transition: opacity 0.35s ease, stroke-width 0.35s ease;
}

.flow-line.green {
  stroke: var(--green);
  filter: url(#glowGreen);
}

.flow-line.orange {
  stroke: var(--orange);
  filter: url(#glowOrange);
}

.flow-line.blue {
  stroke: var(--blue);
  filter: url(#glowBlue);
}

.flow-line.inactive {
  opacity: 0.09;
  stroke: rgba(180, 205, 235, 0.38);
  filter: none;
  animation-play-state: paused;
}

@keyframes flowDash {
  to {
    stroke-dashoffset: -120;
  }
}

/* etichete valori flux - acela i font/dimensiune ca valorile din casete */
.flow-label {
  font-size: 18px;
  font-weight: 900;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 3;
  letter-spacing: 0.04em;
}

.green-label {
  fill: var(--green);
}

.orange-label {
  fill: var(--orange);
}

.blue-label {
  fill: var(--blue);
}

/* casete info PV / RE EA / CAS  */
.info-node rect {
  fill: rgba(5, 18, 38, 0.62);
  stroke-width: 2;
  filter: drop-shadow(0 0 14px rgba(0, 120, 255, 0.22));
}

.info-node text {
  fill: #ffffff;
  font-weight: 900;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 3;
}

.info-title {
  font-size: 16px;
  letter-spacing: 0.16em;
}

.info-value {
  font-size: 18px;
  letter-spacing: 0.04em;
}

.info-node-solar rect {
  stroke: rgba(114, 255, 61, 0.85);
  filter: drop-shadow(0 0 14px rgba(114, 255, 61, 0.28));
}

.info-node-grid rect {
  stroke: rgba(255, 177, 34, 0.85);
  filter: drop-shadow(0 0 14px rgba(255, 177, 34, 0.28));
}

.info-node-home rect {
  stroke: rgba(41, 168, 255, 0.85);
  filter: drop-shadow(0 0 14px rgba(41, 168, 255, 0.28));
}

.info-node-solar .info-value {
  fill: var(--green);
}

.info-node-grid .info-value {
  fill: var(--orange);
}

.info-node-home .info-value {
  fill: var(--blue);
}

/* HUD inferior */
.hud-main {
  position: absolute;
  left: 50%;
  bottom: 10.5%;
  transform: translateX(-50%);
  width: calc(90.4% - 200px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  z-index: 3;
}

.metric,
.hud-mini > div {
  background: linear-gradient(180deg, rgba(5, 18, 38, 0.74), rgba(2, 8, 18, 0.56));
  border: 1px solid var(--panel-border);
  box-shadow:
    0 0 24px rgba(0, 128, 255, 0.14),
    inset 0 0 22px rgba(0, 128, 255, 0.06);
  backdrop-filter: blur(8px);
  border-radius: 18px;
}

.metric {
  min-height: 86px;
  padding: 15px 20px;
}

.metric span,
.hud-mini span {
  display: block;
  color: rgba(226, 240, 255, 0.74);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.metric strong,
.hud-mini strong {
  display: block;
  margin-top: 7px;
  font-size: 32px;
  font-weight: 900;
  line-height: 1.05;
  color: white;
  text-shadow: 0 0 18px currentColor;
}

.metric.solar strong {
  color: var(--green);
}

.metric.home strong {
  color: #f6fbff;
}

.metric.export strong {
  color: var(--orange);
}

.metric.import strong {
  color: var(--blue);
}

.hud-mini {
  position: absolute;
  left: 28%;
  right: 28%;
  bottom: 2.7%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  z-index: 3;
}

.hud-mini > div {
  min-height: 66px;
  padding: 12px 16px;
}

.hud-mini strong {
  font-size: 24px;
}

@media (max-width: 1100px) {
  .hud-main {
    grid-template-columns: repeat(2, 1fr);
    bottom: 8.5%;
  }

  .hud-mini {
    left: 4.8%;
    right: 4.8%;
  }

  .metric strong {
    font-size: 24px;
  }
}
