:root {
  --fondo: #000000;
  --carta: #0c0d10;
  --carta-2: #15171c;
  --testo: #f3f4f7;
  --testo-2: #9ea2ad;
  --testo-3: #5f636d;
  --linea: #23262d;
  --codice: #f6f7f9;         /* the plate the code is printed on */
  --modulo: #0c0d10;         /* the dark modules of the code */
  --accento: #8fa8ff;        /* the single accent: a pale periwinkle, on the time frame, the scan line, the ring and the check */
  --accento-scuro: #5f7cf0;
  --ombra: 0, 0, 0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { font-size: clamp(11px, min(3.5vw, 2.85vh), 18px); }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stage { min-height: 100vh; display: grid; place-items: center; padding: 1em; }

.card {
  position: relative;
  width: min(22em, 92vw);
  padding: 1.7em 1.7em 1.4em;
  border-radius: 1.6em;
  background: linear-gradient(180deg, var(--carta-2), var(--carta) 46%);
  box-shadow: 0 0 0 1px var(--linea), 0 1.6em 3.4em -1.2em rgba(var(--ombra), .9), inset 0 1px 0 rgba(255, 255, 255, .06);
  display: grid;
  justify-items: center;
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}
.card__light {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(18em 14em at var(--lx, 50%) var(--ly, 30%), rgba(143, 168, 255, .1), transparent 70%);
  opacity: 0;
}

.head { display: grid; justify-items: center; gap: .45em; }
.app {
  width: 2.3em; height: 2.3em; border-radius: .7em;
  display: grid; place-items: center;
  background: var(--testo); color: var(--carta);
  box-shadow: 0 .4em 1em -.4em rgba(143, 168, 255, .55);
  margin-bottom: .3em;
}
.app svg { width: 1.35em; height: 1.35em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.head__title { font-size: 1.32em; font-weight: 640; font-stretch: 104%; letter-spacing: -.02em; line-height: 1.2; }
.head__sub { font-size: .86em; color: var(--testo-2); line-height: 1.4; max-width: 18em; }

.roll { display: inline-grid; overflow: hidden; vertical-align: top; }
.roll__line { grid-area: 1 / 1; display: block; white-space: nowrap; }

/* the code: a square button. Every overlay sits on the same box (inset: 0) and centres its child with place-items,
   so the mark, the avatar, the check and the refresh sign share one true centre */
.code {
  position: relative;
  width: min(12.6em, 34vh);
  aspect-ratio: 1;
  margin: 1.35em 0 1em;
  border-radius: 1.05em;
  display: block;
  outline: none;
}
.code:focus-visible .code__plate { box-shadow: 0 0 0 .18em var(--carta), 0 0 0 .32em var(--accento); }
.code__time {
  position: absolute; inset: -.55em;
  width: calc(100% + 1.1em); height: calc(100% + 1.1em);
  overflow: visible; pointer-events: none;
}
.code__time rect { fill: none; stroke-width: .9; }
.code__time-track { stroke: var(--linea); }
.code__time-run { stroke: var(--accento); stroke-dasharray: 1 1; stroke-dashoffset: 0; stroke-linecap: round; }
.code__plate {
  position: absolute; inset: 0;
  border-radius: inherit;
  background: var(--codice);
  overflow: hidden;
  box-shadow: 0 .8em 1.8em -.8em rgba(143, 168, 255, .35), inset 0 0 0 1px rgba(255, 255, 255, .6);
}
.code__canvas { position: absolute; inset: 7%; width: 86%; height: 86%; display: block; }
.code__scan {
  position: absolute; left: 4%; right: 4%; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accento-scuro) 18%, var(--accento-scuro) 82%, transparent);
  box-shadow: 0 0 .9em .2em rgba(95, 124, 240, .35);
  opacity: 0;
}
.code__middle {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
}
.mark {
  width: 2.7em; height: 2.7em; border-radius: .78em;
  display: grid; place-items: center;
  background: var(--modulo); color: var(--codice);
  box-shadow: 0 0 0 .32em var(--codice);
}
.mark svg { width: 1.55em; height: 1.55em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }

.who { position: relative; width: 4.6em; height: 4.6em; display: grid; place-items: center; opacity: 0; }
.who__avatar {
  grid-area: 1 / 1;
  width: 3.7em; height: 3.7em; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(155deg, #b8c8ff, var(--accento-scuro));
  color: #0b0d18;
  font-weight: 700; font-size: 1em; letter-spacing: .02em;
  box-shadow: 0 0 0 .3em var(--codice), 0 .7em 1.4em -.4em rgba(20, 30, 80, .55);
}
.who__ring { grid-area: 1 / 1; width: 100%; height: 100%; overflow: visible; opacity: 0; }
.who__ring circle { fill: none; stroke-width: 2.4; }
.who__ring-track { stroke: rgba(95, 124, 240, .18); }
.who__ring-arc { stroke: var(--accento-scuro); stroke-dasharray: .26 .74; stroke-linecap: round; }

.done {
  width: 4em; height: 4em; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accento-scuro); color: #fff;
  box-shadow: 0 0 0 .32em var(--codice), 0 .8em 1.6em -.4em rgba(40, 60, 170, .6);
  opacity: 0;
}
.done svg { width: 2em; height: 2em; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.done path { stroke-dasharray: 1 1; stroke-dashoffset: 1; }

.expired {
  width: 3.4em; height: 3.4em; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--modulo); color: var(--codice);
  box-shadow: 0 0 0 .32em var(--codice);
  opacity: 0;
}
.expired svg { width: 1.6em; height: 1.6em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.status { font-size: .98em; font-weight: 560; letter-spacing: -.005em; min-height: 1.4em; }

.foot { margin-top: .9em; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: .8em; }
.timer { font-size: .78em; color: var(--testo-2); white-space: nowrap; }
.timer__n { font-family: "Geist Mono Variable", ui-monospace, monospace; color: var(--testo); font-variant-numeric: tabular-nums; }

.pill {
  position: relative;
  height: 2.45em; padding: 0 1.05em;
  border-radius: 99em;
  background: var(--carta-2);
  box-shadow: inset 0 0 0 1px var(--linea), inset 0 1px 0 rgba(255, 255, 255, .06);
  font-size: .84em; font-weight: 560;
  transition: box-shadow .25s ease, background .25s ease;
}
.pill__face { display: inline-flex; align-items: center; gap: .45em; }
.pill__icon { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pill.is-hot { background: var(--accento); color: #0b0d18; box-shadow: inset 0 0 0 1px var(--accento), 0 .5em 1.2em -.4em rgba(143, 168, 255, .6); }
@media (hover: hover) {
  .pill:hover { box-shadow: inset 0 0 0 1px var(--testo-3), inset 0 1px 0 rgba(255, 255, 255, .08); }
  .pill.is-hot:hover { box-shadow: inset 0 0 0 1px var(--accento), 0 .6em 1.4em -.4em rgba(143, 168, 255, .75); }
  .alt:hover { color: var(--testo); }
}
.pill:focus-visible, .alt:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }

.alt { margin-top: 1.05em; font-size: .78em; color: var(--testo-3); text-decoration: none; transition: color .25s ease; }

@media (max-height: 470px) {
  .card { padding: 1.2em 1.4em 1em; }
  .head__sub { display: none; }
  .code { margin: 1em 0 .75em; }
  .alt { margin-top: .7em; }
}
