/* YAAR 3.0 backgrounds. Every layer is a .bgfx box (container-type: size), so the same art fills the phone screen,
   the first-launch screen, the share card and the small previews in Оформление → Фон, always centred on the box.
   Motion uses transform and opacity only. Without .bgfx-run (previews, animation off) every animation is paused
   on its first frame, which the negative delays turn into a scattered still picture. */
.bgfx { position: absolute; inset: 0; overflow: hidden; clip-path: inset(0); pointer-events: none; container-type: size; contain: strict;
  --a: var(--ac); --al: color-mix(in srgb, var(--ac) 55%, white); --ad: color-mix(in srgb, var(--ac) 40%, var(--bg)); }
.bgfx > * { position: absolute; inset: 0; overflow: hidden; }
.bgfx > * > * { position: absolute; inset: 0; }
.bgfx i, .bgfx b, .bgfx em { position: absolute; display: block; }
.bgfx *, .bgfx *::before, .bgfx *::after { animation-play-state: paused; }
.bgfx-run *, .bgfx-run *::before, .bgfx-run *::after { animation-play-state: running; }
.still .bgfx *, .still .bgfx *::before, .still .bgfx *::after { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .bgfx *, .bgfx *::before, .bgfx *::after { animation-play-state: paused !important; } }

/* ---------- Звёзды: twinkling stars sliding down (two copies for a seamless loop) and shooting stars ---------- */
.stars-fall { animation: fx-fall 36s linear infinite; }
.stars-fall.b2 { top: -100%; bottom: 100%; }
@keyframes fx-fall { to { transform: translateY(100cqh); } }
.fx-stars i { left: var(--x); top: var(--y); width: var(--s); height: var(--s); margin: calc(var(--s) / -2); border-radius: 50%;
  width: calc(var(--s) * 3); height: calc(var(--s) * 3); margin: calc(var(--s) * -1.5);
  background: radial-gradient(circle, #fff 0 18%, color-mix(in srgb, var(--al) 55%, transparent) 30%, transparent 62%);
  animation: fx-twinkle var(--d) ease-in-out var(--l) infinite; }
.fx-stars i:nth-child(3n) { background: radial-gradient(circle, var(--al) 0 18%, color-mix(in srgb, var(--al) 45%, transparent) 30%, transparent 62%); }
@keyframes fx-twinkle { 0%, 100% { opacity: calc(var(--o, 1) * .35); } 50% { opacity: var(--o, 1); } }
.fx-stars b { left: var(--x); top: var(--y); width: 30cqmin; height: 2px; border-radius: 2px; transform-origin: 0 50%;
  background: linear-gradient(90deg, #fff, color-mix(in srgb, var(--al) 60%, transparent) 30%, transparent); opacity: 0;
  animation: fx-shoot var(--d) cubic-bezier(.3, 0, .8, .4) var(--l) infinite; }
@keyframes fx-shoot {
  0%, 84% { opacity: 0; transform: rotate(-32deg) translateX(0) scaleX(.3); }
  86% { opacity: 1; }
  96% { opacity: 0; transform: rotate(-32deg) translateX(-55cqmin) scaleX(1); }
  100% { opacity: 0; transform: rotate(-32deg) translateX(-55cqmin) scaleX(1); } }
/* The mockup's own star field under them drifts down faster too. */
.y:has(.fx-stars) .stars { animation-duration: 40s; }
.y:has(.fx-stars) .stars.far { animation-duration: 75s; }

/* ---------- Варп: the old app's warp as it was (web/style-backgrounds.css), every ray on its own random rhythm ---------- */
.background-warp { opacity: .8; }
.background-warp {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(7, 10, 27, .56) 0 6%, rgba(34, 21, 71, .14) 25%, transparent 58%),
    radial-gradient(ellipse at 8% 18%, color-mix(in srgb, var(--a) 30%, transparent), transparent 48%),
    radial-gradient(ellipse at 91% 82%, color-mix(in srgb, var(--al) 26%, transparent), transparent 48%),
    radial-gradient(ellipse at 85% 12%, color-mix(in srgb, var(--a) 22%, transparent), transparent 42%);
  perspective: 900px;
}
.warp-tunnel { position: absolute; inset: -12%; }
.warp-tunnel i {
  position: absolute; top: 50%; left: 50%; width: 132cqmax; height: 132cqmax;
  border: 1px solid color-mix(in srgb, var(--a) 34%, transparent); border-radius: 19%;
  transform: translate(-50%, -50%) rotate(45deg) scale(.22);
}
.warp-tunnel i:nth-child(2) { transform: translate(-50%, -50%) rotate(45deg) scale(.36); border-color: color-mix(in srgb, var(--al) 34%, transparent); }
.warp-tunnel i:nth-child(3) { transform: translate(-50%, -50%) rotate(45deg) scale(.5); border-color: color-mix(in srgb, var(--a) 30%, transparent); }
.warp-tunnel i:nth-child(4) { transform: translate(-50%, -50%) rotate(45deg) scale(.64); border-color: color-mix(in srgb, var(--al) 31%, transparent); }
.warp-tunnel i:nth-child(5) { transform: translate(-50%, -50%) rotate(45deg) scale(.78); border-color: color-mix(in srgb, var(--a) 28%, transparent); }
.warp-tunnel i:nth-child(6) { transform: translate(-50%, -50%) rotate(45deg) scale(.92); border-color: color-mix(in srgb, var(--al) 29%, transparent); }
.warp-beams { position: absolute; inset: 0; }
.warp-beams i {
  position: absolute; top: 50%; left: 50%; width: 2px; height: 120cqmax; transform-origin: 50% 0;
  --beam-color: color-mix(in srgb, var(--a) 72%, white);
  opacity: .3;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--beam-color) 46%, transparent), color-mix(in srgb, var(--beam-color) 66%, transparent) 27%, color-mix(in srgb, var(--beam-color) 8%, transparent) 76%, transparent);
}
.bgfx .warp-beams i::after { animation: warp-lightfly var(--warp-spark-duration, 9s) linear var(--warp-spark-delay, 0s) infinite; }
.warp-beams i::before, .warp-beams i::after {
  position: absolute; top: 0; left: -5px; width: 10px; height: 10px; border-radius: 50%;
  content: ""; opacity: 0;
  background: radial-gradient(circle, white 0 12%, color-mix(in srgb, var(--beam-color) 82%, white) 35%, var(--beam-color) 56%, transparent 78%);
}
.warp-beams i::before { display: none; }
.warp-beams i:nth-child(1) { transform: rotate(0deg) translateY(-1cqh); animation-delay: 0s; }
.warp-beams i:nth-child(2) { --beam-color: rgba(255,95,205,.9); transform: rotate(30deg) translateY(-1cqh); background: linear-gradient(to bottom, rgba(255,255,255,.3), rgba(255,95,205,.55) 24%, rgba(255,95,205,.06) 76%, transparent); animation-delay: -.4s; }
.warp-beams i:nth-child(3) { --beam-color: rgba(126,108,255,.9); transform: rotate(60deg) translateY(-1cqh); background: linear-gradient(to bottom, rgba(255,255,255,.3), rgba(126,108,255,.62) 28%, rgba(126,108,255,.08) 76%, transparent); animation-delay: -.8s; }
.warp-beams i:nth-child(4) { --beam-color: rgba(46,205,255,.92); transform: rotate(90deg) translateY(-1cqh); background: linear-gradient(to bottom, rgba(255,255,255,.32), rgba(46,205,255,.58) 24%, rgba(46,205,255,.06) 76%, transparent); animation-delay: -1.2s; }
.warp-beams i:nth-child(5) { --beam-color: rgba(65,230,202,.9); transform: rotate(120deg) translateY(-1cqh); background: linear-gradient(to bottom, rgba(255,255,255,.28), rgba(65,230,202,.55) 28%, rgba(65,230,202,.06) 76%, transparent); animation-delay: -1.6s; }
.warp-beams i:nth-child(6) { --beam-color: rgba(255,191,102,.9); transform: rotate(150deg) translateY(-1cqh); background: linear-gradient(to bottom, rgba(255,255,255,.28), rgba(255,191,102,.58) 25%, rgba(255,191,102,.06) 76%, transparent); animation-delay: -2s; }
.warp-beams i:nth-child(7) { --beam-color: rgba(120,212,255,.9); transform: rotate(180deg) translateY(-1cqh); background: linear-gradient(to bottom, rgba(255,255,255,.38), rgba(120,212,255,.58) 26%, rgba(120,212,255,.06) 76%, transparent); animation-delay: -2.4s; }
.warp-beams i:nth-child(8) { --beam-color: rgba(216,142,255,.9); transform: rotate(210deg) translateY(-1cqh); background: linear-gradient(to bottom, rgba(255,255,255,.3), rgba(216,142,255,.56) 24%, rgba(216,142,255,.06) 76%, transparent); animation-delay: -2.8s; }
.warp-beams i:nth-child(9) { --beam-color: rgba(93,132,255,.9); transform: rotate(240deg) translateY(-1cqh); background: linear-gradient(to bottom, rgba(255,255,255,.28), rgba(93,132,255,.58) 28%, rgba(93,132,255,.06) 76%, transparent); animation-delay: -3.2s; }
.warp-beams i:nth-child(10) { --beam-color: rgba(255,107,157,.9); transform: rotate(270deg) translateY(-1cqh); background: linear-gradient(to bottom, rgba(255,255,255,.3), rgba(255,107,157,.56) 24%, rgba(255,107,157,.06) 76%, transparent); animation-delay: -3.6s; }
.warp-beams i:nth-child(11) { --beam-color: rgba(126,224,255,.9); transform: rotate(300deg) translateY(-1cqh); background: linear-gradient(to bottom, rgba(255,255,255,.3), rgba(126,224,255,.58) 28%, rgba(126,224,255,.06) 76%, transparent); animation-delay: -4s; }
.warp-beams i:nth-child(12) { --beam-color: rgba(183,120,255,.9); transform: rotate(330deg) translateY(-1cqh); background: linear-gradient(to bottom, rgba(255,255,255,.28), rgba(183,120,255,.58) 24%, rgba(183,120,255,.06) 76%, transparent); animation-delay: -4.4s; }
.warp-beams i::after { animation-delay: var(--ray-delay, 0s); }
.warp-beams i:nth-child(2) { --ray-delay: -.4s; }
.warp-beams i:nth-child(3) { --ray-delay: -.8s; }
.warp-beams i:nth-child(4) { --ray-delay: -1.2s; }
.warp-beams i:nth-child(5) { --ray-delay: -1.6s; }
.warp-beams i:nth-child(6) { --ray-delay: -2s; }
.warp-beams i:nth-child(7) { --ray-delay: -2.4s; }
.warp-beams i:nth-child(8) { --ray-delay: -2.8s; }
.warp-beams i:nth-child(9) { --ray-delay: -3.2s; }
.warp-beams i:nth-child(10) { --ray-delay: -3.6s; }
.warp-beams i:nth-child(11) { --ray-delay: -4s; }
.warp-beams i:nth-child(12) { --ray-delay: -4.4s; }
.bgfx .warp-beams > i { animation: warp-line-flare var(--warp-flare-duration, 8s) ease-in-out var(--warp-flare-delay, 0s) infinite; }
.warp-beams i { background: linear-gradient(to bottom, color-mix(in srgb, var(--beam-color) 46%, transparent), color-mix(in srgb, var(--beam-color) 66%, transparent) 27%, color-mix(in srgb, var(--beam-color) 8%, transparent) 76%, transparent); }
.warp-beams i:nth-child(1) { --beam-color: color-mix(in srgb, var(--a) 72%, white); }
.warp-beams i:nth-child(2) { --beam-color: color-mix(in srgb, var(--a) 58%, white); }
.warp-beams i:nth-child(3) { --beam-color: color-mix(in srgb, var(--a) 78%, white); }
.warp-beams i:nth-child(4) { --beam-color: color-mix(in srgb, var(--a) 64%, white); }
.warp-beams i:nth-child(5) { --beam-color: color-mix(in srgb, var(--a) 86%, white); }
.warp-beams i:nth-child(6) { --beam-color: color-mix(in srgb, var(--a) 52%, white); }
.warp-beams i:nth-child(7) { --beam-color: color-mix(in srgb, var(--a) 74%, white); }
.warp-beams i:nth-child(8) { --beam-color: color-mix(in srgb, var(--a) 58%, white); }
.warp-beams i:nth-child(9) { --beam-color: color-mix(in srgb, var(--a) 82%, white); }
.warp-beams i:nth-child(10) { --beam-color: color-mix(in srgb, var(--a) 64%, white); }
.warp-beams i:nth-child(11) { --beam-color: color-mix(in srgb, var(--a) 76%, white); }
.warp-beams i:nth-child(12) { --beam-color: color-mix(in srgb, var(--a) 54%, white); }
.warp-beams i::after { animation-delay: var(--warp-spark-delay, 0s); }
@keyframes warp-line-flare {
  0%, 100% { opacity: .2; }
  36% { opacity: .34; }
  48% { opacity: 1; }
  58% { opacity: .68; }
  74% { opacity: .28; }
}
@keyframes warp-lightfly {
  0%, 5%, 100% { opacity: 0; transform: translateY(-3cqh); }
  8% { opacity: 1; }
  24% { opacity: .92; transform: translateY(94cqmax); }
  30% { opacity: 0; transform: translateY(110cqmax); }
}

/* ---------- Ретро-сетка: drawn on a canvas by app.js (r_drawGrid) — an endless road and grid that melt into the horizon ---------- */
.fx-grid { background: radial-gradient(ellipse 70% 30% at 50% 46%, color-mix(in srgb, var(--a) 22%, transparent), transparent 70%),
  linear-gradient(to bottom, transparent 41%, color-mix(in srgb, var(--a) 26%, transparent) 46%, transparent 52%),
  linear-gradient(to bottom, var(--bg) 0%, color-mix(in srgb, var(--a) 10%, var(--bg)) 34%, color-mix(in srgb, var(--a) 20%, var(--bg)) 46%, var(--bg) 47%, var(--bg) 100%); }
.fx-grid canvas, .background-warp canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- Под водой: surface shimmer, light shafts, caustics, fish, seaweed and bubbles ---------- */
.fx-water { background: radial-gradient(ellipse 70% 24% at 50% 0, color-mix(in srgb, var(--al) 26%, transparent), transparent), linear-gradient(to bottom, color-mix(in srgb, var(--a) 30%, var(--bg)) 0%, color-mix(in srgb, var(--a) 14%, var(--bg)) 40%, color-mix(in srgb, var(--bg) 85%, black) 100%); }
.water-surface { top: 0; height: 9cqh; left: -30%; right: -30%;
  background: radial-gradient(ellipse 50% 70% at 50% 0, color-mix(in srgb, var(--al) 55%, transparent), transparent 70%) 0 0 / 22cqw 100% repeat-x;
  animation: fx-surface 5s linear infinite; }
@keyframes fx-surface { from { transform: translateX(0); } to { transform: translateX(22cqw); } }
/* The shafts meet far above the screen, so no bright knot of rays shows at the top. */
.water-rays i { left: 50%; top: -45cqh; width: var(--w); height: 150cqh; margin-left: calc(var(--w) / -2); transform-origin: 50% 0;
  background: linear-gradient(to bottom, transparent 0 50cqh, color-mix(in srgb, var(--al) 30%, transparent) 66cqh, color-mix(in srgb, var(--a) 12%, transparent) 75%, transparent 92%);
  -webkit-mask: linear-gradient(90deg, transparent, #000 40% 60%, transparent); mask: linear-gradient(90deg, transparent, #000 40% 60%, transparent);
  transform: rotate(var(--r)); animation: fx-ray 9s ease-in-out var(--l) infinite alternate; }
@keyframes fx-ray { from { transform: rotate(calc(var(--r) - 3deg)); opacity: .25; } to { transform: rotate(calc(var(--r) + 3deg)); opacity: .7; } }
.water-caustics { inset: -20%; opacity: .35;
  background: repeating-conic-gradient(from 10deg at 50% 22%, transparent 0 5deg, color-mix(in srgb, var(--al) 40%, transparent) 5.5deg 6.5deg, transparent 7deg 13deg);
  -webkit-mask: radial-gradient(ellipse at 50% 22%, #000, transparent 60%); mask: radial-gradient(ellipse at 50% 22%, #000, transparent 60%);
  animation: fx-caustic 14s ease-in-out infinite alternate; }
@keyframes fx-caustic { from { transform: rotate(-4deg) scale(1); } to { transform: rotate(4deg) scale(1.08); } }
.water-fish i { left: 0; top: var(--y); width: calc(var(--s) * 1.5); height: calc(var(--s) * .9); opacity: .75;
  background: color-mix(in srgb, var(--bg) 35%, var(--a));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 24'%3E%3Cpath d='M38 12C32 3 18 3 12 12C18 21 32 21 38 12ZM13 12L2 3L5 12L2 21Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 24'%3E%3Cpath d='M38 12C32 3 18 3 12 12C18 21 32 21 38 12ZM13 12L2 3L5 12L2 21Z'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: fx-swim var(--d) linear var(--l) infinite; }
.water-fish i.back { animation-name: fx-swim-back; }
@keyframes fx-swim { 0% { transform: translate(-30cqw, 0); } 25% { transform: translate(5cqw, -2cqh); } 50% { transform: translate(40cqw, 1cqh); } 75% { transform: translate(75cqw, -1cqh); } 100% { transform: translate(130cqw, 0); } }
@keyframes fx-swim-back { 0% { transform: translate(130cqw, 0) scaleX(-1); } 50% { transform: translate(50cqw, 2cqh) scaleX(-1); } 100% { transform: translate(-30cqw, 0) scaleX(-1); } }
.water-weed i { bottom: -2cqh; left: var(--x); width: calc(var(--w) * 1.8); height: var(--h); border-radius: 50% 50% 0 0 / 100% 100% 0 0; transform-origin: 50% 100%;
  background: linear-gradient(to top, color-mix(in srgb, var(--a) 45%, var(--bg)), color-mix(in srgb, var(--a) 22%, transparent));
  animation: fx-weed var(--d) ease-in-out var(--l) infinite alternate; }
/* Seaweed grows in only when the page is scrolled to its end (app.js sets html[data-scroll-end]); previews always show it. */
.water-weed { transform: translateY(105%); transition: transform .9s cubic-bezier(.22, 1, .36, 1); }
html[data-scroll-end] .water-weed, .bgfx:not(.bgfx-run) .water-weed { transform: none; }
@keyframes fx-weed { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
.water-bubbles i { bottom: -4cqh; left: var(--x); width: var(--s); height: var(--s); border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--al) 75%, transparent); box-shadow: inset 1px 1px 2px rgba(255,255,255,.6);
  animation: fx-bubble var(--d) linear var(--l) infinite; }
@keyframes fx-bubble { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: .8; } 30% { transform: translate(1.5cqw, -32cqh); }
  55% { transform: translate(-1.5cqw, -60cqh); } 80% { transform: translate(1cqw, -86cqh); opacity: .6; } 100% { transform: translate(0, -110cqh); opacity: 0; } }

/* ---------- Радуга: a slow rainbow wheel under drifting colour clouds ---------- */
.fx-rainbow { background: var(--bg); }
.rb-wheel { left: 50%; top: 50%; width: 130cqmax; height: 130cqmax; margin: -65cqmax 0 0 -65cqmax; border-radius: 50%; opacity: .5; filter: blur(30px);
  background: conic-gradient(#ff5f9e, #ffb35c, #ffe76a, #5cf0a8, #5cc8ff, #9c7cff, #ff5f9e); animation: fx-spin 14s linear infinite; }
@keyframes fx-spin { to { transform: rotate(1turn); } }
.fx-rainbow i { left: var(--x); top: var(--y); width: 70cqmin; height: 70cqmin; margin: -35cqmin 0 0 -35cqmin; border-radius: 50%;
  background: radial-gradient(closest-side, var(--c), transparent); opacity: .55; animation: fx-cloud var(--d) ease-in-out var(--l) infinite alternate; }
@keyframes fx-cloud { from { transform: translate(-12cqw, -8cqh) scale(.9); } to { transform: translate(12cqw, 8cqh) scale(1.15); } }
.rb-veil { background: radial-gradient(ellipse at 50% 50%, transparent 25%, color-mix(in srgb, var(--bg) 65%, transparent) 100%); }

/* ---------- Бананы: spinning bananas falling through a warm glow ---------- */
.fx-bananas { background: radial-gradient(ellipse at 50% 45%, rgba(255, 210, 80, .08), transparent 65%), var(--bg); }
.fx-bananas i { left: var(--x); top: -20cqmin; width: calc(var(--s) * 1.15); height: calc(var(--s) * 1.15); margin-left: calc(var(--s) * -.58); opacity: .38; filter: saturate(.7) brightness(.85);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M12 14C8 34 18 52 40 57C50 59 58 56 59 51C46 52 34 46 27 35C22 28 20 20 20 13Z' fill='%23FFD84D'/%3E%3Cpath d='M12 14C10 30 16 44 30 52C20 44 15 32 16 15Z' fill='%23F0B81C'/%3E%3Cpath d='M22 30C27 40 36 47 48 50' stroke='%23FFE98A' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M14 7L17 14' stroke='%236B4A14' stroke-width='5' stroke-linecap='round'/%3E%3Ccircle cx='58' cy='51' r='2.6' fill='%236B4A14'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: fx-banana var(--d) linear var(--l) infinite; }
@keyframes fx-banana { from { transform: translateY(0) rotate(0); } to { transform: translateY(calc(100cqh + 36cqmin)) rotate(var(--spin)); } }
