:root {
  --fondo: #fafafa;
  --card: #ffffff;
  --inchiostro: #111113;
  --grigio: #6f6f77;
  --grigio-chiaro: #a1a1aa;
  --bordo: rgba(17, 17, 19, 0.09);
  --terra: #f1f1f3;
  --isolato: #e7e7ea;
  --strada: #ffffff;
  --accento: #3d5afe;
  --accento-velo: rgba(61, 90, 254, 0.08);
}

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

html, body { height: 100%; }

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

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 14px;
}

.track {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: 20px;
  padding: clamp(12px, 3.4vmin, 20px);
  display: grid;
  gap: clamp(9px, 2.4vh, 14px);
  box-shadow: 0 1px 2px rgba(17, 17, 19, 0.04), 0 18px 40px -24px rgba(17, 17, 19, 0.22);
}

/* ---------- head ---------- */
.track__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.track__kicker { font-size: 12px; color: var(--grigio); font-variation-settings: "wdth" 100; }
.track__kicker span { color: var(--grigio-chiaro); }
.track__title {
  position: relative;
  margin-top: 3px;
  font-size: clamp(18px, 4.6vmin, 22px);
  font-weight: 640;
  letter-spacing: -0.02em;
  line-height: 1.15;
  height: 1.2em;
}
.eta, .done { display: inline-flex; align-items: baseline; gap: 0.26em; white-space: nowrap; }
.eta__num {
  position: relative; display: inline-block; overflow: hidden;
  height: 1.15em; vertical-align: bottom;
  color: var(--accento);
  font-variation-settings: "wdth" 112;
}
.eta__num > span { display: block; }
.eta__num > span + span { position: absolute; left: 0; top: 0; }
.done { position: absolute; left: 0; top: 0; align-items: center; opacity: 0; }
.done svg { width: 1em; height: 1em; fill: none; stroke: var(--accento); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.track__clock {
  font-size: 12px; color: var(--grigio-chiaro);
  padding: 4px 8px; border-radius: 999px; border: 1px solid var(--bordo);
}

/* ---------- map ---------- */
.map {
  position: relative;
  height: clamp(110px, 30vh, 176px);
  border-radius: 14px;
  overflow: hidden;
  background: var(--terra);
  box-shadow: inset 0 0 0 1px rgba(17, 17, 19, 0.05);
}
.map svg { display: block; width: 100%; height: 100%; overflow: visible; }
.map__ground { fill: var(--terra); }
.map__blocks rect { fill: var(--isolato); }
.map__streets path { fill: none; stroke: var(--strada); stroke-width: 9; stroke-linecap: round; }
.map__names text { font-size: 6.4px; fill: var(--grigio-chiaro); letter-spacing: 0.04em; font-variation-settings: "wdth" 90; }

.route { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.route--rest { stroke: #c3c3cb; stroke-width: 2.2; stroke-dasharray: 0.1 5.4; stroke-width: 2.6; }
.route--done { stroke: var(--accento); stroke-width: 3.4; }

.pin__bg { fill: var(--card); stroke: var(--bordo); stroke-width: 1; }
.pin { filter: drop-shadow(0 2px 3px rgba(17, 17, 19, 0.12)); }
.pin__icon path { fill: none; stroke: var(--inchiostro); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.pin--home.is-here .pin__bg { fill: var(--accento); stroke: var(--accento); }
.pin--home.is-here .pin__icon path { stroke: #fff; }
.pin__door { transform-box: fill-box; transform-origin: 0% 50%; }

.van { filter: drop-shadow(0 3px 4px rgba(17, 17, 19, 0.18)); }
.van__bg { fill: var(--accento); }
.van__icon path, .van__icon circle { fill: none; stroke: #fff; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.van__icon circle { fill: var(--accento); }

.tip { opacity: 0; pointer-events: none; }
.tip__bg { fill: var(--inchiostro); }
.tip__text { font-size: 8.4px; fill: #fff; font-weight: 560; letter-spacing: 0.01em; }

/* ---------- steps ---------- */
.steps {
  position: relative;
  display: grid; grid-template-columns: repeat(4, 1fr);
  list-style: none;
}
.steps__line {
  position: absolute; left: 12.5%; right: 12.5%; top: 15px; height: 2px;
  background: #ececef; border-radius: 2px; overflow: hidden;
}
.steps__fill { position: absolute; inset: 0; background: var(--accento); transform-origin: 0 50%; transform: scaleX(0.333); }
.step {
  position: relative;
  display: grid; justify-items: center; gap: 3px;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}
.step__ring {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card);
  border: 1.5px solid #e2e2e6;
  transition: border-color 0.3s, background-color 0.3s;
}
.step__ring svg { width: 16px; height: 16px; fill: none; stroke: var(--grigio-chiaro); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.3s; }
.step__name { font-size: 11.5px; font-weight: 520; color: var(--grigio); margin-top: 3px; white-space: nowrap; transition: color 0.3s; }
.step__time { font-size: 10.5px; color: var(--grigio-chiaro); }
.step.is-on .step__ring { border-color: var(--accento); background: var(--accento-velo); }
.step.is-on .step__ring svg { stroke: var(--accento); }
.step.is-on .step__name { color: var(--inchiostro); }
.step.is-now .step__ring { background: var(--accento); }
.step.is-now .step__ring svg { stroke: #fff; }

/* ---------- courier ---------- */
.courier {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding-top: clamp(8px, 2.2vh, 12px);
  border-top: 1px solid var(--bordo);
}
.courier__face {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: #f1f1f3; color: var(--grigio);
  font-size: 11.5px; font-weight: 620; letter-spacing: 0.02em;
}
.courier__text { display: grid; gap: 1px; min-width: 0; }
.courier__name { font-size: 13px; font-weight: 600; }
.courier__van { font-weight: 450; color: var(--grigio-chiaro); }
.courier__line { position: relative; display: block; height: 1.3em; overflow: hidden; font-size: 12px; color: var(--grigio); }
.courier__line > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.courier__line > span + span { position: absolute; left: 0; top: 0; right: 0; }

.msg {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px 0 11px;
  border: 0; border-radius: 999px;
  background: var(--inchiostro); color: #fff;
  font: inherit; font-size: 12.5px; font-weight: 560;
  font-variation-settings: "wdth" 100;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: font-variation-settings 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.msg svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
@media (hover: hover) {
  .msg:hover { font-variation-settings: "wdth" 112; }
  .step:hover .step__ring { border-color: var(--accento); }
}
.msg.is-hover { font-variation-settings: "wdth" 112; }
.step.is-hover .step__ring { border-color: var(--accento); }
.msg:focus-visible, .step:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }

.ghost {
  position: absolute; left: 0; top: 0; width: 22px; height: 22px;
  fill: #111113; stroke: #fff; stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  opacity: 0; pointer-events: none; z-index: 5;
}

@media (max-width: 380px) {
  .track__kicker span, .courier__van { display: none; }
  .step__name { font-size: 10.5px; }
  .step__ring { width: 28px; height: 28px; }
  .steps__line { top: 13px; }
}
