Safeguard — two-key rule
Variant: Two-key rule
Dual control: an action that needs two people, each turning their own key, inside one shared 1.2s window. The window opens on whichever key turns first and drains from both ends toward the middle, so running out favours neither side. One key in turns its ring clay — half, and the clock running — and olive exists only once both rings can wear it on the same frame. The first time the reviewer takes a full second to cross on ease-in-out and arrives 260ms late; the barrel unlatches and throws the operator’s key back out from under their hand in 200ms, with the file’s one overshoot — 6° past off and back — because a return the spring made should look like a spring made it, not like a person changing their mind. Then both turn, the rail stops at half and fades, and the chip rolls from Locked to Authorized. Use it for production deploys behind a second approval, key-ceremony flows and payouts above a limit — anywhere the point is that no single person can.
The source
A complete HTML document. Paste it into an empty .html file and it plays — no stylesheet, script, font, or image to fetch.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Safeguard — two-key rule</title>
<style>
:root {
/* Neutrals — fixed, never remixed. */
--ivory: #faf9f5;
--paper: #ffffff;
--oat: #e3dacc;
--slate: #141413;
/* Knobs — the remix API. A knob exists iff declared here and used below. */
--hue: 38.8;
--lift: 0;
--chroma: 1;
--round: 1;
--speed: 1;
/* Accents — derived from the knobs with the family's offsets baked in,
so one hue roll moves them together. Defaults reproduce the original hex. */
--clay: oklch(calc(0.6724 + var(--lift)) calc(0.1308 * var(--chroma)) var(--hue));
--clay-d: oklch(calc(0.5797 + var(--lift)) calc(0.127 * var(--chroma)) var(--hue));
--olive: oklch(
calc(0.6118 + var(--lift)) calc(0.0713 * var(--chroma)) calc(var(--hue) + 88.3)
);
--rust: oklch(
calc(0.5408 + var(--lift)) calc(0.1357 * var(--chroma)) calc(var(--hue) - 10.3)
);
/* Clock — 6.8s: one turn that goes unanswered, then a pair that lands
inside the shared 1.2s window. */
--cycle: 6.8s;
--t: calc(var(--cycle) / var(--speed));
--_w: min(300px, 88vw);
--ease-out: cubic-bezier(0.23, 1, 0.32, 1);
--ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
--ease-accent: cubic-bezier(0.32, 0.72, 0, 1);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
min-height: 100vh;
display: grid;
place-items: center;
background: var(--ivory);
font-family:
system-ui,
-apple-system,
'Segoe UI',
Roboto,
sans-serif;
color: var(--slate);
}
.stage {
position: relative;
width: var(--_w);
height: 168px;
animation: rearm var(--t) infinite;
}
.key {
position: absolute;
top: 16px;
width: 64px;
margin-left: -32px;
display: grid;
justify-items: center;
gap: 8px;
font-size: 12px;
font-weight: 500;
color: color-mix(in srgb, var(--slate) 62%, var(--ivory));
}
.key.a {
left: 18%;
}
.key.b {
left: 82%;
}
.barrel {
position: relative;
width: 46px;
height: 46px;
border-radius: 50%;
background: var(--paper);
border: 1.5px solid var(--oat);
}
/* Detent marks at off and on, so a turned key reads as a position on a
dial rather than a decoration that happened to rotate. */
.barrel::before,
.barrel::after {
content: '';
position: absolute;
width: 2px;
height: 5px;
border-radius: 999px;
background: color-mix(in srgb, var(--slate) 30%, var(--oat));
}
.barrel::before {
left: calc(50% - 1px);
top: -10px;
}
.barrel::after {
right: -10px;
width: 5px;
height: 2px;
top: calc(50% - 1px);
}
.blade {
position: absolute;
left: calc(50% - 4px);
top: 8px;
width: 8px;
height: 27px;
border-radius: calc(3px * var(--round));
background: color-mix(in srgb, var(--slate) 78%, var(--oat));
transform-origin: 50% 15px;
}
/* The bow gives the blade a direction, so off and on read as a key
pointing somewhere rather than a bar that happens to lie flat. */
.blade::before {
content: '';
position: absolute;
left: calc(50% - 6px);
top: -3px;
width: 12px;
height: 12px;
border-radius: 50%;
background: inherit;
}
.a .blade {
animation: turn-a var(--t) infinite;
}
.b .blade {
animation: turn-b var(--t) infinite;
}
.ring {
position: absolute;
inset: -1.5px;
border-radius: 50%;
border: 2px solid var(--clay);
opacity: 0;
}
.a .ring.pending {
animation: pending var(--t) infinite;
}
.ring.ok {
border-color: var(--olive);
animation: ok var(--t) infinite;
}
.chip {
position: absolute;
left: calc(50% - 50px);
top: 27px;
width: 100px;
height: 26px;
overflow: hidden;
border-radius: 999px;
border: 1px solid var(--oat);
background: var(--paper);
font-size: 12px;
font-weight: 600;
}
.chip .roll {
animation: grant var(--t) infinite;
}
.chip span {
display: grid;
place-items: center;
height: 24px;
}
.chip span:first-child {
color: color-mix(in srgb, var(--slate) 62%, var(--ivory));
}
.chip span:last-child {
color: var(--olive);
}
/* One rail, shared, draining from both ends toward the middle: neither
side's clock runs out first, so neither holder can be blamed for the
lapse by where the light went. */
.rail {
position: absolute;
left: calc(18% + 32px);
right: calc(18% + 32px);
top: 104px;
height: 3px;
border-radius: 999px;
background: var(--oat);
overflow: hidden;
}
.rail i {
position: absolute;
inset: 0;
background: var(--clay);
transform: scaleX(0);
opacity: 0;
animation: window var(--t) infinite;
}
.caption {
position: absolute;
left: 0;
right: 0;
top: 118px;
height: 18px;
font-size: 12px;
font-weight: 500;
text-align: center;
}
.caption span {
position: absolute;
inset: 0;
opacity: 0;
color: color-mix(in srgb, var(--slate) 62%, var(--ivory));
}
.caption .idle {
animation: c-idle var(--t) infinite;
}
.caption .wait {
color: var(--clay-d);
animation: c-wait var(--t) infinite;
}
.caption .lapse {
animation: c-lapse var(--t) infinite;
}
.caption .both {
color: var(--slate);
animation: c-both var(--t) infinite;
}
.ghost {
position: absolute;
left: 0;
top: 0;
width: 14px;
height: 18px;
}
.ghost.a {
transform: translate(calc(var(--_w) * 0.06), 146px);
animation: hand-a var(--t) infinite;
}
.ghost.b {
transform: translate(calc(var(--_w) * 0.9), 146px);
animation: hand-b var(--t) infinite;
}
.tip {
position: absolute;
left: -9px;
top: -9px;
width: 20px;
height: 20px;
border-radius: 50%;
background: var(--clay-d);
opacity: 0;
transform: scale(0.5);
}
.ghost.a .tip {
animation: grip-a var(--t) infinite;
}
.ghost.b .tip {
animation: grip-b var(--t) infinite;
}
.arrow {
display: block;
width: 100%;
height: 100%;
fill: var(--slate);
stroke: var(--ivory);
stroke-width: 1.4;
stroke-linejoin: round;
}
/* A turn is a response to a hand, so it decelerates into the detent in
180ms. When the window lapses the barrel unlatches and the key is
thrown back out from under the hand — the spring doing it, not a
person, so it is faster: 200ms, with the one overshoot in the file,
6° past off and back. The hand is nudged off with it. */
@keyframes turn-a {
0%,
11.18% {
transform: rotate(0deg);
animation-timing-function: var(--ease-accent);
}
13.82%,
31.47% {
transform: rotate(90deg);
animation-timing-function: var(--ease-out);
}
33.24% {
transform: rotate(-6deg);
animation-timing-function: var(--ease-out);
}
34.41%,
44.12% {
transform: rotate(0deg);
animation-timing-function: var(--ease-accent);
}
46.76%,
89.7% {
transform: rotate(90deg);
}
89.71%,
100% {
transform: rotate(0deg);
}
}
@keyframes turn-b {
0%,
52.94% {
transform: rotate(0deg);
animation-timing-function: var(--ease-accent);
}
55.59%,
89.7% {
transform: rotate(90deg);
}
89.71%,
100% {
transform: rotate(0deg);
}
}
/* Clay means "half": one key in and the clock running. It never turns
olive on its own — the colour of done only exists once both rings
can wear it on the same frame. */
@keyframes pending {
0%,
13.82% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
15.2%,
31.47% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
33.24%,
46.76% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
48.1%,
55.59% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
57.35%,
100% {
opacity: 0;
}
}
@keyframes ok {
0%,
55.59% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
58.24%,
89.7% {
opacity: 1;
}
89.71%,
100% {
opacity: 0;
}
}
@keyframes grant {
0%,
55.59% {
transform: translateY(0);
animation-timing-function: var(--ease-accent);
}
58.24%,
89.7% {
transform: translateY(-24px);
}
89.71%,
100% {
transform: translateY(0);
}
}
/* 1.2s, linear, opened by whichever key turns first. The second turn
stops it with half left, and what is left simply fades — a window is
a limit, not a score. */
@keyframes window {
0%,
13.81% {
transform: scaleX(0);
opacity: 0;
}
13.82% {
transform: scaleX(1);
opacity: 1;
animation-timing-function: linear;
}
31.47%,
46.75% {
transform: scaleX(0);
opacity: 1;
}
46.76% {
transform: scaleX(1);
opacity: 1;
animation-timing-function: linear;
}
55.59% {
transform: scaleX(0.5);
opacity: 1;
animation-timing-function: var(--ease-out);
}
57.35%,
100% {
transform: scaleX(0.5);
opacity: 0;
}
}
@keyframes c-idle {
0%,
13% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
13.82%,
90.43% {
opacity: 0;
}
90.44%,
100% {
opacity: 1;
}
}
@keyframes c-wait {
0%,
13.82% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
15.2%,
30.6% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
31.47%,
46.76% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
48.1%,
54.8% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
55.59%,
100% {
opacity: 0;
}
}
@keyframes c-lapse {
0%,
31.47% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
32.8%,
44.12% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
45%,
100% {
opacity: 0;
}
}
@keyframes c-both {
0%,
55.59% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
57%,
89.7% {
opacity: 1;
}
89.71%,
100% {
opacity: 0;
}
}
@keyframes hand-a {
0%,
4.41% {
transform: translate(calc(var(--_w) * 0.06), 146px);
animation-timing-function: var(--ease-out);
}
10.29%,
31.47% {
transform: translate(calc(var(--_w) * 0.18 + 5px), 44px);
animation-timing-function: var(--ease-out);
}
33.24%,
41.18% {
transform: translate(calc(var(--_w) * 0.18 - 3px), 34px);
animation-timing-function: var(--ease-out);
}
44.12%,
63.24% {
transform: translate(calc(var(--_w) * 0.18 + 5px), 44px);
animation-timing-function: var(--ease-out);
}
72.06%,
100% {
transform: translate(calc(var(--_w) * 0.06), 146px);
}
}
/* The second holder takes a full second to cross, on ease-in-out —
deliberate rather than reactive — and arrives 260ms after the window
has already closed. Nothing about the controls blames them for it. */
@keyframes hand-b {
0%,
20.59% {
transform: translate(calc(var(--_w) * 0.9), 146px);
animation-timing-function: var(--ease-in-out);
}
35.29%,
63.24% {
transform: translate(calc(var(--_w) * 0.82 + 5px), 44px);
animation-timing-function: var(--ease-out);
}
72.06%,
100% {
transform: translate(calc(var(--_w) * 0.9), 146px);
}
}
@keyframes grip-a {
0%,
10.29% {
opacity: 0;
transform: scale(0.5);
animation-timing-function: var(--ease-out);
}
11.18%,
31.47% {
opacity: 0.4;
transform: scale(1);
animation-timing-function: var(--ease-out);
}
32.5%,
43.2% {
opacity: 0;
transform: scale(0.5);
animation-timing-function: var(--ease-out);
}
44.12%,
58.24% {
opacity: 0.4;
transform: scale(1);
animation-timing-function: var(--ease-out);
}
60.3%,
100% {
opacity: 0;
transform: scale(0.5);
}
}
@keyframes grip-b {
0%,
52.06% {
opacity: 0;
transform: scale(0.5);
animation-timing-function: var(--ease-out);
}
52.94%,
58.24% {
opacity: 0.4;
transform: scale(1);
animation-timing-function: var(--ease-out);
}
60.3%,
100% {
opacity: 0;
transform: scale(0.5);
}
}
@keyframes rearm {
0%,
85.29% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
89.71%,
90.44% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
100% {
opacity: 1;
}
}
@media (prefers-reduced-motion: reduce) {
/* Hands park, blades stop turning. Every state still lands — the
rings, the shared window, the chip — slowed by half again, because
which keys are in is the information and not the motion. */
.ghost {
opacity: 0;
animation: none;
}
.stage {
animation: rearm calc(var(--t) * 1.5) infinite;
}
.a .blade {
animation: turn-a-step calc(var(--t) * 1.5) infinite;
}
.b .blade {
animation: turn-b-step calc(var(--t) * 1.5) infinite;
}
.a .ring.pending {
animation: pending calc(var(--t) * 1.5) infinite;
}
.ring.ok {
animation: ok calc(var(--t) * 1.5) infinite;
}
.chip .roll {
animation: grant-step calc(var(--t) * 1.5) infinite;
}
.rail i {
animation: window calc(var(--t) * 1.5) infinite;
}
.caption .idle {
animation: c-idle calc(var(--t) * 1.5) infinite;
}
.caption .wait {
animation: c-wait calc(var(--t) * 1.5) infinite;
}
.caption .lapse {
animation: c-lapse calc(var(--t) * 1.5) infinite;
}
.caption .both {
animation: c-both calc(var(--t) * 1.5) infinite;
}
/* Keyframe-level curves override the animation's own, so stepped
states need their own hard stops — and the spring's overshoot is
dropped, since a twitch is exactly what this mode asks to lose. */
@keyframes turn-a-step {
0%,
13.81% {
transform: rotate(0deg);
}
13.82%,
31.47% {
transform: rotate(90deg);
}
31.48%,
46.75% {
transform: rotate(0deg);
}
46.76%,
89.7% {
transform: rotate(90deg);
}
89.71%,
100% {
transform: rotate(0deg);
}
}
@keyframes turn-b-step {
0%,
55.58% {
transform: rotate(0deg);
}
55.59%,
89.7% {
transform: rotate(90deg);
}
89.71%,
100% {
transform: rotate(0deg);
}
}
@keyframes grant-step {
0%,
55.58% {
transform: translateY(0);
}
55.59%,
89.7% {
transform: translateY(-24px);
}
89.71%,
100% {
transform: translateY(0);
}
}
}
</style>
</head>
<body>
<div
class="stage"
role="img"
aria-label="Two key switches, Operator and Reviewer, with a shared 1.2-second window between them. The operator turns their key; the reviewer arrives too late, the window lapses and the key springs back. The operator turns again, the reviewer turns inside the window, and the chip changes from Locked to Authorized"
>
<div class="key a">
<span class="barrel"
><i class="blade"></i><i class="pending ring"></i><i class="ok ring"></i
></span>
Operator
</div>
<div class="key b">
<span class="barrel"><i class="blade"></i><i class="ok ring"></i></span>
Reviewer
</div>
<div class="chip">
<div class="roll"><span>Locked</span><span>Authorized</span></div>
</div>
<div class="rail"><i></i></div>
<div class="caption">
<span class="idle">Both keys within 1.2s</span>
<span class="wait">Waiting on second key</span>
<span class="lapse">Window lapsed · key returned</span>
<span class="both">Authorized by two</span>
</div>
<span class="ghost a">
<span class="tip"></span>
<svg class="arrow" viewBox="0 0 14 18" xmlns="http://www.w3.org/2000/svg">
<path d="M1 1 L1 14.8 L4.5 11.6 L6.7 16.6 L9.3 15.4 L7.1 10.5 L11.8 10.3 Z" />
</svg>
</span>
<span class="ghost b">
<span class="tip"></span>
<svg class="arrow" viewBox="0 0 14 18" xmlns="http://www.w3.org/2000/svg">
<path d="M1 1 L1 14.8 L4.5 11.6 L6.7 16.6 L9.3 15.4 L7.1 10.5 L11.8 10.3 Z" />
</svg>
</span>
</div>
</body>
</html>
The variant family
Same idea, one axis moved. Compare them side by side before you commit.