:root {
  --bg: #000000;
  --ink: #f4efe6;
  --soft: #8f887d;
  --pill-hi: #1f1d1a;
  --pill-lo: #121110;
  --brass: #d9b27c;
  --done: #a6cf9b;
  --oat: #d8c9ad;
  --sage: #8ea58a;
  --rust: #a8532f;
}

*, *::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;
  place-items: center;
  padding: 16px;
}

.wrap { position: relative; width: min(318px, calc(100vw - 32px)); }

.sw {
  --tone: var(--brass);
  position: relative;
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 0 8px;
  border: 0;
  border-radius: 99px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  isolation: isolate;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 24px -10px rgba(0, 0, 0, 0.9),
    0 22px 50px -18px color-mix(in srgb, var(--tone) 34%, transparent);
  transition: box-shadow 0.7s ease;
}
.sw.is-busy {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 24px -10px rgba(0, 0, 0, 0.9),
    0 22px 56px -14px color-mix(in srgb, var(--tone) 55%, transparent);
}
.sw.is-done {
  --tone: var(--done);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 24px -10px rgba(0, 0, 0, 0.9),
    0 22px 58px -14px color-mix(in srgb, var(--done) 55%, transparent),
    0 0 80px -24px color-mix(in srgb, var(--done) 60%, transparent);
}
.sw:focus-visible { outline: 2px solid #ffffff; outline-offset: 4px; }

.sw__body {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 50% -30%, rgba(255, 244, 226, 0.08), transparent 60%),
    linear-gradient(180deg, var(--pill-hi), var(--pill-lo));
  z-index: -2;
}
/* a fine grain, like the weave of a heavy cotton */
.sw__body::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 3px);
}
.sw__light { position: absolute; inset: 0; background: radial-gradient(140px 80px at var(--px, 50%) var(--py, 0%), rgba(255, 236, 205, 0.13), transparent 70%); opacity: 0; transition: opacity 0.3s ease; }
.sw.is-hot .sw__light { opacity: 1; }
.sw__sweep { position: absolute; top: 0; bottom: 0; left: 0; width: 46%; background: linear-gradient(100deg, transparent, color-mix(in srgb, var(--done) 22%, transparent) 45%, rgba(255, 255, 255, 0.12) 52%, transparent); transform: translateX(-120%); opacity: 0; }
.sw__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 240, 215, 0.32), rgba(255, 255, 255, 0.07) 42%, color-mix(in srgb, var(--tone) 30%, rgba(255, 255, 255, 0.04)));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: -1;
  transition: background 0.6s ease;
}
/* the hairline at the bottom: one third for every swatch cut */
.sw__line { position: absolute; left: 26px; right: 26px; bottom: 0; height: 1px; overflow: hidden; pointer-events: none; }
.sw__line span { display: block; height: 100%; background: linear-gradient(90deg, transparent, var(--tone) 18%, var(--tone) 82%, transparent); transform-origin: 0 50%; transform: scaleX(0); transition: background 0.5s ease; }

/* the well where the fabric is cut */
.well {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #262420, #0b0a09 75%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.9), inset 0 -1px 0 rgba(255, 255, 255, 0.06), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: grid;
  place-items: center;
}
.well__cut { position: relative; width: 26px; height: 26px; display: block; }
.well__svg { position: absolute; inset: -2px; width: 30px; height: 30px; overflow: visible; pointer-events: none; }
.well__zig { fill: none; stroke: #ffffff; stroke-width: 0.9; stroke-linejoin: miter; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0.9; }
.well__done { position: absolute; inset: 10px; width: 24px; height: 24px; overflow: visible; }
.well__tick { fill: none; stroke: var(--done); stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }

/* a fabric: the colour, the weave and a soft sheen, with pinked edges cut by clip-path */
.fab {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 1px;
  background-color: var(--c, var(--oat));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.fab::before, .fab::after { content: ""; position: absolute; inset: 0; clip-path: inherit; }
.fab--oat {
  --c: var(--oat);
  background-image:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.55) 0 0.7px, transparent 1.3px),
    radial-gradient(circle at 70% 70%, rgba(90, 70, 40, 0.32) 0 0.8px, transparent 1.4px),
    radial-gradient(circle at 70% 20%, rgba(255, 255, 255, 0.3) 0 0.6px, transparent 1.2px);
  background-size: 3.2px 3.2px, 3.6px 3.6px, 4.4px 4.4px;
}
.fab--sage {
  --c: var(--sage);
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.16) 0 0.6px, transparent 0.6px 2px),
    repeating-linear-gradient(90deg, rgba(30, 45, 30, 0.22) 0 0.7px, transparent 0.7px 2.2px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 7px);
}
.fab--rust {
  --c: var(--rust);
  background-image:
    linear-gradient(135deg, rgba(255, 190, 150, 0.38), transparent 38%, rgba(40, 8, 0, 0.35) 62%, rgba(255, 170, 120, 0.22)),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.05) 0 0.5px, transparent 0.5px 1.5px);
}
.fab::after { background: linear-gradient(160deg, rgba(255, 255, 255, 0.22), transparent 45%, rgba(0, 0, 0, 0.18)); }

.label { flex: 1; min-width: 0; display: grid; gap: 1px; }
.label__main { height: 20px; overflow: hidden; font-size: 15.5px; line-height: 20px; font-weight: 620; font-stretch: 104%; letter-spacing: -0.008em; color: var(--ink); }
.label__sub { height: 15px; overflow: hidden; font-size: 11.5px; line-height: 15px; font-weight: 500; color: var(--soft); }
.label span span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the tray on the right: Free at rest, the cut swatches when they land */
.tray {
  position: relative;
  flex: none;
  width: 64px;
  height: 44px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 1px 2px rgba(0, 0, 0, 0.6);
  transition: background-color 0.4s ease;
}
.tray__free { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13.5px; font-weight: 640; font-stretch: 108%; letter-spacing: 0.01em; color: var(--brass); }
.chip { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; display: block; pointer-events: none; filter: drop-shadow(0 2px 2.5px rgba(0, 0, 0, 0.7)); }
.chip .fab { inset: 0; }
.flyer { position: absolute; left: 0; top: 0; width: 26px; height: 26px; display: block; pointer-events: none; z-index: 4; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.65)); }
.flyer .fab { inset: 0; }
.crumb { position: absolute; width: 2px; height: 2px; border-radius: 0.5px; pointer-events: none; z-index: 3; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  fill: #ffffff;
  stroke: #14151a;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.6));
  opacity: 0;
  visibility: hidden;
  z-index: 5;
}
