:root {
  --fondo: #f4f4f1;
  --carta: #ffffff;
  --inchiostro: #141416;
  --testo: #3d3d43;
  --grigio: #8b8b92;
  --grigio-chiaro: #c4c4c9;
  --linea: #ececee;
  --accento: #4f5bd5;
  --accento-tenue: #eef0fd;
}

* { 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;
}

button { font: inherit; color: inherit; }

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

/* ---------- the card of the roadmap ---------- */
.mappa {
  position: relative;
  width: min(700px, 100%);
  background: var(--carta);
  border-radius: 20px;
  border: 1px solid #e9e9ec;
  box-shadow: 0 1px 2px rgba(20, 20, 22, 0.04), 0 22px 50px -24px rgba(20, 20, 22, 0.22);
  padding: clamp(14px, 3vh, 22px) clamp(14px, 4vw, 26px) clamp(12px, 2.6vh, 20px);
}

.testa { display: flex; align-items: center; gap: 11px; }
.marchio {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: var(--inchiostro); display: grid; place-items: center;
}
.marchio svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.testa__testo { min-width: 0; flex: 1; }
.testa__titolo { font-size: 15px; font-weight: 640; letter-spacing: -0.012em; line-height: 1.2; }
.testa__sotto { font-size: 12.5px; color: var(--grigio); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.testa__agg { font-size: 12px; color: var(--grigio); white-space: nowrap; align-self: flex-start; margin-top: 2px; }

/* ---------- the track: line, quarters, today, milestones ---------- */
.pista {
  position: relative;
  margin-top: clamp(14px, 3.4vh, 24px);
  height: 258px;
}
.is-verticale .pista { height: clamp(250px, calc(100vh - 128px), 460px); margin-top: clamp(10px, 2.6vh, 18px); }

.pista__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.linea { fill: none; stroke-linecap: round; }
.linea--fatta { stroke: var(--inchiostro); stroke-width: 1.6; }
.linea--futura { stroke: var(--grigio-chiaro); stroke-width: 1.6; stroke-dasharray: 2 5; }
.linea--piena { stroke: var(--accento); stroke-width: 2.6; }
.guide line { stroke: var(--linea); stroke-width: 1; }
.tacche path { stroke: var(--grigio-chiaro); stroke-width: 1.4; stroke-linecap: round; }
.oggi__tacca { stroke: var(--inchiostro); stroke-width: 1.6; stroke-linecap: round; fill: none; }

.trimestri { position: absolute; inset: 0; pointer-events: none; }
.trimestre {
  position: absolute; left: 0; top: 0;
  font-size: 11.5px; font-weight: 520; letter-spacing: 0.01em; color: var(--grigio);
  white-space: nowrap; font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}
.trimestre.is-qui { color: var(--inchiostro); }

.oggi {
  position: absolute; left: 0; top: 0;
  height: 18px; padding: 0 6px; border-radius: 6px;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; color: #fff; background: var(--inchiostro);
  white-space: nowrap; pointer-events: none;
}

.tappe { position: absolute; inset: 0; }
.tappa {
  /* the button is the whole hit area; left and top (set by the script) are the point of the diamond on the line */
  position: absolute; left: 0; top: 0; margin: -16px 0 0 -16px; width: 112px; height: 66px;
  padding: 0; border: 0; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.is-verticale .tappa { margin: -18px 0 0 -16px; width: 210px; height: 36px; }
.tappa:focus { outline: none; }
.tappa:focus-visible .rombo { outline: 2px solid var(--inchiostro); outline-offset: 3px; border-radius: 3px; }

.rombo {
  position: absolute; left: 8px; top: 8px; width: 16px; height: 16px;
  display: block; color: var(--inchiostro);
  transition: color 0.3s;
}
.rombo svg { display: block; width: 100%; height: 100%; overflow: visible; }
.rombo__fondo { fill: var(--carta); stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.rombo__pieno { fill: currentColor; }
.tappa--previsto .rombo { color: #9a9aa1; }
.tappa.is-passata .rombo { color: var(--accento); }
.tappa.is-attiva .rombo { color: var(--accento); }
.rombo__eco {
  position: absolute; inset: 0; opacity: 0;
  fill: none; stroke: var(--accento); stroke-width: 1.2;
}

.tappa__nome {
  position: absolute; left: 9px; top: 31px;
  display: flex; flex-direction: column; gap: 1px; text-align: left; white-space: nowrap;
  pointer-events: none;
}
.is-verticale .rombo { top: 10px; }
.is-verticale .tappa__nome { left: 34px; top: 9px; flex-direction: row; align-items: baseline; gap: 6px; }
.tappa__titolo { font-size: 12.5px; font-weight: 540; letter-spacing: -0.005em; color: var(--inchiostro); }
.tappa__stato { font-size: 11px; color: var(--grigio); }

/* ---------- the empty state ---------- */
.invito {
  position: absolute; left: 0; right: 0; bottom: 18px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 12px; color: var(--grigio-chiaro); pointer-events: none;
}
.invito svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.is-verticale .invito { display: none; }

/* ---------- the card that opens from a milestone ---------- */
.scheda {
  position: absolute; left: 0; top: 0; width: 272px;
  background: var(--carta);
  border: 1px solid #e7e7ea;
  border-radius: 14px;
  padding: 13px 14px 12px;
  box-shadow: 0 1px 2px rgba(20, 20, 22, 0.05), 0 16px 34px -14px rgba(20, 20, 22, 0.28);
  opacity: 0; visibility: hidden;
  z-index: 5;
}
.scheda.is-aperta { visibility: visible; }
.scheda__becco {
  position: absolute; left: 0; top: -6px; width: 11px; height: 11px; margin-left: -5.5px;
  background: var(--carta); border-left: 1px solid #e7e7ea; border-top: 1px solid #e7e7ea;
  border-top-left-radius: 3px; transform: rotate(45deg);
}
.is-verticale .scheda__becco { top: 0; left: -6px; margin-left: 0; margin-top: -5.5px; transform: rotate(-45deg); }

.scheda__su { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stato {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px 0 6px; border-radius: 7px;
  font-size: 11.5px; font-weight: 580;
  background: #f2f2f0; color: var(--testo);
}
.stato__icona { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.stato--corso { background: var(--accento-tenue); color: var(--accento); }
.stato--previsto { background: #f4f4f2; color: var(--grigio); }
.scheda__quando { font-size: 11.5px; color: var(--grigio); white-space: nowrap; font-variant-numeric: tabular-nums; }

.scheda__titolo { margin-top: 10px; font-size: 15px; font-weight: 640; letter-spacing: -0.015em; line-height: 1.25; }
.scheda__testo { margin-top: 4px; font-size: 12.5px; line-height: 1.5; color: var(--testo); }

.scheda__giu {
  margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--linea);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.nota { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1; font-size: 11.5px; color: var(--grigio); white-space: nowrap; }
.nota > span:not(.barra):not(.nota__perc) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nota svg { width: 13px; height: 13px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.barra { position: relative; flex: 1; max-width: 120px; height: 4px; border-radius: 4px; background: #ececef; overflow: hidden; }
.barra__piena { position: absolute; inset: 0; border-radius: inherit; background: var(--accento); transform-origin: 0 50%; transform: scaleX(0); }
.nota__perc { color: var(--accento); font-weight: 600; font-variant-numeric: tabular-nums; }

.voto {
  display: inline-flex; align-items: center; gap: 3px; flex: none;
  height: 26px; padding: 0 9px 0 6px; border-radius: 8px;
  border: 1px solid var(--linea); background: var(--carta); cursor: pointer;
  font-size: 12px; font-weight: 580; color: var(--testo); font-variant-numeric: tabular-nums;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.voto svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.voto__n { display: inline-block; min-width: 3ch; text-align: left; }
.voto[aria-pressed="true"] { color: var(--accento); border-color: #d4d8f7; background: var(--accento-tenue); }
.voto:focus-visible { outline: 2px solid var(--inchiostro); outline-offset: 2px; }
@media (hover: hover) {
  .voto:hover { border-color: #dcdce0; }
}

/* ---------- the drawn pointer of the autopilot ---------- */
.fantasma {
  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: 10;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
}

@media (max-width: 520px) {
  .testa__agg { display: none; }
  .marchio { width: 30px; height: 30px; }
}
