:root {
  --fondo: #ffffff;
  --card: #ffffff;
  --inchiostro: #111113;
  --grigio: #6d6d75;
  --grigio-chiaro: #a1a1aa;
  --anello: #d9d9de;
  --bordo: rgba(17, 17, 19, 0.09);
  --riga: rgba(17, 17, 19, 0.06);
  --campo: #f4f4f5;
  --sopra: #fafafa;
  --accento: #16a061;
  --row: clamp(40px, 10.6vh, 48px);
  --bottone: clamp(36px, 9.4vh, 42px);
}

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

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

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

.card {
  position: relative;
  width: min(380px, 100%);
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: 20px;
  padding: clamp(12px, 3.6vh, 16px) clamp(12px, 3.6vw, 16px);
  box-shadow: 0 1px 2px rgba(17, 17, 19, 0.04), 0 22px 50px -26px rgba(17, 17, 19, 0.24);
}

/* ---------- head ---------- */
.head { display: flex; align-items: center; gap: 10px; }
.head__ico {
  flex: none;
  width: clamp(30px, 8vh, 34px); height: clamp(30px, 8vh, 34px);
  border-radius: 10px;
  background: var(--campo);
  display: grid; place-items: center;
}
.head__ico svg { width: 18px; height: 18px; fill: none; stroke: var(--inchiostro); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.head__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.head__title { font-size: clamp(13.5px, 3.6vh, 15px); font-weight: 640; letter-spacing: -0.012em; white-space: nowrap; }
.head__sub { margin-top: 1px; font-size: 12px; color: var(--grigio); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.head__state { position: relative; display: grid; justify-items: end; flex: none; height: 20px; overflow: hidden; }
.state {
  grid-area: 1 / 1;
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px;
  font-size: 12px; font-weight: 560; color: var(--grigio-chiaro);
  white-space: nowrap;
  opacity: 0;
}
.state[data-st="idle"] { opacity: 1; }
.state--issue { color: var(--inchiostro); }
.state--ok { color: var(--accento); }
.state svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* text that shines while it waits */
.state--run, .meta.is-shimmer {
  background: linear-gradient(90deg, var(--grigio-chiaro) 0%, var(--grigio-chiaro) 38%, #e4e4e7 50%, var(--grigio-chiaro) 62%, var(--grigio-chiaro) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 1.5s linear infinite;
}
.meta.is-shimmer { background-image: linear-gradient(90deg, var(--grigio) 0%, var(--grigio) 38%, #d4d4d8 50%, var(--grigio) 62%, var(--grigio) 100%); }
@keyframes shine { from { background-position: 100% 0; } to { background-position: -150% 0; } }

.rerun {
  flex: none;
  width: 28px; height: 28px;
  margin-right: -4px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: var(--grigio);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.rerun__in { display: grid; place-items: center; }
.rerun svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .rerun:hover { background: var(--campo); color: var(--inchiostro); } }
.rerun:focus-visible { outline: 2px solid var(--accento); outline-offset: 1px; }

/* ---------- the segments: one per check ---------- */
.segs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: clamp(10px, 3vh, 14px) 0 clamp(4px, 1.2vh, 6px); }
.segs i { display: block; height: 4px; border-radius: 4px; background: var(--campo); overflow: hidden; }
.segs b { display: block; height: 100%; border-radius: inherit; background: var(--accento); transform: scaleX(0); transform-origin: 0 50%; }
.segs i.is-issue b { background: var(--grigio-chiaro); }

/* ---------- the checks ---------- */
.checks { list-style: none; margin: 0 -8px; }
.check {
  position: relative;
  height: var(--row);
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  border-radius: 11px;
  transition: background-color 0.2s ease;
}
.check + .check::before {
  content: ""; position: absolute; left: 40px; right: 8px; top: 0;
  height: 1px; background: var(--riga);
}
.check.is-issue { background: var(--sopra); }
@media (hover: hover) { .check:hover { background: var(--sopra); } }

.mark { width: 20px; height: 20px; display: block; }
.mark svg { width: 20px; height: 20px; overflow: visible; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mark__ring { stroke: var(--anello); stroke-width: 1.5; }
.mark__arc { stroke: var(--accento); stroke-width: 1.6; opacity: 0; }
.mark__tick { stroke: var(--accento); stroke-width: 1.7; opacity: 0; }
.mark__bang { stroke: var(--inchiostro); stroke-width: 1.7; opacity: 0; }

.check__text { display: flex; flex-direction: column; min-width: 0; }
.check__name {
  font-size: 13.5px; font-weight: 580; letter-spacing: -0.006em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color 0.3s ease;
}
.check.is-idle .check__name { color: var(--grigio); }
.check__meta { position: relative; display: block; height: 16px; margin-top: 1px; overflow: hidden; }
.meta {
  display: block;
  font-size: 12px; line-height: 16px; color: var(--grigio-chiaro);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.meta.is-done { color: var(--grigio); }
.meta.is-issue { color: var(--inchiostro); }
.meta b { display: inline-block; min-width: 1.25em; font-weight: 620; color: var(--inchiostro); }

.check__end { display: grid; justify-items: end; align-items: center; min-width: 40px; }
.check__end > * { grid-area: 1 / 1; }
.time { font-size: 11.5px; color: var(--grigio-chiaro); }

.fix {
  height: 26px; padding: 0 10px 0 8px;
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px;
  background: var(--inchiostro); color: #fff;
  font-size: 12px; font-weight: 600;
  box-shadow: 0 1px 2px rgba(17, 17, 19, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  opacity: 0; visibility: hidden;
  transition: background-color 0.2s ease;
}
.fix svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.fix.is-hover { background: #2b2b30; }
@media (hover: hover) { .fix:hover { background: #2b2b30; } }
.fix:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }

/* ---------- the publish button ---------- */
.foot { margin-top: clamp(8px, 2.4vh, 12px); }
.publish {
  position: relative;
  width: 100%;
  height: var(--bottone);
  border-radius: 12px;
  background: var(--campo);
  color: var(--grigio-chiaro);
  font-size: 13.5px; font-weight: 600; letter-spacing: -0.005em;
  display: grid; place-items: center;
  overflow: hidden;
  cursor: not-allowed;
  transition: box-shadow 0.25s ease;
}
.publish.is-ready { cursor: pointer; box-shadow: 0 1px 2px rgba(17, 17, 19, 0.2), 0 8px 18px -10px rgba(17, 17, 19, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.14); }
.publish.is-ready.is-hover { box-shadow: 0 1px 2px rgba(17, 17, 19, 0.2), 0 10px 22px -10px rgba(17, 17, 19, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.14); }
@media (hover: hover) { .publish.is-ready:hover { box-shadow: 0 1px 2px rgba(17, 17, 19, 0.2), 0 10px 22px -10px rgba(17, 17, 19, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.14); } }
.publish:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }
.publish__face {
  grid-area: 1 / 1;
  display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap;
}
.publish__face[data-pface="busy"], .publish__face[data-pface="live"] { opacity: 0; }
.publish__face svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.publish__spin circle { stroke-dasharray: 9 40; }
.publish__shine { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.publish__shine i {
  position: absolute; top: 0; bottom: 0; left: 0; width: 34%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0));
  opacity: 0;
}

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

@media (max-width: 380px) {
  .check { gap: 10px; }
  .check + .check::before { left: 38px; }
  .check__name { font-size: 13px; }
  .meta { font-size: 11.5px; }
  .head__sub { font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .state--run, .meta.is-shimmer { animation: none; }
}
