/* Motion for Deposit, Send privately and Withdraw (explain.js; the scenes are drawn on a canvas by stage.js).
   - .xp: the card under a screen's headline (scene, three lines, what is seen and what is hidden);
   - .theater: the same scene, large, over the page while a real action runs;
   - .wave-clock: the time to the relayer's next wave.
   Colours come from skin.css, so everything follows the lights. */
.xp {
  position: relative; display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 8px 18px; align-items: center;
  margin: 2px 0 16px; padding: 10px 16px 10px 10px; border-radius: 18px; background: var(--card); border: 1px solid var(--card-b); box-shadow: var(--shadow);
}
.xp__stage { min-width: 0; border-radius: 13px; overflow: hidden; background: radial-gradient(120% 90% at 70% 10%, rgba(var(--accent-rgb), .13), transparent 62%), linear-gradient(180deg, rgba(var(--accent-rgb), .05), rgba(var(--accent-rgb), .01)); }
.xp__canvas { display: block; width: 100%; height: 196px; }
.xp__side { min-width: 0; }
.xp__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 6px; min-height: 30px; }
.xp .xp__t { margin: 0; font: 700 15px/1.2 var(--display); letter-spacing: -.015em; color: var(--text); }
.xp__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; line-height: 1.35; color: var(--text); }
.xp__step { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; align-items: start; }
.xp__step i { width: 18px; height: 18px; border-radius: 50%; background: var(--chip-bg); color: var(--chip-ink); font: 700 10.5px/18px var(--sans); font-style: normal; text-align: center; }
.xp__seen { margin-top: 9px; display: grid; gap: 5px; }
.xp .xp__row { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.xp__row-h { display: inline-flex; align-items: center; gap: 5px; margin-right: 2px; font: 600 10.5px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.xp-ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.xp__row--see .xp-ico { color: var(--red); }
.xp__chip { padding: 3px 8px; border-radius: 99px; font: 600 11.5px/1.3 var(--sans); white-space: nowrap; }
.xp__row--see .xp__chip { background: var(--chip-bg); color: var(--chip-ink); }
.xp__row--hide .xp__chip { color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-2); background: repeating-linear-gradient(135deg, transparent 0 5px, rgba(var(--accent-rgb), .07) 5px 7px); }
.xp__again {
  all: unset; box-sizing: border-box; flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-2); transition: color .2s, box-shadow .2s, transform .5s cubic-bezier(.2, .8, .2, 1);
}
.xp__again svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.xp__again:hover { color: var(--red-2); box-shadow: inset 0 0 0 1px var(--red); transform: rotate(-40deg); }
.xp__again:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .xp__again { display: none; } }

/* ---------- the wave clock ---------- */
.wave-clock { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; white-space: nowrap; font: 600 12px/1 var(--sans); letter-spacing: 0; text-transform: none; color: var(--chip-ink); }
.wave-clock[hidden], .wave-clock.is-off { display: none; }
.wave-clock__i { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wave-clock__t { font: 700 13px/1 var(--mono); font-variant-numeric: tabular-nums; min-width: 2.6em; }
.wave-clock--card { margin-top: 8px; padding: 6px 10px; border-radius: 99px; background: var(--chip-bg); }
.wave-clock--mode { margin-left: 4px; padding: 3px 8px; border-radius: 99px; background: var(--chip-bg); font-size: 11px; }
.wave-clock--mode .wave-clock__i { display: none; }
.wave-clock--theater { margin-right: auto; padding: 8px 12px; border-radius: 99px; background: var(--chip-bg); font-size: 13px; }
.wave-clock--theater .wave-clock__t { font-size: 15px; }

/* ---------- the theater ---------- */
.theater {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); /* no blur: nothing behind is recomputed while the scene runs */
  animation: theater-in .35s ease both;
}
.theater[hidden] { display: none; }
.theater.is-under { visibility: hidden; }
.theater__card {
  width: min(700px, 100%); max-height: calc(100dvh - 24px); display: flex; flex-direction: column; overflow: hidden; border-radius: 24px;
  background: var(--card-s); border: 1px solid var(--card-b); box-shadow: 0 50px 120px -40px rgba(60, 20, 160, .55), 0 0 0 1px rgba(255, 255, 255, .4) inset;
  animation: theater-card .5s cubic-bezier(.2, .8, .2, 1) both;
}
.theater__canvas {
  display: block; width: 100%; height: clamp(210px, 48dvh, 340px); flex: none;
  background: radial-gradient(90% 80% at 72% 8%, rgba(var(--accent-rgb), .17), transparent 60%), radial-gradient(70% 70% at 8% 100%, rgba(var(--accent-rgb), .1), transparent 62%), linear-gradient(180deg, rgba(var(--accent-rgb), .04), transparent);
}
.theater__body { padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.theater__t { margin: 0; font: 900 clamp(20px, 3vw, 26px)/1.1 var(--display); letter-spacing: -.025em; text-transform: uppercase; color: var(--text); }
.theater[data-state='work'] .theater__t::after { content: ''; display: inline-block; width: .5em; height: .5em; margin-left: .35em; border-radius: 50%; background: var(--red); animation: theater-dot 1s ease-in-out infinite; }
.theater__s { margin: 6px 0 0; min-height: 2.9em; font: 500 13.5px/1.45 var(--sans); color: var(--muted); overflow-wrap: anywhere; }
.theater[data-state='done'] .theater__s, .theater[data-state='wait'] .theater__s, .theater[data-state='gone'] .theater__s { color: var(--ok); }
.theater__row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; min-height: 44px; }
.theater__done[hidden], .theater__hide[hidden] { display: none !important; }
:root:root .theater__done { min-height: 44px; }
@keyframes theater-in { from { opacity: 0; } }
@keyframes theater-card { from { opacity: 0; transform: translateY(18px) scale(.97); } }
@keyframes theater-dot { 50% { opacity: .25; transform: scale(.7); } }

/* ---------- sizes ---------- */
@media (max-height: 740px) and (min-width: 821px) {
  .xp { grid-template-columns: minmax(0, 316px) minmax(0, 1fr); margin-bottom: 12px; }
  .xp__canvas { height: 180px; }
}
@media (max-width: 620px) {
  .xp { grid-template-columns: minmax(0, 1fr); padding: 10px 10px 14px; }
  .xp__canvas { height: 204px; }
  .xp__side { padding: 0 6px; }
  .theater { padding: 8px; align-items: end; }
  .theater__card { border-radius: 22px; }
  .theater__body { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }
}

/* The style picker on the cards (only after a link with ?motion=, for comparing styles) */
.xp__styles { display: inline-flex; flex-wrap: wrap; gap: 2px; margin-top: 10px; padding: 3px; border-radius: 16px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.xp__styles button { all: unset; cursor: pointer; padding: 5px 11px; border-radius: 99px; font: 600 12px/1 var(--sans); color: var(--muted); transition: color .2s, background-color .2s; }
.xp__styles button.is-on { background: var(--chip-bg); color: var(--chip-ink); }
.xp__styles button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
