/* The Open chest button of a made-up language app's daily rewards, alone on black. The pill is one element moved by
   GSAP (width, lift, press); its body, grain and sheen sit in a clipped layer, while the chest, its beam of light and
   the three coins sit outside the clip so they can leave the pill. A GSAP element never has a transform in the CSS. */
:root {
  --page: #000000;            /* the page */
  --pill-top: #23201c;        /* the top of the pill's body */
  --pill-bottom: #0e0d0b;     /* the bottom of the pill's body */
  --ink: #f6f1e6;             /* the words on the pill */
  --muted: #9b9384;           /* the small words */
  --gold: #e6c06a;            /* the gold of the light, the XP and the edge */
  --gold-deep: #a9792b;       /* the darker gold */
}

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

html, body { height: 100%; }

body {
  background: var(--page);
  color: var(--ink);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

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

.wrap {
  position: relative;
  padding: 150px 24px 40px;
  display: grid;
  place-items: center;
}

/* the warm light on the floor, it wakes up with the beam */
.glow {
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 360px;
  height: 160px;
  margin-left: -180px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(230, 192, 106, 0.22), rgba(230, 192, 106, 0.06) 55%, transparent);
  filter: blur(6px);
  opacity: 0.25;
  pointer-events: none;
}

.pill {
  position: relative;
  height: 64px;
  width: 232px;
  border-radius: 999px;
  --mx: 50%;
}

.pill__floor {
  position: absolute;
  inset: 8px 10% -10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.9);
  box-shadow: 0 18px 36px -8px rgba(0, 0, 0, 0.9), 0 6px 16px rgba(169, 121, 43, 0.12);
  filter: blur(4px);
}

.pill__clip {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background: linear-gradient(180deg, var(--pill-top), var(--pill-bottom));
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.1), inset 0 -10px 18px rgba(0, 0, 0, 0.5);
}

.pill__grain {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

/* a warm sheen inside the pill, it sits under the chest and brightens with the beam */
.pill__sheen {
  position: absolute;
  left: 0;
  top: -40%;
  width: 140px;
  height: 180%;
  background: radial-gradient(closest-side, rgba(230, 192, 106, 0.32), transparent);
  opacity: 0.18;
}

/* the gold thread on the edge: brushed, brighter on top, it follows the pointer */
.pill__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background:
    radial-gradient(120px 50px at var(--mx) 0%, rgba(255, 232, 170, 0.9), transparent 70%),
    linear-gradient(180deg, rgba(230, 192, 106, 0.55), rgba(169, 121, 43, 0.12) 55%, rgba(230, 192, 106, 0.28));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0.7;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.pill.is-hot .pill__edge { opacity: 1; }

.hit {
  position: absolute;
  inset: 0;
  z-index: 3;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
}
.hit:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.hit[aria-disabled="true"] { cursor: default; }

/* the chest */
.chest {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 46px;
  height: 42px;
  margin-top: -23px;
  z-index: 2;
  pointer-events: none;
}
.chest__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.7));
}
.chest__mouth { opacity: 0; }

/* the beam: a soft tapering column of gold light */
.beam {
  position: absolute;
  left: 50%;
  bottom: 24px;
  width: 90px;
  height: 150px;
  margin-left: -45px;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}
.beam::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(255, 226, 150, 0.75), rgba(230, 192, 106, 0.22) 45%, transparent 92%);
  clip-path: polygon(38% 100%, 62% 100%, 100% 0, 0 0);
  filter: blur(7px);
}
.beam__core {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 14px;
  height: 100%;
  margin-left: -7px;
  background: linear-gradient(0deg, rgba(255, 246, 214, 0.95), rgba(255, 230, 160, 0.3) 50%, transparent);
  filter: blur(4px);
}
.beam__dust {
  position: absolute;
  inset: 10% 20% 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255, 244, 210, 0.9), transparent),
    radial-gradient(1px 1px at 70% 55%, rgba(255, 244, 210, 0.8), transparent),
    radial-gradient(1.2px 1.2px at 45% 75%, rgba(255, 244, 210, 0.9), transparent),
    radial-gradient(1px 1px at 60% 15%, rgba(255, 244, 210, 0.7), transparent),
    radial-gradient(1px 1px at 32% 60%, rgba(255, 244, 210, 0.7), transparent);
}

.coin {
  position: absolute;
  left: 17px;
  top: 10px;
  width: 12px;
  height: 12px;
  opacity: 0;
  filter: drop-shadow(0 0 4px rgba(255, 220, 140, 0.55));
}

/* the words */
.words {
  position: absolute;
  left: 68px;
  top: 0;
  bottom: 0;
  right: 22px;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.state {
  position: absolute;
  left: 0;
  top: 50%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}
.state__main {
  font-weight: 640;
  font-size: 16.5px;
  letter-spacing: -0.01em;
  line-height: 20px;
  font-variation-settings: "wdth" 100;
  color: var(--ink);
}
.state__sub {
  font-style: normal;
  font-size: 12px;
  line-height: 15px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-variation-settings: "wdth" 96;
}
.state--xp, .state--done { opacity: 0; visibility: hidden; }

.xp { display: inline-flex; align-items: center; gap: 1px; color: var(--gold); }
.xp__plus { margin-right: 1px; }
.xp__unit { margin-left: 4px; font-size: 12.5px; font-variation-settings: "wdth" 112; letter-spacing: 0.04em; color: #c9a65a; }
.xp__digits { display: inline-flex; height: 20px; overflow: hidden; }
.reel { display: block; width: 0.62em; text-align: center; font-variant-numeric: tabular-nums; }
.reel span { display: block; height: 20px; line-height: 20px; }

.clock { display: inline-flex; vertical-align: top; height: 15px; overflow: hidden; color: #cfc6b4; }
.clock .cell { position: relative; display: inline-block; width: 0.6em; height: 15px; text-align: center; }
.clock .cell--sep { width: 0.32em; }
.clock .cell span { position: absolute; left: 0; right: 0; top: 0; }

/* the drawn pointer of the autopilot */
.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  fill: #f6f1e6;
  stroke: #000;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
  opacity: 0;
  z-index: 5;
}

@media (max-height: 460px) {
  .wrap { padding-top: 120px; }
}
