/* Site playback: node tree with energy flows and running revenue, cost and profit. */
.site-playback {
  --sp-ink: #0d2a32;
  --sp-muted: #8a92ad;
  --sp-line: #dfe5f5;
  --sp-in: #ff9a45;
  --sp-in-glow: rgba(255, 140, 50, .95);
  /* Production and export in blue, as elsewhere in the app. */
  --sp-out: #4a7fe0;
  --sp-out-tail: #2f5fe0;
  --sp-out-glow: rgba(74, 127, 224, .95);
  /* As the result's total cards: revenue green, cost orange, profit blue. */
  --sp-rev: #2f8f5b;
  --sp-cost: #e8743b;
  --sp-profit: #3e74b5;
  position: relative;
  margin-bottom: 1.75rem;
  padding: 1.4rem 1.5rem 1.5rem !important;
  overflow: hidden;
  color: var(--sp-ink);
  font-family: Barlow, sans-serif;
}
.site-playback:focus { outline: none; }
.site-playback { --sp-price-frame: color-mix(in srgb, var(--sp-price) 45%, white); }
/* main.css gives every svg a grey background and full size. */
.site-playback svg { display: block; background: none; }
.site-playback[hidden] { display: none; }

/* ---------- header ---------- */
.sp-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.sp-eyebrow {
  color: #3e74b5;
  font: 600 .74rem/1.2 Barlow, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.sp-clock {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  margin-top: .3rem;
  font-variant-numeric: tabular-nums;
}
/* The date in the result page's panel title size (its h4). */
.sp-date { color: #24282e; font: 600 20px/25px Barlow, sans-serif; }
.sp-time {
  padding: 1px 8px;
  border-radius: 999px;
  background: #eef0fa;
  font: 600 .9rem/1.5 Barlow, sans-serif;
}
.sp-progress-text { margin-top: .2rem; color: var(--sp-muted); font: 500 .85rem Barlow, sans-serif; }
/* Day-ahead price: a pill right of the grid that opens a small price chart, and a price tint at the grid. */
@property --sp-price {
  syntax: "<color>";
  inherits: true;
  initial-value: #3fc1b5;
}
.site-playback { transition: --sp-price .45s ease; }
.sp-spark-label { display: flex; justify-content: space-between; gap: 1rem; color: var(--sp-muted); font: 500 12px Barlow, sans-serif; }
.sp-spark-label span:first-child { color: var(--sp-ink); font-weight: 600; }
.sp-spark-svg { display: block; overflow: visible; margin: 6px 0 4px; }
.sp-spark-line { fill: none; stroke: #56607a; stroke-width: 1.4; stroke-linejoin: round; }
.sp-spark-label small { color: var(--sp-muted); font: 500 11px Barlow, sans-serif; }
.sp-spark-grid { stroke: #e6ebf3; stroke-width: 1; }
.sp-spark-zero-line { stroke: #c9d1e6; }
.sp-spark-axis {
  fill: var(--sp-muted);
  font: 500 10px Barlow, sans-serif;
  font-variant-numeric: tabular-nums;
}
.sp-spark-now { stroke: #123a44; stroke-width: 1; stroke-dasharray: 2 2; opacity: .5; }
.sp-spark-dot { stroke: #fff; stroke-width: 1.5; }
/* "now" centred under the plot, right of the axis gutter. */
.sp-spark-scale { color: var(--sp-muted); font: 500 11px Barlow, sans-serif; text-align: center; }
.sp-price-anchor {
  position: absolute;
  z-index: 7;
  display: flex;
  transform: translateY(-50%);
}
.sp-price {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 7px 1px 6px;
  border: 1px solid var(--sp-price-frame);
  border-radius: 999px;
  background: #fff;
  color: var(--sp-ink);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--sp-price) 22%, transparent);
  font: 600 12px/17px Barlow, sans-serif;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
}
.sp-price:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--sp-price) 35%, transparent); }
.sp-price:focus-visible { outline: 2px solid #3e74b5; outline-offset: 2px; }
.sp-price .sp-price-da {
  cursor: inherit;
  border-bottom: 0;
  padding-right: 5px;
  margin-right: -1px;
  border-right: 1px solid #e6ebf7;
  color: var(--sp-muted);
  font: 600 10px/13px Barlow, sans-serif;
  letter-spacing: .04em;
  text-decoration: none;
}
.sp-price-caret { color: var(--sp-muted); transition: transform .15s; }
.sp-price.sp-open .sp-price-caret { transform: rotate(180deg); }
/* Beside the pill, its pointer level with the pill's centre. */
.sp-price-pop {
  position: absolute;
  top: calc(50% - 22px);
  left: calc(100% + 12px);
  z-index: 12;
  width: 280px;
  box-sizing: content-box;
  padding: 10px 12px 9px;
  border: 1px solid var(--sp-price-frame);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--sp-price) 22%, transparent);
  animation: sp-pop .15s ease-out;
}
.sp-price-pop[hidden] { display: none; }
.sp-price-pop:before {
  content: "";
  position: absolute;
  top: 15px;
  left: -7px;
  width: 12px;
  height: 12px;
  border-bottom: 1px solid var(--sp-price-frame);
  border-left: 1px solid var(--sp-price-frame);
  background: #fff;
  transform: rotate(45deg);
}
@keyframes sp-pop { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }
.sp-price i { width: 6px; height: 6px; border-radius: 50%; background: var(--sp-price); box-shadow: 0 0 6px var(--sp-price); }
.sp-node.sp-grid.sp-priced {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sp-price) 55%, white), 0 8px 20px color-mix(in srgb, var(--sp-price) 35%, transparent);
}
.sp-price-glow {
  position: absolute;
  inset: 0;
  /* The glow's shape is a dithered mask image: a gradient this faint would
     step through 8-bit levels and show as rings. The mask fades out towards
     the top so the tint has no edge where the tree begins. */
  background: var(--sp-price);
  -webkit-mask: url(../img/site_playback_price_glow.png) center / 100% 100% no-repeat;
  mask: url(../img/site_playback_price_glow.png) center / 100% 100% no-repeat;
  pointer-events: none;
}
.sp-legend { display: flex; gap: 1rem; margin-top: .4rem; color: #56607a; font: 500 .85rem Barlow, sans-serif; }
.sp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sp-dot { width: 8px; height: 8px; border-radius: 50%; }
.sp-dot-in { background: var(--sp-in); box-shadow: 0 0 6px var(--sp-in-glow); }
.sp-dot-out { background: var(--sp-out); box-shadow: 0 0 6px var(--sp-out-glow); }

/* ---------- tree ---------- */
.sp-tree-wrap { position: relative; margin: .5rem -1.5rem 0; }
/* The tree pulled up into the header's empty middle, the grid level with
   the legend (see liftTree). */
.sp-tree-up .sp-tree-wrap { margin-top: -4.875rem; }
/* Narrow screens: the tree at a readable size, scrolled sideways. */
.sp-tree-wrap.sp-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
}
.sp-tree-wrap.sp-scroll::-webkit-scrollbar { display: none; }
.sp-tree-wrap.sp-scroll .sp-stage { left: 0; translate: none; transform-origin: 0 0; }
.sp-stage {
  position: absolute;
  top: 0;
  left: 50%;
  transform-origin: 50% 0;
  translate: -50% 0;
}
.sp-stage:before {
  content: "";
  position: absolute;
  inset: 0 0 -20px;
  /* Colour from a gradient, shape from a dithered mask image, so the faint
     halo shows no rings; the mask fades out towards the top, where the tree
     reaches into the header. */
  background: radial-gradient(ellipse 55% 60% at var(--sp-cx) 52%, #6d8ef2, #3fc1b5 45%, #3fc1b5);
  -webkit-mask: url(../img/site_playback_halo.png) center / 100% 100% no-repeat;
  mask: url(../img/site_playback_halo.png) center / 100% 100% no-repeat;
  pointer-events: none;
}
.sp-stage > svg { position: absolute; inset: 0; overflow: visible; }
.sp-ln { fill: none; stroke-width: 2.4; stroke-linecap: round; }
.sp-glow { fill: none; stroke: #6d8ef2; stroke-width: 8; opacity: .12; filter: blur(3px); stroke-linecap: round; }
.sp-flow path { fill: none; stroke-linecap: round; }
.sp-tail { stroke: var(--sp-in); }
.sp-comet { stroke: var(--sp-in); filter: drop-shadow(0 0 4px var(--sp-in-glow)); }
.sp-particle.sp-out .sp-tail { stroke: var(--sp-out-tail); }
.sp-particle.sp-out .sp-comet { stroke: var(--sp-out); filter: drop-shadow(0 0 4px var(--sp-out-glow)); }

.sp-kw {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 7px;
  transform: translate(-50%, -50%);
  border: 1px solid #f6d3b4;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(243, 154, 79, .16);
  font: 600 12px Barlow, sans-serif;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: border-color .3s, box-shadow .3s;
}
.sp-kw i { width: 6px; height: 6px; border-radius: 50%; background: var(--sp-in); box-shadow: 0 0 6px var(--sp-in-glow); }
.sp-kw.sp-out { border-color: #c9d6fa; box-shadow: 0 4px 12px rgba(74, 127, 224, .16); }
.sp-kw.sp-out i { background: var(--sp-out); box-shadow: 0 0 6px var(--sp-out-glow); }
.sp-kw.sp-idle { border-color: var(--sp-line); box-shadow: 0 3px 10px rgba(13, 42, 50, .08); color: var(--sp-muted); }
.sp-kw.sp-idle i { background: #c3c9d8; box-shadow: none; }
/* At the start and at the end, when nothing flows, the lines carry no labels,
   the nodes no service chips, and a battery no level. */
.sp-at-start .sp-kw, .sp-at-start .sp-svc, .sp-at-start .sp-soc { visibility: hidden; }
/* At rest a battery is the plain icon: the sprite's fixed level in the icon's colour, not its SoC. */
.sp-at-start .sp-level { y: 10.92px; height: 8.18px; fill: currentColor; }

.sp-node {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  color: #fff;
  background: radial-gradient(circle at 35% 28%, #2f6f7c, #123a44 55%, #0a1f25);
  box-shadow: 0 0 0 3px #d8e6fb, 0 12px 28px rgba(14, 80, 95, .38), inset 0 1px 0 rgba(255, 255, 255, .18);
  cursor: default;
  outline: none;
}
.sp-node:focus-visible { box-shadow: 0 0 0 3px #3e74b5, 0 12px 28px rgba(14, 80, 95, .38); }
/* Nodes with detailed results below open them when pressed. */
.sp-node.sp-linked { cursor: pointer; }
.sp-node.sp-linked:not(.sp-grid):hover { transform: scale(1.05); }
.sp-node { transition: transform .15s ease; }
.sp-node.sp-cp {
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  box-shadow: 0 0 0 3px #d8e6fb, 0 14px 32px rgba(14, 80, 95, .42), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.sp-node.sp-grid {
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  color: #3c5bc4;
  background: #fff;
  box-shadow: 0 0 0 3px #d8e6fb, 0 8px 20px rgba(109, 142, 242, .25);
}
.sp-ic { display: flex; }
.sp-soc {
  position: absolute;
  right: -8px;
  bottom: -6px;
  padding: 1px 6px;
  border: 1px solid #bfe8d6;
  border-radius: 999px;
  background: #fff;
  color: #13805b;
  box-shadow: 0 3px 8px rgba(13, 42, 50, .16);
  font: 600 10px/13px Barlow, sans-serif;
  font-variant-numeric: tabular-nums;
}
.sp-soc.sp-low { border-color: #f3c9c5; background: #fff5f4; color: #c2413a; }
.sp-level { transition: height .15s, y .15s; }
/* Income clouds: each node's result per step, rising and fading. */
.sp-cloud {
  position: absolute;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px 1px 5px;
  transform: translateX(-50%);
  border: 1px solid #bfe8d6;
  border-radius: 999px;
  background: rgba(255, 255, 255, .96);
  color: #13805b;
  box-shadow: 0 0 0 3px rgba(34, 192, 138, .08), 0 5px 13px rgba(22, 133, 93, .18);
  font: 600 11px/15px Barlow, sans-serif;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
  animation: sp-cloud 1.8s ease-out forwards;
}
.sp-cloud i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6fe3b7, #22a274);
  box-shadow: 0 0 6px rgba(34, 192, 138, .7);
}
.sp-cloud-neg {
  border-color: #f6d3b4;
  color: #c25a1c;
  box-shadow: 0 0 0 3px rgba(255, 154, 69, .08), 0 5px 13px rgba(243, 154, 79, .18);
}
.sp-cloud-neg i {
  background: radial-gradient(circle at 35% 30%, #ffc28e, #f0832e);
  box-shadow: 0 0 6px rgba(255, 140, 50, .7);
}
@keyframes sp-cloud {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(.8); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  55% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -44px) scale(.94); }
}
/* The services a node is paid for right now, under its name. */
.sp-svc {
  position: absolute;
  overflow: hidden;
  padding: 1px 7px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #eef0fa;
  color: #3c5bc4;
  font: 600 10px/14px Barlow, sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-svc-idle { background: transparent; color: var(--sp-muted); font-weight: 500; }
/* A node's name: up to two lines, cut short beyond that. */
.sp-name {
  position: absolute;
  display: -webkit-box;
  overflow: hidden;
  transform: translateX(-50%);
  font: 500 13px/15px Barlow, sans-serif;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}
.sp-cpname { position: absolute; font: 500 13px Barlow, sans-serif; white-space: nowrap; }

.sp-tip {
  position: absolute;
  bottom: calc(100% + 16px);
  left: 50%;
  z-index: 10;
  width: 220px;
  box-sizing: border-box;
  padding: 12px 14px;
  transform: translate(-50%, 4px);
  border-radius: 12px;
  background: #fff;
  color: var(--sp-ink);
  box-shadow: 0 12px 32px rgba(13, 42, 50, .18), 0 0 0 1px #e6ebf7;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transition: opacity .15s, transform .15s;
}
.sp-tip:after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 12px;
  height: 12px;
  background: #fff;
  transform: translateX(-50%) rotate(45deg);
  box-shadow: 1px 1px 0 #e6ebf7;
}
.sp-tip-left .sp-tip { left: auto; right: -20px; transform: translate(0, 4px); }
.sp-tip-left .sp-tip:after { left: auto; right: 44px; transform: rotate(45deg); }
.sp-tip-right .sp-tip { left: -20px; transform: translate(0, 4px); }
.sp-tip-right .sp-tip:after { left: 44px; transform: rotate(45deg); }
.sp-grid .sp-tip { bottom: auto; top: calc(100% + 16px); transform: translate(-50%, -4px); }
.sp-grid .sp-tip:after { bottom: auto; top: -6px; box-shadow: -1px -1px 0 #e6ebf7; }
/* A node being looked at, and its tooltip, sit above everything in the tree,
   including the day-ahead pill and chart. */
.sp-node:hover, .sp-node:focus-visible { z-index: 20; }
.sp-node:hover .sp-tip, .sp-node:focus-visible .sp-tip { opacity: 1; transform: translate(-50%, 0); }
.sp-tip-left:hover .sp-tip, .sp-tip-left:focus-visible .sp-tip,
.sp-tip-right:hover .sp-tip, .sp-tip-right:focus-visible .sp-tip { transform: translate(0, 0); }
.sp-tt { overflow: hidden; font: 600 14px Barlow, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.sp-tl { margin: 8px 0 4px; color: var(--sp-muted); font: 500 11px Barlow, sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.sp-tr, .sp-tn { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 0; font: 500 13px Barlow, sans-serif; }
.sp-tr b, .sp-tn b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-k { display: inline-flex; align-items: center; gap: 6px; color: #56607a; }
.sp-k:before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.sp-k-out:before { background: var(--sp-out); }
.sp-k-in:before { background: var(--sp-in); }
.sp-tn { margin-top: 6px; padding-top: 8px; border-top: 1px solid #f0f1f6; color: var(--sp-muted); }
.sp-tn b { color: var(--sp-ink); }
.sp-tn-flat { margin-top: 0; padding-top: 3px; border-top: 0; }
.sp-tn-sub { margin-top: 0; padding-top: 0; border-top: 0; font-size: 12px; }

/* ---------- controls ---------- */
.sp-controls {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
  margin-top: .5rem;
  padding: .45rem .7rem;
  border-radius: 12px;
  background: #f5f7fc;
}
.sp-controls button { border: 0; font-family: Barlow, sans-serif; }
.sp-play {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  background: radial-gradient(circle at 35% 28%, #2f6f7c, #123a44 55%, #0a1f25);
  box-shadow: 0 0 0 3px #d8e6fb, 0 5px 14px rgba(14, 80, 95, .3);
  transition: transform .15s;
}
.sp-play:hover { transform: scale(1.06); }
/* Fixed icon sizes: main.css stretches any svg without one to its box. */
.sp-play svg { width: 16px; height: 16px; }
.sp-restart svg, .sp-full-toggle svg { width: 14px; height: 14px; }
.sp-play svg { margin-left: 2px; }
.sp-playing .sp-play svg { margin-left: 0; }
.sp-restart {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #3c5bc4;
  background: #fff;
  box-shadow: 0 0 0 1px var(--sp-line);
}
.sp-restart:hover { background: #eef0fa; }
.sp-full-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #3c5bc4;
  background: #fff;
  box-shadow: 0 0 0 1px var(--sp-line);
}
.sp-full-toggle:hover { background: #eef0fa; }
.sp-full-toggle:focus-visible { outline: 2px solid #3e74b5; outline-offset: 2px; }

/* ---------- full screen ---------- */
.site-playback.sp-full {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 2rem 2.5rem 2rem !important;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-sizing: border-box;
}
.site-playback.sp-full:not(:fullscreen) {
  position: fixed;
  inset: 0;
  z-index: 2000;
}
.sp-full-page, .sp-full-page body { overflow: hidden; }
/* Content at a comfortable width, centred, with room around the tree. */
.site-playback.sp-full > * {
  width: 100%;
  max-width: 1600px;
  margin-right: auto;
  margin-left: auto;
}
.site-playback.sp-full .sp-tree-wrap { flex: 1 1 auto; min-height: 0; margin-top: 1rem; margin-bottom: 1rem; }
.site-playback.sp-full .sp-controls, .site-playback.sp-full .sp-finance { flex: 0 0 auto; }
/* The money row is as tall as its counters, the chart beside them matching. */
.site-playback.sp-full .sp-finance { margin-top: 1.25rem; }
.site-playback.sp-full .sp-counters { gap: .5rem; }
.site-playback.sp-full .sp-counter { padding: .65rem 1rem .65rem; }
.site-playback.sp-full .sp-counter-icon { top: .65rem; }
.site-playback.sp-full .sp-counter-value { margin-top: .3rem; }
.site-playback.sp-full .sp-counter-value b { font-size: 1.45rem; }
.site-playback.sp-full .sp-chart { min-height: 0; }
.sp-play:focus-visible, .sp-restart:focus-visible, .sp-speed button:focus-visible { outline: 2px solid #3e74b5; outline-offset: 2px; }
.sp-scrub { position: relative; flex: 1 1 260px; min-width: 200px; padding-bottom: 13px; }
.sp-range {
  --sp-fill: 0%;
  width: 100%;
  height: 6px;
  margin: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #6d8ef2, #3fc1b5) 0 0 / var(--sp-fill) 100% no-repeat, #dfe5f5;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.sp-range::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #123a44;
  box-shadow: 0 2px 6px rgba(13, 42, 50, .35);
  -webkit-appearance: none;
}
.sp-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #123a44;
  box-shadow: 0 2px 6px rgba(13, 42, 50, .35);
  box-sizing: border-box;
}
.sp-range:focus-visible { outline: 2px solid #3e74b5; outline-offset: 4px; }
.sp-ticks { position: absolute; right: 0; bottom: 0; left: 0; height: 12px; pointer-events: none; }
.sp-ticks span {
  position: absolute;
  top: 0;
  padding-left: 3px;
  border-left: 1px solid #c9d1e6;
  color: var(--sp-muted);
  font: 500 10px/12px Barlow, sans-serif;
  white-space: nowrap;
}
.sp-speed {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--sp-line);
}
.sp-speed-label { padding: 0 6px 0 8px; color: var(--sp-muted); font: 500 12px Barlow, sans-serif; }
.sp-speed button {
  min-width: 36px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #56607a;
  background: transparent;
  font: 600 12px Barlow, sans-serif;
}
.sp-speed button:hover { color: var(--sp-ink); background: #eef0fa; }
.sp-speed button[aria-pressed="true"] { color: #fff; background: #123a44; }

/* ---------- running money ---------- */
.sp-finance {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}
.sp-counters { display: grid; gap: .5rem; align-content: space-between; }
/* Like the total cards above the playback, as compact rows: label left,
   amount right. */
.sp-counter {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  padding: .55rem .9rem .6rem;
  overflow: hidden;
  border: 1px solid #e2e6ea;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(31, 41, 55, .04);
}
.sp-counter-icon {
  position: absolute;
  top: .85rem;
  right: 1rem;
  display: none;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 8px;
  color: #315d91;
  background: #e8eff8;
  font-size: .9rem;
}
.sp-rev .sp-counter-icon { color: #245640; background: #e3f2e6; }
.sp-cost .sp-counter-icon { color: #71360f; background: #fceddf; }
.sp-counter-label {
  margin: 0;
  color: #656d78;
  font: 500 .85rem/1.3 "Titillium Web", sans-serif;
}
.sp-counter-value { display: flex; align-items: baseline; gap: .4rem; }
.sp-counter-value b {
  color: #24282e;
  font: 600 1.25rem/1 Barlow, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
}
.sp-currency { color: #656d78; font: 600 .78rem/1 Barlow, sans-serif; letter-spacing: .04em; }
/* How far each total has come, as a hairline along the card's foot. */
.sp-counter-bar { position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: transparent; }
.sp-counter-bar span { display: block; width: 0; height: 100%; opacity: .7; }
.sp-rev .sp-counter-bar span { background: var(--sp-rev); }
.sp-cost .sp-counter-bar span { background: var(--sp-cost); }
.sp-profit .sp-counter-bar span { background: var(--sp-profit); }
.sp-profit .sp-counter-bar span.sp-neg { background: #c2413a; }

.sp-chart {
  position: relative;
  min-height: 150px;
  padding: .4rem .2rem 0;
  border: 1px solid #e2e6ea;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(31, 41, 55, .04);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}
.sp-chart svg { display: block; width: 100%; height: 100%; position: absolute; inset: 0; }
.sp-chart-grid line { stroke: #eef0f6; stroke-width: 1; }
.sp-chart-grid line.sp-zero { stroke: #c9d1e6; }
.sp-chart-grid text { fill: var(--sp-muted); font: 500 11px Barlow, sans-serif; }
.sp-chart-grid .sp-chart-axis-title { fill: #656d78; font: 600 11px Barlow, sans-serif; letter-spacing: .06em; }
.sp-line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.sp-line.sp-rev { stroke: var(--sp-rev); }
.sp-line.sp-cost { stroke: var(--sp-cost); }
.sp-line.sp-profit { stroke: var(--sp-profit); stroke-width: 2.75; }
.sp-area { fill: rgba(62, 116, 181, .08); }
.sp-cursor { stroke: #123a44; stroke-width: 1; stroke-dasharray: 3 3; opacity: .45; }
.sp-end { stroke: #fff; stroke-width: 2; }
.sp-end.sp-rev { fill: var(--sp-rev); }
.sp-end.sp-cost { fill: var(--sp-cost); }
.sp-end.sp-profit { fill: var(--sp-profit); }

/* Narrower windows: the legend stacks, so the clock's column stays narrow
   enough for the tree to be lifted beside it. */
@media (max-width: 1099.98px) {
  .sp-legend { flex-direction: column; gap: .15rem; }
}
@media (max-width: 767.98px) {
  .site-playback { padding: 1rem !important; }
  /* The price chart opens under its pill, a little smaller, so the grid, the
     pill and the chart fit in view together on a phone. */
  .sp-price-pop {
    top: calc(100% + 4px);
    left: 4px;
    scale: .75;
    transform-origin: 0 0;
  }
  .sp-price-pop:before { top: -7px; left: 18px; transform: rotate(135deg); }
  .sp-tree-wrap { margin: .5rem -1rem 0; }
  .sp-finance { grid-template-columns: 1fr; }
  .sp-chart { min-height: 200px; }
  /* Full screen on a phone scrolls, everything at its normal size. */
  .site-playback.sp-full { padding: 1rem !important; overflow-y: auto; }
  .site-playback.sp-full .sp-tree-wrap { flex: none; margin: .5rem -1rem 0; }
  .site-playback.sp-full .sp-chart { min-height: 200px; }
  .sp-speed-label { display: none; }
  /* One row of play, restart and speeds, the timeline below; no full
     screen on phones. */
  .sp-controls { gap: .45rem; padding: .6rem .6rem; }
  .sp-play { order: 0; width: 38px; height: 38px; }
  .sp-restart { order: 1; width: 30px; height: 30px; }
  .sp-speed { order: 2; margin-left: auto; padding: 2px; }
  .site-playback .sp-speed button { padding: 4px 5px; font-size: 12px; }
  .sp-scrub { order: 3; flex-basis: 100%; min-width: 0; }
  .sp-full-toggle { display: none; }
  .sp-speed button { min-width: 0; }
  .sp-legend { font-size: .78rem; }
}
@media (prefers-reduced-motion: reduce) {
  .sp-level, .sp-kw, .sp-play { transition: none; }
}
