:root {
  --fondo: #f5f5f3;
  --carta: #ffffff;
  --inchiostro: #121214;
  --grigio: #8a8a90;
  --linea: #ececef;
  --su: #0f9d6b;
  --giu: #e0484d;
  --stato: #0f9d6b;
}

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

html, body { height: 100%; overflow: hidden; }

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

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

.card {
  position: relative;
  width: min(620px, 100%);
  background: var(--carta);
  border-radius: 20px;
  padding: clamp(14px, 3.2vh, 22px) clamp(14px, 4vw, 24px) clamp(12px, 2.6vh, 18px);
  box-shadow: 0 1px 2px rgba(18, 18, 20, 0.05), 0 14px 40px -18px rgba(18, 18, 20, 0.22);
  border: 1px solid #ededf0;
}

/* ---------- head: the company and the range ---------- */
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.co { display: flex; align-items: center; gap: 10px; min-width: 0; }
.co__logo {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: var(--inchiostro); display: grid; place-items: center;
}
.co__logo svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 1.5; stroke-linejoin: round; }
.co__text { display: flex; flex-direction: column; min-width: 0; }
.co__name { font-size: 14px; font-weight: 620; letter-spacing: -0.01em; white-space: nowrap; }
.co__tick { font-size: 11.5px; color: var(--grigio); letter-spacing: 0.04em; }

.tabs {
  position: relative; display: flex; padding: 3px; border-radius: 999px; background: #f2f2f4; flex: none;
}
.tabs__pill {
  position: absolute; top: 3px; left: 0; height: calc(100% - 6px); border-radius: 999px;
  background: #fff; box-shadow: 0 1px 3px rgba(18, 18, 20, 0.12);
}
.tabs__tab {
  position: relative; z-index: 1; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 560; color: var(--grigio);
  padding: 5px 11px; border-radius: 999px; transition: color 0.25s;
}
.tabs__tab.is-on { color: var(--inchiostro); }
.tabs__tab:focus-visible { outline: 2px solid var(--inchiostro); outline-offset: 1px; }

/* ---------- the quote ---------- */
.quote { margin-top: clamp(10px, 2.4vh, 16px); }

.price {
  display: flex; align-items: flex-start;
  font-size: clamp(32px, min(9vw, 8.2vh), 44px);
  font-weight: 640; letter-spacing: -0.03em; line-height: 1;
  font-variation-settings: "wdth" 92;
}
.price__cur { font-size: 0.56em; margin-top: 0.1em; margin-right: 0.04em; font-weight: 560; }
.price__digits { display: flex; }
.d {
  position: relative; display: inline-block; height: 1.2em; margin: -0.1em 0; overflow: hidden; width: 0.6em; text-align: center;
  -webkit-mask-image: linear-gradient(transparent, #000 26%, #000 74%, transparent);
  mask-image: linear-gradient(transparent, #000 26%, #000 74%, transparent);
}
.d--narrow { width: 0.28em; line-height: 1.2em; overflow: visible; -webkit-mask-image: none; mask-image: none; }
.d__col { display: flex; flex-direction: column; will-change: transform; }
.d__col span { height: 1.2em; line-height: 1.2em; display: block; }

.change {
  margin-top: 6px; display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 560; color: var(--stato); transition: color 0.3s;
}
.change__tri { width: 9px; height: 9px; fill: currentColor; transition: transform 0.4s cubic-bezier(.3, 1.6, .5, 1); }
.change.is-down .change__tri { transform: scaleY(-1); }
.change__when { color: var(--grigio); font-weight: 450; margin-left: 2px; }

/* ---------- the chart ---------- */
.chart {
  position: relative; margin-top: clamp(8px, 2vh, 14px);
  height: clamp(110px, 31vh, 190px);
  touch-action: pan-y; cursor: crosshair;
  color: var(--stato); transition: color 0.3s;
}
.chart__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart__grid line { stroke: var(--linea); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart__open { stroke: #b9b9c0; stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.chart__dim { fill: none; stroke: #c9c9cf; stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart__area { fill: url(#area-fill); }
.chart__line {
  fill: none; stroke: currentColor; stroke-width: 2; vector-effect: non-scaling-stroke;
  stroke-linejoin: round; stroke-linecap: round;
}
.chart__openlab {
  position: absolute; right: 0; transform: translateY(-140%);
  font-size: 10px; color: var(--grigio); background: var(--carta); padding: 0 0 0 4px; letter-spacing: 0.02em;
}

.hair { opacity: 0; }
.hair__v { stroke: var(--inchiostro); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0.55; }
.hair__dot {
  position: absolute; left: 0; top: 0; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px;
  border-radius: 50%; background: currentColor; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(18, 18, 20, 0.25); opacity: 0; pointer-events: none;
}

.tag {
  position: absolute; left: 0; top: 0; pointer-events: none; opacity: 0;
  background: var(--inchiostro); color: #fff; border-radius: 9px; padding: 5px 8px 6px;
  display: flex; flex-direction: column; gap: 1px; white-space: nowrap;
  box-shadow: 0 6px 18px -6px rgba(18, 18, 20, 0.45);
}
.tag__price { font-size: 12.5px; font-weight: 620; letter-spacing: -0.01em; }
.tag__date { font-size: 10.5px; color: #b6b6bd; }

/* ---------- the stats ---------- */
.stats {
  margin-top: clamp(10px, 2.2vh, 16px); padding-top: clamp(8px, 1.8vh, 12px);
  border-top: 1px solid var(--linea);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.stats div { min-width: 0; }
.stats dt { font-size: 10.5px; color: var(--grigio); }
.stats dd { font-size: 12.5px; font-weight: 580; margin-top: 2px; white-space: nowrap; transition: color 0.3s, transform 0.35s cubic-bezier(.3, 1.8, .5, 1); transform-origin: 0 100%; }
.stats dd.is-hit { color: var(--stato); transform: scale(1.06); }

/* ---------- the drawn pointer of the autopilot ---------- */
.ghost {
  position: absolute; left: 0; top: 0; width: 22px; height: 22px;
  fill: #111113; stroke: #ffffff; stroke-width: 1.4; stroke-linejoin: round;
  pointer-events: none; opacity: 0; z-index: 5;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
}

@media (max-width: 380px) {
  .co__logo { width: 28px; height: 28px; }
  .co__name { font-size: 13px; }
  .tabs__tab { padding: 4px 8px; font-size: 11px; }
  .stats dd { font-size: 11.5px; }
  .change { font-size: 12px; }
}
