:root {
  --bg: #ffffff;
  --fir: #0f3a2b;
  --fir-hi: color-mix(in srgb, var(--fir), #ffffff 12%);
  --fir-lo: color-mix(in srgb, var(--fir), #000000 28%);
  --ivory: #f6f1e6;
  --paper: #fbf8f1;
  --paper-lo: #efe8da;
  --ink: #14231d;
  --berry: #b8213d;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 16px;
}
.live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* the button only moves (GSAP scales it); the face carries the look and the CSS press */
.xm {
  position: relative;
  display: block;
  width: min(304px, 100%);
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 30px;
  background: none;
  color: var(--ivory);
  font: inherit;
  text-align: left;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}
.xm[aria-busy="true"] { cursor: default; }

.xm__face {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  padding: 0 7px 0 22px;
  border-radius: inherit;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 30% 0%, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, var(--fir-hi) 0%, var(--fir) 55%, var(--fir-lo) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.20),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28),
    0 1px 2px rgba(10, 43, 32, 0.22),
    0 8px 16px -8px rgba(10, 43, 32, 0.42),
    0 24px 40px -24px rgba(10, 43, 32, 0.55);
  transition: transform 0.09s ease-out;
}
.xm:active .xm__face { transform: scale(0.975); transition-duration: 0.05s; }
.xm:focus-visible .xm__face { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fir), 0 8px 16px -8px rgba(10, 43, 32, 0.42); }

/* a soft light that follows the pointer over the pill */
.xm__light {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(90px 60px at var(--mx, 40%) 0%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
/* one sheen that crosses the pill when the date is set */
.xm__sheen {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 70px;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.16) 50%, rgba(255, 255, 255, 0) 80%);
  opacity: 0;
  pointer-events: none;
}

.xm__check {
  position: absolute;
  left: 19px;
  top: 50%;
  width: 17px;
  height: 17px;
  margin-top: -16.5px;
  fill: none;
  stroke: var(--ivory);
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}
.xm__check path { stroke-dasharray: 1; stroke-dashoffset: 1; }

.xm__text { position: relative; min-width: 0; display: grid; gap: 1px; padding-left: var(--shift, 0px); }
.xm__line { display: block; overflow: hidden; white-space: nowrap; }
.xm__line > span { display: block; overflow: hidden; text-overflow: ellipsis; }
.xm__line--a { height: 22px; font-size: 16.5px; line-height: 22px; font-weight: 660; font-stretch: 102%; letter-spacing: -0.012em; transition: font-stretch 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
.xm__line--b { height: 17px; font-size: 11.5px; line-height: 17px; font-weight: 540; color: rgba(246, 241, 230, 0.62); }
.xm__chip {
  display: inline-block;
  height: 16px;
  padding: 0 7px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(246, 241, 230, 0.34);
  line-height: 16px;
  font-size: 10.5px;
  font-weight: 620;
  color: var(--ivory);
}

/* the date window: a recessed paper tile, concentric with the pill's round end */
.xm__win { position: relative; width: 74px; height: 46px; }
.xm__paper {
  position: absolute;
  inset: 0;
  border-radius: 12px 23px 23px 12px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-lo) 100%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.22), inset 0 -1px 0 rgba(255, 255, 255, 0.7), 0 1px 0 rgba(255, 255, 255, 0.08);
}
.xm__paper::after {
  /* the drum fades into the paper above and below the chosen row */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--paper) 0%, rgba(251, 248, 241, 0) 34%, rgba(239, 232, 218, 0) 66%, var(--paper-lo) 100%);
  pointer-events: none;
}
.xm__drum { position: absolute; left: 22px; right: 4px; top: 0; bottom: 0; perspective: 120px; }
.xm__drum span {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 16px;
  margin-top: -8px;
  line-height: 16px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 680;
  font-stretch: 96%;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--ink);
  backface-visibility: hidden;
  will-change: transform, opacity;
}
.xm__drum span.is-hit { color: var(--berry); transition: color 0.3s ease; }
/* the chosen row: a faint pressed band behind the drum, like the lens of a picker */
.xm__row { position: absolute; left: 21px; right: 5px; top: calc(50% - 9px); height: 18px; border-radius: 6px; background: rgba(15, 58, 43, 0.055); box-shadow: inset 0 1px 1px rgba(15, 58, 43, 0.08), 0 1px 0 rgba(255, 255, 255, 0.8); }

.xm__ribbon { position: absolute; left: 0; top: 0; width: 74px; height: 46px; overflow: visible; pointer-events: none; }
/* the ribbon is a thin dry mark in the accent: a 2px band, two outlined loops and two short tails */
.rb__band { fill: var(--berry); }
.rb__shade { fill: rgba(20, 35, 29, 0.10); }
.rb__loop, .rb__tail { fill: none; stroke: var(--berry); stroke-width: 1.15; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.rb__knot { fill: var(--berry); }

@media (hover: hover) {
  .xm:not([aria-busy="true"]):hover .xm__light { opacity: 1; }
  .xm:not([aria-busy="true"]):hover .xm__line--a { font-stretch: 110%; }
}
@media (prefers-reduced-motion: reduce) {
  .xm__face, .xm__line--a, .xm__light { transition: none; }
  .xm:active .xm__face { transform: none; }
}
