:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --inchiostro: #0a0a0a;
  --grigio: #71717a;
  --grigio-chiaro: #a1a1aa;
  --morbido: #f4f4f5;
  --legno: #e9e2d6;
  --linea: rgba(10, 10, 10, 0.09);
  --accento: #4ade80;
}

* { 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; background: none; border: 0; cursor: pointer; }

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

/* the booker keeps the space of the open pill, so nothing around it jumps */
.booker {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  min-width: min(330px, calc(100vw - 32px));
  min-height: min(220px, 70vh);
}

/* the shell: a pill when closed, a wide capsule when open; GSAP animates its width, height and corners */
.shell {
  position: relative;
  width: 168px;
  height: 46px;
  border-radius: 23px;
  overflow: hidden;
  background: var(--carta);
  box-shadow: 0 1px 2px rgba(10, 10, 10, 0.18), 0 8px 18px -8px rgba(10, 10, 10, 0.45);
  isolation: isolate;
}
.shell__ink {
  position: absolute; inset: 0;
  background: var(--inchiostro);
  border-radius: inherit;
  z-index: 0;
}
.shell__edge {
  position: absolute; inset: 0;
  border: 1px solid var(--linea);
  border-radius: inherit;
  opacity: 0;
  z-index: 3;
  pointer-events: none;
}

.face {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  color: #fff;
  font-size: 14.5px;
  font-weight: 560;
  letter-spacing: -0.005em;
  white-space: nowrap;
  z-index: 2;
}
.face--idle { width: 100%; border-radius: 23px; }
.face--idle:focus-visible { outline: 2px solid #fff; outline-offset: -5px; }
.face--done { opacity: 0; pointer-events: none; visibility: hidden; }

.mini, .tick { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.tick { stroke: var(--accento); stroke-width: 2.1; }

/* the open capsule */
.panel {
  position: absolute; left: 0; top: 0;
  padding: 14px 14px 12px;
  opacity: 0;
  visibility: hidden;
  z-index: 1;
  color: var(--inchiostro);
}
.row--top {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* the table, seen from above */
.table { width: 72px; height: 72px; flex: none; overflow: visible; }
.table__top { fill: var(--legno); stroke: rgba(10, 10, 10, 0.12); stroke-width: 1; }
.table__shine { fill: none; stroke: rgba(255, 255, 255, 0.7); stroke-width: 1; stroke-dasharray: 9 63; stroke-linecap: round; }
.seat__ghost { fill: none; stroke: rgba(10, 10, 10, 0.16); stroke-width: 1; stroke-dasharray: 2 2; }
.seat__chair { fill: var(--inchiostro); }
.plate { fill: #fff; stroke: rgba(10, 10, 10, 0.22); stroke-width: 0.8; }

.guests { flex: 1; min-width: 0; }
.guests__label { font-size: 11px; font-weight: 540; color: var(--grigio); text-transform: uppercase; letter-spacing: 0.07em; }
.stepper { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.step {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid var(--linea);
  color: var(--inchiostro);
  transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}
.step svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.step[disabled] { opacity: 0.35; cursor: default; }
.count {
  position: relative;
  display: inline-block;
  width: 26px;
  height: 30px;
  overflow: hidden;
  text-align: center;
  /* the digits above and below fade at the edge of the window while they roll */
  -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
}
.count__roll { position: absolute; left: 0; top: 0; width: 100%; }
.count__roll span {
  display: block;
  height: 30px;
  line-height: 30px;
  font-size: 22px;
  font-weight: 640;
  letter-spacing: -0.02em;
}

.reserve {
  position: relative;
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border-radius: 15px;
  background: var(--inchiostro);
  color: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(10, 10, 10, 0.2), 0 6px 14px -6px rgba(10, 10, 10, 0.5);
}
.reserve__fill { position: absolute; inset: 0; background: var(--accento); transform: scale(0); border-radius: inherit; }
.reserve svg { position: relative; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* the time, as a row of segments */
.times {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  margin-top: 12px;
  padding: 3px;
  border-radius: 12px;
  background: var(--morbido);
}
.times__pill {
  position: absolute; left: 0; top: 3px;
  height: calc(100% - 6px);
  border-radius: 9px;
  background: var(--carta);
  box-shadow: 0 1px 2px rgba(10, 10, 10, 0.08), 0 2px 8px -2px rgba(10, 10, 10, 0.12);
}
.time {
  position: relative;
  z-index: 1;
  height: 30px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 540;
  color: var(--grigio);
  transition: color 0.25s ease;
}
.time[aria-checked="true"] { color: var(--inchiostro); }
.time[data-full] { color: var(--grigio-chiaro); text-decoration: line-through; text-decoration-thickness: 1px; cursor: default; }

.foot {
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--grigio);
}

.note {
  font-size: 12px;
  color: var(--grigio);
  opacity: 0;
  white-space: nowrap;
}
.note span { color: var(--inchiostro); font-weight: 520; }

@media (hover: hover) {
  .step:not([disabled]):hover { background: var(--morbido); border-color: rgba(10, 10, 10, 0.18); }
  .time:not([data-full]):hover { color: var(--inchiostro); }
}

/* the drawn pointer of the autopilot */
.ghost {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px;
  fill: var(--inchiostro);
  stroke: #fff; 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: 10;
}
