:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --bordo: rgba(17, 17, 20, 0.08);
  --testo: #141416;
  --testo-2: #6b6b73;
  --testo-3: #a0a0a8;
  --pillola: #141416;
  --pillola-testo: #ffffff;
  --accento: #ff5a36;
  --accento-chiaro: #fff0eb;
  --focus: #5b6cff;
}

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

html, body { height: 100%; }

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

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

/* the delivered order: status, rider, total, the pill */
.order {
  position: relative;
  width: min(340px, 100%);
  padding: clamp(14px, 3.6vh, 20px) 18px 18px;
  border-radius: 24px;
  background: var(--carta);
  box-shadow: 0 0 0 1px var(--bordo), 0 1px 2px rgba(17, 17, 20, 0.04), 0 24px 48px -28px rgba(17, 17, 20, 0.28);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 3.4vh, 18px);
}

.order__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--testo-2);
}
.status { display: inline-flex; align-items: center; gap: 5px; font-weight: 560; color: #1f8a4c; }
.status svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shop { font-weight: 520; }

.rider { display: flex; align-items: center; gap: 12px; }

/* GSAP owns the avatar's transform (the little jump); the face inside is for the CSS */
.avatar { position: relative; flex: none; width: 48px; height: 48px; }
.ring { position: absolute; inset: -6px; width: 60px; height: 60px; transform: rotate(-90deg); overflow: visible; fill: none; }
.ring__line { stroke: var(--accento); stroke-width: 2; stroke-linecap: round; }
.avatar__face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(120% 120% at 30% 20%, #ffe2d6 0%, #ffc7b3 70%, #ffb59c 100%);
  box-shadow: inset 0 0 0 1px rgba(17, 17, 20, 0.06), inset 0 -5px 10px rgba(160, 60, 30, 0.12);
}
.avatar__shine { position: absolute; inset: 0; background: radial-gradient(60% 40% at 35% 15%, rgba(255, 255, 255, 0.55), transparent 70%); }
.avatar__helmet { position: absolute; left: 4px; top: 8px; width: 40px; height: 40px; fill: #2a2a30; }
.avatar__helmet .visor { fill: #7d8aa6; opacity: 0.9; }

.rider__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rider__name { font-size: 16px; font-weight: 620; letter-spacing: -0.01em; }
/* one line at a time: the old note leaves, then the new one comes in */
.rider__note {
  position: relative;
  display: block;
  height: 18px;
  overflow: hidden;
  font-size: 13.5px;
  line-height: 18px;
  color: var(--testo-2);
  white-space: nowrap;
}
.note { display: block; }
.note b { font-weight: 600; color: var(--accento); }

.total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: clamp(10px, 2.6vh, 14px);
  border-top: 1px dashed rgba(17, 17, 20, 0.12);
  font-size: 14px;
}
.total__label { color: var(--testo-2); }
.total__win { position: relative; display: block; height: 22px; overflow: hidden; }
.total__value { display: block; font-size: 17px; line-height: 22px; font-weight: 640; font-variant-numeric: tabular-nums; }

/* the pill: GSAP owns its width and transform; the label row and the chips are children, one shown at a time */
.tip {
  position: relative;
  align-self: center;
  height: 52px;
  border-radius: 999px;
  background: var(--pillola);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 10px 22px -12px rgba(17, 17, 20, 0.55);
}
.tip__fill {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: var(--accento);
  transform: scale(0);
  pointer-events: none;
}
.tip__main {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--pillola-testo);
  font: inherit;
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 22px;
  white-space: nowrap;
}
.tip__main:focus-visible, .amt:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.coin { display: inline-grid; width: 20px; height: 20px; margin-right: 8px; overflow: hidden; }
.coin svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.tick { flex: none; width: 0; height: 20px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tip__label { position: relative; display: block; height: 22px; overflow: hidden; }
.lab { display: block; line-height: 22px; }

.tip__chips {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  visibility: hidden;
}
.amt {
  position: relative;
  flex: none;
  width: 64px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font: inherit;
  font-size: 15px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.amt.is-on { background: var(--accento); box-shadow: none; }
@media (hover: hover) {
  .amt:hover { background: rgba(255, 255, 255, 0.18); }
  .amt.is-on:hover { background: var(--accento); }
}

/* the coin that flies to the rider lives on the stage, above everything */
.flycoin {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a6b 0%, var(--accento) 60%, #e2431f 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35), 0 6px 12px -6px rgba(200, 60, 30, 0.6);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  visibility: hidden;
  pointer-events: none;
  z-index: 3;
}

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

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
