/* Waiting-screen animations (from docs/loading-animations/v1j). Each option is scoped under .optX-. */
/* ============================================================
   B · The day floats up  (6s token loop, staggered)
   ============================================================ */
.optB-card { transform-origin: 110px 166px; animation: optB-card 5s ease-in-out infinite alternate; }
@keyframes optB-card { from { transform: translateY(1.5px) rotate(-0.6deg); } to { transform: translateY(-2.5px) rotate(0.6deg); } }
.optB-beam { animation: optB-beam 3.6s cubic-bezier(0.5, 0, 0.5, 1) infinite; }
@keyframes optB-beam { 0% { transform: translateX(-90px); } 78%, 100% { transform: translateX(200px); } }
.optB-word { transform-box: fill-box; transform-origin: 50% 50%; animation: optB-word 3s ease-in-out infinite; }
@keyframes optB-word { 0%, 100% { transform: scale(1); opacity: 0.85; } 40% { transform: scale(1.12, 1.35); opacity: 1; } }
.optB-rise { animation: optB-rise 6s linear infinite; }
@keyframes optB-rise { from { transform: translateY(0); } to { transform: translateY(-112px); } }
.optB-pop { opacity: 0; animation: optB-pop 6s infinite; }
@keyframes optB-pop {
  0% { opacity: 0; transform: scale(0.1); animation-timing-function: cubic-bezier(0.2, 0.9, 0.3, 1.6); }
  9% { opacity: 1; transform: scale(1.18); }
  15% { opacity: 1; transform: scale(1); }
  72% { opacity: 1; transform: scale(1); animation-timing-function: ease-in; }
  100% { opacity: 0; transform: scale(0.7); }
}
.optB-sway { animation: optB-sway 2.7s ease-in-out infinite alternate; }
@keyframes optB-sway { from { transform: translateX(-6px) rotate(-12deg); } to { transform: translateX(6px) rotate(12deg); } }
.optB-twk { animation: optB-twk 3.2s ease-in-out infinite; }
@keyframes optB-twk { 0%, 100% { transform: scale(0.5); opacity: 0.25; } 50% { transform: scale(1); opacity: 0.9; } }

/* B · the bot: floats above the note and leans along with the light (rigid head, fixed face) */
.optB-peek { animation: optB-peek 2.6s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate; }
@keyframes optB-peek { from { transform: translateY(2px); } to { transform: translateY(-2.5px); } }
.optB-head { transform-origin: 60px 112px; animation: optB-head 7.2s infinite cubic-bezier(0.45, 0, 0.45, 1); }
@keyframes optB-head {
  0%, 3% { transform: rotate(-8deg); } 38% { transform: rotate(8deg); } 46% { transform: rotate(2deg); animation-timing-function: cubic-bezier(0.3, 0.6, 0.4, 1); }
  51% { transform: translateY(-16px) rotate(0deg); animation-timing-function: cubic-bezier(0.6, 0, 0.7, 0.4); } 56% { transform: none; }
  65%, 71% { transform: rotate(-9deg); } 78%, 85% { transform: rotate(9deg); } 100% { transform: rotate(-8deg); }
}

/* ============================================================
   D · Pop-up book  (12s loop: two scenes, 6s each)
   ============================================================ */
.optD-book { animation: optD-book 6s ease-in-out infinite alternate; }
@keyframes optD-book { from { transform: translateY(1px); } to { transform: translateY(-2px); } }
.optD-pop { animation: optD-pop 12s infinite both; }
@keyframes optD-pop {
  0%, 4% { transform: scaleY(0) rotate(-6deg); opacity: 0; animation-timing-function: cubic-bezier(0.2, 0.8, 0.3, 1); }
  4.2% { opacity: 1; }
  8.5% { transform: scaleY(1.14) rotate(1.5deg); opacity: 1; animation-timing-function: ease-in-out; }
  11% { transform: scaleY(0.95) rotate(-0.5deg); }
  13.5%, 32% { transform: none; opacity: 1; animation-timing-function: ease-in-out; }
  33.5% { transform: scaleY(1.07); opacity: 1; animation-timing-function: cubic-bezier(0.5, 0, 0.9, 0.5); }
  37% { transform: scaleY(0) rotate(5deg); opacity: 1; }
  37.2%, 100% { transform: scaleY(0); opacity: 0; }
}
.optD-popc { animation: optD-popc 12s infinite both; }
@keyframes optD-popc {
  0%, 4% { transform: translateY(46px) scale(0); opacity: 0; animation-timing-function: cubic-bezier(0.2, 0.8, 0.3, 1.35); }
  11% { transform: none; opacity: 1; }
  32% { transform: none; opacity: 1; animation-timing-function: cubic-bezier(0.5, -0.2, 0.9, 0.5); }
  37%, 100% { transform: translateY(46px) scale(0); opacity: 0; }
}
.optD-flip { opacity: 0; transform-origin: 110px 178px; animation: optD-flip 6s infinite both; }
/* Same function list in every keyframe, so the browser blends each one on its own
   (mixed lists fall back to matrix blending, which spins the page through the negative scale). */
@keyframes optD-flip {
  0%, 84.9% { opacity: 0; fill: #fffaf2; transform: translateY(0) scaleX(1) skewY(0deg); }
  85% { opacity: 1; fill: #fffaf2; transform: translateY(0) scaleX(1) skewY(0deg); animation-timing-function: cubic-bezier(0.45, 0, 0.7, 0.4); }
  92.5% { opacity: 1; fill: #efe5d3; transform: translateY(-6px) scaleX(0.001) skewY(-8deg); animation-timing-function: cubic-bezier(0.25, 0.6, 0.4, 1); }
  97% { opacity: 1; fill: #fffaf2; transform: translateY(0) scaleX(-1) skewY(0deg); }
  100% { opacity: 0; fill: #fffaf2; transform: translateY(0) scaleX(-1) skewY(0deg); }
}
.optD-glow { animation: optD-glow 2.8s ease-in-out infinite alternate; }
@keyframes optD-glow { from { transform: scale(0.88); opacity: 0.55; } to { transform: scale(1.1); opacity: 1; } }
.optD-win { animation: optD-win 2.2s ease-in-out infinite alternate; }
@keyframes optD-win { from { opacity: 0.7; } to { opacity: 1; } }
.optD-twk { animation: optD-twk 2.4s ease-in-out infinite alternate; }
@keyframes optD-twk { from { transform: scale(0.6) rotate(-10deg); opacity: 0.5; } to { transform: scale(1.05) rotate(10deg); opacity: 1; } }
.optD-rock { transform-origin: 111px 168px; animation: optD-rock 2.6s ease-in-out infinite alternate; }
@keyframes optD-rock { from { transform: rotate(-5deg) translateY(1px); } to { transform: rotate(5deg) translateY(-1px); } }
.optD-swayL { animation: optD-swayL 2.6s ease-in-out infinite alternate; }
.optD-swayR { animation: optD-swayL 3.1s ease-in-out infinite alternate-reverse; }
@keyframes optD-swayL { from { transform: translateX(-4px); } to { transform: translateX(4px); } }
.optD-rays { animation: optD-rays 14s linear infinite; }
@keyframes optD-rays { to { transform: rotate(360deg); } }

/* D · the bot: floats above the book and leans toward what pops up (rigid head, fixed face) */
.optD-peek { animation: optD-peek 3s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate; }
@keyframes optD-peek { from { transform: translateY(2px); } to { transform: translateY(-2.5px); } }
.optD-head { transform-origin: 60px 112px; animation: optD-head 6s infinite cubic-bezier(0.45, 0, 0.4, 1); }
@keyframes optD-head {
  0%, 8% { transform: none; animation-timing-function: cubic-bezier(0.3, 0.6, 0.4, 1); }
  12% { transform: translateY(-16px); animation-timing-function: cubic-bezier(0.6, 0, 0.7, 0.4); } 16% { transform: none; }
  24%, 32% { transform: rotate(-10deg); } 42%, 52% { transform: rotate(10deg); } 62%, 70% { transform: rotate(-5deg); }
  80%, 100% { transform: none; }
}

/* ============================================================
   F · Voice off the page  (paper card, ribbons of sound rise from it)
   ============================================================ */
.optF-card { transform-origin: 110px 168px; animation: optF-card 5s ease-in-out infinite alternate; }
@keyframes optF-card { from { transform: translateY(1.5px) rotate(0.6deg); } to { transform: translateY(-2.5px) rotate(-0.6deg); } }
.optF-word { transform-box: fill-box; transform-origin: 50% 50%; animation: optF-word 2.4s ease-in-out infinite; }
@keyframes optF-word { 0%, 100% { transform: scale(1); opacity: 0.85; } 40% { transform: scale(1.12, 1.4); opacity: 1; } }
.optF-flow { fill: none; stroke-linecap: round; animation: linear infinite; }
.optF-flow1 { animation-name: optF-flow1; animation-duration: 3.4s; }
.optF-flow2 { animation-name: optF-flow2; animation-duration: 4.8s; }
.optF-flow3 { animation-name: optF-flow3; animation-duration: 2.9s; }
.optF-flow4 { animation-name: optF-flow4; animation-duration: 5.6s; }
@keyframes optF-flow1 { to { transform: translateY(-44px); } }
@keyframes optF-flow2 { to { transform: translateY(-56px); } }
@keyframes optF-flow3 { to { transform: translateY(-36px); } }
@keyframes optF-flow4 { to { transform: translateY(-64px); } }
.optF-env { animation: ease-in-out infinite; }
.optF-env1 { transform: scaleX(0.9); animation-name: optF-env1; animation-duration: 5.3s; }
.optF-env2 { transform: scaleX(0.7); animation-name: optF-env2; animation-duration: 6.7s; }
.optF-env3 { transform: scaleX(1); animation-name: optF-env3; animation-duration: 4.9s; }
.optF-env4 { transform: scaleX(0.6); animation-name: optF-env4; animation-duration: 8.3s; }
@keyframes optF-env1 { 0%, 100% { transform: scaleX(0.25); } 18% { transform: scaleX(1.2); } 34% { transform: scaleX(0.55); } 52% { transform: scaleX(1.4); } 74% { transform: scaleX(0.8); } 88% { transform: scaleX(1.1); } }
@keyframes optF-env2 { 0%, 100% { transform: scaleX(0.9); } 22% { transform: scaleX(0.25); } 45% { transform: scaleX(1.15); } 70% { transform: scaleX(0.45); } }
@keyframes optF-env3 { 0%, 100% { transform: scaleX(0.4); } 30% { transform: scaleX(1.35); } 55% { transform: scaleX(0.3); } 78% { transform: scaleX(1); } }
@keyframes optF-env4 { 0%, 100% { transform: scaleX(0.7); } 35% { transform: scaleX(0.2); } 65% { transform: scaleX(1); } }
.optF-rise { animation: optF-rise 6s linear infinite; }
@keyframes optF-rise { from { transform: translateY(0); } to { transform: translateY(-112px); } }
.optF-pop { opacity: 0; animation: optF-pop 6s infinite; }
@keyframes optF-pop {
  0% { opacity: 0; transform: scale(0.1); animation-timing-function: cubic-bezier(0.2, 0.9, 0.3, 1.6); }
  9% { opacity: 1; transform: scale(1.18); }
  15% { opacity: 1; transform: scale(1); }
  72% { opacity: 1; transform: scale(1); animation-timing-function: ease-in; }
  100% { opacity: 0; transform: scale(0.7); }
}
.optF-sway { animation: optF-sway 2.7s ease-in-out infinite alternate; }
@keyframes optF-sway { from { transform: translateX(-5px) rotate(-12deg); } to { transform: translateX(5px) rotate(12deg); } }
.optF-twk { animation: optF-twk 3.2s ease-in-out infinite; }
@keyframes optF-twk { 0%, 100% { transform: scale(0.5); opacity: 0.25; } 50% { transform: scale(1); opacity: 0.9; } }

/* F · the bot hums: floats above the page, rocking and bobbing in time (rigid head, fixed face) */
.optF-peek { animation: optF-peek 1.2s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate; }
@keyframes optF-peek { from { transform: translateY(2px); } to { transform: translateY(-2.5px); } }
.optF-head { transform-origin: 60px 112px; animation: optF-head 9.6s infinite cubic-bezier(0.45, 0, 0.55, 1); }
@keyframes optF-head {
  0%, 100% { transform: rotate(-7deg); } 12.5% { transform: rotate(7deg); } 25% { transform: rotate(-7deg); } 37.5% { transform: rotate(7deg); }
  50% { transform: rotate(-12deg); } 62.5% { transform: rotate(12deg); } 75% { transform: rotate(-7deg); } 87.5% { transform: rotate(7deg); }
}

/* ============================================================
   H · Moonlit journey  (paper-cut diorama: two hill wheels turn on a paper base)
   ============================================================ */
.optH-back { transform-origin: 110px 250px; animation: optH-turn 96s linear infinite; }
.optH-front { transform-origin: 110px 258px; animation: optH-turn 56s linear infinite; }
@keyframes optH-turn { to { transform: rotate(-360deg); } }
.optH-glow { animation: optH-glow 2.8s ease-in-out infinite alternate; }
@keyframes optH-glow { from { transform: scale(0.88); opacity: 0.55; } to { transform: scale(1.1); opacity: 1; } }
.optH-moon { animation: optH-moon 6s ease-in-out infinite alternate; }
@keyframes optH-moon { from { transform: translateY(2px); } to { transform: translateY(-3px); } }
.optH-cloud1 { animation: optH-cloud 5.2s ease-in-out infinite alternate; }
.optH-cloud2 { animation: optH-cloud 6.8s ease-in-out infinite alternate-reverse; }
@keyframes optH-cloud { from { transform: translateX(-6px); } to { transform: translateX(6px); } }
.optH-win { animation: optH-win 2.2s ease-in-out infinite alternate; }
@keyframes optH-win { from { opacity: 0.7; } to { opacity: 1; } }
.optH-twk { animation: optH-twk 2.6s ease-in-out infinite alternate; }
@keyframes optH-twk { from { transform: scale(0.55) rotate(-10deg); opacity: 0.45; } to { transform: scale(1.05) rotate(10deg); opacity: 1; } }
.optH-flyA { animation: optH-flyA 7s ease-in-out infinite alternate; }
.optH-flyB { animation: optH-flyB 4.3s ease-in-out infinite alternate; }
.optH-flyC { animation: optH-flyC 2.9s ease-in-out infinite; }
@keyframes optH-flyA { from { transform: translateX(-9px); } to { transform: translateX(11px); } }
@keyframes optH-flyB { from { transform: translateY(6px); } to { transform: translateY(-8px); } }
@keyframes optH-flyC { 0%, 100% { opacity: 0.2; } 45%, 65% { opacity: 1; } }

/* H · the bot: floats beside the hills, follows them going by, gets drowsy and perks up (rigid head, fixed face) */
.optH-peek { animation: optH-peek 3.6s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate; }
@keyframes optH-peek { from { transform: translateY(2.5px); } to { transform: translateY(-2.5px); } }
.optH-head { transform-origin: 60px 112px; animation: optH-head 9s infinite cubic-bezier(0.45, 0, 0.45, 1); }
@keyframes optH-head {
  0% { transform: rotate(14deg); } 24% { transform: rotate(2deg); } 28% { transform: rotate(14deg); } 50% { transform: rotate(4deg); }
  58% { transform: rotate(-2deg) translateY(4px); } 61% { transform: rotate(1deg) translateY(2px); } 71%, 78% { transform: rotate(-8deg) translateY(10px); animation-timing-function: cubic-bezier(0.3, 0.6, 0.4, 1); }
  82% { transform: rotate(10deg) translateY(-12px); animation-timing-function: cubic-bezier(0.6, 0, 0.7, 0.4); } 87%, 100% { transform: rotate(14deg); }
}


.wait__art { display: block; width: min(250px, 72vw); aspect-ratio: 1; }
.wait__art svg { display: block; width: 100%; height: 100%; overflow: visible;
  /* undo the app's global icon style (svg { fill: none; stroke: currentColor }) so the art keeps SVG defaults */
  fill: #000; stroke: none; stroke-width: 1; stroke-linecap: butt; stroke-linejoin: miter; }
@media (prefers-reduced-motion: reduce) {
  .wait__art *, .wait__art *::before, .wait__art *::after { animation: none !important; }
  .optB-pop, .optF-pop { opacity: 1; }
  .optB-rise, .optF-rise { transform: translateY(var(--still, -40px)); }
  .optD-s2, .optD-flip { display: none; }
}
