:root {
  --bg: #000000;
  --ink: #101116;
  --pill-hi: #ffffff;
  --pill-lo: #e4e6ee;
  --seat: #101116;
  --accent: #6d5cff;
  --accent-soft: #b9b0ff;
}

*, *::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;
}

/* ---- the pill ---- */
.key {
  position: relative;
  width: min(296px, calc(100vw - 32px));
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 0 9px;
  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;
}
.key:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 4px; }

/* the light the pill throws on the black behind it: white at rest, the accent once inside */
.key__glow {
  position: absolute;
  inset: -2px 14px -16px;
  border-radius: 99px;
  background: #ffffff;
  filter: blur(22px);
  opacity: 0.16;
  z-index: -3;
  transition: opacity 0.6s ease, background-color 0.6s ease;
}
.key.is-in .key__glow { background: var(--accent); opacity: 0.55; }

.key__body {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background: linear-gradient(180deg, var(--pill-hi), var(--pill-lo));
  z-index: -2;
}
/* a breath of the accent that stays on the pill once inside */
.key__tint {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent 62%);
  opacity: 0;
}
/* the sheen that crosses the pill when the passkey is accepted */
.key__sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 38%, color-mix(in srgb, var(--accent) 30%, #ffffff) 47%, #ffffff 50%, color-mix(in srgb, var(--accent) 22%, #ffffff) 54%, transparent 63%);
}
/* a soft shade that follows the pointer */
.key__light {
  position: absolute;
  inset: 0;
  background: radial-gradient(130px 80px at var(--px, 50%) var(--py, 0%), color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.key.is-hot .key__light { opacity: 1; }
.key__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 #ffffff, inset 0 -1px 0 rgba(16, 17, 22, 0.12), inset 0 0 0 1px rgba(16, 17, 22, 0.05);
  pointer-events: none;
  z-index: -1;
}

/* ---- the seat: the key, the ring that closes round it, the avatar ---- */
.seat {
  position: relative;
  flex: none;
  width: 42px;
  height: 42px;
}
.seat__disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 0%, #2c2e38, var(--seat) 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 2px 5px rgba(16, 17, 22, 0.28);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.seat__glyph { width: 24px; height: 24px; overflow: visible; }
.seat__glyph circle, .seat__glyph path { fill: none; stroke: #ffffff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.seat__glyph .seat__hole { fill: #ffffff; stroke: none; }
.seat__ring, .seat__ripple {
  position: absolute;
  left: -6px;
  top: -6px;
  width: 54px;
  height: 54px;
  overflow: visible;
  pointer-events: none;
}
.seat__ring { transform: rotate(-90deg); }
.seat__ring circle, .seat__ripple circle { fill: none; stroke-width: 2; stroke-linecap: round; }
.seat__track { stroke: rgba(16, 17, 22, 0.09); opacity: 0; transition: opacity 0.3s ease; }
.key.is-busy .seat__track { opacity: 1; }
.seat__arc { stroke: var(--accent); stroke-dasharray: 1; stroke-dashoffset: 1; }
.seat__ripple { opacity: 0; }
.seat__ripple circle { stroke: var(--accent); }

.avatar {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.55), transparent 46%),
    linear-gradient(140deg, var(--accent-soft), var(--accent) 55%, color-mix(in srgb, var(--accent) 70%, #14102e));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 14px;
  font-weight: 680;
  letter-spacing: 0.02em;
  transform: scale(0);
}

/* ---- the words ---- */
.label {
  flex: 1;
  min-width: 0;
  height: 22px;
  overflow: hidden;
  font-size: 15.5px;
  line-height: 22px;
  font-weight: 620;
  font-stretch: 104%;
  letter-spacing: -0.008em;
}
.label__word { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.3s ease; }
.key.is-busy .label__word { font-stretch: 94%; font-weight: 540; color: #4a4d5a; }

/* ---- the small tick that opens on the right ---- */
.done {
  flex: none;
  width: 0;
  height: 30px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 3px 8px -2px color-mix(in srgb, var(--accent) 70%, transparent);
  display: grid;
  place-items: center;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
}
.done svg { width: 18px; height: 18px; flex: none; }
.done path { fill: none; stroke: #ffffff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }

.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: #101116;
  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;
}
