:root {
  --bg: #07080c;
  --panel: #10121a;
  --ink: #f2f3f7;
  --soft: #8d92a3;
  --line: rgba(255, 255, 255, 0.09);
  --solar: #ffc24a;
  --battery: #45d99a;
  --grid: #8291ff;
  --sky: #ffc24a;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 12px;
}

/* ---- the panel: as wide as the height allows, so it always fits the box ---- */
.panel {
  --w: min(500px, 100vw - 24px, (100vh - 158px) * 1.164);
  position: relative;
  width: calc(var(--w) + 28px);
  max-width: 100%;
  padding: 16px 14px 14px;
  border-radius: 28px;
  background: linear-gradient(180deg, #161924, var(--panel) 46%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 30px 60px -30px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  isolation: isolate;
}
/* the light of the moment of the day, from the top */
.panel__sky {
  position: absolute;
  left: 50%;
  top: -150px;
  width: 420px;
  height: 300px;
  margin-left: -210px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--sky), transparent);
  opacity: 0.2;
  z-index: -1;
  transition: opacity 1.2s ease, background-color 1.2s ease;
}
.panel[data-now="1"] { --sky: #ff8f5c; }
.panel[data-now="1"] .panel__sky { opacity: 0.13; }
.panel[data-now="2"] { --sky: #6f7dff; }
.panel[data-now="2"] .panel__sky { opacity: 0.08; }

.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 0 6px 2px; }
.top__brand { font-size: 11.5px; font-weight: 560; color: var(--soft); letter-spacing: 0.02em; }
.top__title { font-size: 19px; line-height: 24px; font-weight: 660; font-stretch: 106%; letter-spacing: -0.015em; }
.self { display: grid; justify-items: end; }
.self__n { height: 24px; overflow: hidden; font-size: 19px; line-height: 24px; font-weight: 680; letter-spacing: -0.01em; }
.self__n span { display: inline-block; }
.self__l { font-size: 11.5px; font-weight: 520; color: var(--soft); }

.plot svg { display: block; width: 100%; height: auto; overflow: visible; }

/* ---- the lines and the light that runs on them ---- */
.link { --c: var(--solar); }
.link--grid { --c: var(--grid); }
.link--battery { --c: var(--battery); }
.link path { fill: none; stroke-linecap: round; }
.link__base { stroke: var(--line); stroke-width: 1.5; }
.link__run { stroke: var(--c); stroke-width: 2.2; opacity: 0; }
.link__glow { stroke: var(--c); stroke-width: 6; filter: url(#soft); opacity: 0; }

/* ---- the four nodes ---- */
.node { --c: var(--ink); }
.node--solar { --c: var(--solar); }
.node--grid { --c: var(--grid); }
.node--battery { --c: var(--battery); }
.node__halo { fill: var(--c); opacity: 0; transition: opacity 0.9s ease; }
.node.is-on .node__halo { opacity: 0.2; }
.node--home.is-on .node__halo { opacity: 0.1; }
.node__disc {
  fill: #151823;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1.2;
  transition: stroke 0.6s ease;
}
.node.is-on .node__disc { stroke: color-mix(in srgb, var(--c) 70%, transparent); }
.node__icon { transition: opacity 0.6s ease; }
.node__icon path, .node__icon circle, .node__icon rect { fill: none; stroke: var(--c); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.node__icon .node__level { fill: var(--c); stroke: none; }
.node__icon .node__window { fill: #ffd98a; stroke: none; }
.node:not(.is-on) .node__icon { opacity: 0.4; }
.node__value { fill: var(--ink); font-size: 11.5px; font-weight: 660; text-anchor: middle; transition: opacity 0.6s ease; }
.node:not(.is-on) .node__value { opacity: 0.5; }
.node__unit { fill: var(--soft); font-size: 8.6px; font-weight: 560; }
.node__name { fill: var(--ink); font-size: 12.5px; font-weight: 620; }
.node__sub { fill: var(--soft); font-size: 10.6px; font-weight: 500; }
.node__name--end { text-anchor: end; }
.node [data-in] { cursor: pointer; }

/* ---- the three moments of the day ---- */
.seg {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 8px;
  padding: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.seg__pill {
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 33%;
  border-radius: 99px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.09));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 10px -4px rgba(0, 0, 0, 0.6);
}
.seg button {
  position: relative;
  height: 32px;
  border: 0;
  border-radius: 99px;
  background: none;
  color: var(--soft);
  font: inherit;
  font-size: 13px;
  font-weight: 580;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.3s ease, font-stretch 0.4s ease;
}
.seg button[aria-pressed="true"] { color: var(--ink); font-stretch: 108%; }
.seg button.is-hot { color: var(--ink); }
@media (hover: hover) { .seg button:hover { color: var(--ink); } }
.seg button:focus-visible { outline: 2px solid var(--grid); outline-offset: 1px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  fill: #ffffff;
  stroke: #101116;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.6));
  opacity: 0;
  visibility: hidden;
  z-index: 5;
}
