:root {
  --paper: #f6f4ef;
  --ink: #1d1b18;
  --muted: #8b857b;
  --line: #e2ddd3;
  --accent: #3a4fd6;
  --accent-ink: #ffffff;
  --b1: #2b2925;
  --b2: #57534b;
  --b3: #8f897e;
  --b4: #c9c3b7;
  --b5: #e4dfd5;
  --chart: min(90vw, 54vh, 500px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2vh 16px;
}

.panel {
  width: min(560px, 100%);
  display: grid;
  justify-items: center;
  gap: clamp(6px, 1.6vh, 14px);
}

.head { text-align: center; display: grid; gap: clamp(2px, .6vh, 6px); }

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: "JetBrains Mono Variable", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand__mark { width: 12px; height: 12px; color: var(--accent); }

.title {
  font-size: clamp(17px, min(5vw, 3.6vh), 26px);
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: -.015em;
  line-height: 1.1;
}

.total {
  font-size: clamp(12px, 1.9vh, 14px);
  color: var(--muted);
}

.total__num {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* il selettore del periodo: la pastiglia la muove solo GSAP */
.period {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border-radius: 999px;
  background: #ece8e0;
  box-shadow: inset 0 0 0 1px var(--line);
}

.period__pill {
  position: absolute;
  top: 3px;
  left: 3px;
  height: calc(100% - 6px);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(29, 27, 24, .08), 0 4px 10px -4px rgba(29, 27, 24, .18);
}

.period__btn {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-size: clamp(11px, 1.7vh, 13px);
  font-weight: 500;
  color: var(--muted);
  padding: clamp(5px, .9vh, 7px) clamp(12px, 3.4vw, 18px);
  border-radius: 999px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: color .3s ease;
}

.period__btn.is-on { color: var(--ink); }

.period__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.chart {
  position: relative;
  width: var(--chart);
  height: var(--chart);
}

.chart__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.b { cursor: default; }

.b__shape { transition: filter .35s ease; }

.b.is-up .b__shape { filter: drop-shadow(0 6px 10px rgba(29, 27, 24, .16)) drop-shadow(0 1px 2px rgba(29, 27, 24, .12)); }

.b__ring { fill: none; stroke: #fff; stroke-opacity: .22; stroke-width: 1; }

.b__name, .b__val {
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.b__name { font-weight: 600; font-stretch: 104%; letter-spacing: -.01em; }

.b__val { font-family: "JetBrains Mono Variable", ui-monospace, monospace; font-variant-numeric: tabular-nums; }

/* il cartellino sopra la bolla indicata: lo posiziona GSAP */
.tip {
  position: absolute;
  left: 0;
  top: 0;
  padding: 7px 11px 8px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  box-shadow: 0 10px 24px -10px rgba(29, 27, 24, .5);
}

.tip::after {
  content: "";
  position: absolute;
  left: var(--arrow, 50%);
  bottom: -4px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: var(--ink);
  transform: rotate(45deg);
  border-radius: 1px;
}

.tip.is-below::after { bottom: auto; top: -4px; }

.tip__name { font-size: 12px; font-weight: 600; }

.tip__nums {
  margin-top: 2px;
  font-family: "JetBrains Mono Variable", ui-monospace, monospace;
  font-size: 10.5px;
  color: rgba(255, 255, 255, .72);
}

.tip__sep { color: rgba(255, 255, 255, .4); }
