:root {
  --fondo: #f4f4f2;
  --carta: #ffffff;
  --bordo: rgba(0, 0, 0, 0.07);
  --testo: #121212;
  --testo-2: #6d6d72;
  --testo-3: #a6a6ab;
  --pista: #ececee;
  --accento: #1f8a5b;
  --accento-chiaro: #dff1e8;
}

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

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 14px;
  user-select: none;
  -webkit-user-select: none;
}

.card {
  width: min(360px, 100%);
  background: var(--carta);
  border: 1px solid var(--bordo);
  border-radius: 22px;
  padding: clamp(14px, 3.6vmin, 20px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 18px 40px -18px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: clamp(9px, 2.2vh, 14px);
}

.head { display: flex; align-items: center; gap: 10px; }
.mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: #121212; display: grid; place-items: center; flex: none;
}
.mark svg { width: 20px; height: 20px; fill: none; stroke: #ffffff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.head__text { flex: 1; min-width: 0; }
.head__title { font-size: 15px; font-weight: 620; letter-spacing: -0.01em; }
.head__meta { font-size: 12px; color: var(--testo-2); margin-top: 1px; }
.head__time { font-size: 12px; color: var(--testo-3); font-variation-settings: "wdth" 90; }

.row { display: flex; align-items: baseline; justify-content: space-between; }
.row__label { font-size: 13px; color: var(--testo-2); }
.row__value { font-size: 14px; font-weight: 560; }
.row--total { padding-top: clamp(8px, 2vh, 12px); border-top: 1px dashed rgba(0, 0, 0, 0.12); }
.row--total .row__label { color: var(--testo); font-weight: 600; font-size: 14px; }
.total { font-size: clamp(22px, 5.4vmin, 26px); font-weight: 680; letter-spacing: -0.02em; }

.tip { display: flex; flex-direction: column; gap: 6px; }
.tip__head { display: flex; align-items: center; gap: 8px; }
.tip__amount { margin-left: auto; font-size: 14px; font-weight: 600; }

.custom {
  font: inherit; font-size: 11.5px; font-weight: 560;
  color: var(--testo-2);
  background: var(--fondo);
  border: 0; border-radius: 999px;
  padding: 3px 9px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.custom[aria-expanded="true"] { background: var(--accento-chiaro); color: var(--accento); }
@media (hover: hover) { .custom:hover { color: var(--testo); } }

/* the slider: room above for the bubble, the rail, the labels of the marks under it */
.slider { position: relative; padding: 30px 11px 0; touch-action: none; cursor: pointer; outline: none; }
.slider:focus-visible .handle__knob { box-shadow: 0 0 0 4px var(--accento-chiaro), 0 1px 3px rgba(0, 0, 0, 0.2); }
.rail { position: relative; height: 22px; }
.rail__track {
  position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px;
  border-radius: 6px; background: var(--pista); overflow: hidden;
}
.rail__fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accento); border-radius: 6px; }
.rail__notches { position: absolute; inset: 0; pointer-events: none; }
.notch {
  position: absolute; top: 50%; width: 2px; height: 10px; margin: -5px 0 0 -1px;
  border-radius: 2px; background: #d3d3d6;
}
.notch__in { display: block; width: 100%; height: 100%; border-radius: 2px; background: var(--accento); transform: scaleY(0); }

.handle { position: absolute; top: 50%; left: 0; width: 0; height: 0; }
.handle__knob {
  position: absolute; left: -11px; top: -11px;
  width: 22px; height: 22px; border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.18);
}

.bubble { position: absolute; left: 11px; top: 0; width: 0; height: 0; pointer-events: none; }
.bubble__in {
  position: absolute; left: 0; bottom: -24px; transform: translateX(-50%);
  background: #121212; color: #ffffff;
  font-size: 11.5px; font-weight: 620;
  padding: 3px 7px; border-radius: 7px;
  white-space: nowrap;
}
.bubble__in::after {
  content: ""; position: absolute; left: 50%; bottom: -3px; width: 7px; height: 7px; margin-left: -3.5px;
  background: #121212; transform: rotate(45deg); border-radius: 1px;
}

.marks { position: relative; height: 16px; margin-top: 2px; }
.markl {
  position: absolute; top: 0; transform: translateX(-50%);
  font-size: 11px; color: var(--testo-3); font-weight: 500;
  transition: color 0.2s;
}
.markl.on { color: var(--accento); font-weight: 640; }

.field { height: 0; overflow: hidden; }
.field__in {
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px;
  padding: 7px 10px; border-radius: 12px;
  background: var(--fondo);
}
.field__label { font-size: 12px; color: var(--testo-2); flex: 1; }
.field__input {
  width: 34px; text-align: right;
  font: inherit; font-size: 15px; font-weight: 620; color: var(--testo);
  border: 0; background: transparent; outline: none; padding: 0;
}
.field__unit { font-size: 13px; color: var(--testo-2); }

.pay {
  position: relative; overflow: hidden;
  height: clamp(42px, 9vh, 48px);
  border: 0; border-radius: 14px;
  background: #121212; color: #ffffff;
  font: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer;
  display: grid; place-items: center;
}
.pay > * { grid-area: 1 / 1; }
.pay__fill { position: absolute; inset: 0; background: var(--accento); transform: scaleX(0); transform-origin: 0 50%; }
.pay__label, .pay__wait, .pay__done { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.pay__wait, .pay__done { opacity: 0; }
.pay__wait svg { width: 20px; height: 20px; fill: none; stroke: #ffffff; stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 34 60; }
.pay__done svg { width: 18px; height: 18px; fill: none; stroke: #ffffff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.note { font-size: 11.5px; color: var(--testo-3); text-align: center; margin-top: -4px; }

/* rolling characters: every character is a small window with its glyph inside */
.roll { display: inline-flex; }
.ch { position: relative; display: inline-block; overflow: hidden; height: 1.2em; line-height: 1.2em; vertical-align: bottom; }
.ch__g { display: block; }
.ch__g + .ch__g { position: absolute; left: 0; top: 0; }

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

/* on large screens the card grows a little, as on a tablet at the table */
@media (min-width: 1000px) and (min-height: 700px) {
  .card { transform: scale(1.45); }
}
