/* Book a lane button. One graphite pill (.bowl__body, moved only by GSAP) on pure white: a deep satin face with a 1px
   edge catching the light on top, a layered shadow on the floor and a soft light under the pointer. On the left the
   words, stacked in four states that roll in and out; on the right a tiny lane seen from above, sunk into the pill:
   the boards, the gutters, the arrows and the approach dots, the lighter pin deck and the dark pit at the end, the ten
   pins in their triangle and the ball at the foul line. The pins and the ball are placed by the script on every frame
   (their children are moved by GSAP). */
:root {
  --page: #ffffff;              /* the page */
  --pill-hi: #2a2c31;           /* the top of the pill */
  --pill-lo: #121316;           /* the bottom of the pill */
  --lane: #1b1c20;              /* the lane, sunk into the pill */
  --deck: #23242a;              /* the pin deck, a little lighter */
  --ink: #f6f4ef;               /* the main words */
  --muted: #8d9099;             /* the small words */
  --pin: #f3efe7;               /* the pins */
  --accent: #ff5a36;            /* the one accent: the ball, the pin stripes, the tick, the hook line */
  --focus: #ff5a36;             /* the keyboard focus ring */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px 0;
}

.bowl {
  position: relative;
  width: min(90vw, 372px);
  height: 60px;
}

/* the soft shadow on the floor: it tightens when pressed */
.bowl__shadow {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -11px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(18, 20, 26, 0.3), rgba(18, 20, 26, 0));
  filter: blur(7px);
  pointer-events: none;
}

.bowl__btn {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bowl__btn:focus {
  outline: none;
}

.bowl__btn:focus-visible .bowl__body {
  box-shadow:
    0 0 0 2px var(--page),
    0 0 0 4px var(--focus),
    0 1px 1px rgba(14, 16, 22, 0.1),
    0 10px 24px -10px rgba(14, 16, 22, 0.45);
}

.bowl__body {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(10, 11, 14, 0.9),
    0 1px 1px rgba(14, 16, 22, 0.12),
    0 4px 8px -3px rgba(14, 16, 22, 0.18),
    0 14px 30px -12px rgba(14, 16, 22, 0.48);
  will-change: transform;
}

.bowl__face {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 140% at 22% -30%, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, var(--pill-hi) 0%, #1c1d21 52%, var(--pill-lo) 100%);
}

/* the 1px top edge of light and a darker lip at the bottom */
.bowl__face::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5);
}

/* the soft light under the pointer */
.bowl__glow {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(150px 74px at var(--mx, 30%) var(--my, 0px), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
  pointer-events: none;
}

/* the words: four states stacked in one window */
.bowl__words {
  position: absolute;
  left: 24px;
  right: calc(var(--lane-w, 164px) + 18px);
  top: 0;
  bottom: 0;
  overflow: hidden;
  text-align: left;
}

.bowl__state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
}

.bowl__state + .bowl__state {
  visibility: hidden;
}

.bowl__main {
  display: block;
  font-size: clamp(14.5px, 4.3vw, 16.5px);
  line-height: 19px;
  font-weight: 620;
  font-stretch: 100%;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.bowl__main--strike {
  display: flex;
  align-items: center;
}

.reels {
  display: inline-flex;
  vertical-align: top;
}

.bowl__main--num {
  font-variant-numeric: tabular-nums;
  font-stretch: 94%;
}

.bowl__sub {
  font-size: 11.5px;
  line-height: 14px;
  font-weight: 500;
  font-stretch: 104%;
  letter-spacing: 0.005em;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* a rolling digit: one box 1ch wide, a column of digits inside (moved by GSAP) */
.reel {
  position: relative;
  display: inline-block;
  height: 19px;
  overflow: hidden;
  vertical-align: top;
}

.reel__col {
  display: flex;
  flex-direction: column;
}

.reel__col > span {
  display: block;
  height: 19px;
  line-height: 19px;
  text-align: center;
}

.bowl__tick {
  width: 17px;
  height: 17px;
  margin-right: 6px;
  flex: none;
  overflow: visible;
}

.bowl__tick path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bowl__strike {
  display: inline-block;
  font-variation-settings: 'wdth' var(--sw, 100);
}

/* the lane: sunk into the pill on the right, seen from above, the ball rolling left to right */
.bowl__lane {
  position: absolute;
  top: 6px;
  bottom: 6px;
  right: 6px;
  width: var(--lane-w, 164px);
  border-radius: 18px 999px 999px 18px;
  overflow: hidden;
  background:
    repeating-linear-gradient(180deg, rgba(255, 244, 226, 0.035) 0 1px, rgba(255, 244, 226, 0) 1px 3.6px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.03) 70%, rgba(255, 255, 255, 0)),
    var(--lane);
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.75),
    inset 0 0 0 1px rgba(0, 0, 0, 0.45),
    0 1px 0 rgba(255, 255, 255, 0.07);
}

/* the gutters along the two sides */
.bowl__lane::before,
.bowl__lane::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.18));
  pointer-events: none;
}

.bowl__lane::before {
  top: 0;
}

.bowl__lane::after {
  bottom: 0;
  transform: scaleY(-1);
}

.bowl__marks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.bowl__marks .mark {
  fill: none;
  stroke: rgba(255, 244, 226, 0.2);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bowl__marks .foul {
  stroke: rgba(255, 244, 226, 0.14);
  stroke-width: 1;
}

.bowl__marks .dot {
  fill: rgba(255, 244, 226, 0.18);
}

.bowl__marks .aim {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-dasharray: 0.1 3.4;
}

/* the pin deck, a little lighter, and the pit at the end */
.bowl__deck {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 8px;
  width: var(--deck-w, 44px);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.035) 30%, rgba(255, 255, 255, 0.05));
}

.bowl__pit {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 9px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.75));
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.05);
}

.bowl__flash {
  position: absolute;
  top: -10px;
  bottom: -10px;
  right: -10px;
  width: 80px;
  opacity: 0;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 34%, transparent), transparent);
  pointer-events: none;
}

.bowl__pins {
  position: absolute;
  inset: 0;
}

/* a pin: the element is placed by the script; inside, the standing pin seen from above and the fallen pin lying on
   its side, swapped by GSAP when it tips over */
.pin {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
}

.pin__up,
.pin__down,
.pin__shade {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
}

.pin__shade {
  width: 9px;
  height: 9px;
  margin: -3.2px 0 0 -3.8px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
}

.pin__up {
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
}

.pin__down {
  width: 13.4px;
  height: 5.9px;
  margin: -2.95px 0 0 -6.7px;
  opacity: 0;
}

.pin__stripe {
  fill: none;
  stroke: var(--accent);
  stroke-width: 0.6;
}

.pin__edge {
  fill: none;
  stroke: rgba(0, 0, 0, 0.28);
  stroke-width: 0.4;
}

/* the sweep bar of the machine that clears the deck */
.bowl__sweep {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  opacity: 0;
  background: linear-gradient(180deg, #5b5e66, #3a3c42);
  box-shadow: 1px 0 3px rgba(0, 0, 0, 0.6), inset 1px 0 0 rgba(255, 255, 255, 0.18);
  transform-origin: 50% 0;
}

.ball {
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
}

.ball__shadow {
  position: absolute;
  left: 1px;
  top: 4px;
  width: 19px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
}

.ball__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ball__hole {
  fill: #2a0d06;
  stroke: rgba(255, 190, 170, 0.35);
  stroke-width: 0.35;
}

.ball__gloss {
  fill: rgba(255, 255, 255, 0.55);
}

.ball__rim {
  fill: none;
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 0.5;
}

@media (max-width: 360px) {
  .bowl__words {
    left: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bowl__body {
    will-change: auto;
  }
}
