/* The hard lock: the drand round plaque, the League call and the recovery key. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- live round plaque (base styles; it now sits in the machine, see the end of this file) ---------- */
.drand-plaque {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 8px;
  margin: 10px auto 0; padding: 5px 12px 5px 9px; border-radius: 999px;
  background: linear-gradient(180deg, #1c2620, #141c17); color: var(--ink-2);
  border: 1px solid #6b5a3a; box-shadow: inset 0 1px 0 #e8d4a022, 0 1px 6px #0006;
  font: 500 .78rem/1.2 var(--font); letter-spacing: .02em; cursor: pointer;
}
.drand-plaque:hover { border-color: #ac8b58; color: var(--ink); }
.drand-lbl { color: var(--ink-3); text-transform: lowercase; letter-spacing: .06em; }
.drand-num { font-variant-numeric: tabular-nums; color: #e4c48a; font-weight: 600; letter-spacing: .04em; display: inline-block; }
.drand-beacon { width: 17px; height: 17px; flex: none; fill: none; stroke-linecap: round; }
.drand-beacon .mast { stroke: #ac8b58; stroke-width: 1.6; }
.drand-beacon .lamp { fill: #4b4630; stroke: #e4c48a; stroke-width: 1.2; }
.drand-beacon .wave { stroke: #e4c48a; stroke-width: 1.3; opacity: .2; }
.drand-plaque.is-verified .lamp { fill: #e4c48a; }
.drand-plaque.glint .w1 { animation: drand-wave 1.4s ease-out; }
.drand-plaque.glint .w2 { animation: drand-wave 1.4s .18s ease-out; }
@keyframes drand-wave { 0% { opacity: .2; } 30% { opacity: 1; } 100% { opacity: .2; } }
.drand-glint { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(100deg, transparent 30%, #f3dba533 50%, transparent 70%); transform: translateX(-110%); }
.drand-plaque.glint .drand-glint { animation: drand-sweep 1.2s ease-out; }
@keyframes drand-sweep { to { transform: translateX(110%); } }

/* ---------- League dialog ---------- */
.drand-dlg { max-width: 560px; }
.drand-eyebrow { margin: 0 0 4px; color: #d8b985; font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.drand-dlg h2 { margin: 0 0 6px; }
.league-wrap { margin: 4px -8px 2px; }
.league { display: block; width: 100%; height: auto; max-height: min(250px, 30vh); margin: 0 auto; overflow: visible; }
.drand-dlg[data-mode="about"] .league { max-height: min(170px, 22vh); }
.league .ray { stroke: #ac8b58; stroke-width: 1.2; stroke-dasharray: 3 7; opacity: .25; fill: none; }
.league .bind { stroke: #e4c48a; stroke-width: 1.6; fill: none; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; }
.league .node .ring { fill: #141c17; stroke: url(#drand-brass); stroke-width: 2; }
.league .node .cross { stroke: #6b5a3a; stroke-width: 1.2; }
.league .node .core { fill: #3a3424; transition: fill .4s; }
.league .node .halo { fill: #e4c48a; opacity: 0; }
.league .mast { stroke: #ac8b58; stroke-width: 3; stroke-linecap: round; fill: none; }
.league .mast.thin { stroke-width: 2; }
.league .tip { fill: #e4c48a; }
.league .pulse { fill: none; stroke: #e4c48a; stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; }
.league .key { opacity: 0; transform-box: fill-box; transform-origin: center; }
.league .key-bow, .league .key-bit { fill: none; stroke: #e4c48a; stroke-width: 3; stroke-linecap: round; }
.league .seal-ring { fill: #1b2720; stroke: url(#drand-brass); stroke-width: 2; }
.league .seal-lock { fill: none; stroke: #e4c48a; stroke-width: 1.4; stroke-linejoin: round; }
.league .seal-crack { fill: none; stroke: #f3dba5; stroke-width: 1.4; stroke-dasharray: 1; stroke-dashoffset: 1; }

/* idle (explainer): the League quietly signs round after round */
.drand-dlg[data-phase="idle"] .node .core { animation: drand-twinkle 3s calc(var(--i) * .33s) infinite; }
@keyframes drand-twinkle { 0%, 100% { fill: #3a3424; } 12% { fill: #e4c48a; } 40% { fill: #3a3424; } }

/* ask: the beacon calls out */
.drand-dlg[data-phase="ask"] .ray { opacity: .7; animation: drand-ray .9s linear infinite; }
@keyframes drand-ray { to { stroke-dashoffset: -20; } }
.drand-dlg[data-phase="ask"] .pulse { animation: drand-pulse 1.5s ease-out infinite; }
.drand-dlg[data-phase="ask"] .pulse.p2 { animation-delay: .75s; }
@keyframes drand-pulse { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(7); } }

/* shares: members answer one by one; a threshold is enough */
.drand-dlg:is([data-phase="shares"], [data-phase="verify"], [data-phase="release"], [data-phase="done"]) .ray { opacity: .12; }
.drand-dlg:is([data-phase="shares"], [data-phase="verify"], [data-phase="release"], [data-phase="done"]) .node.answers .core { fill: #f3dba5; transition-delay: calc(var(--o) * 120ms); }
.drand-dlg[data-phase="shares"] .node.answers .halo { animation: drand-halo .9s calc(var(--o) * 120ms) ease-out both; }
@keyframes drand-halo { 0% { opacity: 0; } 30% { opacity: .35; } 100% { opacity: 0; } }
.drand-dlg:is([data-phase="shares"], [data-phase="verify"], [data-phase="release"], [data-phase="done"]) .node.quiet { opacity: .45; }

/* verify: the shares combine into one signature: the key */
.drand-dlg:is([data-phase="verify"], [data-phase="release"], [data-phase="done"]) .bind { opacity: .8; animation: drand-draw .7s calc(var(--o) * 50ms) ease-out forwards; }
@keyframes drand-draw { to { stroke-dashoffset: 0; } }
.drand-dlg:is([data-phase="verify"], [data-phase="release"], [data-phase="done"]) .key { animation: drand-key .6s .45s cubic-bezier(.2,.9,.3,1.3) forwards; }
@keyframes drand-key { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }

/* release: the key travels down the mast and the seal cracks */
.drand-dlg:is([data-phase="release"], [data-phase="done"]) .key { animation: drand-key-down .9s ease-in forwards; }
@keyframes drand-key-down { from { opacity: 1; transform: none; } 70% { opacity: 1; } to { opacity: 0; transform: translateY(110px) scale(.5); } }
.drand-dlg:is([data-phase="release"], [data-phase="done"]) .bind { opacity: .2; }
.drand-dlg:is([data-phase="release"], [data-phase="done"]) .seal-crack { animation: drand-draw .4s .65s ease-out forwards; }
.drand-dlg:is([data-phase="release"], [data-phase="done"]) .seal-ring { animation: drand-seal .9s .7s ease-out both; }
@keyframes drand-seal { 0% { filter: none; } 40% { filter: drop-shadow(0 0 8px #f3dba5); } 100% { filter: drop-shadow(0 0 2px #f3dba5); } }

/* error: the call went unanswered */
.drand-dlg[data-phase="error"] .ray { opacity: .1; }
.drand-dlg[data-phase="error"] .node { opacity: .5; }

.drand-steps { list-style: none; margin: 6px 0 10px; padding: 0; display: grid; gap: 6px; }
.drand-steps li { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: .9rem; transition: color .3s; }
.drand-steps .dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #6b5a3a; flex: none; transition: background .3s, border-color .3s; }
.drand-steps li.active { color: var(--ink); }
.drand-steps li.active .dot { border-color: #e4c48a; animation: drand-blink 1s ease-in-out infinite; }
.drand-steps li.done { color: var(--ink-2); }
.drand-steps li.done .dot { background: #e4c48a; border-color: #e4c48a; }
@keyframes drand-blink { 50% { background: #e4c48a66; } }
.drand-dlg[data-phase="error"] .drand-steps li.active .dot { animation: none; border-color: var(--danger); }
.drand-about p { margin: 0 0 10px; color: var(--ink-2); }
.drand-facts dd { font-variant-numeric: tabular-nums; word-break: break-all; }

html.calm .drand-dlg *, html.calm .drand-plaque * { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .drand-dlg *, .drand-plaque * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- recovery key ---------- */
.rk-key {
  display: block; margin: 10px 0 12px; padding: 14px 12px; border-radius: 12px; text-align: center;
  background: #0e1511; border: 1px dashed #ac8b58; color: #f3dba5;
  font: 600 1.05rem/1.6 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .08em;
  word-spacing: .2em; user-select: all; overflow-wrap: anywhere;
}
#rkDlg .rk-check { display: flex; flex-direction: row; gap: 10px; align-items: center; margin: 10px 0 0; color: var(--ink-2); font-size: .95rem; cursor: pointer; }
#rkDlg .rk-check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: #c5d5a9; }
.auth-link { background: none; border: 0; padding: 4px 0; color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; font-size: .88rem; }
.auth-link:hover { color: var(--ink); }
/* sign in: one full-width way in, the rest as quiet links */
.auth-forgot { display: flex; justify-content: flex-end; margin-top: 4px; }
.auth-forgot .auth-link { font-size: .84rem; text-decoration: none; }
.auth-forgot .auth-link:hover { text-decoration: underline; }
.auth-card .auth-go { display: block; width: 100%; min-height: 48px; margin-top: 12px; }
#recoverForm .auth-go { margin-top: 18px; }
.auth-new { margin: .3rem 0 0; text-align: center; color: var(--ink-3); font-size: .9rem; }
.auth-new .auth-link { color: var(--ink-2); font-size: inherit; }
#orbRound .linkish { background: none; border: 0; padding: 0; margin-left: 6px; color: var(--ink-3); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font: inherit; font-size: .85em; }
@media (max-width: 600px) { .drand-plaque { font-size: .74rem; } .rk-key { font-size: .95rem; } }
.auth-sub { font: 400 1.25rem/1.3 var(--serif); margin: .2rem 0 .8rem; }
.acct-sub { margin: 1.6rem 0 .3rem; padding-top: 1.1rem; border-top: 1px solid var(--glass-edge); font: 400 1.15rem/1.3 var(--serif); }

/* ---------- the moment, at the heart of the machine (housing drawn in machine.js) ---------- */
.machine-scene { container-type: inline-size; }
.drand-plaque.in-machine {
  position: absolute; z-index: 3; left: 38.65%; top: 63.56%; width: 22.7%; height: 9.83%; margin: 0; padding: 0;
  display: grid; place-content: center; justify-items: center; gap: .5cqw;
  border: 0; border-radius: 1.4cqw; background: none; box-shadow: none; overflow: visible;
}
.drand-plaque.in-machine:hover { border: 0; }
.drand-plaque.in-machine .drand-num { font-size: max(12px, 4.3cqw); }
.drand-plaque.in-machine .rotors { padding: .08em .14em; }
.drand-plaque.in-machine .drand-sub {
  position: absolute; left: 50%; top: calc(100% + 3.6cqw); transform: translateX(-50%); white-space: nowrap;
  display: inline-flex; align-items: center; gap: .35em; padding: .15em .7em .15em .45em; border-radius: 999px;
  background: #141c17e6; border: 1px solid #6b5a3a; color: #d8b985;
  font: 500 max(9px, 1.9cqw)/1.2 var(--font); letter-spacing: .05em; font-variant-numeric: tabular-nums;
}
.drand-plaque.in-machine .drand-beacon { width: 1.3em; height: 1.3em; }
.drand-plaque.in-machine .drand-glint { border-radius: inherit; }
.drand-plaque.in-machine:focus-visible { outline: 2px solid var(--brass-hi, #e8cf98); outline-offset: 1.4cqw; }
.mw-moment-face { fill: #0f140f; stroke: #3d3322; stroke-width: 1.5; }
.mw-moment-glow { fill: none; stroke: #e8cf98; stroke-width: 2; opacity: .12; }
.machine-scene:has(.drand-plaque.tick) .mw-moment-glow { animation: mw-moment-tick 1.8s ease-out; }
@keyframes mw-moment-tick { 0% { opacity: .12; } 20% { opacity: .7; filter: drop-shadow(0 0 6px #e8cf98); } 100% { opacity: .12; } }
html.calm .mw-moment-glow { animation: none !important; }
