:root {
  --fondo: #000000;
  --carta: #0e0f14;
  --carta-alta: #191a22;
  --inchiostro: #eeedf3;
  --grigio: #8a8b99;
  --tenue: #55566a;
  --osso: #f1eee8;
  --osso-ombra: #dcd8d0;
  --scuro: #121318;
  --holo-1: #8ff1ff;
  --holo-2: #b9a2ff;
  --holo-3: #ff9fd4;
  --holo-4: #ffd79a;
  --holo-5: #a6ffd0;
  --font: 'Mona Sans Variable', system-ui, sans-serif;
  --perf: 70.5%;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 3vh, 32px) 12px;
  overflow: hidden;
}

/* the ticket: every size inside follows its width (cqw), the width follows the window, also in height */
.ticket {
  --mx: 72%;
  --my: 18%;
  --ang: 0deg;
  --lit: 0.35;
  position: relative;
  width: min(320px, 84vw, 60vh);
  aspect-ratio: 320 / 470;
  container-type: inline-size;
  perspective: 1400px;
}
/* a faint coloured light that the foil throws on the floor */
.ticket__glow {
  position: absolute;
  left: 8%; right: 8%; bottom: -7%;
  height: 22%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(185, 162, 255, 0.32), rgba(143, 241, 255, 0.12) 55%, transparent);
  filter: blur(18px);
  opacity: calc(0.45 + var(--lit) * 0.6);
  pointer-events: none;
  transition: background 0.6s ease;
}
.ticket[data-side="back"] .ticket__glow {
  background: radial-gradient(closest-side, rgba(241, 238, 232, 0.3), rgba(241, 238, 232, 0.08) 60%, transparent);
}
.ticket__tilt, .ticket__flip { position: absolute; inset: 0; transform-style: preserve-3d; }

/* the two faces share the notches of the perforation */
.face {
  position: absolute; inset: 0;
  border-radius: 6.5cqw;
  overflow: hidden;
  isolation: isolate;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  -webkit-mask:
    radial-gradient(circle at 0 var(--perf), transparent 3.6cqw, #000 3.7cqw) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% var(--perf), transparent 3.6cqw, #000 3.7cqw) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle at 0 var(--perf), transparent 3.6cqw, #000 3.7cqw) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% var(--perf), transparent 3.6cqw, #000 3.7cqw) right / 51% 100% no-repeat;
}
.face--front {
  color: var(--inchiostro);
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(185, 162, 255, 0.13), transparent 60%),
    radial-gradient(90% 50% at 0% 100%, rgba(143, 241, 255, 0.07), transparent 60%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    linear-gradient(160deg, var(--carta-alta), var(--carta) 55%, #0a0a0e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
}
.face--back {
  color: var(--scuro);
  transform: rotateY(180deg);
  background:
    radial-gradient(110% 60% at 50% 0%, #fbfaf7, transparent 70%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    linear-gradient(180deg, var(--osso), var(--osso-ombra));
}

/* the holographic foil: an engraved guilloche that only shows where the light falls */
.face__holo {
  position: absolute; inset: 0;
  z-index: -1;
  background: linear-gradient(115deg, var(--holo-1), var(--holo-2) 22%, var(--holo-3) 40%, var(--holo-4) 58%, var(--holo-5) 76%, var(--holo-1));
  background-size: 260% 260%;
  background-position: var(--mx) var(--my);
  opacity: calc(0.18 + var(--lit) * 0.62);
  mix-blend-mode: screen;
  -webkit-mask:
    radial-gradient(circle at var(--mx) var(--my), #000, rgba(0, 0, 0, 0.25) 32%, transparent 62%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='24'><path d='M0 12 C 6 2, 18 2, 24 12 S 42 22, 48 12' fill='none' stroke='black' stroke-width='.7'/><path d='M0 18 C 6 8, 18 8, 24 18 S 42 28, 48 18' fill='none' stroke='black' stroke-width='.5'/><path d='M0 6 C 6 -4, 18 -4, 24 6 S 42 16, 48 6' fill='none' stroke='black' stroke-width='.5'/></svg>");
  -webkit-mask-composite: source-in;
  mask:
    radial-gradient(circle at var(--mx) var(--my), #000, rgba(0, 0, 0, 0.25) 32%, transparent 62%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='24'><path d='M0 12 C 6 2, 18 2, 24 12 S 42 22, 48 12' fill='none' stroke='black' stroke-width='.7'/><path d='M0 18 C 6 8, 18 8, 24 18 S 42 28, 48 18' fill='none' stroke='black' stroke-width='.5'/><path d='M0 6 C 6 -4, 18 -4, 24 6 S 42 16, 48 6' fill='none' stroke='black' stroke-width='.5'/></svg>");
  mask-composite: intersect;
  -webkit-mask-size: 100% 100%, 15cqw 7.5cqw;
  mask-size: 100% 100%, 15cqw 7.5cqw;
}
/* the soft glare of the light itself */
.face__glare {
  position: absolute; inset: 0;
  z-index: -1;
  background: radial-gradient(42% 30% at var(--mx) var(--my), rgba(255, 255, 255, 0.16), transparent 70%);
  opacity: calc(0.3 + var(--lit) * 0.7);
  pointer-events: none;
}
/* the 1px rim that takes the light only near the pointer */
.face__rim {
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background:
    radial-gradient(38% 26% at var(--mx) var(--my), rgba(255, 255, 255, 0.75), transparent 75%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}
.face--back .face__rim {
  background:
    radial-gradient(38% 26% at var(--mx) var(--my), rgba(255, 255, 255, 0.95), transparent 75%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(0, 0, 0, 0.06));
}

/* front */
.front__top, .back__top {
  position: absolute; left: 7cqw; right: 7cqw; top: 7cqw;
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 3.3cqw;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 560;
  font-stretch: 112%;
}
.front__venue { color: var(--inchiostro); }
.front__admit { color: var(--grigio); }

.front__title {
  position: absolute; left: 7cqw; right: 7cqw; top: 20cqw;
}
.seal {
  display: block;
  width: 12.5cqw; height: 12.5cqw;
  margin-bottom: 5cqw;
  border-radius: 50%;
  background:
    radial-gradient(circle at calc(100% - var(--mx)) var(--my), rgba(255, 255, 255, 0.85), transparent 40%),
    conic-gradient(from var(--ang), var(--holo-1), var(--holo-2), var(--holo-3), var(--holo-4), var(--holo-5), var(--holo-1));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18) inset, 0 0.8cqw 3cqw rgba(0, 0, 0, 0.5);
}
.seal svg { display: block; width: 100%; height: 100%; fill: none; stroke: rgba(14, 15, 20, 0.42); stroke-width: 0.9; stroke-linecap: round; }
.seal__ring--in { stroke-dasharray: 1.2 1.6; }
.front__show {
  margin: 0;
  font-size: 13.4cqw;
  line-height: 0.92;
  font-weight: 720;
  font-stretch: 84%;
  letter-spacing: -0.03em;
  background: linear-gradient(105deg, var(--inchiostro) 0 34%, var(--holo-1) 42%, var(--holo-2) 48%, var(--holo-3) 54%, var(--holo-4) 60%, var(--inchiostro) 68% 100%);
  background-size: 280% 100%;
  background-position: calc(var(--mx) * 1.2 - 10%) 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.front__artist {
  margin: 2.6cqw 0 0;
  font-size: 4.2cqw;
  color: var(--grigio);
  font-weight: 460;
}

.facts {
  position: absolute; left: 7cqw; right: 7cqw; top: 75cqw;
  margin: 0;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 3.8cqw 3cqw;
}
.facts div:nth-child(1) { grid-column: span 2; }
.facts dt {
  font-size: 2.8cqw;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tenue);
  font-weight: 560;
  margin-bottom: 1cqw;
}
.facts dd {
  margin: 0;
  font-size: 4.6cqw;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* the perforation between ticket and stub */
.perf {
  position: absolute; left: 5.5cqw; right: 5.5cqw;
  top: var(--perf);
  height: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.16);
}

.stub {
  position: absolute; left: 7cqw; right: 7cqw; bottom: 7cqw;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 3cqw;
}
.count { position: relative; min-width: 0; }
.count__label {
  display: block;
  font-size: 2.8cqw;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tenue);
  font-weight: 560;
  margin-bottom: 1.4cqw;
}
.count__time {
  display: flex;
  font-size: 7.6cqw;
  font-weight: 640;
  font-stretch: 92%;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.01em;
}
.count__sep { width: 0.36em; text-align: center; color: var(--grigio); transform: translateY(-0.04em); }
.roll__col {
  position: relative;
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  overflow: hidden;
  -webkit-mask: linear-gradient(transparent, #000 22%, #000 78%, transparent);
  mask: linear-gradient(transparent, #000 22%, #000 78%, transparent);
}
.roll__strip { position: absolute; left: 0; top: 0; width: 100%; display: flex; flex-direction: column; }
.roll__strip span { height: 1.1em; line-height: 1.1em; text-align: center; }
.count__open {
  position: absolute; left: 0; bottom: 0;
  display: flex; align-items: center; gap: 1.8cqw;
  font-size: 5cqw; font-weight: 620;
  opacity: 0;
  white-space: nowrap;
}
.count__open svg { width: 5.6cqw; height: 5.6cqw; fill: none; stroke: var(--holo-5); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* the pill */
.pill {
  position: relative;
  flex: none;
  display: inline-flex; align-items: center; gap: 1.8cqw;
  height: max(32px, 11.5cqw);
  padding: 0 4.4cqw 0 3.6cqw;
  border-radius: 999px;
  color: var(--scuro);
  font-size: max(11px, 3.9cqw);
  font-weight: 620;
  font-stretch: 100%;
  isolation: isolate;
  transition: font-stretch 0.35s cubic-bezier(.3, 1.6, .5, 1);
  -webkit-tap-highlight-color: transparent;
}
.pill__fill {
  position: absolute; inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(180deg, #ffffff, #e2e0ea);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 -1px 0 rgba(0, 0, 0, 0.12) inset, 0 0.8cqw 2.4cqw rgba(0, 0, 0, 0.45);
  transition: transform 0.45s cubic-bezier(.3, 1.7, .45, 1);
}
.pill__icon { width: max(14px, 4.8cqw); height: max(14px, 4.8cqw); fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pill--light { color: var(--osso); }
.pill--light .pill__fill {
  background: linear-gradient(180deg, #2a2b33, #121318);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.16) inset, 0 0.8cqw 2.4cqw rgba(0, 0, 0, 0.25);
}
.pill:focus-visible { outline: none; }
.pill:focus-visible .pill__fill { box-shadow: 0 0 0 2px var(--fondo), 0 0 0 3.5px var(--holo-2); }
.pill--light:focus-visible .pill__fill { box-shadow: 0 0 0 2px var(--osso), 0 0 0 3.5px #6c5ae6; }
.pill.is-hover { font-stretch: 112%; }
.pill.is-hover .pill__fill { transform: scale(1.05, 1.08); }
@media (hover: hover) {
  .pill:hover { font-stretch: 112%; }
  .pill:hover .pill__fill { transform: scale(1.05, 1.08); }
}
.pill:active .pill__fill, .pill.is-down .pill__fill { transform: scale(0.95); transition-duration: 0.1s; }

/* back */
.back__top { color: var(--scuro); }
.back__gate { color: #77746d; }
.code {
  position: absolute;
  left: 50%; top: 17cqw;
  width: 66cqw; height: 66cqw;
  margin-left: -33cqw;
  padding: 4.2cqw;
  border-radius: 5cqw;
  background: #ffffff;
  box-shadow: 0 1px 0 #fff inset, 0 0 0 1px rgba(18, 19, 24, 0.06), 0 1.4cqw 4cqw -1cqw rgba(60, 50, 30, 0.22);
  overflow: hidden;
}
.code__canvas { display: block; width: 100%; height: 100%; }
/* the live band that runs over the code: a screenshot would freeze it */
.code__scan {
  position: absolute; left: 0; right: 0; top: 0;
  height: 9cqw;
  margin-top: -4.5cqw;
  background:
    linear-gradient(90deg, transparent, var(--holo-1) 18%, var(--holo-2) 40%, var(--holo-3) 60%, var(--holo-4) 82%, transparent);
  -webkit-mask: linear-gradient(transparent, #000 48%, #000 52%, transparent);
  mask: linear-gradient(transparent, #000 48%, #000 52%, transparent);
  opacity: 0.55;
  mix-blend-mode: multiply;
  pointer-events: none;
}
.code__corner {
  position: absolute; width: 4cqw; height: 4cqw;
  border: 0 solid rgba(18, 19, 24, 0.28);
}
.code__corner--tl { left: 1.6cqw; top: 1.6cqw; border-left-width: 1px; border-top-width: 1px; border-top-left-radius: 1.6cqw; }
.code__corner--tr { right: 1.6cqw; top: 1.6cqw; border-right-width: 1px; border-top-width: 1px; border-top-right-radius: 1.6cqw; }
.code__corner--bl { left: 1.6cqw; bottom: 1.6cqw; border-left-width: 1px; border-bottom-width: 1px; border-bottom-left-radius: 1.6cqw; }
.code__corner--br { right: 1.6cqw; bottom: 1.6cqw; border-right-width: 1px; border-bottom-width: 1px; border-bottom-right-radius: 1.6cqw; }

.back__seat {
  position: absolute; left: 7cqw; right: 7cqw; top: 87.5cqw;
  margin: 0;
  text-align: center;
  font-size: 4.3cqw;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.back__live {
  position: absolute; left: 7cqw; right: 7cqw; top: 95cqw;
  margin: 0;
  display: flex; align-items: center; justify-content: center; gap: 1.4cqw;
  font-size: 3.1cqw;
  color: #7a766e;
  font-weight: 500;
}
.back__live svg { width: 4cqw; height: 4cqw; fill: none; stroke: #6c5ae6; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.perf--back { border-top-color: rgba(18, 19, 24, 0.16); }
.back__foot {
  position: absolute; left: 7cqw; right: 7cqw; bottom: 7cqw;
  display: flex; align-items: center; justify-content: space-between; gap: 3cqw;
}
.renew { display: inline-flex; align-items: center; gap: 1.8cqw; font-size: 3.5cqw; color: #5d5a54; font-weight: 520; white-space: nowrap; }
.renew__ring { width: 5.4cqw; height: 5.4cqw; transform: rotate(-90deg); flex: none; }
.renew__ring circle { fill: none; stroke-width: 2; }
.renew__track { stroke: rgba(18, 19, 24, 0.1); }
.renew__arc { stroke: #6c5ae6; stroke-linecap: round; }
.renew__num { display: inline-block; min-width: 1.2em; text-align: right; font-variant-numeric: tabular-nums; color: var(--scuro); font-weight: 640; }

/* the pilot's pointer */
.pointer {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px;
  margin: -3px 0 0 -4px;
  fill: #ffffff;
  stroke: #111;
  stroke-width: 1.3;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}

@media (prefers-reduced-motion: reduce) {
  .pill, .pill__fill, .ticket__glow { transition: none; }
  .face--back { transform: none; }
  .face { backface-visibility: visible; -webkit-backface-visibility: visible; }
}
